@ai-sdk/google 4.0.94 → 4.0.95
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 +20 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +173 -15
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +6 -3
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +172 -14
- package/dist/internal/index.js.map +1 -1
- package/docs/15-google.mdx +137 -0
- package/package.json +1 -1
- package/src/continue-google-stream.ts +75 -0
- package/src/convert-google-usage.ts +76 -0
- package/src/google-language-model-options.ts +12 -0
- package/src/google-language-model.ts +146 -24
- package/src/google-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-finish-reason.ts +3 -0
|
@@ -482,7 +482,7 @@ export class GoogleInteractionsLanguageModel implements LanguageModelV4 {
|
|
|
482
482
|
async doGenerate(
|
|
483
483
|
options: LanguageModelV4CallOptions,
|
|
484
484
|
): Promise<LanguageModelV4GenerateResult> {
|
|
485
|
-
const { args, warnings, isAgent, pollingTimeoutMs } =
|
|
485
|
+
const { args, warnings, isAgent, isBackground, pollingTimeoutMs } =
|
|
486
486
|
await this.getArgs(options);
|
|
487
487
|
|
|
488
488
|
const url = `${this.config.baseURL}/interactions`;
|
|
@@ -511,12 +511,12 @@ export class GoogleInteractionsLanguageModel implements LanguageModelV4 {
|
|
|
511
511
|
} = postResult;
|
|
512
512
|
|
|
513
513
|
/*
|
|
514
|
-
* Agent calls
|
|
515
|
-
*
|
|
516
|
-
* `GET /interactions/{id}` until
|
|
517
|
-
* matches a synchronous call.
|
|
514
|
+
* Agent calls and `background: true` calls (e.g. Gemini 4 long decode,
|
|
515
|
+
* where the server runs every hop) may return a non-terminal status
|
|
516
|
+
* (`in_progress` / `requires_action`). Poll `GET /interactions/{id}` until
|
|
517
|
+
* terminal so the user-facing surface matches a synchronous call.
|
|
518
518
|
*/
|
|
519
|
-
if (isAgent && !isTerminalStatus(response.status)) {
|
|
519
|
+
if ((isAgent || isBackground) && !isTerminalStatus(response.status)) {
|
|
520
520
|
const polled = await pollGoogleInteractionUntilTerminal({
|
|
521
521
|
baseURL: this.config.baseURL,
|
|
522
522
|
interactionId: response.id,
|
|
@@ -11,6 +11,9 @@ export function mapGoogleFinishReason({
|
|
|
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':
|