@ai-sdk/google 4.0.0-canary.68 → 4.0.0-canary.69
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 +35 -9
- package/dist/index.js +118 -10
- package/dist/index.js.map +1 -1
- package/docs/15-google.mdx +196 -48
- package/package.json +1 -1
- package/src/google-provider.ts +9 -4
- package/src/interactions/google-interactions-agent.ts +6 -7
- package/src/interactions/google-interactions-language-model-options.ts +64 -0
- package/src/interactions/google-interactions-language-model.ts +73 -22
- package/src/interactions/google-interactions-prompt.ts +50 -0
- package/src/interactions/stream-google-interactions.ts +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -318,6 +318,29 @@ declare const googleInteractionsLanguageModelOptions: _ai_sdk_provider_utils.Laz
|
|
|
318
318
|
signature?: string | null | undefined;
|
|
319
319
|
interactionId?: string | null | undefined;
|
|
320
320
|
pollingTimeoutMs?: number | null | undefined;
|
|
321
|
+
background?: boolean | null | undefined;
|
|
322
|
+
environment?: string | {
|
|
323
|
+
type: "remote";
|
|
324
|
+
sources?: ({
|
|
325
|
+
type: "gcs";
|
|
326
|
+
source: string;
|
|
327
|
+
target?: string | null | undefined;
|
|
328
|
+
} | {
|
|
329
|
+
type: "repository";
|
|
330
|
+
source: string;
|
|
331
|
+
target?: string | null | undefined;
|
|
332
|
+
} | {
|
|
333
|
+
type: "inline";
|
|
334
|
+
content: string;
|
|
335
|
+
target: string;
|
|
336
|
+
})[] | null | undefined;
|
|
337
|
+
network?: "disabled" | {
|
|
338
|
+
allowlist: {
|
|
339
|
+
domain: string;
|
|
340
|
+
transform?: Record<string, string>[] | null | undefined;
|
|
341
|
+
}[];
|
|
342
|
+
} | null | undefined;
|
|
343
|
+
} | null | undefined;
|
|
321
344
|
}>;
|
|
322
345
|
type GoogleLanguageModelInteractionsOptions = InferSchema<typeof googleInteractionsLanguageModelOptions>;
|
|
323
346
|
|
|
@@ -347,14 +370,12 @@ type GoogleInteractionsProviderMetadata = {
|
|
|
347
370
|
* Type-only module: declares the union of supported Gemini Interactions agent
|
|
348
371
|
* names. Used by the `google.interactions({ agent })` factory branch.
|
|
349
372
|
*
|
|
350
|
-
*
|
|
351
|
-
*
|
|
352
|
-
*
|
|
353
|
-
*
|
|
354
|
-
* passing an unknown agent name is a compile-time error. Add new agents here
|
|
355
|
-
* as Google publishes them.
|
|
373
|
+
* Strict string-literal union: unknown agent names are a compile-time error.
|
|
374
|
+
* User-defined agents (created via the `/agents` endpoint) are addressed by
|
|
375
|
+
* a separate `{ managedAgent: string }` factory shape — see
|
|
376
|
+
* `GoogleInteractionsModelInput`.
|
|
356
377
|
*/
|
|
357
|
-
type GoogleInteractionsAgentName = 'deep-research-pro-preview-12-2025' | 'deep-research-preview-04-2026' | 'deep-research-max-preview-04-2026';
|
|
378
|
+
type GoogleInteractionsAgentName = 'deep-research-pro-preview-12-2025' | 'deep-research-preview-04-2026' | 'deep-research-max-preview-04-2026' | 'antigravity-preview-05-2026';
|
|
358
379
|
|
|
359
380
|
declare const googleTools: {
|
|
360
381
|
/**
|
|
@@ -486,11 +507,16 @@ interface GoogleProvider extends ProviderV4 {
|
|
|
486
507
|
files(): FilesV4;
|
|
487
508
|
/**
|
|
488
509
|
* Creates a language model targeting the Gemini Interactions API
|
|
489
|
-
* (`POST /v1beta/interactions`). Pass
|
|
490
|
-
*
|
|
510
|
+
* (`POST /v1beta/interactions`). Pass:
|
|
511
|
+
* - a model ID (string),
|
|
512
|
+
* - `{ agent: <name> }` to use a known Gemini agent preset, or
|
|
513
|
+
* - `{ managedAgent: <name> }` to use a user-defined agent created via
|
|
514
|
+
* the `/v1beta/agents` endpoint.
|
|
491
515
|
*/
|
|
492
516
|
interactions(modelIdOrAgent: GoogleInteractionsModelId | {
|
|
493
517
|
agent: GoogleInteractionsAgentName;
|
|
518
|
+
} | {
|
|
519
|
+
managedAgent: string;
|
|
494
520
|
}): LanguageModelV4;
|
|
495
521
|
tools: typeof googleTools;
|
|
496
522
|
}
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "@ai-sdk/provider-utils";
|
|
8
8
|
|
|
9
9
|
// src/version.ts
|
|
10
|
-
var VERSION = true ? "4.0.0-canary.
|
|
10
|
+
var VERSION = true ? "4.0.0-canary.69" : "0.0.0-test";
|
|
11
11
|
|
|
12
12
|
// src/google-embedding-model.ts
|
|
13
13
|
import {
|
|
@@ -5049,7 +5049,61 @@ var googleInteractionsLanguageModelOptions = lazySchema17(
|
|
|
5049
5049
|
* call) before giving up. Defaults to 30 minutes. Long-running agents
|
|
5050
5050
|
* such as deep research can take tens of minutes — increase if needed.
|
|
5051
5051
|
*/
|
|
5052
|
-
pollingTimeoutMs: z19.number().int().positive().nullish()
|
|
5052
|
+
pollingTimeoutMs: z19.number().int().positive().nullish(),
|
|
5053
|
+
/**
|
|
5054
|
+
* Run the interaction in the background. Required for agents whose
|
|
5055
|
+
* server-side workflow cannot complete within a single request/response.
|
|
5056
|
+
* When `true`, the POST returns with a non-terminal status and the SDK
|
|
5057
|
+
* polls `GET /interactions/{id}` until the work completes. Some agents
|
|
5058
|
+
* reject `true`; see the agent's documentation for which mode it
|
|
5059
|
+
* requires.
|
|
5060
|
+
*/
|
|
5061
|
+
background: z19.boolean().nullish(),
|
|
5062
|
+
/**
|
|
5063
|
+
* Environment configuration for the agent sandbox. Only applies to agent
|
|
5064
|
+
* calls (`google.interactions({ agent })`); ignored on model-id calls.
|
|
5065
|
+
*
|
|
5066
|
+
* - `"remote"`: provision a fresh sandbox for this call.
|
|
5067
|
+
* - any other string: an existing `environment_id` to reuse.
|
|
5068
|
+
* - object: provision a fresh sandbox and optionally preload `sources`
|
|
5069
|
+
* and/or constrain outbound traffic via `network`.
|
|
5070
|
+
*/
|
|
5071
|
+
environment: z19.union([
|
|
5072
|
+
z19.string(),
|
|
5073
|
+
z19.object({
|
|
5074
|
+
type: z19.literal("remote"),
|
|
5075
|
+
sources: z19.array(
|
|
5076
|
+
z19.union([
|
|
5077
|
+
z19.object({
|
|
5078
|
+
type: z19.literal("gcs"),
|
|
5079
|
+
source: z19.string(),
|
|
5080
|
+
target: z19.string().nullish()
|
|
5081
|
+
}),
|
|
5082
|
+
z19.object({
|
|
5083
|
+
type: z19.literal("repository"),
|
|
5084
|
+
source: z19.string(),
|
|
5085
|
+
target: z19.string().nullish()
|
|
5086
|
+
}),
|
|
5087
|
+
z19.object({
|
|
5088
|
+
type: z19.literal("inline"),
|
|
5089
|
+
content: z19.string(),
|
|
5090
|
+
target: z19.string()
|
|
5091
|
+
})
|
|
5092
|
+
])
|
|
5093
|
+
).nullish(),
|
|
5094
|
+
network: z19.union([
|
|
5095
|
+
z19.literal("disabled"),
|
|
5096
|
+
z19.object({
|
|
5097
|
+
allowlist: z19.array(
|
|
5098
|
+
z19.object({
|
|
5099
|
+
domain: z19.string(),
|
|
5100
|
+
transform: z19.array(z19.record(z19.string(), z19.string())).nullish()
|
|
5101
|
+
})
|
|
5102
|
+
)
|
|
5103
|
+
})
|
|
5104
|
+
]).nullish()
|
|
5105
|
+
})
|
|
5106
|
+
]).nullish()
|
|
5053
5107
|
})
|
|
5054
5108
|
)
|
|
5055
5109
|
);
|
|
@@ -5786,6 +5840,9 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
5786
5840
|
if (typeof modelOrAgent === "string") {
|
|
5787
5841
|
this.modelId = modelOrAgent;
|
|
5788
5842
|
this.agent = void 0;
|
|
5843
|
+
} else if ("managedAgent" in modelOrAgent) {
|
|
5844
|
+
this.modelId = modelOrAgent.managedAgent;
|
|
5845
|
+
this.agent = modelOrAgent.managedAgent;
|
|
5789
5846
|
} else {
|
|
5790
5847
|
this.modelId = modelOrAgent.agent;
|
|
5791
5848
|
this.agent = modelOrAgent.agent;
|
|
@@ -5826,7 +5883,7 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
5826
5883
|
};
|
|
5827
5884
|
}
|
|
5828
5885
|
async getArgs(options) {
|
|
5829
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
5886
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
|
5830
5887
|
const warnings = [];
|
|
5831
5888
|
const opts = await parseProviderOptions6({
|
|
5832
5889
|
provider: "google",
|
|
@@ -5983,6 +6040,55 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
5983
6040
|
agentConfig = { type: "dynamic" };
|
|
5984
6041
|
}
|
|
5985
6042
|
}
|
|
6043
|
+
let environment;
|
|
6044
|
+
if ((opts == null ? void 0 : opts.environment) != null) {
|
|
6045
|
+
if (!isAgent) {
|
|
6046
|
+
warnings.push({
|
|
6047
|
+
type: "other",
|
|
6048
|
+
message: "google.interactions: environment is only supported when an agent is set; environment will be omitted from the request body."
|
|
6049
|
+
});
|
|
6050
|
+
} else if (typeof opts.environment === "string") {
|
|
6051
|
+
environment = opts.environment;
|
|
6052
|
+
} else {
|
|
6053
|
+
const env = opts.environment;
|
|
6054
|
+
const sources = (_u = env.sources) == null ? void 0 : _u.map((s) => {
|
|
6055
|
+
var _a2;
|
|
6056
|
+
if (s.type === "inline") {
|
|
6057
|
+
return {
|
|
6058
|
+
type: "inline",
|
|
6059
|
+
content: s.content,
|
|
6060
|
+
target: s.target
|
|
6061
|
+
};
|
|
6062
|
+
}
|
|
6063
|
+
return pruneUndefined({
|
|
6064
|
+
type: s.type,
|
|
6065
|
+
source: s.source,
|
|
6066
|
+
target: (_a2 = s.target) != null ? _a2 : void 0
|
|
6067
|
+
});
|
|
6068
|
+
});
|
|
6069
|
+
let network;
|
|
6070
|
+
if (env.network === "disabled") {
|
|
6071
|
+
network = "disabled";
|
|
6072
|
+
} else if (env.network != null) {
|
|
6073
|
+
network = {
|
|
6074
|
+
allowlist: env.network.allowlist.map(
|
|
6075
|
+
(entry) => {
|
|
6076
|
+
var _a2;
|
|
6077
|
+
return pruneUndefined({
|
|
6078
|
+
domain: entry.domain,
|
|
6079
|
+
transform: (_a2 = entry.transform) != null ? _a2 : void 0
|
|
6080
|
+
});
|
|
6081
|
+
}
|
|
6082
|
+
)
|
|
6083
|
+
};
|
|
6084
|
+
}
|
|
6085
|
+
environment = pruneUndefined({
|
|
6086
|
+
type: "remote",
|
|
6087
|
+
sources: sources != null && sources.length > 0 ? sources : void 0,
|
|
6088
|
+
network
|
|
6089
|
+
});
|
|
6090
|
+
}
|
|
6091
|
+
}
|
|
5986
6092
|
const args = pruneUndefined({
|
|
5987
6093
|
...isAgent ? { agent: this.agent } : { model: this.modelId },
|
|
5988
6094
|
input,
|
|
@@ -5990,18 +6096,20 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
5990
6096
|
tools: toolsForBody,
|
|
5991
6097
|
response_format: responseFormatEntries.length > 0 ? responseFormatEntries : void 0,
|
|
5992
6098
|
response_modalities: (opts == null ? void 0 : opts.responseModalities) != null ? opts.responseModalities : void 0,
|
|
5993
|
-
previous_interaction_id: (
|
|
5994
|
-
service_tier: (
|
|
5995
|
-
store: (
|
|
6099
|
+
previous_interaction_id: (_v = opts == null ? void 0 : opts.previousInteractionId) != null ? _v : void 0,
|
|
6100
|
+
service_tier: (_w = opts == null ? void 0 : opts.serviceTier) != null ? _w : void 0,
|
|
6101
|
+
store: (_x = opts == null ? void 0 : opts.store) != null ? _x : void 0,
|
|
5996
6102
|
generation_config: generationConfig != null && Object.keys(generationConfig).length > 0 ? generationConfig : void 0,
|
|
5997
6103
|
agent_config: agentConfig,
|
|
5998
|
-
|
|
6104
|
+
environment,
|
|
6105
|
+
background: (_y = opts == null ? void 0 : opts.background) != null ? _y : void 0
|
|
5999
6106
|
});
|
|
6000
6107
|
return {
|
|
6001
6108
|
args,
|
|
6002
6109
|
warnings,
|
|
6003
6110
|
isAgent,
|
|
6004
|
-
|
|
6111
|
+
isBackground: (opts == null ? void 0 : opts.background) === true,
|
|
6112
|
+
pollingTimeoutMs: (_z = opts == null ? void 0 : opts.pollingTimeoutMs) != null ? _z : void 0
|
|
6005
6113
|
};
|
|
6006
6114
|
}
|
|
6007
6115
|
async doGenerate(options) {
|
|
@@ -6087,14 +6195,14 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
6087
6195
|
}
|
|
6088
6196
|
async doStream(options) {
|
|
6089
6197
|
var _a;
|
|
6090
|
-
const { args, warnings,
|
|
6198
|
+
const { args, warnings, isBackground, pollingTimeoutMs } = await this.getArgs(options);
|
|
6091
6199
|
const url = `${this.config.baseURL}/interactions`;
|
|
6092
6200
|
const mergedHeaders = combineHeaders7(
|
|
6093
6201
|
INTERACTIONS_API_REVISION_HEADER,
|
|
6094
6202
|
this.config.headers ? await resolve5(this.config.headers) : void 0,
|
|
6095
6203
|
options.headers
|
|
6096
6204
|
);
|
|
6097
|
-
if (
|
|
6205
|
+
if (isBackground) {
|
|
6098
6206
|
return this.doStreamBackground({
|
|
6099
6207
|
args,
|
|
6100
6208
|
warnings,
|