@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.
package/dist/genai.d.ts CHANGED
@@ -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. */
@@ -2986,6 +3017,8 @@ export declare interface HttpOptions {
2986
3017
  headers?: Record<string, string>;
2987
3018
  /** Timeout for the request in milliseconds. */
2988
3019
  timeout?: number;
3020
+ /** Extra parameters to add to the request body. */
3021
+ extraBody?: Record<string, unknown>;
2989
3022
  }
2990
3023
 
2991
3024
  /**
@@ -5550,7 +5583,7 @@ export declare interface ThinkingConfig {
5550
5583
  /** Indicates whether to include thoughts in the response. If true, thoughts are returned only if the model supports thought and thoughts are available.
5551
5584
  */
5552
5585
  includeThoughts?: boolean;
5553
- /** Indicates the thinking budget in tokens.
5586
+ /** Indicates the thinking budget in tokens. 0 is DISABLED. -1 is AUTOMATIC. The default values and allowed ranges are model dependent.
5554
5587
  */
5555
5588
  thinkingBudget?: number;
5556
5589
  }
@@ -6023,6 +6056,8 @@ declare namespace types {
6023
6056
  GenerationConfigRoutingConfig,
6024
6057
  GenerateContentConfig,
6025
6058
  GenerateContentParameters,
6059
+ HttpResponse,
6060
+ LiveCallbacks,
6026
6061
  GoogleTypeDate,
6027
6062
  Citation,
6028
6063
  CitationMetadata,
@@ -6147,8 +6182,6 @@ declare namespace types {
6147
6182
  ListFilesResponse,
6148
6183
  CreateFileConfig,
6149
6184
  CreateFileParameters,
6150
- HttpResponse,
6151
- LiveCallbacks,
6152
6185
  CreateFileResponse,
6153
6186
  GetFileConfig,
6154
6187
  GetFileParameters,