@ai-sdk/google 3.0.131 → 3.0.133
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 +15 -0
- package/dist/index.d.mts +20 -2
- package/dist/index.d.ts +20 -2
- package/dist/index.js +216 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +216 -36
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +3 -2
- package/dist/internal/index.d.ts +3 -2
- package/dist/internal/index.js +215 -35
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +215 -35
- package/dist/internal/index.mjs.map +1 -1
- package/docs/15-google-generative-ai.mdx +137 -0
- package/package.json +2 -2
- package/src/continue-google-stream.ts +75 -0
- package/src/convert-google-generative-ai-usage.ts +75 -0
- package/src/google-generative-ai-language-model.ts +139 -24
- package/src/google-generative-ai-options.ts +12 -0
- package/src/google-generative-ai-prompt.ts +18 -0
- package/src/interactions/google-interactions-language-model-options.ts +1 -0
- package/src/interactions/google-interactions-language-model.ts +6 -6
- package/src/map-google-generative-ai-finish-reason.ts +3 -0
|
@@ -454,7 +454,7 @@ export class GoogleInteractionsLanguageModel implements LanguageModelV3 {
|
|
|
454
454
|
async doGenerate(
|
|
455
455
|
options: LanguageModelV3CallOptions,
|
|
456
456
|
): Promise<LanguageModelV3GenerateResult> {
|
|
457
|
-
const { args, warnings, isAgent, pollingTimeoutMs } =
|
|
457
|
+
const { args, warnings, isAgent, isBackground, pollingTimeoutMs } =
|
|
458
458
|
await this.getArgs(options);
|
|
459
459
|
|
|
460
460
|
const url = `${this.config.baseURL}/interactions`;
|
|
@@ -484,12 +484,12 @@ export class GoogleInteractionsLanguageModel implements LanguageModelV3 {
|
|
|
484
484
|
} = postResult;
|
|
485
485
|
|
|
486
486
|
/*
|
|
487
|
-
* Agent calls
|
|
488
|
-
*
|
|
489
|
-
* `GET /interactions/{id}` until
|
|
490
|
-
* matches a synchronous call.
|
|
487
|
+
* Agent calls and `background: true` calls (e.g. Gemini 4 long decode,
|
|
488
|
+
* where the server runs every hop) may return a non-terminal status
|
|
489
|
+
* (`in_progress` / `requires_action`). Poll `GET /interactions/{id}` until
|
|
490
|
+
* terminal so the user-facing surface matches a synchronous call.
|
|
491
491
|
*/
|
|
492
|
-
if (isAgent && !isTerminalStatus(response.status)) {
|
|
492
|
+
if ((isAgent || isBackground) && !isTerminalStatus(response.status)) {
|
|
493
493
|
const polled = await pollGoogleInteractionUntilTerminal({
|
|
494
494
|
baseURL: this.config.baseURL,
|
|
495
495
|
interactionId: response.id,
|
|
@@ -11,6 +11,9 @@ export function mapGoogleGenerativeAIFinishReason({
|
|
|
11
11
|
case 'STOP':
|
|
12
12
|
return hasToolCalls ? 'tool-calls' : 'stop';
|
|
13
13
|
case 'MAX_TOKENS':
|
|
14
|
+
// Gemini 4 long decode: the per-request cap was reached while budget
|
|
15
|
+
// remains. Continued automatically; only surfaced if continuing fails.
|
|
16
|
+
case 'CONTINUATION':
|
|
14
17
|
return 'length';
|
|
15
18
|
case 'IMAGE_SAFETY':
|
|
16
19
|
case 'RECITATION':
|