Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Update Search_Wikipedia_using_ReAct.ipynb notebook to use google-genai SDK #604

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Raunak2024
Copy link

This Pull Request addresses Search_Wikipedia_using_ReAct.ipynb notebook mentioned in the issue #446 and migrates it from the old google-generativeai SDK to the new google-genai SDK.

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@github-actions github-actions bot added status:awaiting review PR awaiting review from a maintainer component:examples Issues/PR referencing examples folder labels Mar 25, 2025
@Raunak2024
Copy link
Author

Hi @markmcd @andycandy, I have done the necessary changes to the notebook as suggested. Please review the updates and do let me know. Thanks!

@@ -124,7 +124,7 @@
},
Copy link
Collaborator

@Giom-V Giom-V Mar 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be fixed by merging with the main branch, but can you make sure update the button to use an image instead as introduced in #512?

<a target=\"_blank\" href=\"URL\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" height=30/></a>


Reply via ReviewNB

@@ -124,7 +124,7 @@
},
Copy link
Collaborator

@Giom-V Giom-V Mar 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a minimum version, like >=1.0.0?  


Reply via ReviewNB

@@ -124,7 +124,7 @@
},
Copy link
Collaborator

@Giom-V Giom-V Mar 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line #5.            """Prepares Gemini to follow a Few-shot ReAct prompt by imitating

Can you add a line break (and indentation) after """ for readability?


Reply via ReviewNB

@@ -124,7 +124,7 @@
},
Copy link
Collaborator

@Giom-V Giom-V Mar 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line #6.        """Perfoms search on query via Wikipedia api and returns its summary.

Same as before, can you add a line break (and indentation) after """ for readability?


Reply via ReviewNB

@@ -124,7 +124,7 @@
},
Copy link
Collaborator

@Giom-V Giom-V Mar 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line #6.      """Starts multi-turn conversation with the chat models with function calling

Same as before, can you add a line break (and indentation) after """ for readability?


Reply via ReviewNB

@@ -124,7 +124,7 @@
},
Copy link
Collaborator

@Giom-V Giom-V Mar 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line #1.    model_name = 'gemini-2.0-flash'  # This can be any valid model name

Can you add a "MODEL_ID" variable like this?

MODEL_ID="gemini-2.0-flash" # @param ["gemini-2.0-flash-lite","gemini-2.0-flash","gemini-2.0-pro-exp-02-05"] {"allow-input":true, isTemplate: true}

As it would make the notebook easier to maintain in the future.


Reply via ReviewNB

@@ -124,7 +124,7 @@
},
Copy link
Collaborator

@Giom-V Giom-V Mar 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line #2.    gemini_ReAct_chat = ReAct(client=client, model=model_name, ReAct_prompt='model_instructions.txt')

Can you expend the function call on multiple lines for readability? Like:

gemini_ReAct_chat = ReAct(
    client=client,
    model=model_name,
    ReAct_prompt='model_instructions.txt'
)

Reply via ReviewNB

@@ -124,7 +124,7 @@
},
Copy link
Collaborator

@Giom-V Giom-V Mar 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line #4.    response = gemini_ReAct_chat("What are the total of ages of the main trio from the new Percy Jackson and the Olympians TV series in real life?", temperature=0.2)

As before, can you expend on multiple lines to improve readability?


Reply via ReviewNB

@@ -124,7 +124,7 @@
},
Copy link
Collaborator

@Giom-V Giom-V Mar 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line #1.    gemini_ReAct_chat.client.models.generate_content(model=gemini_ReAct_chat.model_name, contents="What is the total of ages of the main trio from the new Percy Jackson and the Olympians TV series in real life?").text

Same as before, multiple lines would make it easier to read.


Reply via ReviewNB

@Giom-V
Copy link
Collaborator

Giom-V commented Mar 31, 2025

Thanks for the submission @Raunak2024.

I just added a couple of minor comments to make the notebook easier to understand and to maintain.

Can you also check the lint and format failures and fix them (format is likely because you haven't run the formatting script, lint because a "we" needs to be changed into a "you"). If you see a lint error reported in the template notebook, just ignore it, it's because of a CL you merged with.

And last thing, before you run the formatting script, can you also run all the cells to make sure everything works as expected?

Thanks again!

@Giom-V
Copy link
Collaborator

Giom-V commented Mar 31, 2025

And thanks @andycandy for helping with the review!!

@KSruthiVel
Copy link
Contributor

Hi @Raunak2024 , just following up to see if you are still working on this. If not, I am happy to take it over and continue from where you left off!

@Giom-V
Copy link
Collaborator

Giom-V commented Apr 7, 2025

Hi @Raunak2024 , just following up to see if you are still working on this. If not, I am happy to take it over and continue from where you left off!

Let's give @Raunak2024 24 hours and without an update you'll be free to work on this notebook.

@Raunak2024
Copy link
Author

Greetings @KSruthiVel @Giom-V
I am busy due to college work for some time. So I am planning to work on checking the lint and format failures and fixing them by the end of this week as suggested. Moreover, I have run all the cells and everything seems to work as expected. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:examples Issues/PR referencing examples folder status:awaiting review PR awaiting review from a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants