@ai-sdk/google 3.0.101 → 3.0.103

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 CHANGED
@@ -1,5 +1,18 @@
1
1
  # @ai-sdk/google
2
2
 
3
+ ## 3.0.103
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [9ecdefe]
8
+ - @ai-sdk/provider-utils@4.0.41
9
+
10
+ ## 3.0.102
11
+
12
+ ### Patch Changes
13
+
14
+ - e728a98: Forward `topK` through Google Interactions requests and warn when unsupported frequency or presence penalties are provided.
15
+
3
16
  ## 3.0.101
4
17
 
5
18
  ### Patch Changes
package/dist/index.js CHANGED
@@ -30,7 +30,7 @@ module.exports = __toCommonJS(index_exports);
30
30
  var import_provider_utils23 = require("@ai-sdk/provider-utils");
31
31
 
32
32
  // src/version.ts
33
- var VERSION = true ? "3.0.101" : "0.0.0-test";
33
+ var VERSION = true ? "3.0.103" : "0.0.0-test";
34
34
 
35
35
  // src/google-generative-ai-embedding-model.ts
36
36
  var import_provider = require("@ai-sdk/provider");
@@ -5772,7 +5772,7 @@ var GoogleInteractionsLanguageModel = class {
5772
5772
  };
5773
5773
  }
