Skip to content

Conversation

@paxiaatucsdedu
Copy link
Member

Problem

When using Google Gemini models with tool calling, AIMessages with empty content (content="") cause a TransientServiceError (HTTP 500) due to a NullPointerException in the OCI backend when converting messages to Google's format.

Issue link: #78

Solution

Check for empty content in AIMessages with tool calls before processing, and provide a minimal placeholder (.) to prevent null serialization. This follows the same pattern used by the Cohere provider.

Testing

Tested with google.gemini-2.5-flash model using AIMessage with empty content and tool calls - error is now resolved.

Model response:
content='The weather in Rome is currently sunny with a temperature of 20 degrees Celsius.' additional_kwargs={'finish_reason': 'stop'} response_metadata={'finish_reason': 'stop'} id='run--68c2e374-d8eb-43be-aec2-de2815789dc4-0'

Adds a check for empty message content before processing in GenericProvider, returning a default text when content is missing.
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Dec 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant