@ai-sdk/google 4.0.111 → 4.0.113

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.
@@ -1,6 +1,6 @@
1
1
  import { FetchFunction, InferSchema, Resolvable, WORKFLOW_DESERIALIZE, WORKFLOW_SERIALIZE, createToolNameMapping } from "@ai-sdk/provider-utils";
2
2
  import { z } from "zod/v4";
3
- import { JSONObject, LanguageModelV4, LanguageModelV4CallOptions, LanguageModelV4GenerateResult, LanguageModelV4StreamResult, SharedV4Warning, SpeechModelV4 } from "@ai-sdk/provider";
3
+ import { JSONObject, LanguageModelV4, LanguageModelV4CallOptions, LanguageModelV4GenerateResult, LanguageModelV4StreamResult, ModelCapabilities, ModelCapability, ModelEntry, SharedV4Warning, SpeechModelV4 } from "@ai-sdk/provider";
4
4
  //#region src/google-prompt.d.ts
5
5
  type GoogleSystemInstruction = {
6
6
  parts: Array<{
@@ -91,6 +91,46 @@ type GoogleFunctionResponsePart = {
91
91
  //#endregion
92
92
  //#region src/google-language-model-options.d.ts
93
93
  type GoogleModelId = 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-flash-lite-001' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro-preview-tts' | 'gemini-2.5-flash-native-audio-latest' | 'gemini-2.5-flash-native-audio-preview-09-2025' | 'gemini-2.5-flash-native-audio-preview-12-2025' | 'gemini-2.5-computer-use-preview-10-2025' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-pro-preview-customtools' | '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-nano-banana-2.1' | 'gemini-pro-latest' | 'gemini-flash-latest' | 'gemini-flash-lite-latest' | 'deep-research-pro-preview-12-2025' | 'deep-research-max-preview-04-2026' | 'deep-research-preview-04-2026' | 'nano-banana-pro-preview' | 'aqa' | 'gemini-robotics-er-1.5-preview' | 'gemma-3-1b-it' | 'gemma-3-4b-it' | 'gemma-3n-e4b-it' | 'gemma-3n-e2b-it' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {});
94
+ declare const googleLanguageModelOptions: import("@ai-sdk/provider-utils").LazySchema<{
95
+ responseModalities?: ("TEXT" | "IMAGE" | "AUDIO")[] | undefined;
96
+ thinkingConfig?: {
97
+ thinkingBudget?: number | undefined;
98
+ includeThoughts?: boolean | undefined;
99
+ thinkingLevel?: "minimal" | "low" | "medium" | "high" | undefined;
100
+ } | undefined;
101
+ cachedContent?: string | undefined;
102
+ structuredOutputs?: boolean | undefined;
103
+ safetySettings?: {
104
+ category: "HARM_CATEGORY_UNSPECIFIED" | "HARM_CATEGORY_HATE_SPEECH" | "HARM_CATEGORY_DANGEROUS_CONTENT" | "HARM_CATEGORY_HARASSMENT" | "HARM_CATEGORY_SEXUALLY_EXPLICIT" | "HARM_CATEGORY_CIVIC_INTEGRITY";
105
+ threshold: "HARM_BLOCK_THRESHOLD_UNSPECIFIED" | "BLOCK_LOW_AND_ABOVE" | "BLOCK_MEDIUM_AND_ABOVE" | "BLOCK_ONLY_HIGH" | "BLOCK_NONE" | "OFF";
106
+ }[] | undefined;
107
+ threshold?: "HARM_BLOCK_THRESHOLD_UNSPECIFIED" | "BLOCK_LOW_AND_ABOVE" | "BLOCK_MEDIUM_AND_ABOVE" | "BLOCK_ONLY_HIGH" | "BLOCK_NONE" | "OFF" | undefined;
108
+ audioTimestamp?: boolean | undefined;
109
+ labels?: Record<string, string> | undefined;
110
+ mediaResolution?: "MEDIA_RESOLUTION_UNSPECIFIED" | "MEDIA_RESOLUTION_LOW" | "MEDIA_RESOLUTION_MEDIUM" | "MEDIA_RESOLUTION_HIGH" | undefined;
111
+ imageConfig?: {
112
+ 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;
113
+ imageSize?: "1K" | "2K" | "4K" | "512" | undefined;
114
+ personGeneration?: "PERSON_GENERATION_UNSPECIFIED" | "ALLOW_ALL" | "ALLOW_ADULT" | "ALLOW_NONE" | undefined;
115
+ prominentPeople?: "PROMINENT_PEOPLE_UNSPECIFIED" | "ALLOW_PROMINENT_PEOPLE" | "BLOCK_PROMINENT_PEOPLE" | undefined;
116
+ imageOutputOptions?: {
117
+ mimeType?: "image/jpeg" | "image/png" | undefined;
118
+ compressionQuality?: number | undefined;
119
+ } | undefined;
120
+ } | undefined;
121
+ retrievalConfig?: {
122
+ latLng?: {
123
+ latitude: number;
124
+ longitude: number;
125
+ } | undefined;
126
+ } | undefined;
127
+ streamFunctionCallArguments?: boolean | undefined;
128
+ serviceTier?: "standard" | "flex" | "priority" | undefined;
129
+ continuationToken?: string | undefined;
130
+ sharedRequestType?: "standard" | "flex" | "priority" | undefined;
131
+ requestType?: "shared" | undefined;
132
+ }>;
133
+ type GoogleLanguageModelOptions = InferSchema<typeof googleLanguageModelOptions>;
94
134
  //#endregion
95
135
  //#region src/google-language-model.d.ts
96
136
  export type GoogleLanguageModelConfig = {
@@ -654,5 +694,103 @@ export declare class GoogleInteractionsLanguageModel implements LanguageModelV4
654
694
  */
655
695
  type GoogleInteractionsAgentName = 'deep-research-pro-preview-12-2025' | 'deep-research-preview-04-2026' | 'deep-research-max-preview-04-2026' | 'antigravity-preview-05-2026';
656
696
  //#endregion
697
+ //#region src/google-model-catalog.d.ts
698
+ type GoogleLanguageProviderOption = keyof GoogleLanguageModelOptions;
699
+ /** Options accepted under providerOptions.google (or googleVertex on Vertex). */
700
+ export declare const googleProviderOptions: {
701
+ readonly language: {
702
+ responseModalities: {
703
+ description: string;
704
+ };
705
+ thinkingConfig: {
706
+ description: string;
707
+ };
708
+ cachedContent: {
709
+ description: string;
710
+ };
711
+ structuredOutputs: {
712
+ description: string;
713
+ };
714
+ safetySettings: {
715
+ description: string;
716
+ };
717
+ threshold: {
718
+ description: string;
719
+ };
720
+ audioTimestamp: {
721
+ description: string;
722
+ };
723
+ labels: {
724
+ description: string;
725
+ };
726
+ mediaResolution: {
727
+ description: string;
728
+ };
729
+ imageConfig: {
730
+ description: string;
731
+ };
732
+ retrievalConfig: {
733
+ description: string;
734
+ };
735
+ streamFunctionCallArguments: {
736
+ description: string;
737
+ };
738
+ serviceTier: {
739
+ description: string;
740
+ };
741
+ continuationToken: {
742
+ description: string;
743
+ };
744
+ sharedRequestType: {
745
+ description: string;
746
+ };
747
+ requestType: {
748
+ description: string;
749
+ };
750
+ };
751
+ };
752
+ type GoogleLanguageCapabilities = NonNullable<ModelCapabilities['language']> & {
753
+ tools: NonNullable<ModelCapabilities['language']>['tools'] & {
754
+ /** Existing request gate for Gemini 2 provider-defined tools. */
755
+ gemini2: boolean;
756
+ googleSearch: ModelCapability;
757
+ urlContext: ModelCapability;
758
+ fileSearch: boolean;
759
+ mixed: boolean;
760
+ functionResponseParts: boolean;
761
+ };
762
+ reasoning: NonNullable<ModelCapabilities['language']>['reasoning'] & {
763
+ minBudget: number;
764
+ maxBudget: number;
765
+ };
766
+ sampling: NonNullable<ModelCapabilities['language']>['sampling'] & {
767
+ topK: ModelCapability;
768
+ penalties: ModelCapability;
769
+ };
770
+ structuredOutput: {
771
+ withFunctionTools: boolean;
772
+ };
773
+ };
774
+ type GoogleLanguageRequestConfig = {
775
+ systemInstruction: 'system' | 'user';
776
+ thinkingFormat: 'level' | 'budget';
777
+ reasoningMaxOutputTokens: number;
778
+ jsonResponseTool: boolean;
779
+ };
780
+ type GoogleLanguageModelEntry = ModelEntry<{
781
+ language: GoogleLanguageRequestConfig;
782
+ }> & {
783
+ capabilities: {
784
+ language: GoogleLanguageCapabilities;
785
+ };
786
+ providerOptions: {
787
+ language: Record<GoogleLanguageProviderOption, ModelCapability>;
788
+ };
789
+ requestConfig: {
790
+ language: GoogleLanguageRequestConfig;
791
+ };
792
+ };
793
+ export declare function getGoogleLanguageModelEntry(modelId: string): GoogleLanguageModelEntry;
794
+ //#endregion
657
795
  export type { GoogleInteractionsAgentName, GoogleInteractionsModelId, GoogleInteractionsModelInput, GoogleModelId };
658
796
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":["_$__google_prompt0.GoogleContent","_$__google_prompt0.GoogleSystemInstruction"],"sources":["../../src/google-prompt.ts","../../src/google-language-model-options.ts","../../src/google-language-model.ts","../../src/google-speech-model-options.ts","../../src/google-speech-model.ts","../../src/google-speech-input.ts","../../src/google-tools.ts","../../src/interactions/google-interactions-language-model-options.ts","../../src/interactions/google-interactions-language-model.ts","../../src/interactions/google-interactions-agent.ts"],"mappings":";;;;KAcY;EACV,OAAO;IAAQ;;;KAGL;EACV;EACA,OAAO,MAAM;;cAGF,2BAAyB,EAAA;;;;GAOpC,EAAA,KAAA;;KAGU,sBAAsB,EAAE,aAAa;KAErC;EACN;EAAc;EAAmB;;EAEjC;IAAc;IAAkB;;EAChC,gBAAgB;EAChB;EACA;;EAGA;IAAgB;IAAa;IAAc;;EAC3C;;EAGA;IACE;IACA;IACA;IACA,QAAQ,MAAM;;;EAIhB;IAAY;IAAkB;;EAC9B,gBAAgB;EAChB;EACA;;EAGA;IACE;IACA;IACA;;EAEF;;EAGA;IACE;IACA;IACA;;EAEF;;EAGA;IACE;IACA;;;EAIF;IACE;IACA;;;KAII;EAEN;IAAc;IAAkB;;;EAGhC;IAAY;IAAkB;;;;;KCxFxB;;;YC8EA;EACV;EACA;EACA,UAAU,WAAW;EACrB,QAAQ;EACR;;;;EAKA,sBAAsB;;;;EAKtB;IACE;IACA;;;qBAIS,+BAA+B;WACjC;WAEA,S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;IACE,oBAAoB;;;qBAQX,6BAA6B;WAsB7B,SAAS;mBACD;WAtBV;UAED,oBAAoB,OAAO;;;;UAO3B,sBAAsB;IAC5B,SAAS;IACT,QAAQ;MACT;MAIG;EAKO,YAAA,SAAS,qBACD,QAAQ;UAGb;EAmNR,WACJ,SAAS,WAAW,kCACnB,QAAQ,QAAQ,WAAW;;;;;;;;;wBCnRhB,uBACd,MACA,OACA;EAEA;EACA;EACA,kBAAkB;;EACd;EAAc;;;;qBCLP;;;;;;;;kBAAA;oBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KCQD;;;KC2CA;EACV;EACA;EACA,UAAU,WAAW;EACrB,QAAQ;EACR;EACA,sBAAsB;;KAGZ,+BACR;EACE;;EACA;;qBAEO,2CAA2C;WAC7C;WAEA;;;;;WAMA;mBAEQ;UAET,oBAAoB,OAAO;;;;;UAU3B,sBAAsB;IAC5B;IACA;IACA,QAAQ;MACT;EAQC,YAAA,cAAc,8BACd,QAAQ;MAeN;MAIA,iBAAa,eAAA,YAAA,YAAA,eAAA;UAgBH;EAiVR,WACJ,SAAS,6BACR,QAAQ;EAiIL,SACJ,SAAS,6BACR,QAAQ;UAkFG;;;;;;;;;;;;;KC9qBJ"}
1
+ {"version":3,"file":"index.d.ts","names":["_$__google_prompt0.GoogleContent","_$__google_prompt0.GoogleSystemInstruction"],"sources":["../../src/google-prompt.ts","../../src/google-language-model-options.ts","../../src/google-language-model.ts","../../src/google-speech-model-options.ts","../../src/google-speech-model.ts","../../src/google-speech-input.ts","../../src/google-tools.ts","../../src/interactions/google-interactions-language-model-options.ts","../../src/interactions/google-interactions-language-model.ts","../../src/interactions/google-interactions-agent.ts","../../src/google-model-catalog.ts"],"mappings":";;;;KAcY;EACV,OAAO;IAAQ;;;KAGL;EACV;EACA,OAAO,MAAM;;cAGF,2BAAyB,EAAA;;;;GAOpC,EAAA,KAAA;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MACT;EAQC,YAAA,cAAc,8BACd,QAAQ;MAeN;MAIA,iBAAa,eAAA,YAAA,YAAA,eAAA;UAgBH;EAiVR,WACJ,SAAS,6BACR,QAAQ;EAiIL,SACJ,SAAS,6BACR,QAAQ;UAkFG;;;;;;;;;;;;;KC9qBJ;;;KCIP,qCAAqC;;qBAG7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAmCR,6BAA6B,YAAY;EAC5C,OAAO,YAAY;;IAEjB;IACA,cAAc;IACd,YAAY;IACZ;IACA;IACA;;EAEF,WAAW,YAAY;IACrB;IACA;;EAEF,UAAU,YAAY;IACpB,MAAM;IACN,WAAW;;EAEb;IACE;;;KAIC;EACH;EACA;EACA;EACA;;KAGU,2BAA2B;EACrC,UAAU;;EAEV;IAAgB,UAAU;;EAC1B;IACE,UAAU,OAAO,8BAA8B;;EAEjD;IAAiB,UAAU;;;wBA2Db,4BACd,kBACC"}
@@ -362,11 +362,11 @@ function convertToGoogleMessages(prompt, options) {
362
362
  const providerOpts = readProviderOpts(part);
363
363
  const thoughtSignature = providerOpts?.thoughtSignature != null ? String(providerOpts.thoughtSignature) : void 0;
364
364
  switch (part.type) {
365
- case "text": return part.text.length === 0 ? void 0 : {
365
+ case "text": return part.text.length === 0 && thoughtSignature == null ? void 0 : {
366
366
  text: part.text,
367
367
  thoughtSignature
368
368
  };
369
- case "reasoning": return part.text.length === 0 ? void 0 : {
369
+ case "reasoning": return part.text.length === 0 && thoughtSignature == null ? void 0 : {
370
370
  text: part.text,
371
371
  thought: true,
372
372
  thoughtSignature
@@ -2019,6 +2019,20 @@ var GoogleLanguageModel = class GoogleLanguageModel {
2019
2019
  const finishActiveStreamingToolCall = (controller) => {
2020
2020
  const active = activeStreamingToolCalls.pop();
2021
2021
  if (active == null) return;
2022
+ if (currentTextBlockId !== null) {
2023
+ controller.enqueue({
2024
+ type: "text-end",
2025
+ id: currentTextBlockId
2026
+ });
2027
+ currentTextBlockId = null;
2028
+ }
2029
+ if (currentReasoningBlockId !== null) {
2030
+ controller.enqueue({
2031
+ type: "reasoning-end",
2032
+ id: currentReasoningBlockId
2033
+ });
2034
+ currentReasoningBlockId = null;
2035
+ }
2022
2036
  const { finalJSON, closingDelta } = active.accumulator.finalize();
2023
2037
  if (closingDelta.length > 0) controller.enqueue({
2024
2038
  type: "tool-input-delta",
@@ -2157,12 +2171,40 @@ var GoogleLanguageModel = class GoogleLanguageModel {
2157
2171
  } else if ("text" in part && part.text != null) {
2158
2172
  const thoughtSignatureMetadata = part.thoughtSignature ? wrapProviderMetadata({ thoughtSignature: part.thoughtSignature }) : void 0;
2159
2173
  if (part.text.length === 0) {
2160
- if (thoughtSignatureMetadata != null && currentTextBlockId !== null) controller.enqueue({
2161
- type: "text-delta",
2162
- id: currentTextBlockId,
2163
- delta: "",
2164
- providerMetadata: thoughtSignatureMetadata
2165
- });
2174
+ if (thoughtSignatureMetadata != null) {
2175
+ if (currentTextBlockId !== null) controller.enqueue({
2176
+ type: "text-delta",
2177
+ id: currentTextBlockId,
2178
+ delta: "",
2179
+ providerMetadata: thoughtSignatureMetadata
2180
+ });
2181
+ else {
2182
+ if (currentReasoningBlockId !== null) {
2183
+ controller.enqueue({
2184
+ type: "reasoning-end",
2185
+ id: currentReasoningBlockId
2186
+ });
2187
+ currentReasoningBlockId = null;
2188
+ }
2189
+ const id = String(blockCounter++);
2190
+ const type = part.thought === true ? "reasoning" : "text";
2191
+ controller.enqueue({
2192
+ type: `${type}-start`,
2193
+ id,
2194
+ providerMetadata: thoughtSignatureMetadata
2195
+ });
2196
+ controller.enqueue({
2197
+ type: `${type}-delta`,
2198
+ id,
2199
+ delta: "",
2200
+ providerMetadata: thoughtSignatureMetadata
2201
+ });
2202
+ controller.enqueue({
2203
+ type: `${type}-end`,
2204
+ id
2205
+ });
2206
+ }
2207
+ }
2166
2208
  } else if (part.thought === true) {
2167
2209
  if (currentTextBlockId !== null) {
2168
2210
  controller.enqueue({
@@ -2266,14 +2308,28 @@ var GoogleLanguageModel = class GoogleLanguageModel {
2266
2308
  providerMetadata: serverMeta
2267
2309
  });
2268
2310
  lastServerToolCallId = void 0;
2269
- }
2270
- for (const part of parts) {
2271
- if (!("functionCall" in part)) continue;
2311
+ } else if ("functionCall" in part) {
2272
2312
  const providerMeta = part.thoughtSignature ? wrapProviderMetadata({ thoughtSignature: part.thoughtSignature }) : void 0;
2273
2313
  const isStreamingChunk = part.functionCall.partialArgs != null || part.functionCall.name != null && part.functionCall.willContinue === true;
2274
2314
  const isTerminalChunk = part.functionCall.name == null && part.functionCall.args == null && part.functionCall.partialArgs == null && part.functionCall.willContinue == null;
2275
2315
  const isCompleteCall = part.functionCall.name != null && part.functionCall.args != null && part.functionCall.partialArgs == null;
2276
2316
  const isNoArgsCompleteCall = part.functionCall.name != null && part.functionCall.args == null && part.functionCall.partialArgs == null && part.functionCall.willContinue !== true;
2317
+ if (!isStreamingChunk && (isCompleteCall || isNoArgsCompleteCall)) {
2318
+ if (currentTextBlockId !== null) {
2319
+ controller.enqueue({
2320
+ type: "text-end",
2321
+ id: currentTextBlockId
2322
+ });
2323
+ currentTextBlockId = null;
2324
+ }
2325
+ if (currentReasoningBlockId !== null) {
2326
+ controller.enqueue({
2327
+ type: "reasoning-end",
2328
+ id: currentReasoningBlockId
2329
+ });
2330
+ currentReasoningBlockId = null;
2331
+ }
2332
+ }
2277
2333
  if (isStreamingChunk) {
2278
2334
  if (part.functionCall.name != null) {
2279
2335
  const toolCallId = part.functionCall.id || generateId();
@@ -2837,7 +2893,14 @@ var GoogleSpeechModel = class GoogleSpeechModel {
2837
2893
  message: "Custom voices are not supported. Use a prebuilt voice instead."
2838
2894
  });
2839
2895
  const multiSpeakerVoiceConfig = googleOptions?.multiSpeakerVoiceConfig;
2840
- const speechConfig = multiSpeakerVoiceConfig ? { multiSpeakerVoiceConfig } : { voiceConfig: { prebuiltVoiceConfig: { voiceName: voice } } };
2896
+ const languageCode = language === "auto" ? void 0 : language;
2897
+ const speechConfig = multiSpeakerVoiceConfig ? {
2898
+ multiSpeakerVoiceConfig,
2899
+ ...languageCode != null && { languageCode }
2900
+ } : {
2901
+ voiceConfig: { prebuiltVoiceConfig: { voiceName: voice } },
2902
+ ...languageCode != null && { languageCode }
2903
+ };
2841
2904
  let promptText = text;
2842
2905
  if (instructions != null && !usesStructuredSpeech) {
2843
2906
  if (multiSpeakerVoiceConfig) warnings.push({
@@ -2889,11 +2952,6 @@ var GoogleSpeechModel = class GoogleSpeechModel {
2889
2952
  feature: "speed",
2890
2953
  details: "Google Gemini TTS models do not support the `speed` option. It was ignored."
2891
2954
  });
2892
- if (language != null) warnings.push({
2893
- type: "unsupported",
2894
- feature: "language",
2895
- details: "Google Gemini TTS models do not support the `language` option. Language is detected automatically from the input text."
2896
- });
2897
2955
  const formats = usesStructuredSpeech ? {
2898
2956
  wav: "AUDIO_WAV",
2899
2957
  "audio/wav": "AUDIO_WAV",
@@ -5930,6 +5988,6 @@ function pruneUndefined(obj) {
5930
5988
  return result;
5931
5989
  }
5932
5990
  //#endregion
5933
- export { GoogleInteractionsLanguageModel, GoogleLanguageModel, GoogleSpeechModel, getGoogleSpeechInput, getGroundingMetadataSchema, getUrlContextMetadataSchema, googleTools, responseSchema };
5991
+ export { GoogleInteractionsLanguageModel, GoogleLanguageModel, GoogleSpeechModel, getGoogleLanguageModelEntry, getGoogleSpeechInput, getGroundingMetadataSchema, getUrlContextMetadataSchema, googleProviderOptions, googleTools, responseSchema };
5934
5992
 
5935
5993
  //# sourceMappingURL=index.js.map