Skip to content

Convex Agent SDK does not support LanguageModelV2 (e.g. Google Gemini) #108

@Mehtari-Nadir

Description

@Mehtari-Nadir

I'm trying to create an agent using (gemini-1.5-flash) as the chat model. However, I get a TypeScript error because the model returned by google.chat is a LanguageModelV2, while Convex Agent expects a LanguageModelV1.

`import { Agent } from "@convex-dev/agent";
import { components } from "../_generated/api";
import { google } from "@ai-sdk/google";

export const chatAgent = new Agent(components.agent, {
name: "human-resources-agent",
chat: google.chat("gemini-1.5-flash"), // ❌ Type error here
instructions: "You are a helpful assistant.",
});
`

Error Message:
Property 'defaultObjectGenerationMode' is missing in type 'LanguageModelV2' but required in type 'LanguageModelV1'.

Environment
"@ai-sdk/google": "^2.0.3",
"@convex-dev/agent": "^0.1.17",
Node.js version: v22.16.0
"typescript": "~5.8.3",

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