Skip to content

Conversation

@ethanabrooks
Copy link
Contributor

No description provided.

@DouweM
Copy link
Collaborator

DouweM commented Aug 14, 2025

@ethanabrooks Can you show me the error you'd get without this? It's odd that Google could generate a model response with only tool calls and no text, that it then wouldn't accept when sent back on a subsequent request.

# If we only have function calls without text, add minimal text to satisfy Google API
if has_function_calls and not has_text_parts:
# Add a minimal text part to make the conversation valid for Google API
parts.append({'text': 'I have completed the function calls above.'})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need text or could be empty?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we do this inside _content_model_response based on the ModelResponse's parts rather than parsing the returned ContentDict? We already iterate over all items there, so we can keep track of what we've seen.

@ethanabrooks ethanabrooks force-pushed the eb/handle-textless-function-calls branch from cacaf7b to 9facb04 Compare August 14, 2025 17:16
@ethanabrooks
Copy link
Contributor Author

In order to allow maintainer to push to branch, switching to this: #2557

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants