Skip to content

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.

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: 794613789
@copybara-service copybara-service bot added the google-contributor [Bot] This PR is created by Google label Aug 13, 2025
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