5774
5774
  async getArgs(options) {
5775
- 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;
5775
+ 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;
5776
5776
  const warnings = [];
5777
5777
  const opts = await (0, import_provider_utils22.parseProviderOptions)({
5778
5778
  provider: "google",
@@ -5780,6 +5780,20 @@ var GoogleInteractionsLanguageModel = class {
5780
5780
  schema: googleInteractionsLanguageModelOptions
5781
5781
  });
5782
5782
  const isAgent = this.agent != null;
5783
+ if (!isAgent) {
5784
+ if (options.frequencyPenalty != null) {
5785
+ warnings.push({
5786
+ type: "unsupported",
5787
+ feature: "frequencyPenalty"
5788
+ });
5789
+ }
5790
+ if (options.presencePenalty != null) {
5791
+ warnings.push({
5792
+ type: "unsupported",
5793
+ feature: "presencePenalty"
5794
+ });
5795
+ }
5796
+ }
5783
5797
  const hasTools = options.tools != null && options.tools.length > 0;
5784
5798
  let toolsForBody;
5785
5799
  let toolChoiceForBody;
@@ -5863,6 +5877,11 @@ var GoogleInteractionsLanguageModel = class {
5863
5877
  const droppedFields = [];
5864
5878
  if (options.temperature != null) droppedFields.push("temperature");
5865
5879
  if (options.topP != null) droppedFields.push("topP");
5880
+ if (options.topK != null) droppedFields.push("topK");
5881
+ if (options.frequencyPenalty != null)
5882
+ droppedFields.push("frequencyPenalty");
5883
+ if (options.presencePenalty != null)
5884
+ droppedFields.push("presencePenalty");
5866
5885
  if (options.seed != null) droppedFields.push("seed");
5867
5886
  if (options.stopSequences != null && options.stopSequences.length > 0) {
5868
5887
  droppedFields.push("stopSequences");
@@ -5885,11 +5904,12 @@ var GoogleInteractionsLanguageModel = class {
5885
5904
  generationConfig = pruneUndefined({
5886
5905
  temperature: (_l = options.temperature) != null ? _l : void 0,
5887
5906
  top_p: (_m = options.topP) != null ? _m : void 0,
5888
- seed: (_n = options.seed) != null ? _n : void 0,
5907
+ top_k: (_n = options.topK) != null ? _n : void 0,
5908
+ seed: (_o = options.seed) != null ? _o : void 0,
5889
5909
  stop_sequences: options.stopSequences != null && options.stopSequences.length > 0 ? options.stopSequences : void 0,
5890
- max_output_tokens: (_o = options.maxOutputTokens) != null ? _o : void 0,
5891
- thinking_level: (_p = opts == null ? void 0 : opts.thinkingLevel) != null ? _p : void 0,
5892
- thinking_summaries: (_q = opts == null ? void 0 : opts.thinkingSummaries) != null ? _q : void 0,
5910
+ max_output_tokens: (_p = options.maxOutputTokens) != null ? _p : void 0,
5911
+ thinking_level: (_q = opts == null ? void 0 : opts.thinkingLevel) != null ? _q : void 0,
5912
+ thinking_summaries: (_r = opts == null ? void 0 : opts.thinkingSummaries) != null ? _r : void 0,
5893
5913
  tool_choice: toolChoiceForBody
5894
5914
  });
5895
5915
  if ((opts == null ? void 0 : opts.imageConfig) != null) {
@@ -5916,9 +5936,9 @@ var GoogleInteractionsLanguageModel = class {
5916
5936
  if (ac.type === "deep-research") {
5917
5937
  agentConfig = pruneUndefined({
5918
5938
  type: "deep-research",
5919
- thinking_summaries: (_r = ac.thinkingSummaries) != null ? _r : void 0,
5920
- visualization: (_s = ac.visualization) != null ? _s : void 0,
5921
- collaborative_planning: (_t = ac.collaborativePlanning) != null ? _t : void 0
5939
+ thinking_summaries: (_s = ac.thinkingSummaries) != null ? _s : void 0,
5940
+ visualization: (_t = ac.visualization) != null ? _t : void 0,
5941
+ collaborative_planning: (_u = ac.collaborativePlanning) != null ? _u : void 0
5922
5942
  });
5923
5943
  } else if (ac.type === "dynamic") {
5924
5944
  agentConfig = { type: "dynamic" };
@@ -5935,7 +5955,7 @@ var GoogleInteractionsLanguageModel = class {
5935
5955
  environment = opts.environment;
5936
5956
  } else {
5937
5957
  const env = opts.environment;
5938
- const sources = (_u = env.sources) == null ? void 0 : _u.map((s) => {
5958
+ const sources = (_v = env.sources) == null ? void 0 : _v.map((s) => {
5939
5959
  var _a2;
5940
5960
  if (s.type === "inline") {
5941
5961
  return {
@@ -5980,20 +6000,20 @@ var GoogleInteractionsLanguageModel = class {
5980
6000
  tools: toolsForBody,
5981
6001
  response_format: responseFormatEntries.length > 0 ? responseFormatEntries : void 0,
5982
6002
  response_modalities: (opts == null ? void 0 : opts.responseModalities) != null ? opts.responseModalities : void 0,
5983
- previous_interaction_id: (_v = opts == null ? void 0 : opts.previousInteractionId) != null ? _v : void 0,
5984
- service_tier: (_w = opts == null ? void 0 : opts.serviceTier) != null ? _w : void 0,
5985
- store: (_x = opts == null ? void 0 : opts.store) != null ? _x : void 0,
6003
+ previous_interaction_id: (_w = opts == null ? void 0 : opts.previousInteractionId) != null ? _w : void 0,
6004
+ service_tier: (_x = opts == null ? void 0 : opts.serviceTier) != null ? _x : void 0,
6005
+ store: (_y = opts == null ? void 0 : opts.store) != null ? _y : void 0,
5986
6006
  generation_config: generationConfig != null && Object.keys(generationConfig).length > 0 ? generationConfig : void 0,
5987
6007
  agent_config: agentConfig,
5988
6008
  environment,
5989
- background: (_y = opts == null ? void 0 : opts.background) != null ? _y : void 0
6009
+ background: (_z = opts == null ? void 0 : opts.background) != null ? _z : void 0
5990
6010
  });
5991
6011
  return {
5992
6012
  args,
5993
6013
  warnings,
5994
6014
  isAgent,
5995
6015
  isBackground: (opts == null ? void 0 : opts.background) === true,
5996
- pollingTimeoutMs: (_z = opts == null ? void 0 : opts.pollingTimeoutMs) != null ? _z : void 0
6016
+ pollingTimeoutMs: (_A = opts == null ? void 0 : opts.pollingTimeoutMs) != null ? _A : void 0
5997
6017
  };
5998
6018
  }
5999
6019
  async doGenerate(options) {