@google/genai 0.9.0 → 0.10.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
@@ -164,6 +164,14 @@ export declare interface AutomaticActivityDetection {
164
164
  declare class BaseModule {
165
165
  }
166
166
 
167
+ /**
168
+ * Parameters for setting the base URLs for the Gemini API and Vertex AI API.
169
+ */
170
+ export declare interface BaseUrlParameters {
171
+ geminiUrl?: string;
172
+ vertexUrl?: string;
173
+ }
174
+
167
175
  /** Content blob. */
168
176
  declare interface Blob_2 {
169
177
  /** Required. Raw bytes. */
@@ -173,6 +181,8 @@ declare interface Blob_2 {
173
181
  }
174
182
  export { Blob_2 as Blob }
175
183
 
184
+ export declare type BlobImageUnion = Blob_2;
185
+
176
186
  /** Output only. Blocked reason. */
177
187
  export declare enum BlockedReason {
178
188
  BLOCKED_REASON_UNSPECIFIED = "BLOCKED_REASON_UNSPECIFIED",
@@ -487,6 +497,13 @@ export declare interface CodeExecutionResult {
487
497
  export declare interface ComputeTokensConfig {
488
498
  /** Used to override HTTP request options. */
489
499
  httpOptions?: HttpOptions;
500
+ /** Abort signal which can be used to cancel the request.
501
+
502
+ NOTE: AbortSignal is a client-only operation. Using it to cancel an
503
+ operation will not cancel the request in the service. You will still
504
+ be charged usage for any applicable operations.
505
+ */
506
+ abortSignal?: AbortSignal;
490
507
  }
491
508
 
492
509
  /** Parameters for computing tokens. */
@@ -595,6 +612,13 @@ export declare enum ControlReferenceType {
595
612
  export declare interface CountTokensConfig {
596
613
  /** Used to override HTTP request options. */
597
614
  httpOptions?: HttpOptions;
615
+ /** Abort signal which can be used to cancel the request.
616
+
617
+ NOTE: AbortSignal is a client-only operation. Using it to cancel an
618
+ operation will not cancel the request in the service. You will still
619
+ be charged usage for any applicable operations.
620
+ */
621
+ abortSignal?: AbortSignal;
598
622
  /** Instructions for the model to steer it toward better performance.
599
623
  */
600
624
  systemInstruction?: ContentUnion;
@@ -631,6 +655,13 @@ export declare class CountTokensResponse {
631
655
  export declare interface CreateCachedContentConfig {
632
656
  /** Used to override HTTP request options. */
633
657
  httpOptions?: HttpOptions;
658
+ /** Abort signal which can be used to cancel the request.
659
+
660
+ NOTE: AbortSignal is a client-only operation. Using it to cancel an
661
+ operation will not cancel the request in the service. You will still
662
+ be charged usage for any applicable operations.
663
+ */
664
+ abortSignal?: AbortSignal;
634
665
  /** The TTL for this resource. The expiration time is computed: now + TTL. It is a duration string, with up to nine fractional digits, terminated by 's'. Example: "3.5s". */
635
666
  ttl?: string;
636
667
  /** Timestamp of when this resource is considered expired. Uses RFC 3339 format, Example: 2014-10-02T15:01:23Z. */
@@ -692,6 +723,13 @@ export declare interface CreateChatParameters {
692
723
  export declare interface CreateFileConfig {
693
724
  /** Used to override HTTP request options. */
694
725
  httpOptions?: HttpOptions;
726
+ /** Abort signal which can be used to cancel the request.
727
+
728
+ NOTE: AbortSignal is a client-only operation. Using it to cancel an
729
+ operation will not cancel the request in the service. You will still
730
+ be charged usage for any applicable operations.
731
+ */
732
+ abortSignal?: AbortSignal;
695
733
  }
696
734
 
697
735
  /** Generates the parameters for the private _create method. */
@@ -762,6 +800,13 @@ export declare function createUserContent(partOrString: PartListUnion | string):
762
800
  export declare interface DeleteCachedContentConfig {
763
801
  /** Used to override HTTP request options. */
764
802
  httpOptions?: HttpOptions;
803
+ /** Abort signal which can be used to cancel the request.
804
+
805
+ NOTE: AbortSignal is a client-only operation. Using it to cancel an
806
+ operation will not cancel the request in the service. You will still
807
+ be charged usage for any applicable operations.
808
+ */
809
+ abortSignal?: AbortSignal;
765
810
  }
766
811
 
767
812
  /** Parameters for caches.delete method. */
@@ -782,6 +827,13 @@ export declare class DeleteCachedContentResponse {
782
827
  export declare interface DeleteFileConfig {
783
828
  /** Used to override HTTP request options. */
784
829
  httpOptions?: HttpOptions;
830
+ /** Abort signal which can be used to cancel the request.
831
+
832
+ NOTE: AbortSignal is a client-only operation. Using it to cancel an
833
+ operation will not cancel the request in the service. You will still
834
+ be charged usage for any applicable operations.
835
+ */
836
+ abortSignal?: AbortSignal;
785
837
  }
786
838
 
787
839
  /** Generates the parameters for the get method. */
@@ -800,6 +852,13 @@ export declare class DeleteFileResponse {
800
852
  export declare interface DownloadFileConfig {
801
853
  /** Used to override HTTP request options. */
802
854
  httpOptions?: HttpOptions;
855
+ /** Abort signal which can be used to cancel the request.
856
+
857
+ NOTE: AbortSignal is a client-only operation. Using it to cancel an
858
+ operation will not cancel the request in the service. You will still
859
+ be charged usage for any applicable operations.
860
+ */
861
+ abortSignal?: AbortSignal;
803
862
  }
804
863
 
805
864
  /** Describes the options to customize dynamic retrieval. */
@@ -819,6 +878,13 @@ export declare enum DynamicRetrievalConfigMode {
819
878
  export declare interface EmbedContentConfig {
820
879
  /** Used to override HTTP request options. */
821
880
  httpOptions?: HttpOptions;
881
+ /** Abort signal which can be used to cancel the request.
882
+
883
+ NOTE: AbortSignal is a client-only operation. Using it to cancel an
884
+ operation will not cancel the request in the service. You will still
885
+ be charged usage for any applicable operations.
886
+ */
887
+ abortSignal?: AbortSignal;
822
888
  /** Type of task for which the embedding will be used.
823
889
  */
824
890
  taskType?: string;
@@ -908,6 +974,13 @@ export declare enum FeatureSelectionPreference {
908
974
  export declare interface FetchPredictOperationConfig {
909
975
  /** Used to override HTTP request options. */
910
976
  httpOptions?: HttpOptions;
977
+ /** Abort signal which can be used to cancel the request.
978
+
979
+ NOTE: AbortSignal is a client-only operation. Using it to cancel an
980
+ operation will not cancel the request in the service. You will still
981
+ be charged usage for any applicable operations.
982
+ */
983
+ abortSignal?: AbortSignal;
911
984
  }
912
985
 
913
986
  /** Parameters for the fetchPredictOperation method. */
@@ -1111,6 +1184,7 @@ export declare enum FinishReason {
1111
1184
  MAX_TOKENS = "MAX_TOKENS",
1112
1185
  SAFETY = "SAFETY",
1113
1186
  RECITATION = "RECITATION",
1187
+ LANGUAGE = "LANGUAGE",
1114
1188
  OTHER = "OTHER",
1115
1189
  BLOCKLIST = "BLOCKLIST",
1116
1190
  PROHIBITED_CONTENT = "PROHIBITED_CONTENT",
@@ -1182,6 +1256,13 @@ export declare class FunctionResponse {
1182
1256
  export declare interface GenerateContentConfig {
1183
1257
  /** Used to override HTTP request options. */
1184
1258
  httpOptions?: HttpOptions;
1259
+ /** Abort signal which can be used to cancel the request.
1260
+
1261
+ NOTE: AbortSignal is a client-only operation. Using it to cancel an
1262
+ operation will not cancel the request in the service. You will still
1263
+ be charged usage for any applicable operations.
1264
+ */
1265
+ abortSignal?: AbortSignal;
1185
1266
  /** Instructions for the model to steer it toward better performance.
1186
1267
  For example, "Answer as concisely as possible" or "Don't use technical
1187
1268
  terms in your response".
@@ -1339,6 +1420,17 @@ export declare class GenerateContentResponse {
1339
1420
  * ```
1340
1421
  */
1341
1422
  get text(): string | undefined;
1423
+ /**
1424
+ * Returns the concatenation of all inline data parts from the first candidate
1425
+ * in the response.
1426
+ *
1427
+ * @remarks
1428
+ * If there are multiple candidates in the response, the inline data from the
1429
+ * first one will be returned. If there are non-inline data parts in the
1430
+ * response, the concatenation of all inline data parts will be returned, and
1431
+ * a warning will be logged.
1432
+ */
1433
+ get data(): string | undefined;
1342
1434
  /**
1343
1435
  * Returns the function calls from the first candidate in the response.
1344
1436
  *
@@ -1499,6 +1591,13 @@ export declare interface GeneratedVideo {
1499
1591
  export declare interface GenerateImagesConfig {
1500
1592
  /** Used to override HTTP request options. */
1501
1593
  httpOptions?: HttpOptions;
1594
+ /** Abort signal which can be used to cancel the request.
1595
+
1596
+ NOTE: AbortSignal is a client-only operation. Using it to cancel an
1597
+ operation will not cancel the request in the service. You will still
1598
+ be charged usage for any applicable operations.
1599
+ */
1600
+ abortSignal?: AbortSignal;
1502
1601
  /** Cloud Storage URI used to store the generated images.
1503
1602
  */
1504
1603
  outputGcsUri?: string;
@@ -1580,6 +1679,13 @@ export declare class GenerateImagesResponse {
1580
1679
  export declare interface GenerateVideosConfig {
1581
1680
  /** Used to override HTTP request options. */
1582
1681
  httpOptions?: HttpOptions;
1682
+ /** Abort signal which can be used to cancel the request.
1683
+
1684
+ NOTE: AbortSignal is a client-only operation. Using it to cancel an
1685
+ operation will not cancel the request in the service. You will still
1686
+ be charged usage for any applicable operations.
1687
+ */
1688
+ abortSignal?: AbortSignal;
1583
1689
  /** Number of output videos. */
1584
1690
  numberOfVideos?: number;
1585
1691
  /** The gcs bucket where to save the generated videos. */
@@ -1702,6 +1808,13 @@ export declare interface GenerationConfigRoutingConfigManualRoutingMode {
1702
1808
  export declare interface GetCachedContentConfig {
1703
1809
  /** Used to override HTTP request options. */
1704
1810
  httpOptions?: HttpOptions;
1811
+ /** Abort signal which can be used to cancel the request.
1812
+
1813
+ NOTE: AbortSignal is a client-only operation. Using it to cancel an
1814
+ operation will not cancel the request in the service. You will still
1815
+ be charged usage for any applicable operations.
1816
+ */
1817
+ abortSignal?: AbortSignal;
1705
1818
  }
1706
1819
 
1707
1820
  /** Parameters for caches.get method. */
@@ -1718,6 +1831,13 @@ export declare interface GetCachedContentParameters {
1718
1831
  export declare interface GetFileConfig {
1719
1832
  /** Used to override HTTP request options. */
1720
1833
  httpOptions?: HttpOptions;
1834
+ /** Abort signal which can be used to cancel the request.
1835
+
1836
+ NOTE: AbortSignal is a client-only operation. Using it to cancel an
1837
+ operation will not cancel the request in the service. You will still
1838
+ be charged usage for any applicable operations.
1839
+ */
1840
+ abortSignal?: AbortSignal;
1721
1841
  }
1722
1842
 
1723
1843
  /** Generates the parameters for the get method. */
@@ -1732,6 +1852,13 @@ export declare interface GetFileParameters {
1732
1852
  export declare interface GetModelConfig {
1733
1853
  /** Used to override HTTP request options. */
1734
1854
  httpOptions?: HttpOptions;
1855
+ /** Abort signal which can be used to cancel the request.
1856
+
1857
+ NOTE: AbortSignal is a client-only operation. Using it to cancel an
1858
+ operation will not cancel the request in the service. You will still
1859
+ be charged usage for any applicable operations.
1860
+ */
1861
+ abortSignal?: AbortSignal;
1735
1862
  }
1736
1863
 
1737
1864
  export declare interface GetModelParameters {
@@ -1743,6 +1870,13 @@ export declare interface GetModelParameters {
1743
1870
  export declare interface GetOperationConfig {
1744
1871
  /** Used to override HTTP request options. */
1745
1872
  httpOptions?: HttpOptions;
1873
+ /** Abort signal which can be used to cancel the request.
1874
+
1875
+ NOTE: AbortSignal is a client-only operation. Using it to cancel an
1876
+ operation will not cancel the request in the service. You will still
1877
+ be charged usage for any applicable operations.
1878
+ */
1879
+ abortSignal?: AbortSignal;
1746
1880
  }
1747
1881
 
1748
1882
  /** Parameters for the GET method. */
@@ -2038,6 +2172,10 @@ declare interface HttpRequest {
2038
2172
  * Optional set of customizable configuration for HTTP requests.
2039
2173
  */
2040
2174
  httpOptions?: HttpOptions;
2175
+ /**
2176
+ * Optional abort signal which can be used to cancel the request.
2177
+ */
2178
+ abortSignal?: AbortSignal;
2041
2179
  }
2042
2180
 
2043
2181
  /** A wrapper class for the http response. */
@@ -2086,6 +2224,13 @@ export declare enum Language {
2086
2224
  export declare interface ListCachedContentsConfig {
2087
2225
  /** Used to override HTTP request options. */
2088
2226
  httpOptions?: HttpOptions;
2227
+ /** Abort signal which can be used to cancel the request.
2228
+
2229
+ NOTE: AbortSignal is a client-only operation. Using it to cancel an
2230
+ operation will not cancel the request in the service. You will still
2231
+ be charged usage for any applicable operations.
2232
+ */
2233
+ abortSignal?: AbortSignal;
2089
2234
  pageSize?: number;
2090
2235
  pageToken?: string;
2091
2236
  }
@@ -2108,6 +2253,13 @@ export declare class ListCachedContentsResponse {
2108
2253
  export declare interface ListFilesConfig {
2109
2254
  /** Used to override HTTP request options. */
2110
2255
  httpOptions?: HttpOptions;
2256
+ /** Abort signal which can be used to cancel the request.
2257
+
2258
+ NOTE: AbortSignal is a client-only operation. Using it to cancel an
2259
+ operation will not cancel the request in the service. You will still
2260
+ be charged usage for any applicable operations.
2261
+ */
2262
+ abortSignal?: AbortSignal;
2111
2263
  pageSize?: number;
2112
2264
  pageToken?: string;
2113
2265
  }
@@ -2252,6 +2404,22 @@ export declare interface LiveClientMessage {
2252
2404
  export declare interface LiveClientRealtimeInput {
2253
2405
  /** Inlined bytes data for media input. */
2254
2406
  mediaChunks?: Blob_2[];
2407
+ /** The realtime audio input stream. */
2408
+ audio?: Blob_2;
2409
+ /**
2410
+ Indicates that the audio stream has ended, e.g. because the microphone was
2411
+ turned off.
2412
+
2413
+ This should only be sent when automatic activity detection is enabled
2414
+ (which is the default).
2415
+
2416
+ The client can reopen the stream by sending an audio message.
2417
+ */
2418
+ audioStreamEnd?: boolean;
2419
+ /** The realtime video input stream. */
2420
+ video?: Blob_2;
2421
+ /** The realtime text input stream. */
2422
+ text?: string;
2255
2423
  /** Marks the start of user activity. */
2256
2424
  activityStart?: ActivityStart;
2257
2425
  /** Marks the end of user activity. */
@@ -2407,7 +2575,23 @@ export declare interface LiveSendClientContentParameters {
2407
2575
  /** Parameters for sending realtime input to the live API. */
2408
2576
  export declare interface LiveSendRealtimeInputParameters {
2409
2577
  /** Realtime input to send to the session. */
2410
- media: Blob_2;
2578
+ media?: BlobImageUnion;
2579
+ /** The realtime audio input stream. */
2580
+ audio?: Blob_2;
2581
+ /**
2582
+ Indicates that the audio stream has ended, e.g. because the microphone was
2583
+ turned off.
2584
+
2585
+ This should only be sent when automatic activity detection is enabled
2586
+ (which is the default).
2587
+
2588
+ The client can reopen the stream by sending an audio message.
2589
+ */
2590
+ audioStreamEnd?: boolean;
2591
+ /** The realtime video input stream. */
2592
+ video?: BlobImageUnion;
2593
+ /** The realtime text input stream. */
2594
+ text?: string;
2411
2595
  /** Marks the start of user activity. */
2412
2596
  activityStart?: ActivityStart;
2413
2597
  /** Marks the end of user activity. */
@@ -3356,7 +3540,6 @@ export declare class Session {
3356
3540
  private readonly apiClient;
3357
3541
  constructor(conn: WebSocket_2, apiClient: ApiClient);
3358
3542
  private tLiveClientContent;
3359
- private tLiveClientRealtimeInput;
3360
3543
  private tLiveClienttToolResponse;
3361
3544
  /**
3362
3545
  Send a message over the established connection.
@@ -3486,6 +3669,28 @@ export declare interface SessionResumptionConfig {
3486
3669
  transparent?: boolean;
3487
3670
  }
3488
3671
 
3672
+ /**
3673
+ * Overrides the base URLs for the Gemini API and Vertex AI API.
3674
+ *
3675
+ * @remarks This function should be called before initializing the SDK. If the
3676
+ * base URLs are set after initializing the SDK, the base URLs will not be
3677
+ * updated. Base URLs provided in the HttpOptions will also take precedence over
3678
+ * URLs set here.
3679
+ *
3680
+ * @example
3681
+ * ```ts
3682
+ * import {GoogleGenAI, setDefaultBaseUrls} from '@google/genai';
3683
+ * // Override the base URL for the Gemini API.
3684
+ * setDefaultBaseUrls({geminiUrl:'https://gemini.google.com'});
3685
+ *
3686
+ * // Override the base URL for the Vertex AI API.
3687
+ * setDefaultBaseUrls({vertexUrl: 'https://vertexai.googleapis.com'});
3688
+ *
3689
+ * const ai = new GoogleGenAI({apiKey: 'GEMINI_API_KEY'});
3690
+ * ```
3691
+ */
3692
+ export declare function setDefaultBaseUrls(baseUrlParams: BaseUrlParameters): void;
3693
+
3489
3694
  /** Context window will be truncated by keeping only suffix of it.
3490
3695
 
3491
3696
  Context window will always be cut at start of USER role turn. System
@@ -3914,6 +4119,7 @@ declare namespace types {
3914
4119
  LiveSendRealtimeInputParameters,
3915
4120
  LiveSendToolResponseParameters,
3916
4121
  OperationGetParameters,
4122
+ BlobImageUnion,
3917
4123
  PartUnion,
3918
4124
  PartListUnion,
3919
4125
  ContentUnion,
@@ -3928,6 +4134,13 @@ declare namespace types {
3928
4134
  export declare interface UpdateCachedContentConfig {
3929
4135
  /** Used to override HTTP request options. */
3930
4136
  httpOptions?: HttpOptions;
4137
+ /** Abort signal which can be used to cancel the request.
4138
+
4139
+ NOTE: AbortSignal is a client-only operation. Using it to cancel an
4140
+ operation will not cancel the request in the service. You will still
4141
+ be charged usage for any applicable operations.
4142
+ */
4143
+ abortSignal?: AbortSignal;
3931
4144
  /** The TTL for this resource. The expiration time is computed: now + TTL. It is a duration string, with up to nine fractional digits, terminated by 's'. Example: "3.5s". */
3932
4145
  ttl?: string;
3933
4146
  /** Timestamp of when this resource is considered expired. Uses RFC 3339 format, Example: 2014-10-02T15:01:23Z. */
@@ -3970,6 +4183,13 @@ declare interface Uploader {
3970
4183
  export declare interface UploadFileConfig {
3971
4184
  /** Used to override HTTP request options. */
3972
4185
  httpOptions?: HttpOptions;
4186
+ /** Abort signal which can be used to cancel the request.
4187
+
4188
+ NOTE: AbortSignal is a client-only operation. Using it to cancel an
4189
+ operation will not cancel the request in the service. You will still
4190
+ be charged usage for any applicable operations.
4191
+ */
4192
+ abortSignal?: AbortSignal;
3973
4193
  /** The name of the file in the destination (e.g., 'files/sample-image'. If not provided one will be generated. */
3974
4194
  name?: string;
3975
4195
  /** mime_type: The MIME type of the file. If not provided, it will be inferred from the file extension. */
@@ -3995,6 +4215,13 @@ export declare interface UploadFileParameters {
3995
4215
  export declare interface UpscaleImageConfig {
3996
4216
  /** Used to override HTTP request options. */
3997
4217
  httpOptions?: HttpOptions;
4218
+ /** Abort signal which can be used to cancel the request.
4219
+
4220
+ NOTE: AbortSignal is a client-only operation. Using it to cancel an
4221
+ operation will not cancel the request in the service. You will still
4222
+ be charged usage for any applicable operations.
4223
+ */
4224
+ abortSignal?: AbortSignal;
3998
4225
  /** Whether to include a reason for filtered-out images in the
3999
4226
  response. */
4000
4227
  includeRaiReason?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google/genai",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "",
5
5
  "main": "dist/node/index.js",
6
6
  "module": "dist/web/index.mjs",