Skip to content

fix: Ignore AsyncGenerator return types in function declarations #2505

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

Merged
merged 1 commit into from
Aug 13, 2025

Conversation

copybara-service[bot]
Copy link

fix: Ignore AsyncGenerator return types in function declarations

For Vertex model backend, we send response back. This doesn't work for streaming tools that the return type is AsyncGenerator. So the fix here is to ignore the return type when it's AsyncGenerator.

We can't distinguish streaming vs non-streaming tool with AsyncGenerator though as LiveRequestQueue is optional in streaming tool.

Adds an ignore_response option to build_function_declaration to skip including the return type in the function declaration. This is enabled for tools that return AsyncGenerator, as the model does not yet support understanding these return types, while streaming tools can still handle them. Also, removes redundant return statements in _get_mandatory_params.

@copybara-service copybara-service bot added the google-contributor [Bot] This PR is created by Google label Aug 13, 2025
@copybara-service copybara-service bot force-pushed the copybara/792797357 branch 5 times, most recently from 459982e to cd4022b Compare August 13, 2025 04:41
For Vertex model backend, we send response back. This doesn't work for streaming tools that the return type is AsyncGenerator. So the fix here is to ignore the return type when it's AsyncGenerator.

We can't distinguish streaming vs non-streaming tool with AsyncGenerator though as LiveRequestQueue is optional in streaming tool.

Adds an `ignore_response` option to `build_function_declaration` to skip including the return type in the function declaration. This is enabled for tools that return `AsyncGenerator`, as the model does not yet support understanding these return types, while streaming tools can still handle them. Also, removes redundant return statements in `_get_mandatory_params`.

PiperOrigin-RevId: 794392846
@copybara-service copybara-service bot merged commit e2518dc into main Aug 13, 2025
@copybara-service copybara-service bot deleted the copybara/792797357 branch August 13, 2025 04:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
google-contributor [Bot] This PR is created by Google
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant