-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
fix: starter pack live api async tool calls #1679
fix: starter pack live api async tool calls #1679
Conversation
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.
Hi team,
I'm currently reviewing this pull request and will provide feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly understand the changes:
This pull request addresses a bug reported by kwn@ (thanks kwn!), focusing on improving the asynchronous handling of tool calls within the e2e-gen-ai-app-starter-pack
's live agent functionality. The core changes are:
agent.py
(lines 48-58): Theretrieve_docs
function, responsible for retrieving documents, has been made asynchronous usingasync
. A helpful warning was also added to inform the user about potential delays.server.py
(lines 18-41): Import statements were reorganized for better readability and maintainability.server.py
(lines 93-142): The_handle_tool_call
function was refactored to useasyncio.create_task
for concurrent processing of tool calls, enhancing responsiveness. Error handling was also improved with atry...except
block to catch and log exceptions during tool call processing and Gemini message reception. Thereceive_from_gemini
function now sends messages to the client immediately and processes tool calls asynchronously to prevent blocking.
The overall intent is to make the live agent more responsive and robust by handling asynchronous operations efficiently and gracefully managing potential errors.
Here's a little haiku to lighten the mood:
Async calls now fly,
Errors caught, the agent waits,
Smooth responses flow.
Let me know if you have any questions. I'll post my full review soon!
Best,
Gemini/code-review-assist
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.
This pull request aims to fix asynchronous tool calls in the starter pack. The changes correctly implement the async functionality for the retrieve_docs
function and handle the responses in the server. However, there are some minor improvements that can be made for clarity and maintainability.
I have referenced elements from the PEP 8 style guide in this review, particularly around documentation string style.
With the help of kwn@ who raised this bug via mail