@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/web/web.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. */
@@ -2991,6 +3022,8 @@ export declare interface HttpOptions {
2991
3022
  headers?: Record<string, string>;
2992
3023
  /** Timeout for the request in milliseconds. */
2993
3024
  timeout?: number;
3025
+ /** Extra parameters to add to the request body. */
3026
+ extraBody?: Record<string, unknown>;
2994
3027
  }
2995
3028
 
2996
3029
  /**
@@ -5555,7 +5588,7 @@ export declare interface ThinkingConfig {
5555
5588
  /** Indicates whether to include thoughts in the response. If true, thoughts are returned only if the model supports thought and thoughts are available.
5556
5589
  */
5557
5590
  includeThoughts?: boolean;
5558
- /** Indicates the thinking budget in tokens.
5591
+ /** Indicates the thinking budget in tokens. 0 is DISABLED. -1 is AUTOMATIC. The default values and allowed ranges are model dependent.
5559
5592
  */
5560
5593
  thinkingBudget?: number;
5561
5594
  }
@@ -6028,6 +6061,8 @@ declare namespace types {
6028
6061
  GenerationConfigRoutingConfig,
6029
6062
  GenerateContentConfig,
6030
6063
  GenerateContentParameters,
6064
+ HttpResponse,
6065
+ LiveCallbacks,
6031
6066
  GoogleTypeDate,
6032
6067
  Citation,
6033
6068
  CitationMetadata,
@@ -6152,8 +6187,6 @@ declare namespace types {
6152
6187
  ListFilesResponse,
6153
6188
  CreateFileConfig,
6154
6189
  CreateFileParameters,
6155
- HttpResponse,
6156
- LiveCallbacks,
6157
6190
  CreateFileResponse,
6158
6191
  GetFileConfig,
6159
6192
  GetFileParameters,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google/genai",
3
- "version": "1.5.1",
3
+ "version": "1.6.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/node/index.mjs",
@@ -38,8 +38,8 @@
38
38
  },
39
39
  "scripts": {
40
40
  "prepare": "npm run build-prod",
41
- "build": "rollup -c && api-extractor run --local --verbose && api-extractor run -c api-extractor.node.json --local --verbose&& api-extractor run -c api-extractor.web.json --local --verbose",
42
- "build-prod": "rollup -c && api-extractor run --verbose && api-extractor run -c api-extractor.node.json --verbose && api-extractor run -c api-extractor.web.json --verbose",
41
+ "build": "rollup -c && api-extractor run --local --verbose && api-extractor run -c api-extractor.node.json --local --verbose&& api-extractor run -c api-extractor.web.json --local --verbose && node scripts/ignore_missing_mcp_dep.js",
42
+ "build-prod": "rollup -c && api-extractor run --verbose && api-extractor run -c api-extractor.node.json --verbose && api-extractor run -c api-extractor.web.json --verbose && node scripts/ignore_missing_mcp_dep.js",
43
43
  "unit-test": "tsc && jasmine dist/test/unit/**/*_test.js dist/test/unit/*_test.js",
44
44
  "system-test": "tsc && jasmine dist/test/system/**/*_test.js",
45
45
  "test-server-tests": "tsc && GOOGLE_CLOUD_PROJECT=googcloudproj GOOGLE_CLOUD_LOCATION=googcloudloc jasmine dist/test/system/node/*_test.js !dist/test/system/node/live_test.js -- --test-server",
@@ -85,7 +85,7 @@
85
85
  "prettier": "3.3.3",
86
86
  "prettier-plugin-organize-imports": "^4.1.0",
87
87
  "rollup-plugin-typescript2": "^0.36.0",
88
- "test-server-sdk": "^0.2.1",
88
+ "test-server-sdk": "^0.2.3",
89
89
  "ts-node": "^10.9.2",
90
90
  "tslib": "^2.8.1",
91
91
  "tsx": "^4.19.4",