@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.
@@ -5644,6 +5644,28 @@ export declare interface Model {
5644
5644
  defaultCheckpointId?: string;
5645
5645
  /** The checkpoints of the model. */
5646
5646
  checkpoints?: Checkpoint[];
5647
+ /** Temperature value used for sampling set when the dataset was saved.
5648
+ This value is used to tune the degree of randomness. */
5649
+ temperature?: number;
5650
+ /** The maximum temperature value used for sampling set when the
5651
+ dataset was saved. This value is used to tune the degree of randomness. */
5652
+ maxTemperature?: number;
5653
+ /** Optional. Specifies the nucleus sampling threshold. The model
5654
+ considers only the smallest set of tokens whose cumulative probability is
5655
+ at least `top_p`. This helps generate more diverse and less repetitive
5656
+ responses. For example, a `top_p` of 0.9 means the model considers tokens
5657
+ until the cumulative probability of the tokens to select from reaches 0.9.
5658
+ It's recommended to adjust either temperature or `top_p`, but not both. */
5659
+ topP?: number;
5660
+ /** Optional. Specifies the top-k sampling threshold. The model
5661
+ considers only the top k most probable tokens for the next token. This can
5662
+ be useful for generating more coherent and less random text. For example,
5663
+ a `top_k` of 40 means the model will choose the next word from the 40 most
5664
+ likely words. */
5665
+ topK?: number;
5666
+ /** Whether the model supports thinking features. If true, thoughts are
5667
+ returned only if the model supports thought and thoughts are available. */
5668
+ thinking?: boolean;
5647
5669
  }
5648
5670
 
5649
5671
  export declare class Models extends BaseModule {
@@ -1951,6 +1951,7 @@ class GenerateContentResponse {
1951
1951
  for (const [fieldName, fieldValue] of Object.entries(part)) {
1952
1952
  if (fieldName !== 'text' &&
1953
1953
  fieldName !== 'thought' &&
1954
+ fieldName !== 'thoughtSignature' &&
1954
1955
  (fieldValue !== null || fieldValue !== undefined)) {
1955
1956
  nonTextParts.push(fieldName);
1956
1957
  }
@@ -2484,6 +2485,9 @@ function tModel(apiClient, model) {
2484
2485
  if (!model || typeof model !== 'string') {
2485
2486
  throw new Error('model is required and must be a string');
2486
2487
  }
2488
+ if (model.includes('..') || model.includes('?') || model.includes('&')) {
2489
+ throw new Error('invalid model parameter');
2490
+ }
2487
2491
  if (apiClient.isVertexAI()) {
2488
2492
  if (model.startsWith('publishers/') ||
2489
2493
  model.startsWith('projects/') ||
@@ -9980,6 +9984,28 @@ function modelFromMldev(fromObject) {
9980
9984
  if (fromSupportedActions != null) {
9981
9985
  setValueByPath(toObject, ['supportedActions'], fromSupportedActions);
9982
9986
  }
9987
+ const fromTemperature = getValueByPath(fromObject, ['temperature']);
9988
+ if (fromTemperature != null) {
9989
+ setValueByPath(toObject, ['temperature'], fromTemperature);
9990
+ }
9991
+ const fromMaxTemperature = getValueByPath(fromObject, [
9992
+ 'maxTemperature',
9993
+ ]);
9994
+ if (fromMaxTemperature != null) {
9995
+ setValueByPath(toObject, ['maxTemperature'], fromMaxTemperature);
9996
+ }
9997
+ const fromTopP = getValueByPath(fromObject, ['topP']);
9998
+ if (fromTopP != null) {
9999
+ setValueByPath(toObject, ['topP'], fromTopP);
10000
+ }
10001
+ const fromTopK = getValueByPath(fromObject, ['topK']);
10002
+ if (fromTopK != null) {
10003
+ setValueByPath(toObject, ['topK'], fromTopK);
10004
+ }
10005
+ const fromThinking = getValueByPath(fromObject, ['thinking']);
10006
+ if (fromThinking != null) {
10007
+ setValueByPath(toObject, ['thinking'], fromThinking);
10008
+ }
9983
10009
  return toObject;
9984
10010
  }
9985
10011
  function modelFromVertex(fromObject) {
@@ -10108,7 +10134,7 @@ function recontextImageConfigToVertex(fromObject, parentObject) {
10108
10134
  }
10109
10135
  const fromBaseSteps = getValueByPath(fromObject, ['baseSteps']);
10110
10136
  if (parentObject !== undefined && fromBaseSteps != null) {
10111
- setValueByPath(parentObject, ['parameters', 'editConfig', 'baseSteps'], fromBaseSteps);
10137
+ setValueByPath(parentObject, ['parameters', 'baseSteps'], fromBaseSteps);
10112
10138
  }
10113
10139
  const fromOutputGcsUri = getValueByPath(fromObject, ['outputGcsUri']);
10114
10140
  if (parentObject !== undefined && fromOutputGcsUri != null) {
@@ -10852,7 +10878,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
10852
10878
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
10853
10879
  const USER_AGENT_HEADER = 'User-Agent';
10854
10880
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
10855
- const SDK_VERSION = '1.29.0'; // x-release-please-version
10881
+ const SDK_VERSION = '1.29.1'; // x-release-please-version
10856
10882
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
10857
10883
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
10858
10884
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';