@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.
package/dist/genai.d.ts CHANGED
@@ -5632,6 +5632,28 @@ export declare interface Model {
5632
5632
  defaultCheckpointId?: string;
5633
5633
  /** The checkpoints of the model. */
5634
5634
  checkpoints?: Checkpoint[];
5635
+ /** Temperature value used for sampling set when the dataset was saved.
5636
+ This value is used to tune the degree of randomness. */
5637
+ temperature?: number;
5638
+ /** The maximum temperature value used for sampling set when the
5639
+ dataset was saved. This value is used to tune the degree of randomness. */
5640
+ maxTemperature?: number;
5641
+ /** Optional. Specifies the nucleus sampling threshold. The model
5642
+ considers only the smallest set of tokens whose cumulative probability is
5643
+ at least `top_p`. This helps generate more diverse and less repetitive
5644
+ responses. For example, a `top_p` of 0.9 means the model considers tokens
5645
+ until the cumulative probability of the tokens to select from reaches 0.9.
5646
+ It's recommended to adjust either temperature or `top_p`, but not both. */
5647
+ topP?: number;
5648
+ /** Optional. Specifies the top-k sampling threshold. The model
5649
+ considers only the top k most probable tokens for the next token. This can
5650
+ be useful for generating more coherent and less random text. For example,
5651
+ a `top_k` of 40 means the model will choose the next word from the 40 most
5652
+ likely words. */
5653
+ topK?: number;
5654
+ /** Whether the model supports thinking features. If true, thoughts are
5655
+ returned only if the model supports thought and thoughts are available. */
5656
+ thinking?: boolean;
5635
5657
  }
5636
5658
 
