Skip to content

Support the Gemini Interactions API in GeminiLanguageModel #302

Description

@rizwankce

Hi!

GeminiLanguageModel currently uses the generateContent / streamGenerateContent endpoints. Google's docs now recommend the Interactions API for all new projects and say all new models, tools and agent features will launch there. generateContent is still supported but is now called legacy.

Would you be open to adding Interactions API support, either as an option on GeminiLanguageModel or as a separate model type? Some benefits:

  • Real tool-call IDs, instead of IDs generated on the client
  • system_instruction as its own field
  • Optional server-side conversation history via previous_interaction_id

Docs:

If okay i can work on it and raise PR

Thanks!

Activity

  1. mattt commented on Oct 7, 2026

    @mattt
    Collaborator

    Hi @rizwankce. Thanks for the suggestion, and for offering to work on it. Yes, we'd welcome a PR.

    I'd follow what OpenAILanguageModel does for Chat Completions and Responses: an apiVariant option on GeminiLanguageModel, keeping generateContent as the default for now, since Google still fully supports it. A few things to keep in mind:

    • LanguageModelSession keeps the transcript itself, so the Interactions variant should send the full history with store: false, rather than depend on previous_interaction_id.
    • The API's tool call IDs should go into the transcript, so toolExecutionDelegate works the same as it does with other providers.
    • Please include tests with canned responses, like the ones in ProviderUsageTests.
  2. rizwankce commented on Oct 8, 2026

    @rizwankce
    Author

    @mattt Thanks, that makes sense! I'll work on it and open a draft PR soon.

    I'm using AnyLanguageModel with Gemini models in an internal project, and it's been working great. That means I can also dogfood the changes while the PR is in draft.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions