@ai-sdk/google
Version:
992 lines • 37.3 kB
TypeScript
import { FetchFunction, InferSchema, Resolvable, WORKFLOW_DESERIALIZE, WORKFLOW_SERIALIZE, createToolNameMapping } from "@ai-sdk/provider-utils";
import { z } from "zod/v4";
import { JSONObject, LanguageModelV4, LanguageModelV4CallOptions, LanguageModelV4GenerateResult, LanguageModelV4StreamResult, ModelCapabilities, ModelCapability, ModelEntry, SharedV4Warning, SpeechModelV4 } from "@ai-sdk/provider";
//#region src/google-prompt.d.ts
type GoogleSystemInstruction = {
parts: Array<{
text: string;
}>;
};
type GoogleContent = {
role: 'user' | 'model';
parts: Array<GoogleContentPart>;
};
declare const googleVideoMetadataSchema: z.ZodObject<{
startOffset: z.ZodOptional<z.ZodString>;
endOffset: z.ZodOptional<z.ZodString>;
fps: z.ZodOptional<z.ZodNumber>;
}, z.core.$strip>;
/** Metadata for preprocessing video file parts. */
type GoogleVideoMetadata = z.infer<typeof googleVideoMetadataSchema>;
type GoogleContentPart = {
text: string;
thought?: boolean;
thoughtSignature?: string;
} | {
inlineData: {
mimeType: string;
data: string;
};
videoMetadata?: GoogleVideoMetadata;
thought?: boolean;
thoughtSignature?: string;
} | {
functionCall: {
id?: string;
name: string;
args: unknown;
};
thoughtSignature?: string;
} | {
functionResponse: {
id?: string;
name: string;
response: unknown;
parts?: Array<GoogleFunctionResponsePart>;
};
} | {
fileData: {
mimeType: string;
fileUri: string;
};
videoMetadata?: GoogleVideoMetadata;
thought?: boolean;
thoughtSignature?: string;
} | {
toolCall: {
toolType: string;
args?: unknown;
id: string;
};
thoughtSignature?: string;
} | {
toolResponse: {
toolType: string;
response?: unknown;
id: string;
};
thoughtSignature?: string;
} | {
executableCode: {
language: string;
code: string;
};
} | {
codeExecutionResult: {
outcome: string;
output: string;
};
};
type GoogleFunctionResponsePart = {
inlineData: {
mimeType: string;
data: string;
};
} | {
fileData: {
mimeType: string;
fileUri: string;
};
};
//#endregion
//#region src/google-model-catalog.d.ts
type GoogleLanguageProviderOption = keyof GoogleLanguageModelOptions;
/** Options accepted under providerOptions.google (or googleVertex on Vertex). */
export declare const googleProviderOptions: {
readonly language: {
responseModalities: {
description: string;
};
thinkingConfig: {
description: string;
};
cachedContent: {
description: string;
};
structuredOutputs: {
description: string;
};
safetySettings: {
description: string;
};
threshold: {
description: string;
};
audioTimestamp: {
description: string;
};
labels: {
description: string;
};
mediaResolution: {
description: string;
};
imageConfig: {
description: string;
};
retrievalConfig: {
description: string;
};
streamFunctionCallArguments: {
description: string;
};
serviceTier: {
description: string;
};
continuationToken: {
description: string;
};
sharedRequestType: {
description: string;
};
requestType: {
description: string;
};
};
};
type GoogleLanguageCapabilities = NonNullable<ModelCapabilities['language']> & {
tools: NonNullable<ModelCapabilities['language']>['tools'] & {
/** Existing request gate for Gemini 2 provider-defined tools. */
gemini2: boolean;
googleSearch: ModelCapability;
urlContext: ModelCapability;
fileSearch: boolean;
mixed: boolean;
functionResponseParts: boolean;
};
reasoning: NonNullable<ModelCapabilities['language']>['reasoning'] & {
minBudget: number;
maxBudget: number;
};
sampling: NonNullable<ModelCapabilities['language']>['sampling'] & {
topK: ModelCapability;
penalties: ModelCapability;
};
structuredOutput: {
withFunctionTools: boolean;
};
};
type GoogleLanguageRequestConfig = {
systemInstruction: 'system' | 'user';
thinkingFormat: 'level' | 'budget';
reasoningMaxOutputTokens: number;
jsonResponseTool: boolean;
};
type GoogleLanguageModelEntry = ModelEntry<{
language: GoogleLanguageRequestConfig;
}> & {
capabilities: {
language: GoogleLanguageCapabilities;
};
providerOptions: {
language: Record<GoogleLanguageProviderOption, ModelCapability>;
};
requestConfig: {
language: GoogleLanguageRequestConfig;
};
};
declare const languageModelDefinitions: {
'gemini-nano-banana-2.1': {
image: true;
objectGeneration: false;
tools: false;
streaming: false;
googleSearch: true;
urlContext: false;
};
'gemini-4-argon': {
readonly image: true;
readonly objectGeneration: true;
readonly tools: true;
readonly streaming: true;
readonly googleSearch: true;
readonly urlContext: true;
};
'gemini-4-carbon': {
readonly image: true;
readonly objectGeneration: true;
readonly tools: true;
readonly streaming: true;
readonly googleSearch: true;
readonly urlContext: true;
};
'gemini-4-hydrogen': {
readonly image: true;
readonly objectGeneration: true;
readonly tools: true;
readonly streaming: true;
readonly googleSearch: true;
readonly urlContext: true;
};
'gemini-3.8-flash': {
readonly image: true;
readonly objectGeneration: true;
readonly tools: true;
readonly streaming: true;
readonly googleSearch: true;
readonly urlContext: true;
};
'gemini-3.7-flash': {
readonly image: true;
readonly objectGeneration: true;
readonly tools: true;
readonly streaming: true;
readonly googleSearch: true;
readonly urlContext: true;
};
'gemini-3.6-flash': {
readonly image: true;
readonly objectGeneration: true;
readonly tools: true;
readonly streaming: true;
readonly googleSearch: true;
readonly urlContext: true;
};
'gemini-3.5-flash': {
readonly image: true;
readonly objectGeneration: true;
readonly tools: true;
readonly streaming: true;
readonly googleSearch: true;
readonly urlContext: true;
};
'gemini-3.5-flash-lite': {
readonly image: true;
readonly objectGeneration: true;
readonly tools: true;
readonly streaming: true;
readonly googleSearch: true;
readonly urlContext: true;
};
'gemini-3.1-pro-preview': {
readonly image: true;
readonly objectGeneration: true;
readonly tools: true;
readonly streaming: true;
readonly googleSearch: true;
readonly urlContext: true;
};
'gemini-3.1-flash-image-preview': {
readonly image: true;
readonly objectGeneration: true;
readonly tools: true;
readonly streaming: true;
readonly googleSearch: true;
readonly urlContext: true;
};
'gemini-3.1-flash-lite-preview': {
readonly image: true;
readonly objectGeneration: true;
readonly tools: true;
readonly streaming: true;
readonly googleSearch: true;
readonly urlContext: true;
};
'gemini-3-pro-preview': {
readonly image: true;
readonly objectGeneration: true;
readonly tools: true;
readonly streaming: true;
readonly googleSearch: true;
readonly urlContext: true;
};
'gemini-3-pro-image-preview': {
readonly image: true;
readonly objectGeneration: true;
readonly tools: true;
readonly streaming: true;
readonly googleSearch: true;
readonly urlContext: true;
};
'gemini-3-flash-preview': {
readonly image: true;
readonly objectGeneration: true;
readonly tools: true;
readonly streaming: true;
readonly googleSearch: true;
readonly urlContext: true;
};
'gemini-2.5-pro': {
readonly image: true;
readonly objectGeneration: true;
readonly tools: true;
readonly streaming: true;
readonly googleSearch: true;
readonly urlContext: true;
};
'gemini-2.5-flash': {
readonly image: true;
readonly objectGeneration: true;
readonly tools: true;
readonly streaming: true;
readonly googleSearch: true;
readonly urlContext: true;
};
'gemini-2.5-flash-lite': {
readonly image: true;
readonly objectGeneration: true;
readonly tools: true;
readonly streaming: true;
readonly googleSearch: true;
readonly urlContext: true;
};
'gemini-2.5-flash-lite-preview-06-17': {
readonly image: true;
readonly objectGeneration: true;
readonly tools: true;
readonly streaming: true;
readonly googleSearch: true;
readonly urlContext: true;
};
'gemini-2.0-flash': {
readonly image: true;
readonly objectGeneration: true;
readonly tools: true;
readonly streaming: true;
readonly googleSearch: true;
readonly urlContext: true;
};
aqa: undefined;
'deep-research-max-preview-04-2026': undefined;
'deep-research-preview-04-2026': undefined;
'deep-research-pro-preview-12-2025': undefined;
'gemini-2.0-flash-001': undefined;
'gemini-2.0-flash-lite': undefined;
'gemini-2.0-flash-lite-001': undefined;
'gemini-2.5-computer-use-preview-10-2025': undefined;
'gemini-2.5-flash-image': undefined;
'gemini-2.5-flash-native-audio-latest': undefined;
'gemini-2.5-flash-native-audio-preview-09-2025': undefined;
'gemini-2.5-flash-native-audio-preview-12-2025': undefined;
'gemini-2.5-flash-preview-tts': undefined;
'gemini-2.5-pro-preview-tts': undefined;
'gemini-3.1-flash-tts-preview': undefined;
'gemini-3.1-pro-preview-customtools': undefined;
'gemini-flash-latest': undefined;
'gemini-flash-lite-latest': undefined;
'gemini-pro-latest': undefined;
'gemini-robotics-er-1.5-preview': undefined;
'gemma-3-12b-it': undefined;
'gemma-3-1b-it': undefined;
'gemma-3-27b-it': undefined;
'gemma-3-4b-it': undefined;
'gemma-3n-e2b-it': undefined;
'gemma-3n-e4b-it': undefined;
'nano-banana-pro-preview': undefined;
};
export declare function getGoogleLanguageModelEntry(modelId: string): GoogleLanguageModelEntry;
/** Known model IDs, derived from the declarations used to build the catalog. */
type GoogleModelIds = {
language: keyof typeof languageModelDefinitions;
};
//#endregion
//#region src/google-language-model-options.d.ts
type GoogleModelId = GoogleModelIds['language'] | (string & {});
declare const googleLanguageModelOptions: import("@ai-sdk/provider-utils").LazySchema<{
responseModalities?: ("TEXT" | "IMAGE" | "AUDIO")[] | undefined;
thinkingConfig?: {
thinkingBudget?: number | undefined;
includeThoughts?: boolean | undefined;
thinkingLevel?: "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
} | undefined;
cachedContent?: string | undefined;
structuredOutputs?: boolean | undefined;
safetySettings?: {
category: "HARM_CATEGORY_UNSPECIFIED" | "HARM_CATEGORY_HATE_SPEECH" | "HARM_CATEGORY_DANGEROUS_CONTENT" | "HARM_CATEGORY_HARASSMENT" | "HARM_CATEGORY_SEXUALLY_EXPLICIT" | "HARM_CATEGORY_CIVIC_INTEGRITY";
threshold: "HARM_BLOCK_THRESHOLD_UNSPECIFIED" | "BLOCK_LOW_AND_ABOVE" | "BLOCK_MEDIUM_AND_ABOVE" | "BLOCK_ONLY_HIGH" | "BLOCK_NONE" | "OFF";
}[] | undefined;
threshold?: "HARM_BLOCK_THRESHOLD_UNSPECIFIED" | "BLOCK_LOW_AND_ABOVE" | "BLOCK_MEDIUM_AND_ABOVE" | "BLOCK_ONLY_HIGH" | "BLOCK_NONE" | "OFF" | undefined;
audioTimestamp?: boolean | undefined;
labels?: Record<string, string> | undefined;
mediaResolution?: "MEDIA_RESOLUTION_UNSPECIFIED" | "MEDIA_RESOLUTION_LOW" | "MEDIA_RESOLUTION_MEDIUM" | "MEDIA_RESOLUTION_HIGH" | undefined;
imageConfig?: {
aspectRatio?: "1:1" | "2:3" | "3:2" | "3:4" | "4:3" | "4:5" | "5:4" | "9:16" | "16:9" | "21:9" | "1:8" | "8:1" | "1:4" | "4:1" | undefined;
imageSize?: "1K" | "2K" | "4K" | "512" | undefined;
personGeneration?: "PERSON_GENERATION_UNSPECIFIED" | "ALLOW_ALL" | "ALLOW_ADULT" | "ALLOW_NONE" | undefined;
prominentPeople?: "PROMINENT_PEOPLE_UNSPECIFIED" | "ALLOW_PROMINENT_PEOPLE" | "BLOCK_PROMINENT_PEOPLE" | undefined;
imageOutputOptions?: {
mimeType?: "image/jpeg" | "image/png" | undefined;
compressionQuality?: number | undefined;
} | undefined;
} | undefined;
retrievalConfig?: {
latLng?: {
latitude: number;
longitude: number;
} | undefined;
} | undefined;
streamFunctionCallArguments?: boolean | undefined;
serviceTier?: "standard" | "flex" | "priority" | undefined;
continuationToken?: string | undefined;
sharedRequestType?: "standard" | "flex" | "priority" | undefined;
requestType?: "shared" | undefined;
}>;
type GoogleLanguageModelOptions = InferSchema<typeof googleLanguageModelOptions>;
//#endregion
//#region src/google-language-model.d.ts
export type GoogleLanguageModelConfig = {
provider: string;
baseURL: string;
headers?: Resolvable<Record<string, string | undefined>>;
fetch?: FetchFunction;
generateId: () => string;
/**
* The supported URLs for the model.
*/
supportedUrls?: () => LanguageModelV4['supportedUrls'];
/**
* Settings for downloading remote files in tool results before conversion.
*/
downloadToolResultFiles?: {
maxBytes: number;
supportsGoogleCloudStorageUrls?: boolean;
/** Transport for untrusted file URLs, without provider authentication. */
fetch?: FetchFunction;
};
};
export declare class GoogleLanguageModel implements LanguageModelV4 {
readonly specificationVersion = "v4";
readonly modelId: GoogleModelId;
private readonly config;
private readonly generateId;
static [WORKFLOW_SERIALIZE](model: GoogleLanguageModel): {
modelId: string;
config: JSONObject;
};
static [WORKFLOW_DESERIALIZE](options: {
modelId: string;
config: GoogleLanguageModelConfig;
}): GoogleLanguageModel;
constructor(modelId: GoogleModelId, config: GoogleLanguageModelConfig);
get provider(): string;
get supportedUrls(): Record<string, RegExp[]> | PromiseLike<Record<string, RegExp[]>>;
static prepareRequest({ modelId, config, options: { prompt, maxOutputTokens, temperature, topP, topK, frequencyPenalty, presencePenalty, stopSequences, responseFormat, seed, tools, toolChoice, reasoning, providerOptions, abortSignal }, isStreaming }: {
modelId: GoogleModelId;
config: GoogleLanguageModelConfig;
options: LanguageModelV4CallOptions;
isStreaming?: boolean;
}): Promise<{
args: {
continuationToken?: string | undefined;
generationConfig: {
imageConfig?: {
aspectRatio?: "1:1" | "2:3" | "3:2" | "3:4" | "4:3" | "4:5" | "5:4" | "9:16" | "16:9" | "21:9" | "1:8" | "8:1" | "1:4" | "4:1" | undefined;
imageSize?: "1K" | "2K" | "4K" | "512" | undefined;
personGeneration?: "PERSON_GENERATION_UNSPECIFIED" | "ALLOW_ALL" | "ALLOW_ADULT" | "ALLOW_NONE" | undefined;
prominentPeople?: "PROMINENT_PEOPLE_UNSPECIFIED" | "ALLOW_PROMINENT_PEOPLE" | "BLOCK_PROMINENT_PEOPLE" | undefined;
imageOutputOptions?: {
mimeType?: "image/jpeg" | "image/png" | undefined;
compressionQuality?: number | undefined;
} | undefined;
} | undefined;
mediaResolution?: "MEDIA_RESOLUTION_UNSPECIFIED" | "MEDIA_RESOLUTION_LOW" | "MEDIA_RESOLUTION_MEDIUM" | "MEDIA_RESOLUTION_HIGH" | undefined;
responseModalities: ("TEXT" | "IMAGE" | "AUDIO")[] | undefined;
thinkingConfig: {
thinkingBudget?: number | undefined;
includeThoughts?: boolean | undefined;
thinkingLevel?: "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
} | undefined;
audioTimestamp?: true | undefined;
maxOutputTokens: number | undefined;
temperature: number | undefined;
topK: number | undefined;
topP: number | undefined;
frequencyPenalty: number | undefined;
presencePenalty: number | undefined;
stopSequences: string[] | undefined;
seed: number | undefined;
responseMimeType: string | undefined;
responseJsonSchema: import("@ai-sdk/provider").JSONSchema7 | undefined;
};
contents: GoogleContent[];
systemInstruction: GoogleSystemInstruction | undefined;
safetySettings: {
category: "HARM_CATEGORY_UNSPECIFIED" | "HARM_CATEGORY_HATE_SPEECH" | "HARM_CATEGORY_DANGEROUS_CONTENT" | "HARM_CATEGORY_HARASSMENT" | "HARM_CATEGORY_SEXUALLY_EXPLICIT" | "HARM_CATEGORY_CIVIC_INTEGRITY";
threshold: "HARM_BLOCK_THRESHOLD_UNSPECIFIED" | "BLOCK_LOW_AND_ABOVE" | "BLOCK_MEDIUM_AND_ABOVE" | "BLOCK_ONLY_HIGH" | "BLOCK_NONE" | "OFF";
}[] | undefined;
tools: ({
functionDeclarations: {
name: string;
description: string;
parametersJsonSchema: unknown;
}[];
} | Record<string, any>)[] | undefined;
toolConfig: {
retrievalConfig?: {
latLng?: {
latitude: number;
longitude: number;
} | undefined;
} | undefined;
functionCallingConfig?: {
mode: "AUTO" | "NONE" | "ANY" | "VALIDATED";
allowedFunctionNames?: string[];
streamFunctionCallArguments?: boolean;
} | {
streamFunctionCallArguments: true;
mode?: "AUTO" | "NONE" | "ANY" | "VALIDATED" | undefined;
allowedFunctionNames?: string[];
} | undefined;
includeServerSideToolInvocations?: boolean;
} | undefined;
cachedContent: string | undefined;
labels: Record<string, string> | undefined;
serviceTier: "standard" | "flex" | "priority" | undefined;
};
warnings: SharedV4Warning[];
providerOptionsNames: readonly string[];
extraHeaders: Record<string, string> | undefined;
toolNameMapping: import("@ai-sdk/provider-utils").ToolNameMapping;
}>;
private getArgs;
static convertGenerateContentResponse({ config, response, responseHeaders, warnings, providerOptionsNames, toolNameMapping, jsonResponseToolName, initialPromptTokenCount, groundingMetadataPerRequest }: {
config: GoogleLanguageModelConfig;
response: InferSchema<typeof responseSchema>;
responseHeaders?: Record<string, string>;
warnings: SharedV4Warning[];
providerOptionsNames: readonly string[];
toolNameMapping?: ReturnType<typeof createToolNameMapping>;
jsonResponseToolName?: string;
initialPromptTokenCount?: number | null;
groundingMetadataPerRequest?: Array<GroundingMetadataSchema | null>;
}): LanguageModelV4GenerateResult;
doGenerate(options: LanguageModelV4CallOptions): Promise<LanguageModelV4GenerateResult>;
doStream(options: LanguageModelV4CallOptions): Promise<LanguageModelV4StreamResult>;
}
export declare const getGroundingMetadataSchema: () => z.ZodObject<{
webSearchQueries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
imageSearchQueries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
retrievalQueries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
searchEntryPoint: z.ZodOptional<z.ZodNullable<z.ZodObject<{
renderedContent: z.ZodString;
}, z.core.$strip>>>;
groundingChunks: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
web: z.ZodOptional<z.ZodNullable<z.ZodObject<{
uri: z.ZodString;
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}, z.core.$strip>>>;
image: z.ZodOptional<z.ZodNullable<z.ZodObject<{
sourceUri: z.ZodString;
imageUri: z.ZodString;
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
domain: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}, z.core.$strip>>>;
retrievedContext: z.ZodOptional<z.ZodNullable<z.ZodObject<{
uri: z.ZodOptional<z.ZodNullable<z.ZodString>>;
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
fileSearchStore: z.ZodOptional<z.ZodNullable<z.ZodString>>;
customMetadata: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
key: z.ZodString;
stringValue: z.ZodOptional<z.ZodNullable<z.ZodString>>;
numericValue: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
stringListValue: z.ZodOptional<z.ZodNullable<z.ZodObject<{
values: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
}, z.core.$strip>>>;
}, z.core.$strip>>>>;
}, z.core.$strip>>>;
maps: z.ZodOptional<z.ZodNullable<z.ZodObject<{
uri: z.ZodOptional<z.ZodNullable<z.ZodString>>;
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
placeId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}, z.core.$strip>>>;
}, z.core.$strip>>>>;
groundingSupports: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
segment: z.ZodOptional<z.ZodNullable<z.ZodObject<{
startIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
endIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}, z.core.$strip>>>;
segment_text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
groundingChunkIndices: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
supportChunkIndices: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
confidenceScores: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
confidenceScore: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
}, z.core.$strip>>>>;
retrievalMetadata: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
webDynamicRetrievalScore: z.ZodNumber;
}, z.core.$strip>, z.ZodObject<{}, z.core.$strip>]>>>;
}, z.core.$strip>;
export declare const getUrlContextMetadataSchema: () => z.ZodObject<{
urlMetadata: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
retrievedUrl: z.ZodString;
urlRetrievalStatus: z.ZodString;
}, z.core.$strip>>>>;
}, z.core.$strip>;
export declare const responseSchema: import("@ai-sdk/provider-utils").LazySchema<{
responseId?: string | null | undefined;
candidates?: {
content?: Record<string, never> | {
parts?: ({
functionCall: {
id?: string | null | undefined;
name?: string | null | undefined;
args?: unknown;
partialArgs?: {
jsonPath: string;
stringValue?: string | null | undefined;
numberValue?: number | null | undefined;
boolValue?: boolean | null | undefined;
nullValue?: unknown;
willContinue?: boolean | null | undefined;
}[] | null | undefined;
willContinue?: boolean | null | undefined;
};
thoughtSignature?: string | null | undefined;
} | {
inlineData: {
mimeType: string;
data: string;
};
thought?: boolean | null | undefined;
thoughtSignature?: string | null | undefined;
} | {
toolCall: {
toolType: string;
id: string;
args?: unknown;
};
thoughtSignature?: string | null | undefined;
} | {
toolResponse: {
toolType: string;
id: string;
response?: unknown;
};
thoughtSignature?: string | null | undefined;
} | {
executableCode?: {
language: string;
code: string;
} | null | undefined;
codeExecutionResult?: {
outcome: string;
output?: string | null | undefined;
} | null | undefined;
text?: string | null | undefined;
thought?: boolean | null | undefined;
thoughtSignature?: string | null | undefined;
})[] | null | undefined;
} | null | undefined;
finishReason?: string | null | undefined;
finishMessage?: string | null | undefined;
continuationToken?: string | null | undefined;
safetyRatings?: {
category?: string | null | undefined;
probability?: string | null | undefined;
probabilityScore?: number | null | undefined;
severity?: string | null | undefined;
severityScore?: number | null | undefined;
blocked?: boolean | null | undefined;
}[] | null | undefined;
groundingMetadata?: {
webSearchQueries?: string[] | null | undefined;
imageSearchQueries?: string[] | null | undefined;
retrievalQueries?: string[] | null | undefined;
searchEntryPoint?: {
renderedContent: string;
} | null | undefined;
groundingChunks?: {
web?: {
uri: string;
title?: string | null | undefined;
} | null | undefined;
image?: {
sourceUri: string;
imageUri: string;
title?: string | null | undefined;
domain?: string | null | undefined;
} | null | undefined;
retrievedContext?: {
uri?: string | null | undefined;
title?: string | null | undefined;
text?: string | null | undefined;
fileSearchStore?: string | null | undefined;
customMetadata?: {
key: string;
stringValue?: string | null | undefined;
numericValue?: number | null | undefined;
stringListValue?: {
values?: string[] | null | undefined;
} | null | undefined;
}[] | null | undefined;
} | null | undefined;
maps?: {
uri?: string | null | undefined;
title?: string | null | undefined;
text?: string | null | undefined;
placeId?: string | null | undefined;
} | null | undefined;
}[] | null | undefined;
groundingSupports?: {
segment?: {
startIndex?: number | null | undefined;
endIndex?: number | null | undefined;
text?: string | null | undefined;
} | null | undefined;
segment_text?: string | null | undefined;
groundingChunkIndices?: number[] | null | undefined;
supportChunkIndices?: number[] | null | undefined;
confidenceScores?: number[] | null | undefined;
confidenceScore?: number[] | null | undefined;
}[] | null | undefined;
retrievalMetadata?: Record<string, never> | {
webDynamicRetrievalScore: number;
} | null | undefined;
} | null | undefined;
urlContextMetadata?: {
urlMetadata?: {
retrievedUrl: string;
urlRetrievalStatus: string;
}[] | null | undefined;
} | null | undefined;
}[] | null | undefined;
usageMetadata?: {
[x: string]: unknown;
cachedContentTokenCount?: number | null | undefined;
thoughtsTokenCount?: number | null | undefined;
promptTokenCount?: number | null | undefined;
candidatesTokenCount?: number | null | undefined;
toolUsePromptTokenCount?: number | null | undefined;
totalTokenCount?: number | null | undefined;
trafficType?: string | null | undefined;
serviceTier?: string | null | undefined;
promptTokensDetails?: {
[x: string]: unknown;
modality: string;
tokenCount: number;
}[] | null | undefined;
cacheTokensDetails?: {
[x: string]: unknown;
modality: string;
tokenCount: number;
}[] | null | undefined;
candidatesTokensDetails?: {
[x: string]: unknown;
modality: string;
tokenCount: number;
}[] | null | undefined;
toolUsePromptTokensDetails?: {
[x: string]: unknown;
modality: string;
tokenCount: number;
}[] | null | undefined;
} | null | undefined;
promptFeedback?: {
blockReason?: string | null | undefined;
safetyRatings?: {
category?: string | null | undefined;
probability?: string | null | undefined;
probabilityScore?: number | null | undefined;
severity?: string | null | undefined;
severityScore?: number | null | undefined;
blocked?: boolean | null | undefined;
}[] | null | undefined;
} | null | undefined;
}>;
type CandidateSchema = NonNullable<InferSchema<typeof responseSchema>['candidates']>[number];
export type GroundingMetadataSchema = NonNullable<CandidateSchema['groundingMetadata']>;
export type UrlContextMetadataSchema = NonNullable<CandidateSchema['urlContextMetadata']>;
export type SafetyRatingSchema = NonNullable<CandidateSchema['safetyRatings']>[number];
export type PromptFeedbackSchema = NonNullable<InferSchema<typeof responseSchema>['promptFeedback']>;
export type UsageMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['usageMetadata']>;
//#endregion
//#region src/google-speech-model-options.d.ts
type GoogleSpeechModelId = 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro-preview-tts' | 'gemini-3.1-flash-tts-preview' | 'gemini-3.8-flash-tts' | 'gemini-3.8-flash-lite-tts' | (string & {});
//#endregion
//#region src/google-speech-model.d.ts
interface GoogleSpeechModelConfig {
provider: string;
baseURL: string;
headers?: Resolvable<Record<string, string | undefined>>;
fetch?: FetchFunction;
_internal?: {
currentDate?: () => Date;
};
}
export declare class GoogleSpeechModel implements SpeechModelV4 {
readonly modelId: GoogleSpeechModelId;
private readonly config;
readonly specificationVersion = "v4";
static [WORKFLOW_SERIALIZE](model: GoogleSpeechModel): {
modelId: string;
config: import("@ai-sdk/provider").JSONObject;
};
static [WORKFLOW_DESERIALIZE](options: {
modelId: GoogleSpeechModelId;
config: GoogleSpeechModelConfig;
}): GoogleSpeechModel;
get provider(): string;
constructor(modelId: GoogleSpeechModelId, config: GoogleSpeechModelConfig);
private getArgs;
doGenerate(options: Parameters<SpeechModelV4['doGenerate']>[0]): Promise<Awaited<ReturnType<SpeechModelV4['doGenerate']>>>;
}
//#endregion
//#region src/google-speech-input.d.ts
/**
* Inspects speech input without replacing provider option validation. This is
* also used by intermediaries that need the transcript or voice kind before
* invoking a model. Model support for structured turns is validated separately.
*/
export declare function getGoogleSpeechInput({ text, voice, providerOptions }: {
text: string;
voice?: string;
providerOptions?: Record<string, unknown>;
}): {
text: string;
usesCustomVoice: boolean;
};
//#endregion
//#region src/google-tools.d.ts
export declare const googleTools: {
/**
* Creates a Google search tool that gives Google direct access to real-time web content.
* Must have name "google_search".
*/
googleSearch: import("@ai-sdk/provider-utils").ProviderExecutedToolFactory<{}, {}, {
[x: string]: unknown;
searchTypes?: {
webSearch?: Record<string, never> | undefined;
imageSearch?: Record<string, never> | undefined;
} | undefined;
timeRangeFilter?: {
startTime: string;
endTime: string;
} | undefined;
}, {}>;
/**
* Creates an Enterprise Web Search tool for grounding responses using a compliance-focused web index.
* Designed for highly-regulated industries (finance, healthcare, public sector).
* Does not log customer data and supports VPC service controls.
* Must have name "enterprise_web_search".
*
* @note Only available on Vertex AI. Requires Gemini 2.0 or newer.
*
* @see https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/web-grounding-enterprise
*/
enterpriseWebSearch: import("@ai-sdk/provider-utils").ProviderExecutedToolFactory<{}, {}, {}, {}>;
/**
* Creates a Google Maps grounding tool that gives the model access to Google Maps data.
* Must have name "google_maps".
*
* @see https://ai.google.dev/gemini-api/docs/maps-grounding
* @see https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/grounding-with-google-maps
*/
googleMaps: import("@ai-sdk/provider-utils").ProviderExecutedToolFactory<{}, {}, {}, {}>;
/**
* Creates a URL context tool that gives Google direct access to real-time web content.
* Must have name "url_context".
*/
urlContext: import("@ai-sdk/provider-utils").ProviderExecutedToolFactory<{}, {}, {}, {}>;
/**
* Enables Retrieval Augmented Generation (RAG) via the Gemini File Search tool.
* Must have name "file_search".
*
* @param fileSearchStoreNames - Fully-qualified File Search store resource names.
* @param metadataFilter - Optional filter expression to restrict the files that can be retrieved.
* @param topK - Optional result limit for the number of chunks returned from File Search.
*
* @see https://ai.google.dev/gemini-api/docs/file-search
*/
fileSearch: import("@ai-sdk/provider-utils").ProviderExecutedToolFactory<{}, {}, {
[x: string]: unknown;
fileSearchStoreNames: string[];
topK?: number | undefined;
metadataFilter?: string | undefined;
}, {}>;
/**
* A tool that enables the model to generate and run Python code.
* Must have name "code_execution".
*
* @note Ensure the selected model supports Code Execution.
* Multi-tool usage with the code execution tool is typically compatible with Gemini >=2 models.
*
* @see https://ai.google.dev/gemini-api/docs/code-execution (Google AI)
* @see https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/code-execution-api (Vertex AI)
*/
codeExecution: import("@ai-sdk/provider-utils").ProviderExecutedToolFactory<{
language: string;
code: string;
}, {
outcome: string;
output: string;
}, {}, {}>;
/**
* Creates a Vertex RAG Store tool that enables the model to perform RAG searches against a Vertex RAG Store.
* Must have name "vertex_rag_store".
*/
vertexRagStore: import("@ai-sdk/provider-utils").ProviderExecutedToolFactory<{}, {}, {
ragCorpus: string;
topK?: number;
}, {}>;
};
//#endregion
//#region src/interactions/google-interactions-language-model-options.d.ts
/**
* Type-only union of Gemini model IDs that the Interactions API accepts via
* `model:`. Mirrors `Model` from `googleapis/js-genai`
* `src/interactions/resources/interactions.ts`.
*
* Kept as a separate type from `GoogleModelId` even though most IDs overlap;
* the two surfaces (`:generateContent` vs `/interactions`) are independent and
* may diverge over time.
*/
type GoogleInteractionsModelId = 'gemini-2.5-computer-use-preview-10-2025' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-native-audio-preview-12-2025' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro' | 'gemini-2.5-pro-preview-tts' | 'gemini-3-flash-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-pro-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-3.1-flash-tts-preview' | 'gemini-3.5-flash' | 'gemini-3.5-flash-lite' | 'gemini-3.6-flash' | 'gemini-3.7-flash' | 'gemini-3.8-flash' | 'gemini-4-argon' | 'gemini-4-carbon' | 'gemini-4-hydrogen' | 'gemini-nano-banana-2.1' | 'lyria-3-clip-preview' | 'lyria-3-pro-preview' | (string & {});
//#endregion
//#region src/interactions/google-interactions-language-model.d.ts
type GoogleInteractionsConfig = {
provider: string;
baseURL: string;
headers?: Resolvable<Record<string, string | undefined>>;
fetch?: FetchFunction;
generateId: () => string;
supportedUrls?: () => LanguageModelV4['supportedUrls'];
};
type GoogleInteractionsModelInput = GoogleInteractionsModelId | {
agent: string;
} | {
managedAgent: string;
};
export declare class GoogleInteractionsLanguageModel implements LanguageModelV4 {
readonly specificationVersion = "v4";
readonly modelId: string;
/**
* Optional agent name. When provided, the request body sends `agent:` instead
* of `model:` and rejects `generation_config` (warned, not thrown).
*/
readonly agent: string | undefined;
private readonly config;
static [WORKFLOW_SERIALIZE](model: GoogleInteractionsLanguageModel): {
agent: string | undefined;
modelId: string;
config: import("@ai-sdk/provider").JSONObject;
};
static [WORKFLOW_DESERIALIZE](options: {
modelId: string;
agent?: string;
config: GoogleInteractionsConfig;
}): GoogleInteractionsLanguageModel;
constructor(modelOrAgent: GoogleInteractionsModelInput, config: GoogleInteractionsConfig);
get provider(): string;
get supportedUrls(): Record<string, RegExp[]> | PromiseLike<Record<string, RegExp[]>>;
private getArgs;
doGenerate(options: LanguageModelV4CallOptions): Promise<LanguageModelV4GenerateResult>;
doStream(options: LanguageModelV4CallOptions): Promise<LanguageModelV4StreamResult>;
private doStreamBackground;
}
//#endregion
//#region src/interactions/google-interactions-agent.d.ts
/**
* Type-only module: declares the union of supported Gemini Interactions agent
* names. Used by the `google.interactions({ agent })` factory branch.
*
* Strict string-literal union: unknown agent names are a compile-time error.
* User-defined agents (created via the `/agents` endpoint) are addressed by
* a separate `{ managedAgent: string }` factory shape — see
* `GoogleInteractionsModelInput`.
*/
type GoogleInteractionsAgentName = 'deep-research-pro-preview-12-2025' | 'deep-research-preview-04-2026' | 'deep-research-max-preview-04-2026' | 'antigravity-preview-05-2026';
//#endregion
export type { GoogleInteractionsAgentName, GoogleInteractionsModelId, GoogleInteractionsModelInput, GoogleModelId };
//# sourceMappingURL=index.d.ts.map