@ai-sdk/google 4.0.57 → 4.0.59
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 +14 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +43 -24
- package/dist/index.js.map +1 -1
- package/dist/internal/index.js +42 -23
- package/dist/internal/index.js.map +1 -1
- package/docs/15-google.mdx +32 -7
- package/package.json +3 -3
- package/src/interactions/google-interactions-language-model-options.ts +12 -2
- package/src/interactions/google-interactions-language-model.ts +11 -0
- package/src/interactions/google-interactions-prompt.ts +15 -1
package/dist/internal/index.js
CHANGED
|
@@ -4745,8 +4745,8 @@ var googleInteractionsLanguageModelOptions = lazySchema13(
|
|
|
4745
4745
|
thinkingSummaries: z14.enum(["auto", "none"]).nullish(),
|
|
4746
4746
|
/**
|
|
4747
4747
|
* Output-format entries that map directly to the API's `response_format`
|
|
4748
|
-
* array. Use this to request image, audio, or non-JSON text
|
|
4749
|
-
* with
|
|
4748
|
+
* array. Use this to request image, audio, video, or non-JSON text
|
|
4749
|
+
* outputs with modality-specific controls.
|
|
4750
4750
|
*
|
|
4751
4751
|
* Entries are sent in order. The AI SDK call-level `responseFormat: {
|
|
4752
4752
|
* type: 'json', schema }` still drives JSON-mode and adds a matching
|
|
@@ -4783,6 +4783,14 @@ var googleInteractionsLanguageModelOptions = lazySchema13(
|
|
|
4783
4783
|
z14.object({
|
|
4784
4784
|
type: z14.literal("audio"),
|
|
4785
4785
|
mimeType: z14.string().nullish()
|
|
4786
|
+
}).loose(),
|
|
4787
|
+
z14.object({
|
|
4788
|
+
type: z14.literal("video"),
|
|
4789
|
+
aspectRatio: z14.enum(["16:9", "9:16"]).nullish(),
|
|
4790
|
+
resolution: z14.enum(["360p", "720p", "1080p", "4k"]).nullish(),
|
|
4791
|
+
duration: z14.string().nullish(),
|
|
4792
|
+
delivery: z14.enum(["inline", "uri"]).nullish(),
|
|
4793
|
+
gcsUri: z14.string().nullish()
|
|
4786
4794
|
}).loose()
|
|
4787
4795
|
])
|
|
4788
4796
|
).nullish(),
|
|
@@ -5690,7 +5698,7 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
5690
5698
|
};
|
|
5691
5699
|
}
|
|
5692
5700
|
async getArgs(options) {
|
|
5693
|
-
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, _A;
|
|
5701
|
+
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, _A, _B, _C, _D, _E, _F;
|
|
5694
5702
|
const warnings = [];
|
|
5695
5703
|
const googleOptions = await parseProviderOptions3({
|
|
5696
5704
|
provider: "google",
|
|
@@ -5766,6 +5774,17 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
5766
5774
|
mime_type: (_g = entry.mimeType) != null ? _g : void 0
|
|
5767
5775
|
})
|
|
5768
5776
|
);
|
|
5777
|
+
} else if (entry.type === "video") {
|
|
5778
|
+
responseFormatEntries.push(
|
|
5779
|
+
pruneUndefined({
|
|
5780
|
+
type: "video",
|
|
5781
|
+
aspect_ratio: (_h = entry.aspectRatio) != null ? _h : void 0,
|
|
5782
|
+
resolution: (_i = entry.resolution) != null ? _i : void 0,
|
|
5783
|
+
duration: (_j = entry.duration) != null ? _j : void 0,
|
|
5784
|
+
delivery: (_k = entry.delivery) != null ? _k : void 0,
|
|
5785
|
+
gcs_uri: (_l = entry.gcsUri) != null ? _l : void 0
|
|
5786
|
+
})
|
|
5787
|
+
);
|
|
5769
5788
|
}
|
|
5770
5789
|
}
|
|
5771
5790
|
}
|
|
@@ -5775,13 +5794,13 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
5775
5794
|
warnings: convWarnings
|
|
5776
5795
|
} = convertToGoogleInteractionsInput({
|
|
5777
5796
|
prompt: options.prompt,
|
|
5778
|
-
previousInteractionId: (
|
|
5779
|
-
store: (
|
|
5780
|
-
mediaResolution: (
|
|
5797
|
+
previousInteractionId: (_m = googleOptions == null ? void 0 : googleOptions.previousInteractionId) != null ? _m : void 0,
|
|
5798
|
+
store: (_n = googleOptions == null ? void 0 : googleOptions.store) != null ? _n : void 0,
|
|
5799
|
+
mediaResolution: (_o = googleOptions == null ? void 0 : googleOptions.mediaResolution) != null ? _o : void 0
|
|
5781
5800
|
});
|
|
5782
5801
|
warnings.push(...convWarnings);
|
|
5783
5802
|
let systemInstruction = convertedSystemInstruction;
|
|
5784
|
-
const optionSystemInstruction = (
|
|
5803
|
+
const optionSystemInstruction = (_p = googleOptions == null ? void 0 : googleOptions.systemInstruction) != null ? _p : void 0;
|
|
5785
5804
|
if (systemInstruction != null && optionSystemInstruction != null) {
|
|
5786
5805
|
warnings.push({
|
|
5787
5806
|
type: "other",
|
|
@@ -5821,14 +5840,14 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
5821
5840
|
generationConfig = void 0;
|
|
5822
5841
|
} else {
|
|
5823
5842
|
generationConfig = pruneUndefined({
|
|
5824
|
-
temperature: (
|
|
5825
|
-
top_p: (
|
|
5826
|
-
top_k: (
|
|
5827
|
-
seed: (
|
|
5843
|
+
temperature: (_q = options.temperature) != null ? _q : void 0,
|
|
5844
|
+
top_p: (_r = options.topP) != null ? _r : void 0,
|
|
5845
|
+
top_k: (_s = options.topK) != null ? _s : void 0,
|
|
5846
|
+
seed: (_t = options.seed) != null ? _t : void 0,
|
|
5828
5847
|
stop_sequences: options.stopSequences != null && options.stopSequences.length > 0 ? options.stopSequences : void 0,
|
|
5829
|
-
max_output_tokens: (
|
|
5830
|
-
thinking_level: (
|
|
5831
|
-
thinking_summaries: (
|
|
5848
|
+
max_output_tokens: (_u = options.maxOutputTokens) != null ? _u : void 0,
|
|
5849
|
+
thinking_level: (_v = googleOptions == null ? void 0 : googleOptions.thinkingLevel) != null ? _v : void 0,
|
|
5850
|
+
thinking_summaries: (_w = googleOptions == null ? void 0 : googleOptions.thinkingSummaries) != null ? _w : void 0,
|
|
5832
5851
|
tool_choice: toolChoiceForBody
|
|
5833
5852
|
});
|
|
5834
5853
|
if ((googleOptions == null ? void 0 : googleOptions.imageConfig) != null) {
|
|
@@ -5855,9 +5874,9 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
5855
5874
|
if (agentConfigOptions.type === "deep-research") {
|
|
5856
5875
|
agentConfig = pruneUndefined({
|
|
5857
5876
|
type: "deep-research",
|
|
5858
|
-
thinking_summaries: (
|
|
5859
|
-
visualization: (
|
|
5860
|
-
collaborative_planning: (
|
|
5877
|
+
thinking_summaries: (_x = agentConfigOptions.thinkingSummaries) != null ? _x : void 0,
|
|
5878
|
+
visualization: (_y = agentConfigOptions.visualization) != null ? _y : void 0,
|
|
5879
|
+
collaborative_planning: (_z = agentConfigOptions.collaborativePlanning) != null ? _z : void 0
|
|
5861
5880
|
});
|
|
5862
5881
|
} else if (agentConfigOptions.type === "dynamic") {
|
|
5863
5882
|
agentConfig = { type: "dynamic" };
|
|
@@ -5874,7 +5893,7 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
5874
5893
|
environment = googleOptions.environment;
|
|
5875
5894
|
} else {
|
|
5876
5895
|
const environmentOptions = googleOptions.environment;
|
|
5877
|
-
const sources = (
|
|
5896
|
+
const sources = (_A = environmentOptions.sources) == null ? void 0 : _A.map((source) => {
|
|
5878
5897
|
var _a2;
|
|
5879
5898
|
if (source.type === "inline") {
|
|
5880
5899
|
return {
|
|
@@ -5919,20 +5938,20 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
5919
5938
|
tools: toolsForBody,
|
|
5920
5939
|
response_format: responseFormatEntries.length > 0 ? responseFormatEntries : void 0,
|
|
5921
5940
|
response_modalities: (googleOptions == null ? void 0 : googleOptions.responseModalities) != null ? googleOptions.responseModalities : void 0,
|
|
5922
|
-
previous_interaction_id: (
|
|
5923
|
-
service_tier: (
|
|
5924
|
-
store: (
|
|
5941
|
+
previous_interaction_id: (_B = googleOptions == null ? void 0 : googleOptions.previousInteractionId) != null ? _B : void 0,
|
|
5942
|
+
service_tier: (_C = googleOptions == null ? void 0 : googleOptions.serviceTier) != null ? _C : void 0,
|
|
5943
|
+
store: (_D = googleOptions == null ? void 0 : googleOptions.store) != null ? _D : void 0,
|
|
5925
5944
|
generation_config: generationConfig != null && Object.keys(generationConfig).length > 0 ? generationConfig : void 0,
|
|
5926
5945
|
agent_config: agentConfig,
|
|
5927
5946
|
environment,
|
|
5928
|
-
background: (
|
|
5947
|
+
background: (_E = googleOptions == null ? void 0 : googleOptions.background) != null ? _E : void 0
|
|
5929
5948
|
});
|
|
5930
5949
|
return {
|
|
5931
5950
|
args,
|
|
5932
5951
|
warnings,
|
|
5933
5952
|
isAgent,
|
|
5934
5953
|
isBackground: (googleOptions == null ? void 0 : googleOptions.background) === true,
|
|
5935
|
-
pollingTimeoutMs: (
|
|
5954
|
+
pollingTimeoutMs: (_F = googleOptions == null ? void 0 : googleOptions.pollingTimeoutMs) != null ? _F : void 0
|
|
5936
5955
|
};
|
|
5937
5956
|
}
|
|
5938
5957
|
async doGenerate(options) {
|