@ai-sdk/google 3.0.0-beta.70 → 3.0.0-beta.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/index.js +3 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -5
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +2 -4
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +2 -4
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/google-generative-ai-language-model.ts","../../src/convert-google-generative-ai-usage.ts","../../src/convert-json-schema-to-openapi-schema.ts","../../src/convert-to-google-generative-ai-messages.ts","../../src/get-model-path.ts","../../src/google-error.ts","../../src/google-generative-ai-options.ts","../../src/google-prepare-tools.ts","../../src/map-google-generative-ai-finish-reason.ts","../../src/tool/code-execution.ts","../../src/tool/file-search.ts","../../src/tool/google-search.ts","../../src/tool/url-context.ts","../../src/tool/vertex-rag-store.ts","../../src/google-tools.ts"],"sourcesContent":["import {\n LanguageModelV3,\n SharedV3Warning,\n LanguageModelV3Content,\n LanguageModelV3FinishReason,\n LanguageModelV3Source,\n LanguageModelV3StreamPart,\n SharedV3ProviderMetadata,\n} from '@ai-sdk/provider';\nimport {\n FetchFunction,\n InferSchema,\n ParseResult,\n Resolvable,\n combineHeaders,\n createEventSourceResponseHandler,\n createJsonResponseHandler,\n generateId,\n lazySchema,\n parseProviderOptions,\n postJsonToApi,\n resolve,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\nimport {\n convertGoogleGenerativeAIUsage,\n GoogleGenerativeAIUsageMetadata,\n} from './convert-google-generative-ai-usage';\nimport { convertJSONSchemaToOpenAPISchema } from './convert-json-schema-to-openapi-schema';\nimport { convertToGoogleGenerativeAIMessages } from './convert-to-google-generative-ai-messages';\nimport { getModelPath } from './get-model-path';\nimport { googleFailedResponseHandler } from './google-error';\nimport { GoogleGenerativeAIContentPart } from './google-generative-ai-prompt';\nimport {\n GoogleGenerativeAIModelId,\n googleGenerativeAIProviderOptions,\n} from './google-generative-ai-options';\nimport { prepareTools } from './google-prepare-tools';\nimport { mapGoogleGenerativeAIFinishReason } from './map-google-generative-ai-finish-reason';\n\ntype GoogleGenerativeAIConfig = {\n provider: string;\n baseURL: string;\n headers: Resolvable<Record<string, string | undefined>>;\n fetch?: FetchFunction;\n generateId: () => string;\n\n /**\n * The supported URLs for the model.\n */\n supportedUrls?: () => LanguageModelV3['supportedUrls'];\n};\n\nexport class GoogleGenerativeAILanguageModel implements LanguageModelV3 {\n readonly specificationVersion = 'v3';\n\n readonly modelId: GoogleGenerativeAIModelId;\n\n private readonly config: GoogleGenerativeAIConfig;\n private readonly generateId: () => string;\n\n constructor(\n modelId: GoogleGenerativeAIModelId,\n config: GoogleGenerativeAIConfig,\n ) {\n this.modelId = modelId;\n this.config = config;\n this.generateId = config.generateId ?? generateId;\n }\n\n get provider(): string {\n return this.config.provider;\n }\n\n get supportedUrls() {\n return this.config.supportedUrls?.() ?? {};\n }\n\n private async getArgs({\n prompt,\n maxOutputTokens,\n temperature,\n topP,\n topK,\n frequencyPenalty,\n presencePenalty,\n stopSequences,\n responseFormat,\n seed,\n tools,\n toolChoice,\n providerOptions,\n }: Parameters<LanguageModelV3['doGenerate']>[0]) {\n const warnings: SharedV3Warning[] = [];\n\n const googleOptions = await parseProviderOptions({\n provider: 'google',\n providerOptions,\n schema: googleGenerativeAIProviderOptions,\n });\n\n // Add warning if Vertex rag tools are used with a non-Vertex Google provider\n if (\n tools?.some(\n tool =>\n tool.type === 'provider' && tool.id === 'google.vertex_rag_store',\n ) &&\n !this.config.provider.startsWith('google.vertex.')\n ) {\n warnings.push({\n type: 'other',\n message:\n \"The 'vertex_rag_store' tool is only supported with the Google Vertex provider \" +\n 'and might not be supported or could behave unexpectedly with the current Google provider ' +\n `(${this.config.provider}).`,\n });\n }\n\n const isGemmaModel = this.modelId.toLowerCase().startsWith('gemma-');\n\n const { contents, systemInstruction } = convertToGoogleGenerativeAIMessages(\n prompt,\n { isGemmaModel },\n );\n\n const {\n tools: googleTools,\n toolConfig: googleToolConfig,\n toolWarnings,\n } = prepareTools({\n tools,\n toolChoice,\n modelId: this.modelId,\n });\n\n return {\n args: {\n generationConfig: {\n // standardized settings:\n maxOutputTokens,\n temperature,\n topK,\n topP,\n frequencyPenalty,\n presencePenalty,\n stopSequences,\n seed,\n\n // response format:\n responseMimeType:\n responseFormat?.type === 'json' ? 'application/json' : undefined,\n responseSchema:\n responseFormat?.type === 'json' &&\n responseFormat.schema != null &&\n // Google GenAI does not support all OpenAPI Schema features,\n // so this is needed as an escape hatch:\n // TODO convert into provider option\n (googleOptions?.structuredOutputs ?? true)\n ? convertJSONSchemaToOpenAPISchema(responseFormat.schema)\n : undefined,\n ...(googleOptions?.audioTimestamp && {\n audioTimestamp: googleOptions.audioTimestamp,\n }),\n\n // provider options:\n responseModalities: googleOptions?.responseModalities,\n thinkingConfig: googleOptions?.thinkingConfig,\n ...(googleOptions?.mediaResolution && {\n mediaResolution: googleOptions.mediaResolution,\n }),\n ...(googleOptions?.imageConfig && {\n imageConfig: googleOptions.imageConfig,\n }),\n },\n contents,\n systemInstruction: isGemmaModel ? undefined : systemInstruction,\n safetySettings: googleOptions?.safetySettings,\n tools: googleTools,\n toolConfig: googleToolConfig,\n cachedContent: googleOptions?.cachedContent,\n labels: googleOptions?.labels,\n },\n warnings: [...warnings, ...toolWarnings],\n };\n }\n\n async doGenerate(\n options: Parameters<LanguageModelV3['doGenerate']>[0],\n ): Promise<Awaited<ReturnType<LanguageModelV3['doGenerate']>>> {\n const { args, warnings } = await this.getArgs(options);\n const body = JSON.stringify(args);\n\n const mergedHeaders = combineHeaders(\n await resolve(this.config.headers),\n options.headers,\n );\n\n const {\n responseHeaders,\n value: response,\n rawValue: rawResponse,\n } = await postJsonToApi({\n url: `${this.config.baseURL}/${getModelPath(\n this.modelId,\n )}:generateContent`,\n headers: mergedHeaders,\n body: args,\n failedResponseHandler: googleFailedResponseHandler,\n successfulResponseHandler: createJsonResponseHandler(responseSchema),\n abortSignal: options.abortSignal,\n fetch: this.config.fetch,\n });\n\n const candidate = response.candidates[0];\n const content: Array<LanguageModelV3Content> = [];\n\n // map ordered parts to content:\n const parts = candidate.content?.parts ?? [];\n\n const usageMetadata = response.usageMetadata;\n\n // Associates a code execution result with its preceding call.\n let lastCodeExecutionToolCallId: string | undefined;\n\n // Build content array from all parts\n for (const part of parts) {\n if ('executableCode' in part && part.executableCode?.code) {\n const toolCallId = this.config.generateId();\n lastCodeExecutionToolCallId = toolCallId;\n\n content.push({\n type: 'tool-call',\n toolCallId,\n toolName: 'code_execution',\n input: JSON.stringify(part.executableCode),\n providerExecuted: true,\n });\n } else if ('codeExecutionResult' in part && part.codeExecutionResult) {\n content.push({\n type: 'tool-result',\n // Assumes a result directly follows its corresponding call part.\n toolCallId: lastCodeExecutionToolCallId!,\n toolName: 'code_execution',\n result: {\n outcome: part.codeExecutionResult.outcome,\n output: part.codeExecutionResult.output,\n },\n });\n // Clear the ID after use to avoid accidental reuse.\n lastCodeExecutionToolCallId = undefined;\n } else if ('text' in part && part.text != null && part.text.length > 0) {\n content.push({\n type: part.thought === true ? 'reasoning' : 'text',\n text: part.text,\n providerMetadata: part.thoughtSignature\n ? { google: { thoughtSignature: part.thoughtSignature } }\n : undefined,\n });\n } else if ('functionCall' in part) {\n content.push({\n type: 'tool-call' as const,\n toolCallId: this.config.generateId(),\n toolName: part.functionCall.name,\n input: JSON.stringify(part.functionCall.args),\n providerMetadata: part.thoughtSignature\n ? { google: { thoughtSignature: part.thoughtSignature } }\n : undefined,\n });\n } else if ('inlineData' in part) {\n content.push({\n type: 'file' as const,\n data: part.inlineData.data,\n mediaType: part.inlineData.mimeType,\n providerMetadata: part.thoughtSignature\n ? { google: { thoughtSignature: part.thoughtSignature } }\n : undefined,\n });\n }\n }\n\n const sources =\n extractSources({\n groundingMetadata: candidate.groundingMetadata,\n generateId: this.config.generateId,\n }) ?? [];\n for (const source of sources) {\n content.push(source);\n }\n\n return {\n content,\n finishReason: mapGoogleGenerativeAIFinishReason({\n finishReason: candidate.finishReason,\n hasToolCalls: content.some(part => part.type === 'tool-call'),\n }),\n usage: convertGoogleGenerativeAIUsage(usageMetadata),\n warnings,\n providerMetadata: {\n google: {\n promptFeedback: response.promptFeedback ?? null,\n groundingMetadata: candidate.groundingMetadata ?? null,\n urlContextMetadata: candidate.urlContextMetadata ?? null,\n safetyRatings: candidate.safetyRatings ?? null,\n usageMetadata: usageMetadata ?? null,\n },\n },\n request: { body },\n response: {\n // TODO timestamp, model id, id\n headers: responseHeaders,\n body: rawResponse,\n },\n };\n }\n\n async doStream(\n options: Parameters<LanguageModelV3['doStream']>[0],\n ): Promise<Awaited<ReturnType<LanguageModelV3['doStream']>>> {\n const { args, warnings } = await this.getArgs(options);\n\n const body = JSON.stringify(args);\n const headers = combineHeaders(\n await resolve(this.config.headers),\n options.headers,\n );\n\n const { responseHeaders, value: response } = await postJsonToApi({\n url: `${this.config.baseURL}/${getModelPath(\n this.modelId,\n )}:streamGenerateContent?alt=sse`,\n headers,\n body: args,\n failedResponseHandler: googleFailedResponseHandler,\n successfulResponseHandler: createEventSourceResponseHandler(chunkSchema),\n abortSignal: options.abortSignal,\n fetch: this.config.fetch,\n });\n\n let finishReason: LanguageModelV3FinishReason = 'unknown';\n let usage: GoogleGenerativeAIUsageMetadata | undefined = undefined;\n let providerMetadata: SharedV3ProviderMetadata | undefined = undefined;\n\n const generateId = this.config.generateId;\n let hasToolCalls = false;\n\n // Track active blocks to group consecutive parts of same type\n let currentTextBlockId: string | null = null;\n let currentReasoningBlockId: string | null = null;\n let blockCounter = 0;\n\n // Track emitted sources to prevent duplicates\n const emittedSourceUrls = new Set<string>();\n // Associates a code execution result with its preceding call.\n let lastCodeExecutionToolCallId: string | undefined;\n\n return {\n stream: response.pipeThrough(\n new TransformStream<\n ParseResult<ChunkSchema>,\n LanguageModelV3StreamPart\n >({\n start(controller) {\n controller.enqueue({ type: 'stream-start', warnings });\n },\n\n transform(chunk, controller) {\n if (options.includeRawChunks) {\n controller.enqueue({ type: 'raw', rawValue: chunk.rawValue });\n }\n\n if (!chunk.success) {\n controller.enqueue({ type: 'error', error: chunk.error });\n return;\n }\n\n const value = chunk.value;\n\n const usageMetadata = value.usageMetadata;\n\n if (usageMetadata != null) {\n usage = usageMetadata;\n }\n\n const candidate = value.candidates?.[0];\n\n // sometimes the API returns an empty candidates array\n if (candidate == null) {\n return;\n }\n\n const content = candidate.content;\n\n const sources = extractSources({\n groundingMetadata: candidate.groundingMetadata,\n generateId,\n });\n if (sources != null) {\n for (const source of sources) {\n if (\n source.sourceType === 'url' &&\n !emittedSourceUrls.has(source.url)\n ) {\n emittedSourceUrls.add(source.url);\n controller.enqueue(source);\n }\n }\n }\n\n // Process tool call's parts before determining finishReason to ensure hasToolCalls is properly set\n if (content != null) {\n // Process all parts in a single loop to preserve original order\n const parts = content.parts ?? [];\n for (const part of parts) {\n if ('executableCode' in part && part.executableCode?.code) {\n const toolCallId = generateId();\n lastCodeExecutionToolCallId = toolCallId;\n\n controller.enqueue({\n type: 'tool-call',\n toolCallId,\n toolName: 'code_execution',\n input: JSON.stringify(part.executableCode),\n providerExecuted: true,\n });\n\n hasToolCalls = true;\n } else if (\n 'codeExecutionResult' in part &&\n part.codeExecutionResult\n ) {\n // Assumes a result directly follows its corresponding call part.\n const toolCallId = lastCodeExecutionToolCallId;\n\n if (toolCallId) {\n controller.enqueue({\n type: 'tool-result',\n toolCallId,\n toolName: 'code_execution',\n result: {\n outcome: part.codeExecutionResult.outcome,\n output: part.codeExecutionResult.output,\n },\n });\n // Clear the ID after use.\n lastCodeExecutionToolCallId = undefined;\n }\n } else if (\n 'text' in part &&\n part.text != null &&\n part.text.length > 0\n ) {\n if (part.thought === true) {\n // End any active text block before starting reasoning\n if (currentTextBlockId !== null) {\n controller.enqueue({\n type: 'text-end',\n id: currentTextBlockId,\n });\n currentTextBlockId = null;\n }\n\n // Start new reasoning block if not already active\n if (currentReasoningBlockId === null) {\n currentReasoningBlockId = String(blockCounter++);\n controller.enqueue({\n type: 'reasoning-start',\n id: currentReasoningBlockId,\n providerMetadata: part.thoughtSignature\n ? {\n google: {\n thoughtSignature: part.thoughtSignature,\n },\n }\n : undefined,\n });\n }\n\n controller.enqueue({\n type: 'reasoning-delta',\n id: currentReasoningBlockId,\n delta: part.text,\n providerMetadata: part.thoughtSignature\n ? {\n google: { thoughtSignature: part.thoughtSignature },\n }\n : undefined,\n });\n } else {\n // End any active reasoning block before starting text\n if (currentReasoningBlockId !== null) {\n controller.enqueue({\n type: 'reasoning-end',\n id: currentReasoningBlockId,\n });\n currentReasoningBlockId = null;\n }\n\n // Start new text block if not already active\n if (currentTextBlockId === null) {\n currentTextBlockId = String(blockCounter++);\n controller.enqueue({\n type: 'text-start',\n id: currentTextBlockId,\n providerMetadata: part.thoughtSignature\n ? {\n google: {\n thoughtSignature: part.thoughtSignature,\n },\n }\n : undefined,\n });\n }\n\n controller.enqueue({\n type: 'text-delta',\n id: currentTextBlockId,\n delta: part.text,\n providerMetadata: part.thoughtSignature\n ? {\n google: { thoughtSignature: part.thoughtSignature },\n }\n : undefined,\n });\n }\n } else if ('inlineData' in part) {\n // Process file parts inline to preserve order with text\n controller.enqueue({\n type: 'file',\n mediaType: part.inlineData.mimeType,\n data: part.inlineData.data,\n });\n }\n }\n\n const toolCallDeltas = getToolCallsFromParts({\n parts: content.parts,\n generateId,\n });\n\n if (toolCallDeltas != null) {\n for (const toolCall of toolCallDeltas) {\n controller.enqueue({\n type: 'tool-input-start',\n id: toolCall.toolCallId,\n toolName: toolCall.toolName,\n providerMetadata: toolCall.providerMetadata,\n });\n\n controller.enqueue({\n type: 'tool-input-delta',\n id: toolCall.toolCallId,\n delta: toolCall.args,\n providerMetadata: toolCall.providerMetadata,\n });\n\n controller.enqueue({\n type: 'tool-input-end',\n id: toolCall.toolCallId,\n providerMetadata: toolCall.providerMetadata,\n });\n\n controller.enqueue({\n type: 'tool-call',\n toolCallId: toolCall.toolCallId,\n toolName: toolCall.toolName,\n input: toolCall.args,\n providerMetadata: toolCall.providerMetadata,\n });\n\n hasToolCalls = true;\n }\n }\n }\n\n if (candidate.finishReason != null) {\n finishReason = mapGoogleGenerativeAIFinishReason({\n finishReason: candidate.finishReason,\n hasToolCalls,\n });\n\n providerMetadata = {\n google: {\n promptFeedback: value.promptFeedback ?? null,\n groundingMetadata: candidate.groundingMetadata ?? null,\n urlContextMetadata: candidate.urlContextMetadata ?? null,\n safetyRatings: candidate.safetyRatings ?? null,\n },\n };\n if (usageMetadata != null) {\n providerMetadata.google.usageMetadata = usageMetadata;\n }\n }\n },\n\n flush(controller) {\n // Close any open blocks before finishing\n if (currentTextBlockId !== null) {\n controller.enqueue({\n type: 'text-end',\n id: currentTextBlockId,\n });\n }\n if (currentReasoningBlockId !== null) {\n controller.enqueue({\n type: 'reasoning-end',\n id: currentReasoningBlockId,\n });\n }\n\n controller.enqueue({\n type: 'finish',\n finishReason,\n usage: convertGoogleGenerativeAIUsage(usage),\n providerMetadata,\n });\n },\n }),\n ),\n response: { headers: responseHeaders },\n request: { body },\n };\n }\n}\n\nfunction getToolCallsFromParts({\n parts,\n generateId,\n}: {\n parts: ContentSchema['parts'];\n generateId: () => string;\n}) {\n const functionCallParts = parts?.filter(\n part => 'functionCall' in part,\n ) as Array<\n GoogleGenerativeAIContentPart & {\n functionCall: { name: string; args: unknown };\n thoughtSignature?: string | null;\n }\n >;\n\n return functionCallParts == null || functionCallParts.length === 0\n ? undefined\n : functionCallParts.map(part => ({\n type: 'tool-call' as const,\n toolCallId: generateId(),\n toolName: part.functionCall.name,\n args: JSON.stringify(part.functionCall.args),\n providerMetadata: part.thoughtSignature\n ? { google: { thoughtSignature: part.thoughtSignature } }\n : undefined,\n }));\n}\n\nfunction extractSources({\n groundingMetadata,\n generateId,\n}: {\n groundingMetadata: GroundingMetadataSchema | undefined | null;\n generateId: () => string;\n}): undefined | LanguageModelV3Source[] {\n if (!groundingMetadata?.groundingChunks) {\n return undefined;\n }\n\n const sources: LanguageModelV3Source[] = [];\n\n for (const chunk of groundingMetadata.groundingChunks) {\n if (chunk.web != null) {\n // Handle web chunks as URL sources\n sources.push({\n type: 'source',\n sourceType: 'url',\n id: generateId(),\n url: chunk.web.uri,\n title: chunk.web.title ?? undefined,\n });\n } else if (chunk.retrievedContext != null) {\n // Handle retrievedContext chunks from RAG operations\n const uri = chunk.retrievedContext.uri;\n const fileSearchStore = chunk.retrievedContext.fileSearchStore;\n\n if (uri && (uri.startsWith('http://') || uri.startsWith('https://'))) {\n // Old format: Google Search with HTTP/HTTPS URL\n sources.push({\n type: 'source',\n sourceType: 'url',\n id: generateId(),\n url: uri,\n title: chunk.retrievedContext.title ?? undefined,\n });\n } else if (uri) {\n // Old format: Document with file path (gs://, etc.)\n const title = chunk.retrievedContext.title ?? 'Unknown Document';\n let mediaType = 'application/octet-stream';\n let filename: string | undefined = undefined;\n\n if (uri.endsWith('.pdf')) {\n mediaType = 'application/pdf';\n filename = uri.split('/').pop();\n } else if (uri.endsWith('.txt')) {\n mediaType = 'text/plain';\n filename = uri.split('/').pop();\n } else if (uri.endsWith('.docx')) {\n mediaType =\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';\n filename = uri.split('/').pop();\n } else if (uri.endsWith('.doc')) {\n mediaType = 'application/msword';\n filename = uri.split('/').pop();\n } else if (uri.match(/\\.(md|markdown)$/)) {\n mediaType = 'text/markdown';\n filename = uri.split('/').pop();\n } else {\n filename = uri.split('/').pop();\n }\n\n sources.push({\n type: 'source',\n sourceType: 'document',\n id: generateId(),\n mediaType,\n title,\n filename,\n });\n } else if (fileSearchStore) {\n // New format: File Search with fileSearchStore (no uri)\n const title = chunk.retrievedContext.title ?? 'Unknown Document';\n sources.push({\n type: 'source',\n sourceType: 'document',\n id: generateId(),\n mediaType: 'application/octet-stream',\n title,\n filename: fileSearchStore.split('/').pop(),\n });\n }\n }\n }\n\n return sources.length > 0 ? sources : undefined;\n}\n\nexport const getGroundingMetadataSchema = () =>\n z.object({\n webSearchQueries: z.array(z.string()).nullish(),\n retrievalQueries: z.array(z.string()).nullish(),\n searchEntryPoint: z.object({ renderedContent: z.string() }).nullish(),\n groundingChunks: z\n .array(\n z.object({\n web: z\n .object({ uri: z.string(), title: z.string().nullish() })\n .nullish(),\n retrievedContext: z\n .object({\n uri: z.string().nullish(),\n title: z.string().nullish(),\n text: z.string().nullish(),\n fileSearchStore: z.string().nullish(),\n })\n .nullish(),\n }),\n )\n .nullish(),\n groundingSupports: z\n .array(\n z.object({\n segment: z.object({\n startIndex: z.number().nullish(),\n endIndex: z.number().nullish(),\n text: z.string().nullish(),\n }),\n segment_text: z.string().nullish(),\n groundingChunkIndices: z.array(z.number()).nullish(),\n supportChunkIndices: z.array(z.number()).nullish(),\n confidenceScores: z.array(z.number()).nullish(),\n confidenceScore: z.array(z.number()).nullish(),\n }),\n )\n .nullish(),\n retrievalMetadata: z\n .union([\n z.object({\n webDynamicRetrievalScore: z.number(),\n }),\n z.object({}),\n ])\n .nullish(),\n });\n\nconst getContentSchema = () =>\n z.object({\n parts: z\n .array(\n z.union([\n // note: order matters since text can be fully empty\n z.object({\n functionCall: z.object({\n name: z.string(),\n args: z.unknown(),\n }),\n thoughtSignature: z.string().nullish(),\n }),\n z.object({\n inlineData: z.object({\n mimeType: z.string(),\n data: z.string(),\n }),\n thoughtSignature: z.string().nullish(),\n }),\n z.object({\n executableCode: z\n .object({\n language: z.string(),\n code: z.string(),\n })\n .nullish(),\n codeExecutionResult: z\n .object({\n outcome: z.string(),\n output: z.string(),\n })\n .nullish(),\n text: z.string().nullish(),\n thought: z.boolean().nullish(),\n thoughtSignature: z.string().nullish(),\n }),\n ]),\n )\n .nullish(),\n });\n\n// https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/configure-safety-filters\nconst getSafetyRatingSchema = () =>\n z.object({\n category: z.string().nullish(),\n probability: z.string().nullish(),\n probabilityScore: z.number().nullish(),\n severity: z.string().nullish(),\n severityScore: z.number().nullish(),\n blocked: z.boolean().nullish(),\n });\n\nconst usageSchema = z.object({\n cachedContentTokenCount: z.number().nullish(),\n thoughtsTokenCount: z.number().nullish(),\n promptTokenCount: z.number().nullish(),\n candidatesTokenCount: z.number().nullish(),\n totalTokenCount: z.number().nullish(),\n // https://cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/GenerateContentResponse#TrafficType\n trafficType: z.string().nullish(),\n});\n\n// https://ai.google.dev/api/generate-content#UrlRetrievalMetadata\nexport const getUrlContextMetadataSchema = () =>\n z.object({\n urlMetadata: z.array(\n z.object({\n retrievedUrl: z.string(),\n urlRetrievalStatus: z.string(),\n }),\n ),\n });\n\nconst responseSchema = lazySchema(() =>\n zodSchema(\n z.object({\n candidates: z.array(\n z.object({\n content: getContentSchema().nullish().or(z.object({}).strict()),\n finishReason: z.string().nullish(),\n safetyRatings: z.array(getSafetyRatingSchema()).nullish(),\n groundingMetadata: getGroundingMetadataSchema().nullish(),\n urlContextMetadata: getUrlContextMetadataSchema().nullish(),\n }),\n ),\n usageMetadata: usageSchema.nullish(),\n promptFeedback: z\n .object({\n blockReason: z.string().nullish(),\n safetyRatings: z.array(getSafetyRatingSchema()).nullish(),\n })\n .nullish(),\n }),\n ),\n);\n\ntype ContentSchema = NonNullable<\n InferSchema<typeof responseSchema>['candidates'][number]['content']\n>;\nexport type GroundingMetadataSchema = NonNullable<\n InferSchema<typeof responseSchema>['candidates'][number]['groundingMetadata']\n>;\n\ntype GroundingChunkSchema = NonNullable<\n GroundingMetadataSchema['groundingChunks']\n>[number];\n\nexport type UrlContextMetadataSchema = NonNullable<\n InferSchema<typeof responseSchema>['candidates'][number]['urlContextMetadata']\n>;\n\nexport type SafetyRatingSchema = NonNullable<\n InferSchema<typeof responseSchema>['candidates'][number]['safetyRatings']\n>[number];\n\n// limited version of the schema, focussed on what is needed for the implementation\n// this approach limits breakages when the API changes and increases efficiency\nconst chunkSchema = lazySchema(() =>\n zodSchema(\n z.object({\n candidates: z\n .array(\n z.object({\n content: getContentSchema().nullish(),\n finishReason: z.string().nullish(),\n safetyRatings: z.array(getSafetyRatingSchema()).nullish(),\n groundingMetadata: getGroundingMetadataSchema().nullish(),\n urlContextMetadata: getUrlContextMetadataSchema().nullish(),\n }),\n )\n .nullish(),\n usageMetadata: usageSchema.nullish(),\n promptFeedback: z\n .object({\n blockReason: z.string().nullish(),\n safetyRatings: z.array(getSafetyRatingSchema()).nullish(),\n })\n .nullish(),\n }),\n ),\n);\n\ntype ChunkSchema = InferSchema<typeof chunkSchema>;\n","import { LanguageModelV3Usage } from '@ai-sdk/provider';\n\nexport type GoogleGenerativeAIUsageMetadata = {\n promptTokenCount?: number | null;\n candidatesTokenCount?: number | null;\n totalTokenCount?: number | null;\n cachedContentTokenCount?: number | null;\n thoughtsTokenCount?: number | null;\n trafficType?: string | null;\n};\n\nexport function convertGoogleGenerativeAIUsage(\n usage: GoogleGenerativeAIUsageMetadata | undefined | null,\n): LanguageModelV3Usage {\n if (usage == null) {\n return {\n inputTokens: {\n total: undefined,\n noCache: undefined,\n cacheRead: undefined,\n cacheWrite: undefined,\n },\n outputTokens: {\n total: undefined,\n text: undefined,\n reasoning: undefined,\n },\n raw: undefined,\n };\n }\n\n const promptTokens = usage.promptTokenCount ?? 0;\n const candidatesTokens = usage.candidatesTokenCount ?? 0;\n const cachedContentTokens = usage.cachedContentTokenCount ?? 0;\n const thoughtsTokens = usage.thoughtsTokenCount ?? 0;\n\n return {\n inputTokens: {\n total: promptTokens,\n noCache: promptTokens - cachedContentTokens,\n cacheRead: cachedContentTokens,\n cacheWrite: undefined,\n },\n outputTokens: {\n total: candidatesTokens + thoughtsTokens,\n text: candidatesTokens,\n reasoning: thoughtsTokens,\n },\n raw: usage,\n };\n}\n","import { JSONSchema7Definition } from '@ai-sdk/provider';\n\n/**\n * Converts JSON Schema 7 to OpenAPI Schema 3.0\n */\nexport function convertJSONSchemaToOpenAPISchema(\n jsonSchema: JSONSchema7Definition | undefined,\n): unknown {\n // parameters need to be undefined if they are empty objects:\n if (jsonSchema == null || isEmptyObjectSchema(jsonSchema)) {\n return undefined;\n }\n\n if (typeof jsonSchema === 'boolean') {\n return { type: 'boolean', properties: {} };\n }\n\n const {\n type,\n description,\n required,\n properties,\n items,\n allOf,\n anyOf,\n oneOf,\n format,\n const: constValue,\n minLength,\n enum: enumValues,\n } = jsonSchema;\n\n const result: Record<string, unknown> = {};\n\n if (description) result.description = description;\n if (required) result.required = required;\n if (format) result.format = format;\n\n if (constValue !== undefined) {\n result.enum = [constValue];\n }\n\n // Handle type\n if (type) {\n if (Array.isArray(type)) {\n const hasNull = type.includes('null');\n const nonNullTypes = type.filter(t => t !== 'null');\n\n if (nonNullTypes.length === 0) {\n // Only null type\n result.type = 'null';\n } else {\n // One or more non-null types: always use anyOf\n result.anyOf = nonNullTypes.map(t => ({ type: t }));\n if (hasNull) {\n result.nullable = true;\n }\n }\n } else {\n result.type = type;\n }\n }\n\n // Handle enum\n if (enumValues !== undefined) {\n result.enum = enumValues;\n }\n\n if (properties != null) {\n result.properties = Object.entries(properties).reduce(\n (acc, [key, value]) => {\n acc[key] = convertJSONSchemaToOpenAPISchema(value);\n return acc;\n },\n {} as Record<string, unknown>,\n );\n }\n\n if (items) {\n result.items = Array.isArray(items)\n ? items.map(convertJSONSchemaToOpenAPISchema)\n : convertJSONSchemaToOpenAPISchema(items);\n }\n\n if (allOf) {\n result.allOf = allOf.map(convertJSONSchemaToOpenAPISchema);\n }\n if (anyOf) {\n // Handle cases where anyOf includes a null type\n if (\n anyOf.some(\n schema => typeof schema === 'object' && schema?.type === 'null',\n )\n ) {\n const nonNullSchemas = anyOf.filter(\n schema => !(typeof schema === 'object' && schema?.type === 'null'),\n );\n\n if (nonNullSchemas.length === 1) {\n // If there's only one non-null schema, convert it and make it nullable\n const converted = convertJSONSchemaToOpenAPISchema(nonNullSchemas[0]);\n if (typeof converted === 'object') {\n result.nullable = true;\n Object.assign(result, converted);\n }\n } else {\n // If there are multiple non-null schemas, keep them in anyOf\n result.anyOf = nonNullSchemas.map(convertJSONSchemaToOpenAPISchema);\n result.nullable = true;\n }\n } else {\n result.anyOf = anyOf.map(convertJSONSchemaToOpenAPISchema);\n }\n }\n if (oneOf) {\n result.oneOf = oneOf.map(convertJSONSchemaToOpenAPISchema);\n }\n\n if (minLength !== undefined) {\n result.minLength = minLength;\n }\n\n return result;\n}\n\nfunction isEmptyObjectSchema(jsonSchema: JSONSchema7Definition): boolean {\n return (\n jsonSchema != null &&\n typeof jsonSchema === 'object' &&\n jsonSchema.type === 'object' &&\n (jsonSchema.properties == null ||\n Object.keys(jsonSchema.properties).length === 0) &&\n !jsonSchema.additionalProperties\n );\n}\n","import {\n LanguageModelV3Prompt,\n UnsupportedFunctionalityError,\n} from '@ai-sdk/provider';\nimport {\n GoogleGenerativeAIContent,\n GoogleGenerativeAIContentPart,\n GoogleGenerativeAIPrompt,\n} from './google-generative-ai-prompt';\nimport { convertToBase64 } from '@ai-sdk/provider-utils';\n\nexport function convertToGoogleGenerativeAIMessages(\n prompt: LanguageModelV3Prompt,\n options?: { isGemmaModel?: boolean },\n): GoogleGenerativeAIPrompt {\n const systemInstructionParts: Array<{ text: string }> = [];\n const contents: Array<GoogleGenerativeAIContent> = [];\n let systemMessagesAllowed = true;\n const isGemmaModel = options?.isGemmaModel ?? false;\n\n for (const { role, content } of prompt) {\n switch (role) {\n case 'system': {\n if (!systemMessagesAllowed) {\n throw new UnsupportedFunctionalityError({\n functionality:\n 'system messages are only supported at the beginning of the conversation',\n });\n }\n\n systemInstructionParts.push({ text: content });\n break;\n }\n\n case 'user': {\n systemMessagesAllowed = false;\n\n const parts: GoogleGenerativeAIContentPart[] = [];\n\n for (const part of content) {\n switch (part.type) {\n case 'text': {\n parts.push({ text: part.text });\n break;\n }\n\n case 'file': {\n // default to image/jpeg for unknown image/* types\n const mediaType =\n part.mediaType === 'image/*' ? 'image/jpeg' : part.mediaType;\n\n parts.push(\n part.data instanceof URL\n ? {\n fileData: {\n mimeType: mediaType,\n fileUri: part.data.toString(),\n },\n }\n : {\n inlineData: {\n mimeType: mediaType,\n data: convertToBase64(part.data),\n },\n },\n );\n\n break;\n }\n }\n }\n\n contents.push({ role: 'user', parts });\n break;\n }\n\n case 'assistant': {\n systemMessagesAllowed = false;\n\n contents.push({\n role: 'model',\n parts: content\n .map(part => {\n const thoughtSignature =\n part.providerOptions?.google?.thoughtSignature != null\n ? String(part.providerOptions.google?.thoughtSignature)\n : undefined;\n\n switch (part.type) {\n case 'text': {\n return part.text.length === 0\n ? undefined\n : {\n text: part.text,\n thoughtSignature,\n };\n }\n\n case 'reasoning': {\n return part.text.length === 0\n ? undefined\n : {\n text: part.text,\n thought: true,\n thoughtSignature,\n };\n }\n\n case 'file': {\n if (part.data instanceof URL) {\n throw new UnsupportedFunctionalityError({\n functionality:\n 'File data URLs in assistant messages are not supported',\n });\n }\n\n return {\n inlineData: {\n mimeType: part.mediaType,\n data: convertToBase64(part.data),\n },\n thoughtSignature,\n };\n }\n\n case 'tool-call': {\n return {\n functionCall: {\n name: part.toolName,\n args: part.input,\n },\n thoughtSignature,\n };\n }\n }\n })\n .filter(part => part !== undefined),\n });\n break;\n }\n\n case 'tool': {\n systemMessagesAllowed = false;\n\n const parts: GoogleGenerativeAIContentPart[] = [];\n\n for (const part of content) {\n const output = part.output;\n\n if (output.type === 'content') {\n for (const contentPart of output.value) {\n switch (contentPart.type) {\n case 'text':\n parts.push({\n functionResponse: {\n name: part.toolName,\n response: {\n name: part.toolName,\n content: contentPart.text,\n },\n },\n });\n break;\n case 'image-data':\n parts.push(\n {\n inlineData: {\n mimeType: contentPart.mediaType,\n data: contentPart.data,\n },\n },\n {\n text: 'Tool executed successfully and returned this image as a response',\n },\n );\n break;\n default:\n parts.push({ text: JSON.stringify(contentPart) });\n break;\n }\n }\n } else {\n parts.push({\n functionResponse: {\n name: part.toolName,\n response: {\n name: part.toolName,\n content:\n output.type === 'execution-denied'\n ? (output.reason ?? 'Tool execution denied.')\n : output.value,\n },\n },\n });\n }\n }\n\n contents.push({\n role: 'user',\n parts,\n });\n break;\n }\n }\n }\n\n if (\n isGemmaModel &&\n systemInstructionParts.length > 0 &&\n contents.length > 0 &&\n contents[0].role === 'user'\n ) {\n const systemText = systemInstructionParts\n .map(part => part.text)\n .join('\\n\\n');\n\n contents[0].parts.unshift({ text: systemText + '\\n\\n' });\n }\n\n return {\n systemInstruction:\n systemInstructionParts.length > 0 && !isGemmaModel\n ? { parts: systemInstructionParts }\n : undefined,\n contents,\n };\n}\n","export function getModelPath(modelId: string): string {\n return modelId.includes('/') ? modelId : `models/${modelId}`;\n}\n","import {\n createJsonErrorResponseHandler,\n type InferSchema,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nconst googleErrorDataSchema = lazySchema(() =>\n zodSchema(\n z.object({\n error: z.object({\n code: z.number().nullable(),\n message: z.string(),\n status: z.string(),\n }),\n }),\n ),\n);\n\nexport type GoogleErrorData = InferSchema<typeof googleErrorDataSchema>;\n\nexport const googleFailedResponseHandler = createJsonErrorResponseHandler({\n errorSchema: googleErrorDataSchema,\n errorToMessage: data => data.error.message,\n});\n","import { InferSchema, lazySchema, zodSchema } from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nexport type GoogleGenerativeAIModelId =\n // Stable models\n // https://ai.google.dev/gemini-api/docs/models/gemini\n | 'gemini-1.5-flash'\n | 'gemini-1.5-flash-latest'\n | 'gemini-1.5-flash-001'\n | 'gemini-1.5-flash-002'\n | 'gemini-1.5-flash-8b'\n | 'gemini-1.5-flash-8b-latest'\n | 'gemini-1.5-flash-8b-001'\n | 'gemini-1.5-pro'\n | 'gemini-1.5-pro-latest'\n | 'gemini-1.5-pro-001'\n | 'gemini-1.5-pro-002'\n | 'gemini-2.0-flash'\n | 'gemini-2.0-flash-001'\n | 'gemini-2.0-flash-live-001'\n | 'gemini-2.0-flash-lite'\n | 'gemini-2.0-pro-exp-02-05'\n | 'gemini-2.0-flash-thinking-exp-01-21'\n | 'gemini-2.0-flash-exp'\n | 'gemini-2.5-pro'\n | 'gemini-2.5-flash'\n | 'gemini-2.5-flash-image-preview'\n | 'gemini-2.5-flash-lite'\n | 'gemini-2.5-flash-lite-preview-09-2025'\n | 'gemini-2.5-flash-preview-04-17'\n | 'gemini-2.5-flash-preview-09-2025'\n | 'gemini-3-pro-preview'\n | 'gemini-3-pro-image-preview'\n // latest version\n // https://ai.google.dev/gemini-api/docs/models#latest\n | 'gemini-pro-latest'\n | 'gemini-flash-latest'\n | 'gemini-flash-lite-latest'\n // Experimental models\n // https://ai.google.dev/gemini-api/docs/models/experimental-models\n | 'gemini-2.5-pro-exp-03-25'\n | 'gemini-exp-1206'\n | 'gemma-3-12b-it'\n | 'gemma-3-27b-it'\n | (string & {});\n\nexport const googleGenerativeAIProviderOptions = lazySchema(() =>\n zodSchema(\n z.object({\n responseModalities: z.array(z.enum(['TEXT', 'IMAGE'])).optional(),\n\n thinkingConfig: z\n .object({\n thinkingBudget: z.number().optional(),\n includeThoughts: z.boolean().optional(),\n // https://ai.google.dev/gemini-api/docs/gemini-3?thinking=high#thinking_level\n thinkingLevel: z.enum(['low', 'medium', 'high']).optional(),\n })\n .optional(),\n\n /**\n * Optional.\n * The name of the cached content used as context to serve the prediction.\n * Format: cachedContents/{cachedContent}\n */\n cachedContent: z.string().optional(),\n\n /**\n * Optional. Enable structured output. Default is true.\n *\n * This is useful when the JSON Schema contains elements that are\n * not supported by the OpenAPI schema version that\n * Google Generative AI uses. You can use this to disable\n * structured outputs if you need to.\n */\n structuredOutputs: z.boolean().optional(),\n\n /**\n * Optional. A list of unique safety settings for blocking unsafe content.\n */\n safetySettings: z\n .array(\n z.object({\n category: z.enum([\n 'HARM_CATEGORY_UNSPECIFIED',\n 'HARM_CATEGORY_HATE_SPEECH',\n 'HARM_CATEGORY_DANGEROUS_CONTENT',\n 'HARM_CATEGORY_HARASSMENT',\n 'HARM_CATEGORY_SEXUALLY_EXPLICIT',\n 'HARM_CATEGORY_CIVIC_INTEGRITY',\n ]),\n threshold: z.enum([\n 'HARM_BLOCK_THRESHOLD_UNSPECIFIED',\n 'BLOCK_LOW_AND_ABOVE',\n 'BLOCK_MEDIUM_AND_ABOVE',\n 'BLOCK_ONLY_HIGH',\n 'BLOCK_NONE',\n 'OFF',\n ]),\n }),\n )\n .optional(),\n\n threshold: z\n .enum([\n 'HARM_BLOCK_THRESHOLD_UNSPECIFIED',\n 'BLOCK_LOW_AND_ABOVE',\n 'BLOCK_MEDIUM_AND_ABOVE',\n 'BLOCK_ONLY_HIGH',\n 'BLOCK_NONE',\n 'OFF',\n ])\n .optional(),\n\n /**\n * Optional. Enables timestamp understanding for audio-only files.\n *\n * https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/audio-understanding\n */\n audioTimestamp: z.boolean().optional(),\n\n /**\n * Optional. Defines labels used in billing reports. Available on Vertex AI only.\n *\n * https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/add-labels-to-api-calls\n */\n labels: z.record(z.string(), z.string()).optional(),\n\n /**\n * Optional. If specified, the media resolution specified will be used.\n *\n * https://ai.google.dev/api/generate-content#MediaResolution\n */\n mediaResolution: z\n .enum([\n 'MEDIA_RESOLUTION_UNSPECIFIED',\n 'MEDIA_RESOLUTION_LOW',\n 'MEDIA_RESOLUTION_MEDIUM',\n 'MEDIA_RESOLUTION_HIGH',\n ])\n .optional(),\n\n /**\n * Optional. Configures the image generation aspect ratio for Gemini models.\n *\n * https://ai.google.dev/gemini-api/docs/image-generation#aspect_ratios\n */\n imageConfig: z\n .object({\n aspectRatio: z\n .enum([\n '1:1',\n '2:3',\n '3:2',\n '3:4',\n '4:3',\n '4:5',\n '5:4',\n '9:16',\n '16:9',\n '21:9',\n ])\n .optional(),\n imageSize: z.enum(['1K', '2K', '4K']).optional(),\n })\n .optional(),\n }),\n ),\n);\n\nexport type GoogleGenerativeAIProviderOptions = InferSchema<\n typeof googleGenerativeAIProviderOptions\n>;\n","import {\n LanguageModelV3CallOptions,\n SharedV3Warning,\n UnsupportedFunctionalityError,\n} from '@ai-sdk/provider';\nimport { convertJSONSchemaToOpenAPISchema } from './convert-json-schema-to-openapi-schema';\nimport { GoogleGenerativeAIModelId } from './google-generative-ai-options';\n\nexport function prepareTools({\n tools,\n toolChoice,\n modelId,\n}: {\n tools: LanguageModelV3CallOptions['tools'];\n toolChoice?: LanguageModelV3CallOptions['toolChoice'];\n modelId: GoogleGenerativeAIModelId;\n}): {\n tools:\n | Array<\n | {\n functionDeclarations: Array<{\n name: string;\n description: string;\n parameters: unknown;\n }>;\n }\n | Record<string, any>\n >\n | undefined;\n toolConfig:\n | undefined\n | {\n functionCallingConfig: {\n mode: 'AUTO' | 'NONE' | 'ANY';\n allowedFunctionNames?: string[];\n };\n };\n toolWarnings: SharedV3Warning[];\n} {\n // when the tools array is empty, change it to undefined to prevent errors:\n tools = tools?.length ? tools : undefined;\n\n const toolWarnings: SharedV3Warning[] = [];\n\n const isLatest = (\n [\n 'gemini-flash-latest',\n 'gemini-flash-lite-latest',\n 'gemini-pro-latest',\n ] as const satisfies GoogleGenerativeAIModelId[]\n ).some(id => id === modelId);\n const isGemini2orNewer =\n modelId.includes('gemini-2') || modelId.includes('gemini-3') || isLatest;\n const supportsDynamicRetrieval =\n modelId.includes('gemini-1.5-flash') && !modelId.includes('-8b');\n const supportsFileSearch = modelId.includes('gemini-2.5');\n\n if (tools == null) {\n return { tools: undefined, toolConfig: undefined, toolWarnings };\n }\n\n // Check for mixed tool types and add warnings\n const hasFunctionTools = tools.some(tool => tool.type === 'function');\n const hasProviderTools = tools.some(tool => tool.type === 'provider');\n\n if (hasFunctionTools && hasProviderTools) {\n toolWarnings.push({\n type: 'unsupported',\n feature: `combination of function and provider-defined tools`,\n });\n }\n\n if (hasProviderTools) {\n const googleTools: any[] = [];\n\n const ProviderTools = tools.filter(tool => tool.type === 'provider');\n ProviderTools.forEach(tool => {\n switch (tool.id) {\n case 'google.google_search':\n if (isGemini2orNewer) {\n googleTools.push({ googleSearch: {} });\n } else if (supportsDynamicRetrieval) {\n // For non-Gemini-2 models that don't support dynamic retrieval, use basic googleSearchRetrieval\n googleTools.push({\n googleSearchRetrieval: {\n dynamicRetrievalConfig: {\n mode: tool.args.mode as\n | 'MODE_DYNAMIC'\n | 'MODE_UNSPECIFIED'\n | undefined,\n dynamicThreshold: tool.args.dynamicThreshold as\n | number\n | undefined,\n },\n },\n });\n } else {\n googleTools.push({ googleSearchRetrieval: {} });\n }\n break;\n case 'google.url_context':\n if (isGemini2orNewer) {\n googleTools.push({ urlContext: {} });\n } else {\n toolWarnings.push({\n type: 'unsupported',\n feature: `provider-defined tool ${tool.id}`,\n details:\n 'The URL context tool is not supported with other Gemini models than Gemini 2.',\n });\n }\n break;\n case 'google.code_execution':\n if (isGemini2orNewer) {\n googleTools.push({ codeExecution: {} });\n } else {\n toolWarnings.push({\n type: 'unsupported',\n feature: `provider-defined tool ${tool.id}`,\n details:\n 'The code execution tools is not supported with other Gemini models than Gemini 2.',\n });\n }\n break;\n case 'google.file_search':\n if (supportsFileSearch) {\n googleTools.push({ fileSearch: { ...tool.args } });\n } else {\n toolWarnings.push({\n type: 'unsupported',\n feature: `provider-defined tool ${tool.id}`,\n details:\n 'The file search tool is only supported with Gemini 2.5 models.',\n });\n }\n break;\n case 'google.vertex_rag_store':\n if (isGemini2orNewer) {\n googleTools.push({\n retrieval: {\n vertex_rag_store: {\n rag_resources: {\n rag_corpus: tool.args.ragCorpus,\n },\n similarity_top_k: tool.args.topK as number | undefined,\n },\n },\n });\n } else {\n toolWarnings.push({\n type: 'unsupported',\n feature: `provider-defined tool ${tool.id}`,\n details:\n 'The RAG store tool is not supported with other Gemini models than Gemini 2.',\n });\n }\n break;\n default:\n toolWarnings.push({\n type: 'unsupported',\n feature: `provider-defined tool ${tool.id}`,\n });\n break;\n }\n });\n\n return {\n tools: googleTools.length > 0 ? googleTools : undefined,\n toolConfig: undefined,\n toolWarnings,\n };\n }\n\n const functionDeclarations = [];\n for (const tool of tools) {\n switch (tool.type) {\n case 'function':\n functionDeclarations.push({\n name: tool.name,\n description: tool.description ?? '',\n parameters: convertJSONSchemaToOpenAPISchema(tool.inputSchema),\n });\n break;\n default:\n toolWarnings.push({\n type: 'unsupported',\n feature: `function tool ${tool.name}`,\n });\n break;\n }\n }\n\n if (toolChoice == null) {\n return {\n tools: [{ functionDeclarations }],\n toolConfig: undefined,\n toolWarnings,\n };\n }\n\n const type = toolChoice.type;\n\n switch (type) {\n case 'auto':\n return {\n tools: [{ functionDeclarations }],\n toolConfig: { functionCallingConfig: { mode: 'AUTO' } },\n toolWarnings,\n };\n case 'none':\n return {\n tools: [{ functionDeclarations }],\n toolConfig: { functionCallingConfig: { mode: 'NONE' } },\n toolWarnings,\n };\n case 'required':\n return {\n tools: [{ functionDeclarations }],\n toolConfig: { functionCallingConfig: { mode: 'ANY' } },\n toolWarnings,\n };\n case 'tool':\n return {\n tools: [{ functionDeclarations }],\n toolConfig: {\n functionCallingConfig: {\n mode: 'ANY',\n allowedFunctionNames: [toolChoice.toolName],\n },\n },\n toolWarnings,\n };\n default: {\n const _exhaustiveCheck: never = type;\n throw new UnsupportedFunctionalityError({\n functionality: `tool choice type: ${_exhaustiveCheck}`,\n });\n }\n }\n}\n","import { LanguageModelV3FinishReason } from '@ai-sdk/provider';\n\nexport function mapGoogleGenerativeAIFinishReason({\n finishReason,\n hasToolCalls,\n}: {\n finishReason: string | null | undefined;\n hasToolCalls: boolean;\n}): LanguageModelV3FinishReason {\n switch (finishReason) {\n case 'STOP':\n return hasToolCalls ? 'tool-calls' : 'stop';\n case 'MAX_TOKENS':\n return 'length';\n case 'IMAGE_SAFETY':\n case 'RECITATION':\n case 'SAFETY':\n case 'BLOCKLIST':\n case 'PROHIBITED_CONTENT':\n case 'SPII':\n return 'content-filter';\n case 'FINISH_REASON_UNSPECIFIED':\n case 'OTHER':\n return 'other';\n case 'MALFORMED_FUNCTION_CALL':\n return 'error';\n default:\n return 'unknown';\n }\n}\n","import { createProviderToolFactoryWithOutputSchema } from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\n/**\n * A tool that enables the model to generate and run Python code.\n *\n * @note Ensure the selected model supports Code Execution.\n * Multi-tool usage with the code execution tool is typically compatible with Gemini >=2 models.\n *\n * @see https://ai.google.dev/gemini-api/docs/code-execution (Google AI)\n * @see https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/code-execution-api (Vertex AI)\n */\nexport const codeExecution = createProviderToolFactoryWithOutputSchema<\n {\n language: string;\n code: string;\n },\n {\n outcome: string;\n output: string;\n },\n {}\n>({\n id: 'google.code_execution',\n inputSchema: z.object({\n language: z.string().describe('The programming language of the code.'),\n code: z.string().describe('The code to be executed.'),\n }),\n outputSchema: z.object({\n outcome: z\n .string()\n .describe('The outcome of the execution (e.g., \"OUTCOME_OK\").'),\n output: z.string().describe('The output from the code execution.'),\n }),\n});\n","import {\n createProviderToolFactory,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\n/** Tool to retrieve knowledge from the File Search Stores. */\nconst fileSearchArgsBaseSchema = z\n .object({\n /** The names of the file_search_stores to retrieve from.\n * Example: `fileSearchStores/my-file-search-store-123`\n */\n fileSearchStoreNames: z\n .array(z.string())\n .describe(\n 'The names of the file_search_stores to retrieve from. Example: `fileSearchStores/my-file-search-store-123`',\n ),\n /** The number of file search retrieval chunks to retrieve. */\n topK: z\n .number()\n .int()\n .positive()\n .describe('The number of file search retrieval chunks to retrieve.')\n .optional(),\n\n /** Metadata filter to apply to the file search retrieval documents.\n * See https://google.aip.dev/160 for the syntax of the filter expression.\n */\n metadataFilter: z\n .string()\n .describe(\n 'Metadata filter to apply to the file search retrieval documents. See https://google.aip.dev/160 for the syntax of the filter expression.',\n )\n .optional(),\n })\n .passthrough();\n\nexport type GoogleFileSearchToolArgs = z.infer<typeof fileSearchArgsBaseSchema>;\n\nconst fileSearchArgsSchema = lazySchema(() =>\n zodSchema(fileSearchArgsBaseSchema),\n);\n\nexport const fileSearch = createProviderToolFactory<\n {},\n GoogleFileSearchToolArgs\n>({\n id: 'google.file_search',\n inputSchema: fileSearchArgsSchema,\n});\n","import {\n createProviderToolFactory,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\n// https://ai.google.dev/gemini-api/docs/google-search\n// https://ai.google.dev/api/generate-content#GroundingSupport\n// https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/grounding-with-google-search\n\nexport const googleSearch = createProviderToolFactory<\n {},\n {\n /**\n * The mode of the predictor to be used in dynamic retrieval. The following modes are supported:\n * - MODE_DYNAMIC: Run retrieval only when system decides it is necessary\n * - MODE_UNSPECIFIED: Always trigger retrieval\n * @default MODE_UNSPECIFIED\n */\n mode?: 'MODE_DYNAMIC' | 'MODE_UNSPECIFIED';\n\n /**\n * The threshold to be used in dynamic retrieval (if not set, a system default value is used).\n */\n dynamicThreshold?: number;\n }\n>({\n id: 'google.google_search',\n inputSchema: lazySchema(() =>\n zodSchema(\n z.object({\n mode: z\n .enum(['MODE_DYNAMIC', 'MODE_UNSPECIFIED'])\n .default('MODE_UNSPECIFIED'),\n dynamicThreshold: z.number().default(1),\n }),\n ),\n ),\n});\n","import {\n createProviderToolFactory,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nexport const urlContext = createProviderToolFactory<\n {\n // Url context does not have any input schema, it will directly use the url from the prompt\n },\n {}\n>({\n id: 'google.url_context',\n inputSchema: lazySchema(() => zodSchema(z.object({}))),\n});\n","import { createProviderToolFactory } from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\n// https://cloud.google.com/vertex-ai/generative-ai/docs/rag-engine/use-vertexai-search#generate-content-using-gemini-api\n// https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/rag-output-explained\n\n/**\n * A tool that enables the model to perform RAG searches against a Vertex RAG Store.\n *\n * @note Only works with Vertex Gemini models.\n */\nexport const vertexRagStore = createProviderToolFactory<\n {},\n {\n /**\n * RagCorpus resource names, eg: projects/{project}/locations/{location}/ragCorpora/{rag_corpus}\n */\n ragCorpus: string;\n\n /**\n * The number of top contexts to retrieve.\n */\n topK?: number;\n }\n>({\n id: 'google.vertex_rag_store',\n inputSchema: z.object({\n ragCorpus: z.string(),\n topK: z.number().optional(),\n }),\n});\n","import { codeExecution } from './tool/code-execution';\nimport { fileSearch } from './tool/file-search';\nimport { googleSearch } from './tool/google-search';\nimport { urlContext } from './tool/url-context';\nimport { vertexRagStore } from './tool/vertex-rag-store';\n\nexport const googleTools = {\n /**\n * Creates a Google search tool that gives Google direct access to real-time web content.\n * Must have name \"google_search\".\n */\n googleSearch,\n\n /**\n * Creates a URL context tool that gives Google direct access to real-time web content.\n * Must have name \"url_context\".\n */\n urlContext,\n\n /**\n * Enables Retrieval Augmented Generation (RAG) via the Gemini File Search tool.\n * Must have name \"file_search\".\n *\n * @param fileSearchStoreNames - Fully-qualified File Search store resource names.\n * @param metadataFilter - Optional filter expression to restrict the files that can be retrieved.\n * @param topK - Optional result limit for the number of chunks returned from File Search.\n *\n * @see https://ai.google.dev/gemini-api/docs/file-search\n */\n fileSearch,\n /**\n * A tool that enables the model to generate and run Python code.\n * Must have name \"code_execution\".\n *\n * @note Ensure the selected model supports Code Execution.\n * Multi-tool usage with the code execution tool is typically compatible with Gemini >=2 models.\n *\n * @see https://ai.google.dev/gemini-api/docs/code-execution (Google AI)\n * @see https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/code-execution-api (Vertex AI)\n */\n codeExecution,\n\n /**\n * Creates a Vertex RAG Store tool that enables the model to perform RAG searches against a Vertex RAG Store.\n * Must have name \"vertex_rag_store\".\n */\n vertexRagStore,\n};\n"],"mappings":";AASA;AAAA,EAKE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,cAAAA;AAAA,E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AAC1C,SAAS,KAAAC,UAAS;AAUX,IAAM,iBAAiBD,2BAa5B;AAAA,EACA,IAAI;AAAA,EACJ,aAAaC,GAAE,OAAO;AAAA,IACpB,WAAWA,GAAE,OAAO;AAAA,IACpB,MAAMA,GAAE,OAAO,EAAE,SAAS;AAAA,EAC5B,CAAC;AACH,CAAC;;;ACxBM,IAAM,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA,EAKzB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA;AACF;","names":["lazySchema","zodSchema","z","_a","_b","lazySchema","zodSchema","z","UnsupportedFunctionalityError","googleTools","UnsupportedFunctionalityError","googleTools","generateId","z","lazySchema","zodSchema","z","lazySchema","zodSchema","z","createProviderToolFactory","lazySchema","zodSchema","z","createProviderToolFactory","lazySchema","zodSchema","z","createProviderToolFactory","z"]}
|
|
1
|
+
{"version":3,"sources":["../../src/google-generative-ai-language-model.ts","../../src/convert-google-generative-ai-usage.ts","../../src/convert-json-schema-to-openapi-schema.ts","../../src/convert-to-google-generative-ai-messages.ts","../../src/get-model-path.ts","../../src/google-error.ts","../../src/google-generative-ai-options.ts","../../src/google-prepare-tools.ts","../../src/map-google-generative-ai-finish-reason.ts","../../src/tool/code-execution.ts","../../src/tool/file-search.ts","../../src/tool/google-search.ts","../../src/tool/url-context.ts","../../src/tool/vertex-rag-store.ts","../../src/google-tools.ts"],"sourcesContent":["import {\n LanguageModelV3,\n SharedV3Warning,\n LanguageModelV3Content,\n LanguageModelV3FinishReason,\n LanguageModelV3Source,\n LanguageModelV3StreamPart,\n SharedV3ProviderMetadata,\n} from '@ai-sdk/provider';\nimport {\n FetchFunction,\n InferSchema,\n ParseResult,\n Resolvable,\n combineHeaders,\n createEventSourceResponseHandler,\n createJsonResponseHandler,\n generateId,\n lazySchema,\n parseProviderOptions,\n postJsonToApi,\n resolve,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\nimport {\n convertGoogleGenerativeAIUsage,\n GoogleGenerativeAIUsageMetadata,\n} from './convert-google-generative-ai-usage';\nimport { convertJSONSchemaToOpenAPISchema } from './convert-json-schema-to-openapi-schema';\nimport { convertToGoogleGenerativeAIMessages } from './convert-to-google-generative-ai-messages';\nimport { getModelPath } from './get-model-path';\nimport { googleFailedResponseHandler } from './google-error';\nimport { GoogleGenerativeAIContentPart } from './google-generative-ai-prompt';\nimport {\n GoogleGenerativeAIModelId,\n googleGenerativeAIProviderOptions,\n} from './google-generative-ai-options';\nimport { prepareTools } from './google-prepare-tools';\nimport { mapGoogleGenerativeAIFinishReason } from './map-google-generative-ai-finish-reason';\n\ntype GoogleGenerativeAIConfig = {\n provider: string;\n baseURL: string;\n headers: Resolvable<Record<string, string | undefined>>;\n fetch?: FetchFunction;\n generateId: () => string;\n\n /**\n * The supported URLs for the model.\n */\n supportedUrls?: () => LanguageModelV3['supportedUrls'];\n};\n\nexport class GoogleGenerativeAILanguageModel implements LanguageModelV3 {\n readonly specificationVersion = 'v3';\n\n readonly modelId: GoogleGenerativeAIModelId;\n\n private readonly config: GoogleGenerativeAIConfig;\n private readonly generateId: () => string;\n\n constructor(\n modelId: GoogleGenerativeAIModelId,\n config: GoogleGenerativeAIConfig,\n ) {\n this.modelId = modelId;\n this.config = config;\n this.generateId = config.generateId ?? generateId;\n }\n\n get provider(): string {\n return this.config.provider;\n }\n\n get supportedUrls() {\n return this.config.supportedUrls?.() ?? {};\n }\n\n private async getArgs({\n prompt,\n maxOutputTokens,\n temperature,\n topP,\n topK,\n frequencyPenalty,\n presencePenalty,\n stopSequences,\n responseFormat,\n seed,\n tools,\n toolChoice,\n providerOptions,\n }: Parameters<LanguageModelV3['doGenerate']>[0]) {\n const warnings: SharedV3Warning[] = [];\n\n const googleOptions = await parseProviderOptions({\n provider: 'google',\n providerOptions,\n schema: googleGenerativeAIProviderOptions,\n });\n\n // Add warning if Vertex rag tools are used with a non-Vertex Google provider\n if (\n tools?.some(\n tool =>\n tool.type === 'provider' && tool.id === 'google.vertex_rag_store',\n ) &&\n !this.config.provider.startsWith('google.vertex.')\n ) {\n warnings.push({\n type: 'other',\n message:\n \"The 'vertex_rag_store' tool is only supported with the Google Vertex provider \" +\n 'and might not be supported or could behave unexpectedly with the current Google provider ' +\n `(${this.config.provider}).`,\n });\n }\n\n const isGemmaModel = this.modelId.toLowerCase().startsWith('gemma-');\n\n const { contents, systemInstruction } = convertToGoogleGenerativeAIMessages(\n prompt,\n { isGemmaModel },\n );\n\n const {\n tools: googleTools,\n toolConfig: googleToolConfig,\n toolWarnings,\n } = prepareTools({\n tools,\n toolChoice,\n modelId: this.modelId,\n });\n\n return {\n args: {\n generationConfig: {\n // standardized settings:\n maxOutputTokens,\n temperature,\n topK,\n topP,\n frequencyPenalty,\n presencePenalty,\n stopSequences,\n seed,\n\n // response format:\n responseMimeType:\n responseFormat?.type === 'json' ? 'application/json' : undefined,\n responseSchema:\n responseFormat?.type === 'json' &&\n responseFormat.schema != null &&\n // Google GenAI does not support all OpenAPI Schema features,\n // so this is needed as an escape hatch:\n // TODO convert into provider option\n (googleOptions?.structuredOutputs ?? true)\n ? convertJSONSchemaToOpenAPISchema(responseFormat.schema)\n : undefined,\n ...(googleOptions?.audioTimestamp && {\n audioTimestamp: googleOptions.audioTimestamp,\n }),\n\n // provider options:\n responseModalities: googleOptions?.responseModalities,\n thinkingConfig: googleOptions?.thinkingConfig,\n ...(googleOptions?.mediaResolution && {\n mediaResolution: googleOptions.mediaResolution,\n }),\n ...(googleOptions?.imageConfig && {\n imageConfig: googleOptions.imageConfig,\n }),\n },\n contents,\n systemInstruction: isGemmaModel ? undefined : systemInstruction,\n safetySettings: googleOptions?.safetySettings,\n tools: googleTools,\n toolConfig: googleToolConfig,\n cachedContent: googleOptions?.cachedContent,\n labels: googleOptions?.labels,\n },\n warnings: [...warnings, ...toolWarnings],\n };\n }\n\n async doGenerate(\n options: Parameters<LanguageModelV3['doGenerate']>[0],\n ): Promise<Awaited<ReturnType<LanguageModelV3['doGenerate']>>> {\n const { args, warnings } = await this.getArgs(options);\n\n const mergedHeaders = combineHeaders(\n await resolve(this.config.headers),\n options.headers,\n );\n\n const {\n responseHeaders,\n value: response,\n rawValue: rawResponse,\n } = await postJsonToApi({\n url: `${this.config.baseURL}/${getModelPath(\n this.modelId,\n )}:generateContent`,\n headers: mergedHeaders,\n body: args,\n failedResponseHandler: googleFailedResponseHandler,\n successfulResponseHandler: createJsonResponseHandler(responseSchema),\n abortSignal: options.abortSignal,\n fetch: this.config.fetch,\n });\n\n const candidate = response.candidates[0];\n const content: Array<LanguageModelV3Content> = [];\n\n // map ordered parts to content:\n const parts = candidate.content?.parts ?? [];\n\n const usageMetadata = response.usageMetadata;\n\n // Associates a code execution result with its preceding call.\n let lastCodeExecutionToolCallId: string | undefined;\n\n // Build content array from all parts\n for (const part of parts) {\n if ('executableCode' in part && part.executableCode?.code) {\n const toolCallId = this.config.generateId();\n lastCodeExecutionToolCallId = toolCallId;\n\n content.push({\n type: 'tool-call',\n toolCallId,\n toolName: 'code_execution',\n input: JSON.stringify(part.executableCode),\n providerExecuted: true,\n });\n } else if ('codeExecutionResult' in part && part.codeExecutionResult) {\n content.push({\n type: 'tool-result',\n // Assumes a result directly follows its corresponding call part.\n toolCallId: lastCodeExecutionToolCallId!,\n toolName: 'code_execution',\n result: {\n outcome: part.codeExecutionResult.outcome,\n output: part.codeExecutionResult.output,\n },\n });\n // Clear the ID after use to avoid accidental reuse.\n lastCodeExecutionToolCallId = undefined;\n } else if ('text' in part && part.text != null && part.text.length > 0) {\n content.push({\n type: part.thought === true ? 'reasoning' : 'text',\n text: part.text,\n providerMetadata: part.thoughtSignature\n ? { google: { thoughtSignature: part.thoughtSignature } }\n : undefined,\n });\n } else if ('functionCall' in part) {\n content.push({\n type: 'tool-call' as const,\n toolCallId: this.config.generateId(),\n toolName: part.functionCall.name,\n input: JSON.stringify(part.functionCall.args),\n providerMetadata: part.thoughtSignature\n ? { google: { thoughtSignature: part.thoughtSignature } }\n : undefined,\n });\n } else if ('inlineData' in part) {\n content.push({\n type: 'file' as const,\n data: part.inlineData.data,\n mediaType: part.inlineData.mimeType,\n providerMetadata: part.thoughtSignature\n ? { google: { thoughtSignature: part.thoughtSignature } }\n : undefined,\n });\n }\n }\n\n const sources =\n extractSources({\n groundingMetadata: candidate.groundingMetadata,\n generateId: this.config.generateId,\n }) ?? [];\n for (const source of sources) {\n content.push(source);\n }\n\n return {\n content,\n finishReason: mapGoogleGenerativeAIFinishReason({\n finishReason: candidate.finishReason,\n hasToolCalls: content.some(part => part.type === 'tool-call'),\n }),\n usage: convertGoogleGenerativeAIUsage(usageMetadata),\n warnings,\n providerMetadata: {\n google: {\n promptFeedback: response.promptFeedback ?? null,\n groundingMetadata: candidate.groundingMetadata ?? null,\n urlContextMetadata: candidate.urlContextMetadata ?? null,\n safetyRatings: candidate.safetyRatings ?? null,\n usageMetadata: usageMetadata ?? null,\n },\n },\n request: { body: args },\n response: {\n // TODO timestamp, model id, id\n headers: responseHeaders,\n body: rawResponse,\n },\n };\n }\n\n async doStream(\n options: Parameters<LanguageModelV3['doStream']>[0],\n ): Promise<Awaited<ReturnType<LanguageModelV3['doStream']>>> {\n const { args, warnings } = await this.getArgs(options);\n\n const headers = combineHeaders(\n await resolve(this.config.headers),\n options.headers,\n );\n\n const { responseHeaders, value: response } = await postJsonToApi({\n url: `${this.config.baseURL}/${getModelPath(\n this.modelId,\n )}:streamGenerateContent?alt=sse`,\n headers,\n body: args,\n failedResponseHandler: googleFailedResponseHandler,\n successfulResponseHandler: createEventSourceResponseHandler(chunkSchema),\n abortSignal: options.abortSignal,\n fetch: this.config.fetch,\n });\n\n let finishReason: LanguageModelV3FinishReason = 'unknown';\n let usage: GoogleGenerativeAIUsageMetadata | undefined = undefined;\n let providerMetadata: SharedV3ProviderMetadata | undefined = undefined;\n\n const generateId = this.config.generateId;\n let hasToolCalls = false;\n\n // Track active blocks to group consecutive parts of same type\n let currentTextBlockId: string | null = null;\n let currentReasoningBlockId: string | null = null;\n let blockCounter = 0;\n\n // Track emitted sources to prevent duplicates\n const emittedSourceUrls = new Set<string>();\n // Associates a code execution result with its preceding call.\n let lastCodeExecutionToolCallId: string | undefined;\n\n return {\n stream: response.pipeThrough(\n new TransformStream<\n ParseResult<ChunkSchema>,\n LanguageModelV3StreamPart\n >({\n start(controller) {\n controller.enqueue({ type: 'stream-start', warnings });\n },\n\n transform(chunk, controller) {\n if (options.includeRawChunks) {\n controller.enqueue({ type: 'raw', rawValue: chunk.rawValue });\n }\n\n if (!chunk.success) {\n controller.enqueue({ type: 'error', error: chunk.error });\n return;\n }\n\n const value = chunk.value;\n\n const usageMetadata = value.usageMetadata;\n\n if (usageMetadata != null) {\n usage = usageMetadata;\n }\n\n const candidate = value.candidates?.[0];\n\n // sometimes the API returns an empty candidates array\n if (candidate == null) {\n return;\n }\n\n const content = candidate.content;\n\n const sources = extractSources({\n groundingMetadata: candidate.groundingMetadata,\n generateId,\n });\n if (sources != null) {\n for (const source of sources) {\n if (\n source.sourceType === 'url' &&\n !emittedSourceUrls.has(source.url)\n ) {\n emittedSourceUrls.add(source.url);\n controller.enqueue(source);\n }\n }\n }\n\n // Process tool call's parts before determining finishReason to ensure hasToolCalls is properly set\n if (content != null) {\n // Process all parts in a single loop to preserve original order\n const parts = content.parts ?? [];\n for (const part of parts) {\n if ('executableCode' in part && part.executableCode?.code) {\n const toolCallId = generateId();\n lastCodeExecutionToolCallId = toolCallId;\n\n controller.enqueue({\n type: 'tool-call',\n toolCallId,\n toolName: 'code_execution',\n input: JSON.stringify(part.executableCode),\n providerExecuted: true,\n });\n\n hasToolCalls = true;\n } else if (\n 'codeExecutionResult' in part &&\n part.codeExecutionResult\n ) {\n // Assumes a result directly follows its corresponding call part.\n const toolCallId = lastCodeExecutionToolCallId;\n\n if (toolCallId) {\n controller.enqueue({\n type: 'tool-result',\n toolCallId,\n toolName: 'code_execution',\n result: {\n outcome: part.codeExecutionResult.outcome,\n output: part.codeExecutionResult.output,\n },\n });\n // Clear the ID after use.\n lastCodeExecutionToolCallId = undefined;\n }\n } else if (\n 'text' in part &&\n part.text != null &&\n part.text.length > 0\n ) {\n if (part.thought === true) {\n // End any active text block before starting reasoning\n if (currentTextBlockId !== null) {\n controller.enqueue({\n type: 'text-end',\n id: currentTextBlockId,\n });\n currentTextBlockId = null;\n }\n\n // Start new reasoning block if not already active\n if (currentReasoningBlockId === null) {\n currentReasoningBlockId = String(blockCounter++);\n controller.enqueue({\n type: 'reasoning-start',\n id: currentReasoningBlockId,\n providerMetadata: part.thoughtSignature\n ? {\n google: {\n thoughtSignature: part.thoughtSignature,\n },\n }\n : undefined,\n });\n }\n\n controller.enqueue({\n type: 'reasoning-delta',\n id: currentReasoningBlockId,\n delta: part.text,\n providerMetadata: part.thoughtSignature\n ? {\n google: { thoughtSignature: part.thoughtSignature },\n }\n : undefined,\n });\n } else {\n // End any active reasoning block before starting text\n if (currentReasoningBlockId !== null) {\n controller.enqueue({\n type: 'reasoning-end',\n id: currentReasoningBlockId,\n });\n currentReasoningBlockId = null;\n }\n\n // Start new text block if not already active\n if (currentTextBlockId === null) {\n currentTextBlockId = String(blockCounter++);\n controller.enqueue({\n type: 'text-start',\n id: currentTextBlockId,\n providerMetadata: part.thoughtSignature\n ? {\n google: {\n thoughtSignature: part.thoughtSignature,\n },\n }\n : undefined,\n });\n }\n\n controller.enqueue({\n type: 'text-delta',\n id: currentTextBlockId,\n delta: part.text,\n providerMetadata: part.thoughtSignature\n ? {\n google: { thoughtSignature: part.thoughtSignature },\n }\n : undefined,\n });\n }\n } else if ('inlineData' in part) {\n // Process file parts inline to preserve order with text\n controller.enqueue({\n type: 'file',\n mediaType: part.inlineData.mimeType,\n data: part.inlineData.data,\n });\n }\n }\n\n const toolCallDeltas = getToolCallsFromParts({\n parts: content.parts,\n generateId,\n });\n\n if (toolCallDeltas != null) {\n for (const toolCall of toolCallDeltas) {\n controller.enqueue({\n type: 'tool-input-start',\n id: toolCall.toolCallId,\n toolName: toolCall.toolName,\n providerMetadata: toolCall.providerMetadata,\n });\n\n controller.enqueue({\n type: 'tool-input-delta',\n id: toolCall.toolCallId,\n delta: toolCall.args,\n providerMetadata: toolCall.providerMetadata,\n });\n\n controller.enqueue({\n type: 'tool-input-end',\n id: toolCall.toolCallId,\n providerMetadata: toolCall.providerMetadata,\n });\n\n controller.enqueue({\n type: 'tool-call',\n toolCallId: toolCall.toolCallId,\n toolName: toolCall.toolName,\n input: toolCall.args,\n providerMetadata: toolCall.providerMetadata,\n });\n\n hasToolCalls = true;\n }\n }\n }\n\n if (candidate.finishReason != null) {\n finishReason = mapGoogleGenerativeAIFinishReason({\n finishReason: candidate.finishReason,\n hasToolCalls,\n });\n\n providerMetadata = {\n google: {\n promptFeedback: value.promptFeedback ?? null,\n groundingMetadata: candidate.groundingMetadata ?? null,\n urlContextMetadata: candidate.urlContextMetadata ?? null,\n safetyRatings: candidate.safetyRatings ?? null,\n },\n };\n if (usageMetadata != null) {\n providerMetadata.google.usageMetadata = usageMetadata;\n }\n }\n },\n\n flush(controller) {\n // Close any open blocks before finishing\n if (currentTextBlockId !== null) {\n controller.enqueue({\n type: 'text-end',\n id: currentTextBlockId,\n });\n }\n if (currentReasoningBlockId !== null) {\n controller.enqueue({\n type: 'reasoning-end',\n id: currentReasoningBlockId,\n });\n }\n\n controller.enqueue({\n type: 'finish',\n finishReason,\n usage: convertGoogleGenerativeAIUsage(usage),\n providerMetadata,\n });\n },\n }),\n ),\n response: { headers: responseHeaders },\n request: { body: args },\n };\n }\n}\n\nfunction getToolCallsFromParts({\n parts,\n generateId,\n}: {\n parts: ContentSchema['parts'];\n generateId: () => string;\n}) {\n const functionCallParts = parts?.filter(\n part => 'functionCall' in part,\n ) as Array<\n GoogleGenerativeAIContentPart & {\n functionCall: { name: string; args: unknown };\n thoughtSignature?: string | null;\n }\n >;\n\n return functionCallParts == null || functionCallParts.length === 0\n ? undefined\n : functionCallParts.map(part => ({\n type: 'tool-call' as const,\n toolCallId: generateId(),\n toolName: part.functionCall.name,\n args: JSON.stringify(part.functionCall.args),\n providerMetadata: part.thoughtSignature\n ? { google: { thoughtSignature: part.thoughtSignature } }\n : undefined,\n }));\n}\n\nfunction extractSources({\n groundingMetadata,\n generateId,\n}: {\n groundingMetadata: GroundingMetadataSchema | undefined | null;\n generateId: () => string;\n}): undefined | LanguageModelV3Source[] {\n if (!groundingMetadata?.groundingChunks) {\n return undefined;\n }\n\n const sources: LanguageModelV3Source[] = [];\n\n for (const chunk of groundingMetadata.groundingChunks) {\n if (chunk.web != null) {\n // Handle web chunks as URL sources\n sources.push({\n type: 'source',\n sourceType: 'url',\n id: generateId(),\n url: chunk.web.uri,\n title: chunk.web.title ?? undefined,\n });\n } else if (chunk.retrievedContext != null) {\n // Handle retrievedContext chunks from RAG operations\n const uri = chunk.retrievedContext.uri;\n const fileSearchStore = chunk.retrievedContext.fileSearchStore;\n\n if (uri && (uri.startsWith('http://') || uri.startsWith('https://'))) {\n // Old format: Google Search with HTTP/HTTPS URL\n sources.push({\n type: 'source',\n sourceType: 'url',\n id: generateId(),\n url: uri,\n title: chunk.retrievedContext.title ?? undefined,\n });\n } else if (uri) {\n // Old format: Document with file path (gs://, etc.)\n const title = chunk.retrievedContext.title ?? 'Unknown Document';\n let mediaType = 'application/octet-stream';\n let filename: string | undefined = undefined;\n\n if (uri.endsWith('.pdf')) {\n mediaType = 'application/pdf';\n filename = uri.split('/').pop();\n } else if (uri.endsWith('.txt')) {\n mediaType = 'text/plain';\n filename = uri.split('/').pop();\n } else if (uri.endsWith('.docx')) {\n mediaType =\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';\n filename = uri.split('/').pop();\n } else if (uri.endsWith('.doc')) {\n mediaType = 'application/msword';\n filename = uri.split('/').pop();\n } else if (uri.match(/\\.(md|markdown)$/)) {\n mediaType = 'text/markdown';\n filename = uri.split('/').pop();\n } else {\n filename = uri.split('/').pop();\n }\n\n sources.push({\n type: 'source',\n sourceType: 'document',\n id: generateId(),\n mediaType,\n title,\n filename,\n });\n } else if (fileSearchStore) {\n // New format: File Search with fileSearchStore (no uri)\n const title = chunk.retrievedContext.title ?? 'Unknown Document';\n sources.push({\n type: 'source',\n sourceType: 'document',\n id: generateId(),\n mediaType: 'application/octet-stream',\n title,\n filename: fileSearchStore.split('/').pop(),\n });\n }\n }\n }\n\n return sources.length > 0 ? sources : undefined;\n}\n\nexport const getGroundingMetadataSchema = () =>\n z.object({\n webSearchQueries: z.array(z.string()).nullish(),\n retrievalQueries: z.array(z.string()).nullish(),\n searchEntryPoint: z.object({ renderedContent: z.string() }).nullish(),\n groundingChunks: z\n .array(\n z.object({\n web: z\n .object({ uri: z.string(), title: z.string().nullish() })\n .nullish(),\n retrievedContext: z\n .object({\n uri: z.string().nullish(),\n title: z.string().nullish(),\n text: z.string().nullish(),\n fileSearchStore: z.string().nullish(),\n })\n .nullish(),\n }),\n )\n .nullish(),\n groundingSupports: z\n .array(\n z.object({\n segment: z.object({\n startIndex: z.number().nullish(),\n endIndex: z.number().nullish(),\n text: z.string().nullish(),\n }),\n segment_text: z.string().nullish(),\n groundingChunkIndices: z.array(z.number()).nullish(),\n supportChunkIndices: z.array(z.number()).nullish(),\n confidenceScores: z.array(z.number()).nullish(),\n confidenceScore: z.array(z.number()).nullish(),\n }),\n )\n .nullish(),\n retrievalMetadata: z\n .union([\n z.object({\n webDynamicRetrievalScore: z.number(),\n }),\n z.object({}),\n ])\n .nullish(),\n });\n\nconst getContentSchema = () =>\n z.object({\n parts: z\n .array(\n z.union([\n // note: order matters since text can be fully empty\n z.object({\n functionCall: z.object({\n name: z.string(),\n args: z.unknown(),\n }),\n thoughtSignature: z.string().nullish(),\n }),\n z.object({\n inlineData: z.object({\n mimeType: z.string(),\n data: z.string(),\n }),\n thoughtSignature: z.string().nullish(),\n }),\n z.object({\n executableCode: z\n .object({\n language: z.string(),\n code: z.string(),\n })\n .nullish(),\n codeExecutionResult: z\n .object({\n outcome: z.string(),\n output: z.string(),\n })\n .nullish(),\n text: z.string().nullish(),\n thought: z.boolean().nullish(),\n thoughtSignature: z.string().nullish(),\n }),\n ]),\n )\n .nullish(),\n });\n\n// https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/configure-safety-filters\nconst getSafetyRatingSchema = () =>\n z.object({\n category: z.string().nullish(),\n probability: z.string().nullish(),\n probabilityScore: z.number().nullish(),\n severity: z.string().nullish(),\n severityScore: z.number().nullish(),\n blocked: z.boolean().nullish(),\n });\n\nconst usageSchema = z.object({\n cachedContentTokenCount: z.number().nullish(),\n thoughtsTokenCount: z.number().nullish(),\n promptTokenCount: z.number().nullish(),\n candidatesTokenCount: z.number().nullish(),\n totalTokenCount: z.number().nullish(),\n // https://cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/GenerateContentResponse#TrafficType\n trafficType: z.string().nullish(),\n});\n\n// https://ai.google.dev/api/generate-content#UrlRetrievalMetadata\nexport const getUrlContextMetadataSchema = () =>\n z.object({\n urlMetadata: z.array(\n z.object({\n retrievedUrl: z.string(),\n urlRetrievalStatus: z.string(),\n }),\n ),\n });\n\nconst responseSchema = lazySchema(() =>\n zodSchema(\n z.object({\n candidates: z.array(\n z.object({\n content: getContentSchema().nullish().or(z.object({}).strict()),\n finishReason: z.string().nullish(),\n safetyRatings: z.array(getSafetyRatingSchema()).nullish(),\n groundingMetadata: getGroundingMetadataSchema().nullish(),\n urlContextMetadata: getUrlContextMetadataSchema().nullish(),\n }),\n ),\n usageMetadata: usageSchema.nullish(),\n promptFeedback: z\n .object({\n blockReason: z.string().nullish(),\n safetyRatings: z.array(getSafetyRatingSchema()).nullish(),\n })\n .nullish(),\n }),\n ),\n);\n\ntype ContentSchema = NonNullable<\n InferSchema<typeof responseSchema>['candidates'][number]['content']\n>;\nexport type GroundingMetadataSchema = NonNullable<\n InferSchema<typeof responseSchema>['candidates'][number]['groundingMetadata']\n>;\n\ntype GroundingChunkSchema = NonNullable<\n GroundingMetadataSchema['groundingChunks']\n>[number];\n\nexport type UrlContextMetadataSchema = NonNullable<\n InferSchema<typeof responseSchema>['candidates'][number]['urlContextMetadata']\n>;\n\nexport type SafetyRatingSchema = NonNullable<\n InferSchema<typeof responseSchema>['candidates'][number]['safetyRatings']\n>[number];\n\n// limited version of the schema, focussed on what is needed for the implementation\n// this approach limits breakages when the API changes and increases efficiency\nconst chunkSchema = lazySchema(() =>\n zodSchema(\n z.object({\n candidates: z\n .array(\n z.object({\n content: getContentSchema().nullish(),\n finishReason: z.string().nullish(),\n safetyRatings: z.array(getSafetyRatingSchema()).nullish(),\n groundingMetadata: getGroundingMetadataSchema().nullish(),\n urlContextMetadata: getUrlContextMetadataSchema().nullish(),\n }),\n )\n .nullish(),\n usageMetadata: usageSchema.nullish(),\n promptFeedback: z\n .object({\n blockReason: z.string().nullish(),\n safetyRatings: z.array(getSafetyRatingSchema()).nullish(),\n })\n .nullish(),\n }),\n ),\n);\n\ntype ChunkSchema = InferSchema<typeof chunkSchema>;\n","import { LanguageModelV3Usage } from '@ai-sdk/provider';\n\nexport type GoogleGenerativeAIUsageMetadata = {\n promptTokenCount?: number | null;\n candidatesTokenCount?: number | null;\n totalTokenCount?: number | null;\n cachedContentTokenCount?: number | null;\n thoughtsTokenCount?: number | null;\n trafficType?: string | null;\n};\n\nexport function convertGoogleGenerativeAIUsage(\n usage: GoogleGenerativeAIUsageMetadata | undefined | null,\n): LanguageModelV3Usage {\n if (usage == null) {\n return {\n inputTokens: {\n total: undefined,\n noCache: undefined,\n cacheRead: undefined,\n cacheWrite: undefined,\n },\n outputTokens: {\n total: undefined,\n text: undefined,\n reasoning: undefined,\n },\n raw: undefined,\n };\n }\n\n const promptTokens = usage.promptTokenCount ?? 0;\n const candidatesTokens = usage.candidatesTokenCount ?? 0;\n const cachedContentTokens = usage.cachedContentTokenCount ?? 0;\n const thoughtsTokens = usage.thoughtsTokenCount ?? 0;\n\n return {\n inputTokens: {\n total: promptTokens,\n noCache: promptTokens - cachedContentTokens,\n cacheRead: cachedContentTokens,\n cacheWrite: undefined,\n },\n outputTokens: {\n total: candidatesTokens + thoughtsTokens,\n text: candidatesTokens,\n reasoning: thoughtsTokens,\n },\n raw: usage,\n };\n}\n","import { JSONSchema7Definition } from '@ai-sdk/provider';\n\n/**\n * Converts JSON Schema 7 to OpenAPI Schema 3.0\n */\nexport function convertJSONSchemaToOpenAPISchema(\n jsonSchema: JSONSchema7Definition | undefined,\n): unknown {\n // parameters need to be undefined if they are empty objects:\n if (jsonSchema == null || isEmptyObjectSchema(jsonSchema)) {\n return undefined;\n }\n\n if (typeof jsonSchema === 'boolean') {\n return { type: 'boolean', properties: {} };\n }\n\n const {\n type,\n description,\n required,\n properties,\n items,\n allOf,\n anyOf,\n oneOf,\n format,\n const: constValue,\n minLength,\n enum: enumValues,\n } = jsonSchema;\n\n const result: Record<string, unknown> = {};\n\n if (description) result.description = description;\n if (required) result.required = required;\n if (format) result.format = format;\n\n if (constValue !== undefined) {\n result.enum = [constValue];\n }\n\n // Handle type\n if (type) {\n if (Array.isArray(type)) {\n const hasNull = type.includes('null');\n const nonNullTypes = type.filter(t => t !== 'null');\n\n if (nonNullTypes.length === 0) {\n // Only null type\n result.type = 'null';\n } else {\n // One or more non-null types: always use anyOf\n result.anyOf = nonNullTypes.map(t => ({ type: t }));\n if (hasNull) {\n result.nullable = true;\n }\n }\n } else {\n result.type = type;\n }\n }\n\n // Handle enum\n if (enumValues !== undefined) {\n result.enum = enumValues;\n }\n\n if (properties != null) {\n result.properties = Object.entries(properties).reduce(\n (acc, [key, value]) => {\n acc[key] = convertJSONSchemaToOpenAPISchema(value);\n return acc;\n },\n {} as Record<string, unknown>,\n );\n }\n\n if (items) {\n result.items = Array.isArray(items)\n ? items.map(convertJSONSchemaToOpenAPISchema)\n : convertJSONSchemaToOpenAPISchema(items);\n }\n\n if (allOf) {\n result.allOf = allOf.map(convertJSONSchemaToOpenAPISchema);\n }\n if (anyOf) {\n // Handle cases where anyOf includes a null type\n if (\n anyOf.some(\n schema => typeof schema === 'object' && schema?.type === 'null',\n )\n ) {\n const nonNullSchemas = anyOf.filter(\n schema => !(typeof schema === 'object' && schema?.type === 'null'),\n );\n\n if (nonNullSchemas.length === 1) {\n // If there's only one non-null schema, convert it and make it nullable\n const converted = convertJSONSchemaToOpenAPISchema(nonNullSchemas[0]);\n if (typeof converted === 'object') {\n result.nullable = true;\n Object.assign(result, converted);\n }\n } else {\n // If there are multiple non-null schemas, keep them in anyOf\n result.anyOf = nonNullSchemas.map(convertJSONSchemaToOpenAPISchema);\n result.nullable = true;\n }\n } else {\n result.anyOf = anyOf.map(convertJSONSchemaToOpenAPISchema);\n }\n }\n if (oneOf) {\n result.oneOf = oneOf.map(convertJSONSchemaToOpenAPISchema);\n }\n\n if (minLength !== undefined) {\n result.minLength = minLength;\n }\n\n return result;\n}\n\nfunction isEmptyObjectSchema(jsonSchema: JSONSchema7Definition): boolean {\n return (\n jsonSchema != null &&\n typeof jsonSchema === 'object' &&\n jsonSchema.type === 'object' &&\n (jsonSchema.properties == null ||\n Object.keys(jsonSchema.properties).length === 0) &&\n !jsonSchema.additionalProperties\n );\n}\n","import {\n LanguageModelV3Prompt,\n UnsupportedFunctionalityError,\n} from '@ai-sdk/provider';\nimport {\n GoogleGenerativeAIContent,\n GoogleGenerativeAIContentPart,\n GoogleGenerativeAIPrompt,\n} from './google-generative-ai-prompt';\nimport { convertToBase64 } from '@ai-sdk/provider-utils';\n\nexport function convertToGoogleGenerativeAIMessages(\n prompt: LanguageModelV3Prompt,\n options?: { isGemmaModel?: boolean },\n): GoogleGenerativeAIPrompt {\n const systemInstructionParts: Array<{ text: string }> = [];\n const contents: Array<GoogleGenerativeAIContent> = [];\n let systemMessagesAllowed = true;\n const isGemmaModel = options?.isGemmaModel ?? false;\n\n for (const { role, content } of prompt) {\n switch (role) {\n case 'system': {\n if (!systemMessagesAllowed) {\n throw new UnsupportedFunctionalityError({\n functionality:\n 'system messages are only supported at the beginning of the conversation',\n });\n }\n\n systemInstructionParts.push({ text: content });\n break;\n }\n\n case 'user': {\n systemMessagesAllowed = false;\n\n const parts: GoogleGenerativeAIContentPart[] = [];\n\n for (const part of content) {\n switch (part.type) {\n case 'text': {\n parts.push({ text: part.text });\n break;\n }\n\n case 'file': {\n // default to image/jpeg for unknown image/* types\n const mediaType =\n part.mediaType === 'image/*' ? 'image/jpeg' : part.mediaType;\n\n parts.push(\n part.data instanceof URL\n ? {\n fileData: {\n mimeType: mediaType,\n fileUri: part.data.toString(),\n },\n }\n : {\n inlineData: {\n mimeType: mediaType,\n data: convertToBase64(part.data),\n },\n },\n );\n\n break;\n }\n }\n }\n\n contents.push({ role: 'user', parts });\n break;\n }\n\n case 'assistant': {\n systemMessagesAllowed = false;\n\n contents.push({\n role: 'model',\n parts: content\n .map(part => {\n const thoughtSignature =\n part.providerOptions?.google?.thoughtSignature != null\n ? String(part.providerOptions.google?.thoughtSignature)\n : undefined;\n\n switch (part.type) {\n case 'text': {\n return part.text.length === 0\n ? undefined\n : {\n text: part.text,\n thoughtSignature,\n };\n }\n\n case 'reasoning': {\n return part.text.length === 0\n ? undefined\n : {\n text: part.text,\n thought: true,\n thoughtSignature,\n };\n }\n\n case 'file': {\n if (part.data instanceof URL) {\n throw new UnsupportedFunctionalityError({\n functionality:\n 'File data URLs in assistant messages are not supported',\n });\n }\n\n return {\n inlineData: {\n mimeType: part.mediaType,\n data: convertToBase64(part.data),\n },\n thoughtSignature,\n };\n }\n\n case 'tool-call': {\n return {\n functionCall: {\n name: part.toolName,\n args: part.input,\n },\n thoughtSignature,\n };\n }\n }\n })\n .filter(part => part !== undefined),\n });\n break;\n }\n\n case 'tool': {\n systemMessagesAllowed = false;\n\n const parts: GoogleGenerativeAIContentPart[] = [];\n\n for (const part of content) {\n const output = part.output;\n\n if (output.type === 'content') {\n for (const contentPart of output.value) {\n switch (contentPart.type) {\n case 'text':\n parts.push({\n functionResponse: {\n name: part.toolName,\n response: {\n name: part.toolName,\n content: contentPart.text,\n },\n },\n });\n break;\n case 'image-data':\n parts.push(\n {\n inlineData: {\n mimeType: contentPart.mediaType,\n data: contentPart.data,\n },\n },\n {\n text: 'Tool executed successfully and returned this image as a response',\n },\n );\n break;\n default:\n parts.push({ text: JSON.stringify(contentPart) });\n break;\n }\n }\n } else {\n parts.push({\n functionResponse: {\n name: part.toolName,\n response: {\n name: part.toolName,\n content:\n output.type === 'execution-denied'\n ? (output.reason ?? 'Tool execution denied.')\n : output.value,\n },\n },\n });\n }\n }\n\n contents.push({\n role: 'user',\n parts,\n });\n break;\n }\n }\n }\n\n if (\n isGemmaModel &&\n systemInstructionParts.length > 0 &&\n contents.length > 0 &&\n contents[0].role === 'user'\n ) {\n const systemText = systemInstructionParts\n .map(part => part.text)\n .join('\\n\\n');\n\n contents[0].parts.unshift({ text: systemText + '\\n\\n' });\n }\n\n return {\n systemInstruction:\n systemInstructionParts.length > 0 && !isGemmaModel\n ? { parts: systemInstructionParts }\n : undefined,\n contents,\n };\n}\n","export function getModelPath(modelId: string): string {\n return modelId.includes('/') ? modelId : `models/${modelId}`;\n}\n","import {\n createJsonErrorResponseHandler,\n type InferSchema,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nconst googleErrorDataSchema = lazySchema(() =>\n zodSchema(\n z.object({\n error: z.object({\n code: z.number().nullable(),\n message: z.string(),\n status: z.string(),\n }),\n }),\n ),\n);\n\nexport type GoogleErrorData = InferSchema<typeof googleErrorDataSchema>;\n\nexport const googleFailedResponseHandler = createJsonErrorResponseHandler({\n errorSchema: googleErrorDataSchema,\n errorToMessage: data => data.error.message,\n});\n","import { InferSchema, lazySchema, zodSchema } from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nexport type GoogleGenerativeAIModelId =\n // Stable models\n // https://ai.google.dev/gemini-api/docs/models/gemini\n | 'gemini-1.5-flash'\n | 'gemini-1.5-flash-latest'\n | 'gemini-1.5-flash-001'\n | 'gemini-1.5-flash-002'\n | 'gemini-1.5-flash-8b'\n | 'gemini-1.5-flash-8b-latest'\n | 'gemini-1.5-flash-8b-001'\n | 'gemini-1.5-pro'\n | 'gemini-1.5-pro-latest'\n | 'gemini-1.5-pro-001'\n | 'gemini-1.5-pro-002'\n | 'gemini-2.0-flash'\n | 'gemini-2.0-flash-001'\n | 'gemini-2.0-flash-live-001'\n | 'gemini-2.0-flash-lite'\n | 'gemini-2.0-pro-exp-02-05'\n | 'gemini-2.0-flash-thinking-exp-01-21'\n | 'gemini-2.0-flash-exp'\n | 'gemini-2.5-pro'\n | 'gemini-2.5-flash'\n | 'gemini-2.5-flash-image-preview'\n | 'gemini-2.5-flash-lite'\n | 'gemini-2.5-flash-lite-preview-09-2025'\n | 'gemini-2.5-flash-preview-04-17'\n | 'gemini-2.5-flash-preview-09-2025'\n | 'gemini-3-pro-preview'\n | 'gemini-3-pro-image-preview'\n // latest version\n // https://ai.google.dev/gemini-api/docs/models#latest\n | 'gemini-pro-latest'\n | 'gemini-flash-latest'\n | 'gemini-flash-lite-latest'\n // Experimental models\n // https://ai.google.dev/gemini-api/docs/models/experimental-models\n | 'gemini-2.5-pro-exp-03-25'\n | 'gemini-exp-1206'\n | 'gemma-3-12b-it'\n | 'gemma-3-27b-it'\n | (string & {});\n\nexport const googleGenerativeAIProviderOptions = lazySchema(() =>\n zodSchema(\n z.object({\n responseModalities: z.array(z.enum(['TEXT', 'IMAGE'])).optional(),\n\n thinkingConfig: z\n .object({\n thinkingBudget: z.number().optional(),\n includeThoughts: z.boolean().optional(),\n // https://ai.google.dev/gemini-api/docs/gemini-3?thinking=high#thinking_level\n thinkingLevel: z.enum(['low', 'medium', 'high']).optional(),\n })\n .optional(),\n\n /**\n * Optional.\n * The name of the cached content used as context to serve the prediction.\n * Format: cachedContents/{cachedContent}\n */\n cachedContent: z.string().optional(),\n\n /**\n * Optional. Enable structured output. Default is true.\n *\n * This is useful when the JSON Schema contains elements that are\n * not supported by the OpenAPI schema version that\n * Google Generative AI uses. You can use this to disable\n * structured outputs if you need to.\n */\n structuredOutputs: z.boolean().optional(),\n\n /**\n * Optional. A list of unique safety settings for blocking unsafe content.\n */\n safetySettings: z\n .array(\n z.object({\n category: z.enum([\n 'HARM_CATEGORY_UNSPECIFIED',\n 'HARM_CATEGORY_HATE_SPEECH',\n 'HARM_CATEGORY_DANGEROUS_CONTENT',\n 'HARM_CATEGORY_HARASSMENT',\n 'HARM_CATEGORY_SEXUALLY_EXPLICIT',\n 'HARM_CATEGORY_CIVIC_INTEGRITY',\n ]),\n threshold: z.enum([\n 'HARM_BLOCK_THRESHOLD_UNSPECIFIED',\n 'BLOCK_LOW_AND_ABOVE',\n 'BLOCK_MEDIUM_AND_ABOVE',\n 'BLOCK_ONLY_HIGH',\n 'BLOCK_NONE',\n 'OFF',\n ]),\n }),\n )\n .optional(),\n\n threshold: z\n .enum([\n 'HARM_BLOCK_THRESHOLD_UNSPECIFIED',\n 'BLOCK_LOW_AND_ABOVE',\n 'BLOCK_MEDIUM_AND_ABOVE',\n 'BLOCK_ONLY_HIGH',\n 'BLOCK_NONE',\n 'OFF',\n ])\n .optional(),\n\n /**\n * Optional. Enables timestamp understanding for audio-only files.\n *\n * https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/audio-understanding\n */\n audioTimestamp: z.boolean().optional(),\n\n /**\n * Optional. Defines labels used in billing reports. Available on Vertex AI only.\n *\n * https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/add-labels-to-api-calls\n */\n labels: z.record(z.string(), z.string()).optional(),\n\n /**\n * Optional. If specified, the media resolution specified will be used.\n *\n * https://ai.google.dev/api/generate-content#MediaResolution\n */\n mediaResolution: z\n .enum([\n 'MEDIA_RESOLUTION_UNSPECIFIED',\n 'MEDIA_RESOLUTION_LOW',\n 'MEDIA_RESOLUTION_MEDIUM',\n 'MEDIA_RESOLUTION_HIGH',\n ])\n .optional(),\n\n /**\n * Optional. Configures the image generation aspect ratio for Gemini models.\n *\n * https://ai.google.dev/gemini-api/docs/image-generation#aspect_ratios\n */\n imageConfig: z\n .object({\n aspectRatio: z\n .enum([\n '1:1',\n '2:3',\n '3:2',\n '3:4',\n '4:3',\n '4:5',\n '5:4',\n '9:16',\n '16:9',\n '21:9',\n ])\n .optional(),\n imageSize: z.enum(['1K', '2K', '4K']).optional(),\n })\n .optional(),\n }),\n ),\n);\n\nexport type GoogleGenerativeAIProviderOptions = InferSchema<\n typeof googleGenerativeAIProviderOptions\n>;\n","import {\n LanguageModelV3CallOptions,\n SharedV3Warning,\n UnsupportedFunctionalityError,\n} from '@ai-sdk/provider';\nimport { convertJSONSchemaToOpenAPISchema } from './convert-json-schema-to-openapi-schema';\nimport { GoogleGenerativeAIModelId } from './google-generative-ai-options';\n\nexport function prepareTools({\n tools,\n toolChoice,\n modelId,\n}: {\n tools: LanguageModelV3CallOptions['tools'];\n toolChoice?: LanguageModelV3CallOptions['toolChoice'];\n modelId: GoogleGenerativeAIModelId;\n}): {\n tools:\n | Array<\n | {\n functionDeclarations: Array<{\n name: string;\n description: string;\n parameters: unknown;\n }>;\n }\n | Record<string, any>\n >\n | undefined;\n toolConfig:\n | undefined\n | {\n functionCallingConfig: {\n mode: 'AUTO' | 'NONE' | 'ANY';\n allowedFunctionNames?: string[];\n };\n };\n toolWarnings: SharedV3Warning[];\n} {\n // when the tools array is empty, change it to undefined to prevent errors:\n tools = tools?.length ? tools : undefined;\n\n const toolWarnings: SharedV3Warning[] = [];\n\n const isLatest = (\n [\n 'gemini-flash-latest',\n 'gemini-flash-lite-latest',\n 'gemini-pro-latest',\n ] as const satisfies GoogleGenerativeAIModelId[]\n ).some(id => id === modelId);\n const isGemini2orNewer =\n modelId.includes('gemini-2') || modelId.includes('gemini-3') || isLatest;\n const supportsDynamicRetrieval =\n modelId.includes('gemini-1.5-flash') && !modelId.includes('-8b');\n const supportsFileSearch = modelId.includes('gemini-2.5');\n\n if (tools == null) {\n return { tools: undefined, toolConfig: undefined, toolWarnings };\n }\n\n // Check for mixed tool types and add warnings\n const hasFunctionTools = tools.some(tool => tool.type === 'function');\n const hasProviderTools = tools.some(tool => tool.type === 'provider');\n\n if (hasFunctionTools && hasProviderTools) {\n toolWarnings.push({\n type: 'unsupported',\n feature: `combination of function and provider-defined tools`,\n });\n }\n\n if (hasProviderTools) {\n const googleTools: any[] = [];\n\n const ProviderTools = tools.filter(tool => tool.type === 'provider');\n ProviderTools.forEach(tool => {\n switch (tool.id) {\n case 'google.google_search':\n if (isGemini2orNewer) {\n googleTools.push({ googleSearch: {} });\n } else if (supportsDynamicRetrieval) {\n // For non-Gemini-2 models that don't support dynamic retrieval, use basic googleSearchRetrieval\n googleTools.push({\n googleSearchRetrieval: {\n dynamicRetrievalConfig: {\n mode: tool.args.mode as\n | 'MODE_DYNAMIC'\n | 'MODE_UNSPECIFIED'\n | undefined,\n dynamicThreshold: tool.args.dynamicThreshold as\n | number\n | undefined,\n },\n },\n });\n } else {\n googleTools.push({ googleSearchRetrieval: {} });\n }\n break;\n case 'google.url_context':\n if (isGemini2orNewer) {\n googleTools.push({ urlContext: {} });\n } else {\n toolWarnings.push({\n type: 'unsupported',\n feature: `provider-defined tool ${tool.id}`,\n details:\n 'The URL context tool is not supported with other Gemini models than Gemini 2.',\n });\n }\n break;\n case 'google.code_execution':\n if (isGemini2orNewer) {\n googleTools.push({ codeExecution: {} });\n } else {\n toolWarnings.push({\n type: 'unsupported',\n feature: `provider-defined tool ${tool.id}`,\n details:\n 'The code execution tools is not supported with other Gemini models than Gemini 2.',\n });\n }\n break;\n case 'google.file_search':\n if (supportsFileSearch) {\n googleTools.push({ fileSearch: { ...tool.args } });\n } else {\n toolWarnings.push({\n type: 'unsupported',\n feature: `provider-defined tool ${tool.id}`,\n details:\n 'The file search tool is only supported with Gemini 2.5 models.',\n });\n }\n break;\n case 'google.vertex_rag_store':\n if (isGemini2orNewer) {\n googleTools.push({\n retrieval: {\n vertex_rag_store: {\n rag_resources: {\n rag_corpus: tool.args.ragCorpus,\n },\n similarity_top_k: tool.args.topK as number | undefined,\n },\n },\n });\n } else {\n toolWarnings.push({\n type: 'unsupported',\n feature: `provider-defined tool ${tool.id}`,\n details:\n 'The RAG store tool is not supported with other Gemini models than Gemini 2.',\n });\n }\n break;\n default:\n toolWarnings.push({\n type: 'unsupported',\n feature: `provider-defined tool ${tool.id}`,\n });\n break;\n }\n });\n\n return {\n tools: googleTools.length > 0 ? googleTools : undefined,\n toolConfig: undefined,\n toolWarnings,\n };\n }\n\n const functionDeclarations = [];\n for (const tool of tools) {\n switch (tool.type) {\n case 'function':\n functionDeclarations.push({\n name: tool.name,\n description: tool.description ?? '',\n parameters: convertJSONSchemaToOpenAPISchema(tool.inputSchema),\n });\n break;\n default:\n toolWarnings.push({\n type: 'unsupported',\n feature: `function tool ${tool.name}`,\n });\n break;\n }\n }\n\n if (toolChoice == null) {\n return {\n tools: [{ functionDeclarations }],\n toolConfig: undefined,\n toolWarnings,\n };\n }\n\n const type = toolChoice.type;\n\n switch (type) {\n case 'auto':\n return {\n tools: [{ functionDeclarations }],\n toolConfig: { functionCallingConfig: { mode: 'AUTO' } },\n toolWarnings,\n };\n case 'none':\n return {\n tools: [{ functionDeclarations }],\n toolConfig: { functionCallingConfig: { mode: 'NONE' } },\n toolWarnings,\n };\n case 'required':\n return {\n tools: [{ functionDeclarations }],\n toolConfig: { functionCallingConfig: { mode: 'ANY' } },\n toolWarnings,\n };\n case 'tool':\n return {\n tools: [{ functionDeclarations }],\n toolConfig: {\n functionCallingConfig: {\n mode: 'ANY',\n allowedFunctionNames: [toolChoice.toolName],\n },\n },\n toolWarnings,\n };\n default: {\n const _exhaustiveCheck: never = type;\n throw new UnsupportedFunctionalityError({\n functionality: `tool choice type: ${_exhaustiveCheck}`,\n });\n }\n }\n}\n","import { LanguageModelV3FinishReason } from '@ai-sdk/provider';\n\nexport function mapGoogleGenerativeAIFinishReason({\n finishReason,\n hasToolCalls,\n}: {\n finishReason: string | null | undefined;\n hasToolCalls: boolean;\n}): LanguageModelV3FinishReason {\n switch (finishReason) {\n case 'STOP':\n return hasToolCalls ? 'tool-calls' : 'stop';\n case 'MAX_TOKENS':\n return 'length';\n case 'IMAGE_SAFETY':\n case 'RECITATION':\n case 'SAFETY':\n case 'BLOCKLIST':\n case 'PROHIBITED_CONTENT':\n case 'SPII':\n return 'content-filter';\n case 'FINISH_REASON_UNSPECIFIED':\n case 'OTHER':\n return 'other';\n case 'MALFORMED_FUNCTION_CALL':\n return 'error';\n default:\n return 'unknown';\n }\n}\n","import { createProviderToolFactoryWithOutputSchema } from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\n/**\n * A tool that enables the model to generate and run Python code.\n *\n * @note Ensure the selected model supports Code Execution.\n * Multi-tool usage with the code execution tool is typically compatible with Gemini >=2 models.\n *\n * @see https://ai.google.dev/gemini-api/docs/code-execution (Google AI)\n * @see https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/code-execution-api (Vertex AI)\n */\nexport const codeExecution = createProviderToolFactoryWithOutputSchema<\n {\n language: string;\n code: string;\n },\n {\n outcome: string;\n output: string;\n },\n {}\n>({\n id: 'google.code_execution',\n inputSchema: z.object({\n language: z.string().describe('The programming language of the code.'),\n code: z.string().describe('The code to be executed.'),\n }),\n outputSchema: z.object({\n outcome: z\n .string()\n .describe('The outcome of the execution (e.g., \"OUTCOME_OK\").'),\n output: z.string().describe('The output from the code execution.'),\n }),\n});\n","import {\n createProviderToolFactory,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\n/** Tool to retrieve knowledge from the File Search Stores. */\nconst fileSearchArgsBaseSchema = z\n .object({\n /** The names of the file_search_stores to retrieve from.\n * Example: `fileSearchStores/my-file-search-store-123`\n */\n fileSearchStoreNames: z\n .array(z.string())\n .describe(\n 'The names of the file_search_stores to retrieve from. Example: `fileSearchStores/my-file-search-store-123`',\n ),\n /** The number of file search retrieval chunks to retrieve. */\n topK: z\n .number()\n .int()\n .positive()\n .describe('The number of file search retrieval chunks to retrieve.')\n .optional(),\n\n /** Metadata filter to apply to the file search retrieval documents.\n * See https://google.aip.dev/160 for the syntax of the filter expression.\n */\n metadataFilter: z\n .string()\n .describe(\n 'Metadata filter to apply to the file search retrieval documents. See https://google.aip.dev/160 for the syntax of the filter expression.',\n )\n .optional(),\n })\n .passthrough();\n\nexport type GoogleFileSearchToolArgs = z.infer<typeof fileSearchArgsBaseSchema>;\n\nconst fileSearchArgsSchema = lazySchema(() =>\n zodSchema(fileSearchArgsBaseSchema),\n);\n\nexport const fileSearch = createProviderToolFactory<\n {},\n GoogleFileSearchToolArgs\n>({\n id: 'google.file_search',\n inputSchema: fileSearchArgsSchema,\n});\n","import {\n createProviderToolFactory,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\n// https://ai.google.dev/gemini-api/docs/google-search\n// https://ai.google.dev/api/generate-content#GroundingSupport\n// https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/grounding-with-google-search\n\nexport const googleSearch = createProviderToolFactory<\n {},\n {\n /**\n * The mode of the predictor to be used in dynamic retrieval. The following modes are supported:\n * - MODE_DYNAMIC: Run retrieval only when system decides it is necessary\n * - MODE_UNSPECIFIED: Always trigger retrieval\n * @default MODE_UNSPECIFIED\n */\n mode?: 'MODE_DYNAMIC' | 'MODE_UNSPECIFIED';\n\n /**\n * The threshold to be used in dynamic retrieval (if not set, a system default value is used).\n */\n dynamicThreshold?: number;\n }\n>({\n id: 'google.google_search',\n inputSchema: lazySchema(() =>\n zodSchema(\n z.object({\n mode: z\n .enum(['MODE_DYNAMIC', 'MODE_UNSPECIFIED'])\n .default('MODE_UNSPECIFIED'),\n dynamicThreshold: z.number().default(1),\n }),\n ),\n ),\n});\n","import {\n createProviderToolFactory,\n lazySchema,\n zodSchema,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\nexport const urlContext = createProviderToolFactory<\n {\n // Url context does not have any input schema, it will directly use the url from the prompt\n },\n {}\n>({\n id: 'google.url_context',\n inputSchema: lazySchema(() => zodSchema(z.object({}))),\n});\n","import { createProviderToolFactory } from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\n\n// https://cloud.google.com/vertex-ai/generative-ai/docs/rag-engine/use-vertexai-search#generate-content-using-gemini-api\n// https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/rag-output-explained\n\n/**\n * A tool that enables the model to perform RAG searches against a Vertex RAG Store.\n *\n * @note Only works with Vertex Gemini models.\n */\nexport const vertexRagStore = createProviderToolFactory<\n {},\n {\n /**\n * RagCorpus resource names, eg: projects/{project}/locations/{location}/ragCorpora/{rag_corpus}\n */\n ragCorpus: string;\n\n /**\n * The number of top contexts to retrieve.\n */\n topK?: number;\n }\n>({\n id: 'google.vertex_rag_store',\n inputSchema: z.object({\n ragCorpus: z.string(),\n topK: z.number().optional(),\n }),\n});\n","import { codeExecution } from './tool/code-execution';\nimport { fileSearch } from './tool/file-search';\nimport { googleSearch } from './tool/google-search';\nimport { urlContext } from './tool/url-context';\nimport { vertexRagStore } from './tool/vertex-rag-store';\n\nexport const googleTools = {\n /**\n * Creates a Google search tool that gives Google direct access to real-time web content.\n * Must have name \"google_search\".\n */\n googleSearch,\n\n /**\n * Creates a URL context tool that gives Google direct access to real-time web content.\n * Must have name \"url_context\".\n */\n urlContext,\n\n /**\n * Enables Retrieval Augmented Generation (RAG) via the Gemini File Search tool.\n * Must have name \"file_search\".\n *\n * @param fileSearchStoreNames - Fully-qualified File Search store resource names.\n * @param metadataFilter - Optional filter expression to restrict the files that can be retrieved.\n * @param topK - Optional result limit for the number of chunks returned from File Search.\n *\n * @see https://ai.google.dev/gemini-api/docs/file-search\n */\n fileSearch,\n /**\n * A tool that enables the model to generate and run Python code.\n * Must have name \"code_execution\".\n *\n * @note Ensure the selected model supports Code Execution.\n * Multi-tool usage with the code execution tool is typically compatible with Gemini >=2 models.\n *\n * @see https://ai.google.dev/gemini-api/docs/code-execution (Google AI)\n * @see https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/code-execution-api (Vertex AI)\n */\n codeExecution,\n\n /**\n * Creates a Vertex RAG Store tool that enables the model to perform RAG searches against a Vertex RAG Store.\n * Must have name \"vertex_rag_store\".\n */\n vertexRagStore,\n};\n"],"mappings":";AASA;AAAA,EAKE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,cAAAA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAAC;AAAA,OACK;AACP,SAAS,KAAAC,UAAS;;;ACbX,SAAS,+BACd,OACsB;AAbxB;AAcE,MAAI,SAAS,MAAM;AACjB,WAAO;AAAA,MACL,aAAa;AAAA,QACX,OAAO;AAAA,QACP,SAAS;AAAA,QACT,WAAW;AAAA,QACX,YAAY;AAAA,MACd;AAAA,MACA,cAAc;AAAA,QACZ,OAAO;AAAA,QACP,MAAM;AAAA,QACN,WAAW;AAAA,MACb;AAAA,MACA,KAAK;AAAA,IACP;AAAA,EACF;AAEA,QAAM,gBAAe,WAAM,qBAAN,YAA0B;AAC/C,QAAM,oBAAmB,WAAM,yBAAN,YAA8B;AACvD,QAAM,uBAAsB,WAAM,4BAAN,YAAiC;AAC7D,QAAM,kBAAiB,WAAM,uBAAN,YAA4B;AAEnD,SAAO;AAAA,IACL,aAAa;AAAA,MACX,OAAO;AAAA,MACP,SAAS,eAAe;AAAA,MACxB,WAAW;AAAA,MACX,YAAY;AAAA,IACd;AAAA,IACA,cAAc;AAAA,MACZ,OAAO,mBAAmB;AAAA,MAC1B,MAAM;AAAA,MACN,WAAW;AAAA,IACb;AAAA,IACA,KAAK;AAAA,EACP;AACF;;;AC7CO,SAAS,iCACd,YACS;AAET,MAAI,cAAc,QAAQ,oBAAoB,UAAU,GAAG;AACzD,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,eAAe,WAAW;AACnC,WAAO,EAAE,MAAM,WAAW,YAAY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,EACE,6BAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC;AAAA,OACK;AACP,SAAS,KAAAC,UAAS;AAEX,IAAM,aAAaH,2BAKxB;AAAA,EACA,IAAI;AAAA,EACJ,aAAaC,YAAW,MAAMC,WAAUC,GAAE,OAAO,CAAC,CAAC,CAAC,CAAC;AACvD,CAAC;;;ACfD,SAAS,6BAAAC,kCAAiC;AAC1C,SAAS,KAAAC,UAAS;AAUX,IAAM,iBAAiBD,2BAa5B;AAAA,EACA,IAAI;AAAA,EACJ,aAAaC,GAAE,OAAO;AAAA,IACpB,WAAWA,GAAE,OAAO;AAAA,IACpB,MAAMA,GAAE,OAAO,EAAE,SAAS;AAAA,EAC5B,CAAC;AACH,CAAC;;;ACxBM,IAAM,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA,EAKzB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA;AACF;","names":["lazySchema","zodSchema","z","_a","_b","lazySchema","zodSchema","z","UnsupportedFunctionalityError","googleTools","UnsupportedFunctionalityError","googleTools","generateId","z","lazySchema","zodSchema","z","lazySchema","zodSchema","z","createProviderToolFactory","lazySchema","zodSchema","z","createProviderToolFactory","lazySchema","zodSchema","z","createProviderToolFactory","z"]}
|