[▲ Vercel Community](/) · [Categories](/categories) · [Latest](/latest) · [Top](/top) · [Live](/live) [AI SDK](/c/ai-sdk/62) # Error with @ai-sdk/google using streamText 1179 views · 0 likes · 4 posts Jeet Patel (@jeetlogicwind-gmailc) · 2025-04-09 I'm encountering an issue when using the `@ai-sdk/google` integration in the Vercel AI SDK with the `gemini-2.0-flash-001` model. I'm trying to use the `streamText` function along with tools and the `experimental_output` option. code: ``` import { createGoogleGenerativeAI } from "@ai-sdk/google"; import { Output, smoothStream, streamText, tool } from "ai"; import { z } from "zod"; const model = createGoogleGenerativeAI({ apiKey: EncodedVideoChunk.GEMINI_API_KEY, }); const Schema = z.object({ response: z.string(), }); const getWeatherInformation = tool({ description: "show the weather in a given city to the user", parameters: z.object({ city: z.string() }), execute: async ({ city }) => { console.log(`Getting weather information for ${city}`); return `The weather in ${city} is sunny`; }, }); export const tools = { getWeatherInformation, }; const result = streamText({ model: model("gemini-2.0-flash-001"), messages: [ { role: "system", content: "You are a helpful assistant." }, { role: "user", content: "Give me weather of gujarat" }, ], tools, maxSteps: 2, onError: (error) => { console.error("Error while streaming:", JSON.stringify(error, null, 2)); }, onFinish: (result) => { console.info("Output: " + JSON.stringify(result.object, null, 2)); console.info("Tool calling: " + JSON.stringify(result.toolCalls, null, 2)); }, experimental_transform: smoothStream(), experimental_output: Output.object({ schema: Schema, }), }); for await (const delta of result.textStream) { console.info("------------------->", delta); console.info("\n\n"); } ``` However, I'm consistently getting the following error: ```json { "error": { "code": 400, "message": "For controlled generation of only function calls (forced function calling), please set 'tool_config.function_calling_config.mode' field to ANY instead of populating 'response_mime_type' and 'response_schema' fields. For more details, see: https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling#tool-config", "status": "INVALID_ARGUMENT" } } ``` Interestingly, when I use the OpenAI integration with a similar setup (streaming text with tools), it works without any issues. Could you please help me understand what might be causing this error with the Google Gemini model and how I can resolve it? It seems like there might be a specific configuration requirement for Gemini when using tools and `experimental_output` with `streamText` that I'm missing. Any guidance or suggestions would be greatly appreciated. Thanks! system (@system) · 2025-04-09 Did you know about these other v0 resources? A human should be here soon to help, but the answer may already be available even faster in one of these other posts. This guide is a great place to start. https://vercel.community/t/become-a-v0-expert/5981 And these recordings can give you a look at v0 features and strategies in action: https://vercel.community/tags/c/events/42/v0 fran (@fran-rtzrai) · 2025-04-28 Same issue. Currently google-genai api raise error when responseSchema is given and function calling mode is ANY or AUTO. https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling#tool-config Swarnava Sengupta (@swarnava) · 2025-04-28 Perhaps this might help [streamText Tool Invocation Failure - #2 by jessyan0913](https://community.vercel.com/t/streamtext-tool-invocation-failure/7701/2)