@ai-sdk/google 4.0.0-canary.53 → 4.0.0-canary.54
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.d.ts +90 -1
- package/dist/index.js +2355 -1
- package/dist/index.js.map +1 -1
- package/docs/15-google.mdx +396 -0
- package/package.json +3 -3
- package/src/google-provider.ts +34 -0
- package/src/index.ts +6 -0
- package/src/interactions/build-google-interactions-stream-transform.ts +699 -0
- package/src/interactions/convert-google-interactions-usage.ts +47 -0
- package/src/interactions/convert-to-google-interactions-input.ts +634 -0
- package/src/interactions/extract-google-interactions-sources.ts +245 -0
- package/src/interactions/google-interactions-agent.ts +16 -0
- package/src/interactions/google-interactions-api.ts +466 -0
- package/src/interactions/google-interactions-language-model-options.ts +136 -0
- package/src/interactions/google-interactions-language-model.ts +633 -0
- package/src/interactions/google-interactions-prompt.ts +457 -0
- package/src/interactions/google-interactions-provider-metadata.ts +23 -0
- package/src/interactions/map-google-interactions-finish-reason.ts +33 -0
- package/src/interactions/parse-google-interactions-outputs.ts +246 -0
- package/src/interactions/poll-google-interactions.ts +110 -0
- package/src/interactions/prepare-google-interactions-tools.ts +245 -0
- package/src/interactions/synthesize-google-interactions-agent-stream.ts +185 -0
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -253,6 +253,87 @@ type GoogleFilesUploadOptions = {
|
|
|
253
253
|
[key: string]: unknown;
|
|
254
254
|
};
|
|
255
255
|
|
|
256
|
+
/**
|
|
257
|
+
* Type-only union of Gemini model IDs that the Interactions API accepts via
|
|
258
|
+
* `model:`. Mirrors `Model` from `googleapis/js-genai`
|
|
259
|
+
* `src/interactions/resources/interactions.ts`.
|
|
260
|
+
*
|
|
261
|
+
* Kept as a separate type from `GoogleModelId` even though most IDs overlap;
|
|
262
|
+
* the two surfaces (`:generateContent` vs `/interactions`) are independent and
|
|
263
|
+
* may diverge over time.
|
|
264
|
+
*/
|
|
265
|
+
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' | 'lyria-3-clip-preview' | 'lyria-3-pro-preview' | (string & {});
|
|
266
|
+
/**
|
|
267
|
+
* Provider-options schema for `google.interactions(...)` calls. Read from the
|
|
268
|
+
* shared `providerOptions.google.*` namespace (per PRD); per-call options that
|
|
269
|
+
* the AI SDK doesn't natively expose live here.
|
|
270
|
+
*
|
|
271
|
+
* All fields are `.nullish()` per the existing google provider convention.
|
|
272
|
+
*/
|
|
273
|
+
declare const googleInteractionsLanguageModelOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
274
|
+
previousInteractionId?: string | null | undefined;
|
|
275
|
+
store?: boolean | null | undefined;
|
|
276
|
+
agent?: string | null | undefined;
|
|
277
|
+
agentConfig?: {
|
|
278
|
+
[x: string]: unknown;
|
|
279
|
+
type: "dynamic";
|
|
280
|
+
} | {
|
|
281
|
+
type: "deep-research";
|
|
282
|
+
thinkingSummaries?: "auto" | "none" | null | undefined;
|
|
283
|
+
visualization?: "auto" | "off" | null | undefined;
|
|
284
|
+
collaborativePlanning?: boolean | null | undefined;
|
|
285
|
+
} | null | undefined;
|
|
286
|
+
thinkingLevel?: "minimal" | "low" | "medium" | "high" | null | undefined;
|
|
287
|
+
thinkingSummaries?: "auto" | "none" | null | undefined;
|
|
288
|
+
imageConfig?: {
|
|
289
|
+
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" | null | undefined;
|
|
290
|
+
imageSize?: "1K" | "2K" | "4K" | "512" | null | undefined;
|
|
291
|
+
} | null | undefined;
|
|
292
|
+
mediaResolution?: "low" | "medium" | "high" | "ultra_high" | null | undefined;
|
|
293
|
+
responseModalities?: ("text" | "image" | "document" | "audio" | "video")[] | null | undefined;
|
|
294
|
+
serviceTier?: "standard" | "flex" | "priority" | null | undefined;
|
|
295
|
+
systemInstruction?: string | null | undefined;
|
|
296
|
+
signature?: string | null | undefined;
|
|
297
|
+
interactionId?: string | null | undefined;
|
|
298
|
+
pollingTimeoutMs?: number | null | undefined;
|
|
299
|
+
}>;
|
|
300
|
+
type GoogleLanguageModelInteractionsOptions = InferSchema<typeof googleInteractionsLanguageModelOptions>;
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Provider-metadata shape that the Gemini Interactions language model writes
|
|
304
|
+
* onto `result.providerMetadata.google` (and reads back from input messages on
|
|
305
|
+
* the next turn for stateful chaining and signature round-trip).
|
|
306
|
+
*/
|
|
307
|
+
type GoogleInteractionsProviderMetadata = {
|
|
308
|
+
/**
|
|
309
|
+
* Gemini-server-side interaction id (`Interaction.id`). Pass back in
|
|
310
|
+
* `providerOptions.google.previousInteractionId` to chain stateful turns.
|
|
311
|
+
*/
|
|
312
|
+
interactionId?: string;
|
|
313
|
+
/**
|
|
314
|
+
* Service tier used for this interaction (passthrough for observability).
|
|
315
|
+
*/
|
|
316
|
+
serviceTier?: string;
|
|
317
|
+
/**
|
|
318
|
+
* Per-block signature hash for backend validation. Set by the SDK on output
|
|
319
|
+
* reasoning / tool-call parts and round-tripped on input parts.
|
|
320
|
+
*/
|
|
321
|
+
signature?: string;
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Type-only module: declares the union of supported Gemini Interactions agent
|
|
326
|
+
* names. Used by the `google.interactions({ agent })` factory branch.
|
|
327
|
+
*
|
|
328
|
+
* Sourced from `googleapis/js-genai` `src/interactions/resources/interactions.ts`
|
|
329
|
+
* (`Interaction.agent` enum). Subject to expansion as Google adds new agents.
|
|
330
|
+
*
|
|
331
|
+
* This is a strict string-literal union (no `string` escape hatch) so that
|
|
332
|
+
* passing an unknown agent name is a compile-time error. Add new agents here
|
|
333
|
+
* as Google publishes them.
|
|
334
|
+
*/
|
|
335
|
+
type GoogleInteractionsAgentName = 'deep-research-pro-preview-12-2025' | 'deep-research-preview-04-2026' | 'deep-research-max-preview-04-2026';
|
|
336
|
+
|
|
256
337
|
declare const googleTools: {
|
|
257
338
|
/**
|
|
258
339
|
* Creates a Google search tool that gives Google direct access to real-time web content.
|
|
@@ -381,6 +462,14 @@ interface GoogleProvider extends ProviderV4 {
|
|
|
381
462
|
*/
|
|
382
463
|
videoModel(modelId: GoogleVideoModelId): Experimental_VideoModelV4;
|
|
383
464
|
files(): FilesV4;
|
|
465
|
+
/**
|
|
466
|
+
* Creates a language model targeting the Gemini Interactions API
|
|
467
|
+
* (`POST /v1beta/interactions`). Pass either a model ID (string) or
|
|
468
|
+
* `{ agent: <name> }` to use a Gemini agent preset.
|
|
469
|
+
*/
|
|
470
|
+
interactions(modelIdOrAgent: GoogleInteractionsModelId | {
|
|
471
|
+
agent: GoogleInteractionsAgentName;
|
|
472
|
+
}): LanguageModelV4;
|
|
384
473
|
tools: typeof googleTools;
|
|
385
474
|
}
|
|
386
475
|
interface GoogleProviderSettings {
|
|
@@ -424,4 +513,4 @@ declare const google: GoogleProvider;
|
|
|
424
513
|
|
|
425
514
|
declare const VERSION: string;
|
|
426
515
|
|
|
427
|
-
export { type GoogleEmbeddingModelOptions, type GoogleErrorData, type GoogleFilesUploadOptions, type GoogleEmbeddingModelOptions as GoogleGenerativeAIEmbeddingProviderOptions, type GoogleImageModelOptions as GoogleGenerativeAIImageProviderOptions, type GoogleProvider as GoogleGenerativeAIProvider, type GoogleProviderMetadata as GoogleGenerativeAIProviderMetadata, type GoogleLanguageModelOptions as GoogleGenerativeAIProviderOptions, type GoogleProviderSettings as GoogleGenerativeAIProviderSettings, type GoogleVideoModelId as GoogleGenerativeAIVideoModelId, type GoogleVideoModelOptions as GoogleGenerativeAIVideoProviderOptions, type GoogleImageModelOptions, type GoogleLanguageModelOptions, type GoogleProvider, type GoogleProviderMetadata, type GoogleProviderSettings, type GoogleVideoModelId, type GoogleVideoModelOptions, VERSION, createGoogle, createGoogle as createGoogleGenerativeAI, google };
|
|
516
|
+
export { type GoogleEmbeddingModelOptions, type GoogleErrorData, type GoogleFilesUploadOptions, type GoogleEmbeddingModelOptions as GoogleGenerativeAIEmbeddingProviderOptions, type GoogleImageModelOptions as GoogleGenerativeAIImageProviderOptions, type GoogleProvider as GoogleGenerativeAIProvider, type GoogleProviderMetadata as GoogleGenerativeAIProviderMetadata, type GoogleLanguageModelOptions as GoogleGenerativeAIProviderOptions, type GoogleProviderSettings as GoogleGenerativeAIProviderSettings, type GoogleVideoModelId as GoogleGenerativeAIVideoModelId, type GoogleVideoModelOptions as GoogleGenerativeAIVideoProviderOptions, type GoogleImageModelOptions, type GoogleInteractionsAgentName, type GoogleInteractionsModelId, type GoogleInteractionsProviderMetadata, type GoogleLanguageModelInteractionsOptions, type GoogleLanguageModelOptions, type GoogleProvider, type GoogleProviderMetadata, type GoogleProviderSettings, type GoogleVideoModelId, type GoogleVideoModelOptions, VERSION, createGoogle, createGoogle as createGoogleGenerativeAI, google };
|