@ai-sdk/google 4.0.0-beta.82 → 4.0.0-beta.84
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 +12 -0
- package/dist/index.d.ts +23 -1
- package/dist/index.js +21 -8
- package/dist/index.js.map +1 -1
- package/docs/15-google.mdx +39 -0
- package/package.json +1 -1
- package/src/index.ts +4 -0
- package/src/interactions/google-interactions-language-model.ts +0 -11
- package/src/realtime/google-realtime-event-mapper.ts +30 -2
- package/src/realtime/google-realtime-model-options.ts +21 -1
- package/src/realtime/index.ts +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ai-sdk/google
|
|
2
2
|
|
|
3
|
+
## 4.0.0-beta.84
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 947cdab: Add Google realtime Live Translation provider options for `gemini-3.5-live-translate-preview`.
|
|
8
|
+
|
|
9
|
+
## 4.0.0-beta.83
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- bdb9ea1: chore(google): remove now obsolete Interactions API `Api-Revision` header
|
|
14
|
+
|
|
3
15
|
## 4.0.0-beta.82
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -622,6 +622,28 @@ declare class GoogleRealtimeModel implements Experimental_RealtimeModelV4 {
|
|
|
622
622
|
buildSessionConfig(config: Experimental_RealtimeModelV4SessionConfig): Record<string, unknown>;
|
|
623
623
|
}
|
|
624
624
|
|
|
625
|
+
type GoogleRealtimeModelId = string;
|
|
626
|
+
type GoogleRealtimeModelOptions = {
|
|
627
|
+
/**
|
|
628
|
+
* Gemini Live Translation configuration.
|
|
629
|
+
*
|
|
630
|
+
* Required for `gemini-3.5-live-translate-preview` when translating speech
|
|
631
|
+
* to a target language.
|
|
632
|
+
*/
|
|
633
|
+
translationConfig?: {
|
|
634
|
+
/**
|
|
635
|
+
* BCP-47 language code of the language to translate into.
|
|
636
|
+
* Defaults to `en` in the Gemini API.
|
|
637
|
+
*/
|
|
638
|
+
targetLanguageCode?: string;
|
|
639
|
+
/**
|
|
640
|
+
* Whether input audio already in the target language should be echoed
|
|
641
|
+
* instead of producing silence.
|
|
642
|
+
*/
|
|
643
|
+
echoTargetLanguage?: boolean;
|
|
644
|
+
};
|
|
645
|
+
};
|
|
646
|
+
|
|
625
647
|
declare const VERSION: string;
|
|
626
648
|
|
|
627
|
-
export { GoogleRealtimeModel as Experimental_GoogleRealtimeModel, type GoogleRealtimeModelConfig as Experimental_GoogleRealtimeModelConfig, 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 GoogleSpeechModelId, type GoogleSpeechModelOptions, type GoogleVideoModelId, type GoogleVideoModelOptions, VERSION, createGoogle, createGoogle as createGoogleGenerativeAI, google };
|
|
649
|
+
export { GoogleRealtimeModel as Experimental_GoogleRealtimeModel, type GoogleRealtimeModelConfig as Experimental_GoogleRealtimeModelConfig, type GoogleRealtimeModelId as Experimental_GoogleRealtimeModelId, type GoogleRealtimeModelOptions as Experimental_GoogleRealtimeModelOptions, 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 GoogleSpeechModelId, type GoogleSpeechModelOptions, type GoogleVideoModelId, type GoogleVideoModelOptions, VERSION, createGoogle, createGoogle as createGoogleGenerativeAI, google };
|
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-beta.
|
|
10
|
+
var VERSION = true ? "4.0.0-beta.84" : "0.0.0-test";
|
|
11
11
|
|
|
12
12
|
// src/google-embedding-model.ts
|
|
13
13
|
import {
|
|
@@ -6496,7 +6496,6 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
6496
6496
|
const { args, warnings, isAgent, pollingTimeoutMs } = await this.getArgs(options);
|
|
6497
6497
|
const url = `${this.config.baseURL}/interactions`;
|
|
6498
6498
|
const mergedHeaders = combineHeaders8(
|
|
6499
|
-
INTERACTIONS_API_REVISION_HEADER,
|
|
6500
6499
|
this.config.headers ? await resolve6(this.config.headers) : void 0,
|
|
6501
6500
|
options.headers
|
|
6502
6501
|
);
|
|
@@ -6577,7 +6576,6 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
6577
6576
|
const { args, warnings, isBackground, pollingTimeoutMs } = await this.getArgs(options);
|
|
6578
6577
|
const url = `${this.config.baseURL}/interactions`;
|
|
6579
6578
|
const mergedHeaders = combineHeaders8(
|
|
6580
|
-
INTERACTIONS_API_REVISION_HEADER,
|
|
6581
6579
|
this.config.headers ? await resolve6(this.config.headers) : void 0,
|
|
6582
6580
|
options.headers
|
|
6583
6581
|
);
|
|
@@ -6697,9 +6695,6 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
6697
6695
|
};
|
|
6698
6696
|
}
|
|
6699
6697
|
};
|
|
6700
|
-
var INTERACTIONS_API_REVISION_HEADER = {
|
|
6701
|
-
"Api-Revision": "2026-05-20"
|
|
6702
|
-
};
|
|
6703
6698
|
function pruneUndefined(obj) {
|
|
6704
6699
|
const result = {};
|
|
6705
6700
|
for (const [key, value] of Object.entries(obj)) {
|
|
@@ -6711,6 +6706,9 @@ function pruneUndefined(obj) {
|
|
|
6711
6706
|
|
|
6712
6707
|
// src/realtime/google-realtime-event-mapper.ts
|
|
6713
6708
|
import { safeParseJSON } from "@ai-sdk/provider-utils";
|
|
6709
|
+
function isRecord(value) {
|
|
6710
|
+
return value != null && typeof value === "object" && !Array.isArray(value);
|
|
6711
|
+
}
|
|
6714
6712
|
var GoogleRealtimeEventMapper = class {
|
|
6715
6713
|
constructor() {
|
|
6716
6714
|
this.turnCounter = 0;
|
|
@@ -6905,6 +6903,11 @@ var GoogleRealtimeEventMapper = class {
|
|
|
6905
6903
|
}
|
|
6906
6904
|
};
|
|
6907
6905
|
case "input-audio-commit":
|
|
6906
|
+
return {
|
|
6907
|
+
realtimeInput: {
|
|
6908
|
+
audioStreamEnd: true
|
|
6909
|
+
}
|
|
6910
|
+
};
|
|
6908
6911
|
case "input-audio-clear":
|
|
6909
6912
|
case "response-create":
|
|
6910
6913
|
case "response-cancel":
|
|
@@ -6989,8 +6992,18 @@ function buildGoogleSessionConfig(config, modelId) {
|
|
|
6989
6992
|
if ((config == null ? void 0 : config.outputAudioTranscription) != null) {
|
|
6990
6993
|
setup.outputAudioTranscription = {};
|
|
6991
6994
|
}
|
|
6992
|
-
if ((config == null ? void 0 : config.providerOptions)
|
|
6993
|
-
|
|
6995
|
+
if ((config == null ? void 0 : config.providerOptions) == null) {
|
|
6996
|
+
return setup;
|
|
6997
|
+
}
|
|
6998
|
+
const { google: google2, ...providerOptions } = config.providerOptions;
|
|
6999
|
+
Object.assign(setup, providerOptions);
|
|
7000
|
+
const googleOptions = isRecord(google2) ? google2 : void 0;
|
|
7001
|
+
if ((googleOptions == null ? void 0 : googleOptions.translationConfig) != null) {
|
|
7002
|
+
const target = isRecord(setup.generationConfig) ? setup.generationConfig : generationConfig;
|
|
7003
|
+
setup.generationConfig = {
|
|
7004
|
+
...target,
|
|
7005
|
+
translationConfig: googleOptions.translationConfig
|
|
7006
|
+
};
|
|
6994
7007
|
}
|
|
6995
7008
|
return setup;
|
|
6996
7009
|
}
|