5637
5659
  export declare class Models extends BaseModule {
package/dist/index.cjs CHANGED
@@ -1923,6 +1923,7 @@ class GenerateContentResponse {
1923
1923
  for (const [fieldName, fieldValue] of Object.entries(part)) {
1924
1924
  if (fieldName !== 'text' &&
1925
1925
  fieldName !== 'thought' &&
1926
+ fieldName !== 'thoughtSignature' &&
1926
1927
  (fieldValue !== null || fieldValue !== undefined)) {
1927
1928
  nonTextParts.push(fieldName);
1928
1929
  }
@@ -2456,6 +2457,9 @@ function tModel(apiClient, model) {
2456
2457
  if (!model || typeof model !== 'string') {
2457
2458
  throw new Error('model is required and must be a string');
2458
2459
  }
2460
+ if (model.includes('..') || model.includes('?') || model.includes('&')) {
2461
+ throw new Error('invalid model parameter');
2462
+ }
2459
2463
  if (apiClient.isVertexAI()) {
2460
2464
  if (model.startsWith('publishers/') ||
2461
2465
  model.startsWith('projects/') ||
@@ -6426,7 +6430,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
6426
6430
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
6427
6431
  const USER_AGENT_HEADER = 'User-Agent';
6428
6432
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
6429
- const SDK_VERSION = '1.29.0'; // x-release-please-version
6433
+ const SDK_VERSION = '1.29.1'; // x-release-please-version
6430
6434
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
6431
6435
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
6432
6436
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -11459,6 +11463,28 @@ function modelFromMldev(fromObject) {
11459
11463
  if (fromSupportedActions != null) {
11460
11464
  setValueByPath(toObject, ['supportedActions'], fromSupportedActions);
11461
11465
  }
11466
+ const fromTemperature = getValueByPath(fromObject, ['temperature']);
11467
+ if (fromTemperature != null) {
11468
+ setValueByPath(toObject, ['temperature'], fromTemperature);
11469
+ }
11470
+ const fromMaxTemperature = getValueByPath(fromObject, [
11471
+ 'maxTemperature',
11472
+ ]);
11473
+ if (fromMaxTemperature != null) {
11474
+ setValueByPath(toObject, ['maxTemperature'], fromMaxTemperature);
11475
+ }
11476
+ const fromTopP = getValueByPath(fromObject, ['topP']);
11477
+ if (fromTopP != null) {
11478
+ setValueByPath(toObject, ['topP'], fromTopP);
11479
+ }
11480
+ const fromTopK = getValueByPath(fromObject, ['topK']);
11481
+ if (fromTopK != null) {
11482
+ setValueByPath(toObject, ['topK'], fromTopK);
11483
+ }
11484
+ const fromThinking = getValueByPath(fromObject, ['thinking']);
11485
+ if (fromThinking != null) {
11486
+ setValueByPath(toObject, ['thinking'], fromThinking);
11487
+ }
11462
11488
  return toObject;
11463
11489
  }
11464
11490
  function modelFromVertex(fromObject) {
@@ -11587,7 +11613,7 @@ function recontextImageConfigToVertex(fromObject, parentObject) {
11587
11613
  }
11588
11614
  const fromBaseSteps = getValueByPath(fromObject, ['baseSteps']);
11589
11615
  if (parentObject !== undefined && fromBaseSteps != null) {
11590
- setValueByPath(parentObject, ['parameters', 'editConfig', 'baseSteps'], fromBaseSteps);
11616
+ setValueByPath(parentObject, ['parameters', 'baseSteps'], fromBaseSteps);
11591
11617
  }
11592
11618
  const fromOutputGcsUri = getValueByPath(fromObject, ['outputGcsUri']);
11593
11619
  if (parentObject !== undefined && fromOutputGcsUri != null) {
package/dist/index.mjs CHANGED
@@ -1921,6 +1921,7 @@ class GenerateContentResponse {
1921
1921
  for (const [fieldName, fieldValue] of Object.entries(part)) {
1922
1922
  if (fieldName !== 'text' &&
1923
1923
  fieldName !== 'thought' &&
1924
+ fieldName !== 'thoughtSignature' &&
1924
1925
  (fieldValue !== null || fieldValue !== undefined)) {
1925
1926
  nonTextParts.push(fieldName);
1926
1927
  }
@@ -2454,6 +2455,9 @@ function tModel(apiClient, model) {
2454
2455
  if (!model || typeof model !== 'string') {
2455
2456
  throw new Error('model is required and must be a string');
2456
2457
  }
2458
+ if (model.includes('..') || model.includes('?') || model.includes('&')) {
2459
+ throw new Error('invalid model parameter');
2460
+ }
2457
2461
  if (apiClient.isVertexAI()) {
2458
2462
  if (model.startsWith('publishers/') ||
2459
2463
  model.startsWith('projects/') ||
@@ -6424,7 +6428,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
6424
6428
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
6425
6429
  const USER_AGENT_HEADER = 'User-Agent';
6426
6430
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
6427
- const SDK_VERSION = '1.29.0'; // x-release-please-version
6431
+ const SDK_VERSION = '1.29.1'; // x-release-please-version
6428
6432
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
6429
6433
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
6430
6434
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -11457,6 +11461,28 @@ function modelFromMldev(fromObject) {
11457
11461
  if (fromSupportedActions != null) {
11458
11462
  setValueByPath(toObject, ['supportedActions'], fromSupportedActions);
11459
11463
  }
11464
+ const fromTemperature = getValueByPath(fromObject, ['temperature']);
11465
+ if (fromTemperature != null) {
11466
+ setValueByPath(toObject, ['temperature'], fromTemperature);
11467
+ }
11468
+ const fromMaxTemperature = getValueByPath(fromObject, [
11469
+ 'maxTemperature',
11470
+ ]);
11471
+ if (fromMaxTemperature != null) {
11472
+ setValueByPath(toObject, ['maxTemperature'], fromMaxTemperature);
11473
+ }
11474
+ const fromTopP = getValueByPath(fromObject, ['topP']);
11475
+ if (fromTopP != null) {
11476
+ setValueByPath(toObject, ['topP'], fromTopP);
11477
+ }
11478
+ const fromTopK = getValueByPath(fromObject, ['topK']);
11479
+ if (fromTopK != null) {
11480
+ setValueByPath(toObject, ['topK'], fromTopK);
11481
+ }
11482
+ const fromThinking = getValueByPath(fromObject, ['thinking']);
11483
+ if (fromThinking != null) {
11484
+ setValueByPath(toObject, ['thinking'], fromThinking);
11485
+ }
11460
11486
  return toObject;
11461
11487
  }
11462
11488
  function modelFromVertex(fromObject) {
@@ -11585,7 +11611,7 @@ function recontextImageConfigToVertex(fromObject, parentObject) {
11585
11611
  }
11586
11612
  const fromBaseSteps = getValueByPath(fromObject, ['baseSteps']);
11587
11613
  if (parentObject !== undefined && fromBaseSteps != null) {
11588
- setValueByPath(parentObject, ['parameters', 'editConfig', 'baseSteps'], fromBaseSteps);
11614
+ setValueByPath(parentObject, ['parameters', 'baseSteps'], fromBaseSteps);
11589
11615
  }
11590
11616
  const fromOutputGcsUri = getValueByPath(fromObject, ['outputGcsUri']);
11591
11617
  if (parentObject !== undefined && fromOutputGcsUri != null) {