Repository navigation
fix(examples): Use await in session_service call in Getting_started_with_ADK.ipynb - #1661
janasangeetha wants to merge 3 commits into
Conversation
|
Notebooks changed:
Review visual diffs and comment on any notebook cell. All comments sync back to this PR. Powered by ReviewNB |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request updates the 'Getting_started_with_ADK.ipynb' notebook to ensure correct asynchronous handling of session service operations. It also includes maintenance updates to notebook cell execution counts, metadata, and output formatting to provide a more stable and accurate user experience. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request updates the Getting_started_with_ADK.ipynb notebook, specifically adding await to the session_service calls (create_session and get_session), updating the execution counts, and adding language metadata. The review feedback correctly points out that the execution_count values were changed from null to integers, indicating that the repository's notebook formatting script needs to be run to clean up and standardize the notebook metadata before submission.
kkorpal
left a comment
There was a problem hiding this comment.
I ran the notebook's code with the current ADK (google-adk 2.16.0), with and without the change:
- On
main, the events cell fails withSession not found: session_01, and the last cell fails too. - With the two
awaits it runs: the same five events as before, thenFinal workflow status: ENDandAgent response: Hello ADK!.
The fix is right. One thing before approving:
- The latest version removes the saved outputs of three cells (the key cell, the event log and the final status). Section 5 still tells readers to look at the event log "printed above", so those outputs are needed. Please keep the notebook as it is on
mainand change only the two lines. The old outputs still match what the fixed code prints, and this also clears the bot'sexecution_countcomment.
Getting_started_with_ADK.ipynbproduces below errors onmain:session = session_service.create_session->ValueError: Session not found: session_01final_session = session_service.get_session->AttributeError: 'coroutine' object has no attribute 'state'Changes made:
awaitkeyword tosession = session_service.create_sessionwhen initializing session, to ensure thesessionis properly created insession_servicerather than returning an unexecuted coroutine object, preventingValueError: Session not foundawaitkeyword tofinal_session = session_service.get_sessionwhen retrievingfinal_session, to preventfinal_sessionfrom being assigned an unexecuted coroutine object.