@google/genai 1.29.0 → 1.29.1

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.
@@ -1982,6 +1982,7 @@ class GenerateContentResponse {
1982
1982
  for (const [fieldName, fieldValue] of Object.entries(part)) {
1983
1983
  if (fieldName !== 'text' &&
1984
1984
  fieldName !== 'thought' &&
1985
+ fieldName !== 'thoughtSignature' &&
1985
1986
  (fieldValue !== null || fieldValue !== undefined)) {
1986
1987
  nonTextParts.push(fieldName);
1987
1988
  }
@@ -2515,6 +2516,9 @@ function tModel(apiClient, model) {
2515
2516
  if (!model || typeof model !== 'string') {
2516
2517
  throw new Error('model is required and must be a string');
2517
2518
  }
2519
+ if (model.includes('..') || model.includes('?') || model.includes('&')) {
2520
+ throw new Error('invalid model parameter');
2521
+ }
2518
2522
  if (apiClient.isVertexAI()) {
2519
2523
  if (model.startsWith('publishers/') ||
2520
2524
  model.startsWith('projects/') ||
@@ -10011,6 +10015,28 @@ function modelFromMldev(fromObject) {
10011
10015
  if (fromSupportedActions != null) {
10012
10016
  setValueByPath(toObject, ['supportedActions'], fromSupportedActions);
10013
10017
  }
10018
+ const fromTemperature = getValueByPath(fromObject, ['temperature']);
10019
+ if (fromTemperature != null) {
10020
+ setValueByPath(toObject, ['temperature'], fromTemperature);
10021
+ }
10022
+ const fromMaxTemperature = getValueByPath(fromObject, [
10023
+ 'maxTemperature',
10024
+ ]);
10025
+ if (fromMaxTemperature != null) {
10026
+ setValueByPath(toObject, ['maxTemperature'], fromMaxTemperature);
10027
+ }
10028
+ const fromTopP = getValueByPath(fromObject, ['topP']);
10029
+ if (fromTopP != null) {
10030
+ setValueByPath(toObject, ['topP'], fromTopP);
10031
+ }
10032
+ const fromTopK = getValueByPath(fromObject, ['topK']);
10033
+ if (fromTopK != null) {
10034
+ setValueByPath(toObject, ['topK'], fromTopK);
10035
+ }
10036
+ const fromThinking = getValueByPath(fromObject, ['thinking']);
10037
+ if (fromThinking != null) {
10038
+ setValueByPath(toObject, ['thinking'], fromThinking);
10039
+ }
10014
10040
  return toObject;
10015
10041
  }
10016
10042
  function modelFromVertex(fromObject) {
@@ -10139,7 +10165,7 @@ function recontextImageConfigToVertex(fromObject, parentObject) {
10139
10165
  }
10140
10166
  const fromBaseSteps = getValueByPath(fromObject, ['baseSteps']);
10141
10167
  if (parentObject !== undefined && fromBaseSteps != null) {
10142
- setValueByPath(parentObject, ['parameters', 'editConfig', 'baseSteps'], fromBaseSteps);
10168
+ setValueByPath(parentObject, ['parameters', 'baseSteps'], fromBaseSteps);
10143
10169
  }
10144
10170
  const fromOutputGcsUri = getValueByPath(fromObject, ['outputGcsUri']);
10145
10171
  if (parentObject !== undefined && fromOutputGcsUri != null) {
@@ -10883,7 +10909,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
10883
10909
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
10884
10910
  const USER_AGENT_HEADER = 'User-Agent';
10885
10911
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
10886
- const SDK_VERSION = '1.29.0'; // x-release-please-version
10912
+ const SDK_VERSION = '1.29.1'; // x-release-please-version
10887
10913
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
10888
10914
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
10889
10915
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -1960,6 +1960,7 @@ class GenerateContentResponse {
1960
1960
  for (const [fieldName, fieldValue] of Object.entries(part)) {
1961
1961
  if (fieldName !== 'text' &&
1962
1962
  fieldName !== 'thought' &&
1963
+ fieldName !== 'thoughtSignature' &&
1963
1964
  (fieldValue !== null || fieldValue !== undefined)) {
1964
1965
  nonTextParts.push(fieldName);
1965
1966
  }
@@ -2493,6 +2494,9 @@ function tModel(apiClient, model) {
2493
2494
  if (!model || typeof model !== 'string') {
2494
2495
  throw new Error('model is required and must be a string');
2495
2496
  }
2497
+ if (model.includes('..') || model.includes('?') || model.includes('&')) {
2498
+ throw new Error('invalid model parameter');
2499
+ }
2496
2500
  if (apiClient.isVertexAI()) {
2497
2501
  if (model.startsWith('publishers/') ||
2498
2502
  model.startsWith('projects/') ||
@@ -9989,6 +9993,28 @@ function modelFromMldev(fromObject) {
9989
9993
  if (fromSupportedActions != null) {
9990
9994
  setValueByPath(toObject, ['supportedActions'], fromSupportedActions);
9991
9995
  }
9996
+ const fromTemperature = getValueByPath(fromObject, ['temperature']);
9997
+ if (fromTemperature != null) {
9998
+ setValueByPath(toObject, ['temperature'], fromTemperature);
9999
+ }
10000
+ const fromMaxTemperature = getValueByPath(fromObject, [
10001
+ 'maxTemperature',
10002
+ ]);
10003
+ if (fromMaxTemperature != null) {
10004
+ setValueByPath(toObject, ['maxTemperature'], fromMaxTemperature);
10005
+ }
10006
+ const fromTopP = getValueByPath(fromObject, ['topP']);
10007
+ if (fromTopP != null) {
10008
+ setValueByPath(toObject, ['topP'], fromTopP);
10009
+ }
10010
+ const fromTopK = getValueByPath(fromObject, ['topK']);
10011
+ if (fromTopK != null) {
10012
+ setValueByPath(toObject, ['topK'], fromTopK);
10013
+ }
10014
+ const fromThinking = getValueByPath(fromObject, ['thinking']);
10015
+ if (fromThinking != null) {
10016
+ setValueByPath(toObject, ['thinking'], fromThinking);
10017
+ }
9992
10018
  return toObject;
9993
10019
  }
9994
10020
  function modelFromVertex(fromObject) {
@@ -10117,7 +10143,7 @@ function recontextImageConfigToVertex(fromObject, parentObject) {
10117
10143
  }
10118
10144
  const fromBaseSteps = getValueByPath(fromObject, ['baseSteps']);
10119
10145
  if (parentObject !== undefined && fromBaseSteps != null) {
10120
- setValueByPath(parentObject, ['parameters', 'editConfig', 'baseSteps'], fromBaseSteps);
10146
+ setValueByPath(parentObject, ['parameters', 'baseSteps'], fromBaseSteps);
10121
10147
  }
10122
10148
  const fromOutputGcsUri = getValueByPath(fromObject, ['outputGcsUri']);
10123
10149
  if (parentObject !== undefined && fromOutputGcsUri != null) {
@@ -10861,7 +10887,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
10861
10887
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
10862
10888
  const USER_AGENT_HEADER = 'User-Agent';
10863
10889
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
10864
- const SDK_VERSION = '1.29.0'; // x-release-please-version
10890
+ const SDK_VERSION = '1.29.1'; // x-release-please-version
10865
10891
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
10866
10892
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
10867
10893
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';