-
Notifications
You must be signed in to change notification settings - Fork 2.6k
docs(adk): fix run_async example and correct ticketId payload key #3875
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
docs(adk): fix run_async example and correct ticketId payload key #3875
Conversation
Summary of ChangesHello @krishna-dhulipalla, 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 addresses two critical documentation issues within the 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 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 counter productive. 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. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request correctly addresses two issues in the human_in_loop sample documentation. Changing "ticket-id" to "ticketId" ensures consistency with the rest of the ADK, and fixing the run_async example to correctly consume the async generator makes the documentation runnable and accurate. These are valuable improvements. I've added one suggestion to make the code example slightly more illustrative for new users.
Merge #3875 # Problem The example in `contributing/samples/human_in_loop/README.md` shows: ```python await runner.run_async(...) ``` However, `run_async` returns an **async generator**, so awaiting it raises: ``` TypeError: object async_generator can't be used in 'await' expression ``` Additionally, the example payload uses `"ticket-id"` while ADK tools and other examples use `"ticketId"`, creating a mismatch that breaks copy/paste usage. # Solution - Updated the snippet to consume the async generator correctly: ```python async for event in runner.run_async(...): ... ``` - Aligned the payload key from `"ticket-id"` → `"ticketId"` for consistency with ADK schema and other examples. These changes make the example runnable and consistent with the API’s actual behavior. # Testing Plan This PR is a **small documentation correction**, so no unit tests are required per contribution guidelines. - Verified the corrected snippet manually to ensure it no longer raises `TypeError`. # Checklist - [x] I have read the CONTRIBUTING.md document. - [x] I have performed a self-review of my own code. - [ ] I have commented my code, particularly in hard-to-understand areas. *(N/A – docs only)* - [ ] I have added tests that prove my fix is effective or that my feature works. *(N/A – docs only)* - [ ] New and existing unit tests pass locally with my changes. *(N/A – docs only)* - [x] I have manually tested my changes end-to-end. - [ ] Any dependent changes have been merged and published in downstream modules. *(N/A)* COPYBARA_INTEGRATE_REVIEW=#3875 from krishna-dhulipalla:docs/fix-adk-run_async-example 83fc5b4 PiperOrigin-RevId: 842952362
|
Thank you @krishna-dhulipalla for your contribution! 🎉 Your changes have been successfully imported and merged via Copybara in commit 4111f85. Closing this PR as the changes are now in the main branch. |
Problem
The example in
contributing/samples/human_in_loop/README.mdshows:However,
run_asyncreturns an async generator, so awaiting it raises:Additionally, the example payload uses
"ticket-id"while ADK tools and other examples use"ticketId", creating a mismatch that breaks copy/paste usage.Solution
"ticket-id"→"ticketId"for consistency with ADK schema and other examples.These changes make the example runnable and consistent with the API’s actual behavior.
Testing Plan
This PR is a small documentation correction, so no unit tests are required per contribution guidelines.
TypeError.Checklist