Skip to content

Add GoogleModel support#727

Draft
szykol wants to merge 2 commits intoskolton/ai-message-content-fixesfrom
skolton/gemini-support
Draft

Add GoogleModel support#727
szykol wants to merge 2 commits intoskolton/ai-message-content-fixesfrom
skolton/gemini-support

Conversation

@szykol
Copy link
Copy Markdown
Collaborator

@szykol szykol commented Apr 17, 2026

This PR adds support to Google Models via:

  • Gemini API
  • VertexAI

The actual backend used depends on the parameters passed to GoogleModel

@szykol szykol force-pushed the skolton/gemini-support branch 3 times, most recently from 52cbd48 to 8bcd6bf Compare April 17, 2026 12:10
@szykol
Copy link
Copy Markdown
Collaborator Author

szykol commented Apr 23, 2026

update:

Those changes were tested with Gemini models through Gemini API.
The thought signature issue that we had when using Gemini models through OpenAI compatible API is (partially) gone now.
However, our SDK does not preserve the though signatures in it's own types and this works only because the langchain-google-genai package uses dummy thought signatures when original ones (generated by the model) are missing.

I imagine we're gonna need to include the original though signatures when passing new messages to the Gemini model, but this requires a couple of changes to the SDK code - mainly how we handle content of AIMessage. Currently we're dumping everything to string, but some model providers return content blocks instead of strings there. Gemini models include thought signatures inside those content blocks (if not calling tools). If calling tools, the though signature is stored in the additional_kwargs field of AIMessage.

Once we'll fix handling content in AIMessages we can continue with this PR. It's already in progress.

@Ickerday Ickerday marked this pull request as draft April 23, 2026 13:30
@Ickerday Ickerday self-requested a review April 23, 2026 13:43
This PR adds support to Google Models via:
- Gemini API
- VertexAI

The actual backend used depends on the parameters passed to GoogleModel
@szykol szykol force-pushed the skolton/gemini-support branch from 8bcd6bf to 843e406 Compare April 24, 2026 07:37
@szykol szykol changed the base branch from develop to skolton/ai-message-content-fixes April 24, 2026 07:39
@szykol szykol force-pushed the skolton/ai-message-content-fixes branch 3 times, most recently from 5b49b03 to ad69e2c Compare April 24, 2026 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants