@google/genai 1.5.1 → 1.6.0

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.
@@ -1,3 +1,4 @@
1
+ // @ts-ignore
1
2
  import type { Client } from '@modelcontextprotocol/sdk/client/index.js';
2
3
  import { GoogleAuthOptions } from 'google-auth-library';
3
4
 
@@ -191,6 +192,30 @@ declare interface ApiClientInitOptions {
191
192
  userAgentExtra?: string;
192
193
  }
193
194
 
195
+ /**
196
+ * API errors raised by the GenAI API.
197
+ */
198
+ export declare class ApiError extends Error {
199
+ /** HTTP status code */
200
+ status: number;
201
+ constructor(options: ApiErrorInfo);
202
+ }
203
+
204
+ /**
205
+ * @license
206
+ * Copyright 2025 Google LLC
207
+ * SPDX-License-Identifier: Apache-2.0
208
+ */
209
+ /**
210
+ * Details for errors from calling the API.
211
+ */
212
+ export declare interface ApiErrorInfo {
213
+ /** The error message. */
214
+ message: string;
215
+ /** The HTTP status code. */
216
+ status: number;
217
+ }
218
+
194
219
  /** Config for authentication with API key. */
195
220
  export declare interface ApiKeyConfig {
196
221
  /** The API key to be used in the request directly. */
@@ -1913,8 +1938,12 @@ export declare interface FunctionDeclaration {
1913
1938
  name?: string;
1914
1939
  /** Optional. Describes the parameters to this function in JSON Schema Object format. Reflects the Open API 3.03 Parameter Object. string Key: the name of the parameter. Parameter names are case sensitive. Schema Value: the Schema defining the type used for the parameter. For function with no parameters, this can be left unset. Parameter names must start with a letter or an underscore and must only contain chars a-z, A-Z, 0-9, or underscores with a maximum length of 64. Example with 1 required and 1 optional parameter: type: OBJECT properties: param1: type: STRING param2: type: INTEGER required: - param1 */
1915
1940
  parameters?: Schema;
1941
+ /** Optional. Describes the parameters to the function in JSON Schema format. The schema must describe an object where the properties are the parameters to the function. For example: ``` { "type": "object", "properties": { "name": { "type": "string" }, "age": { "type": "integer" } }, "additionalProperties": false, "required": ["name", "age"], "propertyOrdering": ["name", "age"] } ``` This field is mutually exclusive with `parameters`. */
1942
+ parametersJsonSchema?: unknown;
1916
1943
  /** Optional. Describes the output from this function in JSON Schema format. Reflects the Open API 3.03 Response Object. The Schema defines the type used for the response value of the function. */
1917
1944
  response?: Schema;
1945
+ /** Optional. Describes the output from this function in JSON Schema format. The value specified by the schema is the response value of the function. This field is mutually exclusive with `response`. */
1946
+ responseJsonSchema?: unknown;
1918
1947
  }
1919
1948
 
1920
1949
  /** A function response. */
@@ -2501,6 +2530,8 @@ export declare interface GenerationConfig {
2501
2530
  responseModalities?: Modality[];
2502
2531
  /** Optional. The `Schema` object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. Represents a select subset of an [OpenAPI 3.0 schema object](https://spec.openapis.org/oas/v3.0.3#schema). If set, a compatible response_mime_type must also be set. Compatible mimetypes: `application/json`: Schema for JSON response. */
2503
2532
  responseSchema?: Schema;
2533
+ /** Optional. Output schema of the generated response. This is an alternative to `response_schema` that accepts [JSON Schema](https://json-schema.org/). If set, `response_schema` must be omitted, but `response_mime_type` is required. While the full JSON Schema may be sent, not all features are supported. Specifically, only the following properties are supported: - `$id` - `$defs` - `$ref` - `$anchor` - `type` - `format` - `title` - `description` - `enum` (for strings and numbers) - `items` - `prefixItems` - `minItems` - `maxItems` - `minimum` - `maximum` - `anyOf` - `oneOf` (interpreted the same as `anyOf`) - `properties` - `additionalProperties` - `required` The non-standard `propertyOrdering` property may also be set. Cyclic references are unrolled to a limited degree and, as such, may only be used within non-required properties. (Nullable properties are not sufficient.) If `$ref` is set on a sub-schema, no other properties, except for than those starting as a `$`, may be set. */
2534
+ responseJsonSchema?: unknown;
2504
2535
  /** Optional. Routing configuration. */
2505
2536
  routingConfig?: GenerationConfigRoutingConfig;
2506
2537
  /** Optional. Seed. */
@@ -2998,6 +3029,8 @@ export declare interface HttpOptions {
2998
3029
  headers?: Record<string, string>;
2999
3030
  /** Timeout for the request in milliseconds. */
3000
3031
  timeout?: number;
3032
+ /** Extra parameters to add to the request body. */
3033
+ extraBody?: Record<string, unknown>;
3001
3034
  }
3002
3035
 
3003
3036
  /**
@@ -5562,7 +5595,7 @@ export declare interface ThinkingConfig {
5562
5595
  /** Indicates whether to include thoughts in the response. If true, thoughts are returned only if the model supports thought and thoughts are available.
5563
5596
  */
5564
5597
  includeThoughts?: boolean;
5565
- /** Indicates the thinking budget in tokens.
5598
+ /** Indicates the thinking budget in tokens. 0 is DISABLED. -1 is AUTOMATIC. The default values and allowed ranges are model dependent.
5566
5599
  */
5567
5600
  thinkingBudget?: number;
5568
5601
  }
@@ -6035,6 +6068,8 @@ declare namespace types {
6035
6068
  GenerationConfigRoutingConfig,
6036
6069
  GenerateContentConfig,
6037
6070
  GenerateContentParameters,
6071
+ HttpResponse,
6072
+ LiveCallbacks,
6038
6073
  GoogleTypeDate,
6039
6074
  Citation,
6040
6075
  CitationMetadata,
@@ -6159,8 +6194,6 @@ declare namespace types {
6159
6194
  ListFilesResponse,
6160
6195
  CreateFileConfig,
6161
6196
  CreateFileParameters,
6162
- HttpResponse,
6163
- LiveCallbacks,
6164
6197
  CreateFileResponse,
6165
6198
  GetFileConfig,
6166
6199
  GetFileParameters,