@firebase/ai 1.4.0 → 1.4.1-canary.2b5731292

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/ai.d.ts CHANGED
@@ -46,7 +46,7 @@ export declare class AIError extends FirebaseError {
46
46
  /**
47
47
  * Constructs a new instance of the `AIError` class.
48
48
  *
49
- * @param code - The error code from {@link AIErrorCode}.
49
+ * @param code - The error code from {@link (AIErrorCode:type)}.
50
50
  * @param message - A human-readable message describing the error.
51
51
  * @param customErrorData - Optional error data.
52
52
  */
@@ -58,36 +58,41 @@ export declare class AIError extends FirebaseError {
58
58
  *
59
59
  * @public
60
60
  */
61
- declare const enum AIErrorCode {
61
+ export declare const AIErrorCode: {
62
62
  /** A generic error occurred. */
63
- ERROR = "error",
63
+ readonly ERROR: "error";
64
64
  /** An error occurred in a request. */
65
- REQUEST_ERROR = "request-error",
65
+ readonly REQUEST_ERROR: "request-error";
66
66
  /** An error occurred in a response. */
67
- RESPONSE_ERROR = "response-error",
67
+ readonly RESPONSE_ERROR: "response-error";
68
68
  /** An error occurred while performing a fetch. */
69
- FETCH_ERROR = "fetch-error",
69
+ readonly FETCH_ERROR: "fetch-error";
70
70
  /** An error associated with a Content object. */
71
- INVALID_CONTENT = "invalid-content",
71
+ readonly INVALID_CONTENT: "invalid-content";
72
72
  /** An error due to the Firebase API not being enabled in the Console. */
73
- API_NOT_ENABLED = "api-not-enabled",
73
+ readonly API_NOT_ENABLED: "api-not-enabled";
74
74
  /** An error due to invalid Schema input. */
75
- INVALID_SCHEMA = "invalid-schema",
75
+ readonly INVALID_SCHEMA: "invalid-schema";
76
76
  /** An error occurred due to a missing Firebase API key. */
77
- NO_API_KEY = "no-api-key",
77
+ readonly NO_API_KEY: "no-api-key";
78
78
  /** An error occurred due to a missing Firebase app ID. */
79
- NO_APP_ID = "no-app-id",
79
+ readonly NO_APP_ID: "no-app-id";
80
80
  /** An error occurred due to a model name not being specified during initialization. */
81
- NO_MODEL = "no-model",
81
+ readonly NO_MODEL: "no-model";
82
82
  /** An error occurred due to a missing project ID. */
83
- NO_PROJECT_ID = "no-project-id",
83
+ readonly NO_PROJECT_ID: "no-project-id";
84
84
  /** An error occurred while parsing. */
85
- PARSE_FAILED = "parse-failed",
85
+ readonly PARSE_FAILED: "parse-failed";
86
86
  /** An error occurred due an attempt to use an unsupported feature. */
87
- UNSUPPORTED = "unsupported"
88
- }
89
- export { AIErrorCode }
90
- export { AIErrorCode as VertexAIErrorCode }
87
+ readonly UNSUPPORTED: "unsupported";
88
+ };
89
+
90
+ /**
91
+ * Standardized error codes that {@link AIError} can have.
92
+ *
93
+ * @public
94
+ */
95
+ export declare type AIErrorCode = (typeof AIErrorCode)[keyof typeof AIErrorCode];
91
96
 
92
97
  /**
93
98
  * Base class for Firebase AI model APIs.
@@ -253,24 +258,30 @@ export declare interface BaseParams {
253
258
  * Reason that a prompt was blocked.
254
259
  * @public
255
260
  */
256
- export declare enum BlockReason {
261
+ export declare const BlockReason: {
257
262
  /**
258
263
  * Content was blocked by safety settings.
259
264
  */
260
- SAFETY = "SAFETY",
265
+ readonly SAFETY: "SAFETY";
261
266
  /**
262
267
  * Content was blocked, but the reason is uncategorized.
263
268
  */
264
- OTHER = "OTHER",
269
+ readonly OTHER: "OTHER";
265
270
  /**
266
271
  * Content was blocked because it contained terms from the terminology blocklist.
267
272
  */
268
- BLOCKLIST = "BLOCKLIST",
273
+ readonly BLOCKLIST: "BLOCKLIST";
269
274
  /**
270
275
  * Content was blocked due to prohibited content.
271
276
  */
272
- PROHIBITED_CONTENT = "PROHIBITED_CONTENT"
273
- }
277
+ readonly PROHIBITED_CONTENT: "PROHIBITED_CONTENT";
278
+ };
279
+
280
+ /**
281
+ * Reason that a prompt was blocked.
282
+ * @public
283
+ */
284
+ export declare type BlockReason = (typeof BlockReason)[keyof typeof BlockReason];
274
285
 
275
286
  /**
276
287
  * Schema class for "boolean" types.
@@ -383,11 +394,10 @@ export declare interface CountTokensResponse {
383
394
  */
384
395
  totalTokens: number;
385
396
  /**
397
+ * @deprecated Use `totalTokens` instead. This property is undefined when using models greater than `gemini-1.5-*`.
398
+ *
386
399
  * The total number of billable characters counted across all instances
387
400
  * from the request.
388
- *
389
- * This property is only supported when using the Vertex AI Gemini API ({@link VertexAIBackend}).
390
- * When using the Gemini Developer API ({@link GoogleAIBackend}), this property is not supported and will default to 0.
391
401
  */
392
402
  totalBillableCharacters?: number;
393
403
  /**
@@ -488,44 +498,50 @@ export declare interface FileDataPart {
488
498
  * Reason that a candidate finished.
489
499
  * @public
490
500
  */
491
- export declare enum FinishReason {
501
+ export declare const FinishReason: {
492
502
  /**
493
503
  * Natural stop point of the model or provided stop sequence.
494
504
  */
495
- STOP = "STOP",
505
+ readonly STOP: "STOP";
496
506
  /**
497
507
  * The maximum number of tokens as specified in the request was reached.
498
508
  */
499
- MAX_TOKENS = "MAX_TOKENS",
509
+ readonly MAX_TOKENS: "MAX_TOKENS";
500
510
  /**
501
511
  * The candidate content was flagged for safety reasons.
502
512
  */
503
- SAFETY = "SAFETY",
513
+ readonly SAFETY: "SAFETY";
504
514
  /**
505
515
  * The candidate content was flagged for recitation reasons.
506
516
  */
507
- RECITATION = "RECITATION",
517
+ readonly RECITATION: "RECITATION";
508
518
  /**
509
519
  * Unknown reason.
510
520
  */
511
- OTHER = "OTHER",
521
+ readonly OTHER: "OTHER";
512
522
  /**
513
523
  * The candidate content contained forbidden terms.
514
524
  */
515
- BLOCKLIST = "BLOCKLIST",
525
+ readonly BLOCKLIST: "BLOCKLIST";
516
526
  /**
517
527
  * The candidate content potentially contained prohibited content.
518
528
  */
519
- PROHIBITED_CONTENT = "PROHIBITED_CONTENT",
529
+ readonly PROHIBITED_CONTENT: "PROHIBITED_CONTENT";
520
530
  /**
521
531
  * The candidate content potentially contained Sensitive Personally Identifiable Information (SPII).
522
532
  */
523
- SPII = "SPII",
533
+ readonly SPII: "SPII";
524
534
  /**
525
535
  * The function call generated by the model was invalid.
526
536
  */
527
- MALFORMED_FUNCTION_CALL = "MALFORMED_FUNCTION_CALL"
528
- }
537
+ readonly MALFORMED_FUNCTION_CALL: "MALFORMED_FUNCTION_CALL";
538
+ };
539
+
540
+ /**
541
+ * Reason that a candidate finished.
542
+ * @public
543
+ */
544
+ export declare type FinishReason = (typeof FinishReason)[keyof typeof FinishReason];
529
545
 
530
546
  /**
531
547
  * A predicted {@link FunctionCall} returned from the model
@@ -549,25 +565,27 @@ export declare interface FunctionCallingConfig {
549
565
  /**
550
566
  * @public
551
567
  */
552
- export declare enum FunctionCallingMode {
568
+ export declare const FunctionCallingMode: {
553
569
  /**
554
570
  * Default model behavior; model decides to predict either a function call
555
571
  * or a natural language response.
556
572
  */
557
- AUTO = "AUTO",
573
+ readonly AUTO: "AUTO";
558
574
  /**
559
575
  * Model is constrained to always predicting a function call only.
560
576
  * If `allowed_function_names` is set, the predicted function call will be
561
577
  * limited to any one of `allowed_function_names`, else the predicted
562
578
  * function call will be any one of the provided `function_declarations`.
563
579
  */
564
- ANY = "ANY",
580
+ readonly ANY: "ANY";
565
581
  /**
566
582
  * Model will not predict any function call. Model behavior is same as when
567
583
  * not passing any function declarations.
568
584
  */
569
- NONE = "NONE"
570
- }
585
+ readonly NONE: "NONE";
586
+ };
587
+
588
+ export declare type FunctionCallingMode = (typeof FunctionCallingMode)[keyof typeof FunctionCallingMode];
571
589
 
572
590
  /**
573
591
  * Content part interface if the part represents a {@link FunctionCall}.
@@ -606,7 +624,7 @@ export declare interface FunctionDeclaration {
606
624
  * format. Reflects the Open API 3.03 Parameter Object. Parameter names are
607
625
  * case-sensitive. For a function with no parameters, this can be left unset.
608
626
  */
609
- parameters?: ObjectSchemaInterface;
627
+ parameters?: ObjectSchema | ObjectSchemaRequest;
610
628
  }
611
629
 
612
630
  /**
@@ -753,6 +771,10 @@ export declare interface GenerationConfig {
753
771
  * @beta
754
772
  */
755
773
  responseModalities?: ResponseModality[];
774
+ /**
775
+ * Configuration for "thinking" behavior of compatible Gemini models.
776
+ */
777
+ thinkingConfig?: ThinkingConfig;
756
778
  }
757
779
 
758
780
  /**
@@ -856,22 +878,6 @@ export declare function getGenerativeModel(ai: AI, modelParams: ModelParams, req
856
878
  */
857
879
  export declare function getImagenModel(ai: AI, modelParams: ImagenModelParams, requestOptions?: RequestOptions): ImagenModel;
858
880
 
859
- /**
860
- * @deprecated Use the new {@link getAI | getAI()} instead. The Vertex AI in Firebase SDK has been
861
- * replaced with the Firebase AI SDK to accommodate the evolving set of supported features and
862
- * services. For migration details, see the {@link https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk | migration guide}.
863
- *
864
- * Returns a {@link VertexAI} instance for the given app, configured to use the
865
- * Vertex AI Gemini API. This instance will be
866
- * configured to use the Vertex AI Gemini API.
867
- *
868
- * @param app - The {@link @firebase/app#FirebaseApp} to use.
869
- * @param options - Options to configure the Vertex AI instance, including the location.
870
- *
871
- * @public
872
- */
873
- export declare function getVertexAI(app?: FirebaseApp, options?: VertexAIOptions): VertexAI;
874
-
875
881
  /**
876
882
  * Configuration class for the Gemini Developer API.
877
883
  *
@@ -929,6 +935,42 @@ export declare interface GoogleAIGenerateContentResponse {
929
935
  usageMetadata?: UsageMetadata;
930
936
  }
931
937
 
938
+ /**
939
+ * Specifies the Google Search configuration.
940
+ *
941
+ * @remarks Currently, this is an empty object, but it's reserved for future configuration options.
942
+ *
943
+ * @public
944
+ */
945
+ export declare interface GoogleSearch {
946
+ }
947
+
948
+ /**
949
+ * A tool that allows a Gemini model to connect to Google Search to access and incorporate
950
+ * up-to-date information from the web into its responses.
951
+ *
952
+ * Important: If using Grounding with Google Search, you are required to comply with the
953
+ * "Grounding with Google Search" usage requirements for your chosen API provider: {@link https://ai.google.dev/gemini-api/terms#grounding-with-google-search | Gemini Developer API}
954
+ * or Vertex AI Gemini API (see {@link https://cloud.google.com/terms/service-terms | Service Terms}
955
+ * section within the Service Specific Terms).
956
+ *
957
+ * @public
958
+ */
959
+ export declare interface GoogleSearchTool {
960
+ /**
961
+ * Specifies the Google Search configuration.
962
+ * Currently, this is an empty object, but it's reserved for future configuration options.
963
+ * Specifies the Google Search configuration. Currently, this is an empty object, but it's
964
+ * reserved for future configuration options.
965
+ *
966
+ * When using this feature, you are required to comply with the "Grounding with Google Search"
967
+ * usage requirements for your chosen API provider: {@link https://ai.google.dev/gemini-api/terms#grounding-with-google-search | Gemini Developer API}
968
+ * or Vertex AI Gemini API (see {@link https://cloud.google.com/terms/service-terms | Service Terms}
969
+ * section within the Service Specific Terms).
970
+ */
971
+ googleSearch: GoogleSearch;
972
+ }
973
+
932
974
  /**
933
975
  * @deprecated
934
976
  * @public
@@ -941,125 +983,221 @@ export declare interface GroundingAttribution {
941
983
  }
942
984
 
943
985
  /**
944
- * Metadata returned to client when grounding is enabled.
986
+ * Represents a chunk of retrieved data that supports a claim in the model's response. This is part
987
+ * of the grounding information provided when grounding is enabled.
988
+ *
989
+ * @public
990
+ */
991
+ export declare interface GroundingChunk {
992
+ /**
993
+ * Contains details if the grounding chunk is from a web source.
994
+ */
995
+ web?: WebGroundingChunk;
996
+ }
997
+
998
+ /**
999
+ * Metadata returned when grounding is enabled.
1000
+ *
1001
+ * Currently, only Grounding with Google Search is supported (see {@link GoogleSearchTool}).
1002
+ *
1003
+ * Important: If using Grounding with Google Search, you are required to comply with the
1004
+ * "Grounding with Google Search" usage requirements for your chosen API provider: {@link https://ai.google.dev/gemini-api/terms#grounding-with-google-search | Gemini Developer API}
1005
+ * or Vertex AI Gemini API (see {@link https://cloud.google.com/terms/service-terms | Service Terms}
1006
+ * section within the Service Specific Terms).
1007
+ *
945
1008
  * @public
946
1009
  */
947
1010
  export declare interface GroundingMetadata {
1011
+ /**
1012
+ * Google Search entry point for web searches. This contains an HTML/CSS snippet that must be
1013
+ * embedded in an app to display a Google Search entry point for follow-up web searches related to
1014
+ * a model's “Grounded Response”.
1015
+ */
1016
+ searchEntryPoint?: SearchEntrypoint;
1017
+ /**
1018
+ * A list of {@link GroundingChunk} objects. Each chunk represents a piece of retrieved content
1019
+ * (for example, from a web page). that the model used to ground its response.
1020
+ */
1021
+ groundingChunks?: GroundingChunk[];
1022
+ /**
1023
+ * A list of {@link GroundingSupport} objects. Each object details how specific segments of the
1024
+ * model's response are supported by the `groundingChunks`.
1025
+ */
1026
+ groundingSupports?: GroundingSupport[];
1027
+ /**
1028
+ * A list of web search queries that the model performed to gather the grounding information.
1029
+ * These can be used to allow users to explore the search results themselves.
1030
+ */
948
1031
  webSearchQueries?: string[];
1032
+ /**
1033
+ * @deprecated Use {@link GroundingSupport} instead.
1034
+ */
949
1035
  retrievalQueries?: string[];
950
1036
  /**
951
- * @deprecated
1037
+ * @deprecated Use {@link GroundingChunk} instead.
952
1038
  */
953
1039
  groundingAttributions: GroundingAttribution[];
954
1040
  }
955
1041
 
1042
+ /**
1043
+ * Provides information about how a specific segment of the model's response is supported by the
1044
+ * retrieved grounding chunks.
1045
+ *
1046
+ * @public
1047
+ */
1048
+ export declare interface GroundingSupport {
1049
+ /**
1050
+ * Specifies the segment of the model's response content that this grounding support pertains to.
1051
+ */
1052
+ segment?: Segment;
1053
+ /**
1054
+ * A list of indices that refer to specific {@link GroundingChunk} objects within the
1055
+ * {@link GroundingMetadata.groundingChunks} array. These referenced chunks
1056
+ * are the sources that support the claim made in the associated `segment` of the response.
1057
+ * For example, an array `[1, 3, 4]` means that `groundingChunks[1]`, `groundingChunks[3]`,
1058
+ * and `groundingChunks[4]` are the retrieved content supporting this part of the response.
1059
+ */
1060
+ groundingChunkIndices?: number[];
1061
+ }
1062
+
956
1063
  /**
957
1064
  * This property is not supported in the Gemini Developer API ({@link GoogleAIBackend}).
958
1065
  *
959
1066
  * @public
960
1067
  */
961
- export declare enum HarmBlockMethod {
1068
+ export declare const HarmBlockMethod: {
962
1069
  /**
963
1070
  * The harm block method uses both probability and severity scores.
964
1071
  */
965
- SEVERITY = "SEVERITY",
1072
+ readonly SEVERITY: "SEVERITY";
966
1073
  /**
967
1074
  * The harm block method uses the probability score.
968
1075
  */
969
- PROBABILITY = "PROBABILITY"
970
- }
1076
+ readonly PROBABILITY: "PROBABILITY";
1077
+ };
1078
+
1079
+ /**
1080
+ * This property is not supported in the Gemini Developer API ({@link GoogleAIBackend}).
1081
+ *
1082
+ * @public
1083
+ */
1084
+ export declare type HarmBlockMethod = (typeof HarmBlockMethod)[keyof typeof HarmBlockMethod];
971
1085
 
972
1086
  /**
973
1087
  * Threshold above which a prompt or candidate will be blocked.
974
1088
  * @public
975
1089
  */
976
- export declare enum HarmBlockThreshold {
1090
+ export declare const HarmBlockThreshold: {
977
1091
  /**
978
1092
  * Content with `NEGLIGIBLE` will be allowed.
979
1093
  */
980
- BLOCK_LOW_AND_ABOVE = "BLOCK_LOW_AND_ABOVE",
1094
+ readonly BLOCK_LOW_AND_ABOVE: "BLOCK_LOW_AND_ABOVE";
981
1095
  /**
982
1096
  * Content with `NEGLIGIBLE` and `LOW` will be allowed.
983
1097
  */
984
- BLOCK_MEDIUM_AND_ABOVE = "BLOCK_MEDIUM_AND_ABOVE",
1098
+ readonly BLOCK_MEDIUM_AND_ABOVE: "BLOCK_MEDIUM_AND_ABOVE";
985
1099
  /**
986
1100
  * Content with `NEGLIGIBLE`, `LOW`, and `MEDIUM` will be allowed.
987
1101
  */
988
- BLOCK_ONLY_HIGH = "BLOCK_ONLY_HIGH",
1102
+ readonly BLOCK_ONLY_HIGH: "BLOCK_ONLY_HIGH";
989
1103
  /**
990
1104
  * All content will be allowed.
991
1105
  */
992
- BLOCK_NONE = "BLOCK_NONE",
1106
+ readonly BLOCK_NONE: "BLOCK_NONE";
993
1107
  /**
994
1108
  * All content will be allowed. This is the same as `BLOCK_NONE`, but the metadata corresponding
995
1109
  * to the {@link HarmCategory} will not be present in the response.
996
1110
  */
997
- OFF = "OFF"
998
- }
1111
+ readonly OFF: "OFF";
1112
+ };
1113
+
1114
+ /**
1115
+ * Threshold above which a prompt or candidate will be blocked.
1116
+ * @public
1117
+ */
1118
+ export declare type HarmBlockThreshold = (typeof HarmBlockThreshold)[keyof typeof HarmBlockThreshold];
999
1119
 
1000
1120
  /**
1001
1121
  * Harm categories that would cause prompts or candidates to be blocked.
1002
1122
  * @public
1003
1123
  */
1004
- export declare enum HarmCategory {
1005
- HARM_CATEGORY_HATE_SPEECH = "HARM_CATEGORY_HATE_SPEECH",
1006
- HARM_CATEGORY_SEXUALLY_EXPLICIT = "HARM_CATEGORY_SEXUALLY_EXPLICIT",
1007
- HARM_CATEGORY_HARASSMENT = "HARM_CATEGORY_HARASSMENT",
1008
- HARM_CATEGORY_DANGEROUS_CONTENT = "HARM_CATEGORY_DANGEROUS_CONTENT"
1009
- }
1124
+ export declare const HarmCategory: {
1125
+ readonly HARM_CATEGORY_HATE_SPEECH: "HARM_CATEGORY_HATE_SPEECH";
1126
+ readonly HARM_CATEGORY_SEXUALLY_EXPLICIT: "HARM_CATEGORY_SEXUALLY_EXPLICIT";
1127
+ readonly HARM_CATEGORY_HARASSMENT: "HARM_CATEGORY_HARASSMENT";
1128
+ readonly HARM_CATEGORY_DANGEROUS_CONTENT: "HARM_CATEGORY_DANGEROUS_CONTENT";
1129
+ };
1130
+
1131
+ /**
1132
+ * Harm categories that would cause prompts or candidates to be blocked.
1133
+ * @public
1134
+ */
1135
+ export declare type HarmCategory = (typeof HarmCategory)[keyof typeof HarmCategory];
1010
1136
 
1011
1137
  /**
1012
1138
  * Probability that a prompt or candidate matches a harm category.
1013
1139
  * @public
1014
1140
  */
1015
- export declare enum HarmProbability {
1141
+ export declare const HarmProbability: {
1016
1142
  /**
1017
1143
  * Content has a negligible chance of being unsafe.
1018
1144
  */
1019
- NEGLIGIBLE = "NEGLIGIBLE",
1145
+ readonly NEGLIGIBLE: "NEGLIGIBLE";
1020
1146
  /**
1021
1147
  * Content has a low chance of being unsafe.
1022
1148
  */
1023
- LOW = "LOW",
1149
+ readonly LOW: "LOW";
1024
1150
  /**
1025
1151
  * Content has a medium chance of being unsafe.
1026
1152
  */
1027
- MEDIUM = "MEDIUM",
1153
+ readonly MEDIUM: "MEDIUM";
1028
1154
  /**
1029
1155
  * Content has a high chance of being unsafe.
1030
1156
  */
1031
- HIGH = "HIGH"
1032
- }
1157
+ readonly HIGH: "HIGH";
1158
+ };
1159
+
1160
+ /**
1161
+ * Probability that a prompt or candidate matches a harm category.
1162
+ * @public
1163
+ */
1164
+ export declare type HarmProbability = (typeof HarmProbability)[keyof typeof HarmProbability];
1033
1165
 
1034
1166
  /**
1035
1167
  * Harm severity levels.
1036
1168
  * @public
1037
1169
  */
1038
- export declare enum HarmSeverity {
1170
+ export declare const HarmSeverity: {
1039
1171
  /**
1040
1172
  * Negligible level of harm severity.
1041
1173
  */
1042
- HARM_SEVERITY_NEGLIGIBLE = "HARM_SEVERITY_NEGLIGIBLE",
1174
+ readonly HARM_SEVERITY_NEGLIGIBLE: "HARM_SEVERITY_NEGLIGIBLE";
1043
1175
  /**
1044
1176
  * Low level of harm severity.
1045
1177
  */
1046
- HARM_SEVERITY_LOW = "HARM_SEVERITY_LOW",
1178
+ readonly HARM_SEVERITY_LOW: "HARM_SEVERITY_LOW";
1047
1179
  /**
1048
1180
  * Medium level of harm severity.
1049
1181
  */
1050
- HARM_SEVERITY_MEDIUM = "HARM_SEVERITY_MEDIUM",
1182
+ readonly HARM_SEVERITY_MEDIUM: "HARM_SEVERITY_MEDIUM";
1051
1183
  /**
1052
1184
  * High level of harm severity.
1053
1185
  */
1054
- HARM_SEVERITY_HIGH = "HARM_SEVERITY_HIGH",
1186
+ readonly HARM_SEVERITY_HIGH: "HARM_SEVERITY_HIGH";
1055
1187
  /**
1056
1188
  * Harm severity is not supported.
1057
1189
  *
1058
1190
  * @remarks
1059
1191
  * The GoogleAI backend does not support `HarmSeverity`, so this value is used as a fallback.
1060
1192
  */
1061
- HARM_SEVERITY_UNSUPPORTED = "HARM_SEVERITY_UNSUPPORTED"
1062
- }
1193
+ readonly HARM_SEVERITY_UNSUPPORTED: "HARM_SEVERITY_UNSUPPORTED";
1194
+ };
1195
+
1196
+ /**
1197
+ * Harm severity levels.
1198
+ * @public
1199
+ */
1200
+ export declare type HarmSeverity = (typeof HarmSeverity)[keyof typeof HarmSeverity];
1063
1201
 
1064
1202
  /**
1065
1203
  * Aspect ratios for Imagen images.
@@ -1072,28 +1210,41 @@ export declare enum HarmSeverity {
1072
1210
  *
1073
1211
  * @beta
1074
1212
  */
1075
- export declare enum ImagenAspectRatio {
1213
+ export declare const ImagenAspectRatio: {
1076
1214
  /**
1077
1215
  * Square (1:1) aspect ratio.
1078
1216
  */
1079
- SQUARE = "1:1",
1217
+ readonly SQUARE: "1:1";
1080
1218
  /**
1081
1219
  * Landscape (3:4) aspect ratio.
1082
1220
  */
1083
- LANDSCAPE_3x4 = "3:4",
1221
+ readonly LANDSCAPE_3x4: "3:4";
1084
1222
  /**
1085
1223
  * Portrait (4:3) aspect ratio.
1086
1224
  */
1087
- PORTRAIT_4x3 = "4:3",
1225
+ readonly PORTRAIT_4x3: "4:3";
1088
1226
  /**
1089
1227
  * Landscape (16:9) aspect ratio.
1090
1228
  */
1091
- LANDSCAPE_16x9 = "16:9",
1229
+ readonly LANDSCAPE_16x9: "16:9";
1092
1230
  /**
1093
1231
  * Portrait (9:16) aspect ratio.
1094
1232
  */
1095
- PORTRAIT_9x16 = "9:16"
1096
- }
1233
+ readonly PORTRAIT_9x16: "9:16";
1234
+ };
1235
+
1236
+ /**
1237
+ * Aspect ratios for Imagen images.
1238
+ *
1239
+ * To specify an aspect ratio for generated images, set the `aspectRatio` property in your
1240
+ * {@link ImagenGenerationConfig}.
1241
+ *
1242
+ * See the the {@link http://firebase.google.com/docs/vertex-ai/generate-images | documentation }
1243
+ * for more details and examples of the supported aspect ratios.
1244
+ *
1245
+ * @beta
1246
+ */
1247
+ export declare type ImagenAspectRatio = (typeof ImagenAspectRatio)[keyof typeof ImagenAspectRatio];
1097
1248
 
1098
1249
  /**
1099
1250
  * An image generated by Imagen, stored in a Cloud Storage for Firebase bucket.
@@ -1145,7 +1296,7 @@ export declare interface ImagenGenerationConfig {
1145
1296
  numberOfImages?: number;
1146
1297
  /**
1147
1298
  * The aspect ratio of the generated images. The default value is square 1:1.
1148
- * Supported aspect ratios depend on the Imagen model, see {@link ImagenAspectRatio}
1299
+ * Supported aspect ratios depend on the Imagen model, see {@link (ImagenAspectRatio:type)}
1149
1300
  * for more details.
1150
1301
  */
1151
1302
  aspectRatio?: ImagenAspectRatio;
@@ -1187,8 +1338,8 @@ export declare interface ImagenGenerationResponse<T extends ImagenInlineImage |
1187
1338
  * The reason that images were filtered out. This property will only be defined if one
1188
1339
  * or more images were filtered.
1189
1340
  *
1190
- * Images may be filtered out due to the {@link ImagenSafetyFilterLevel},
1191
- * {@link ImagenPersonFilterLevel}, or filtering included in the model.
1341
+ * Images may be filtered out due to the {@link (ImagenSafetyFilterLevel:type)},
1342
+ * {@link (ImagenPersonFilterLevel:type)}, or filtering included in the model.
1192
1343
  * The filter levels may be adjusted in your {@link ImagenSafetySettings}.
1193
1344
  *
1194
1345
  * See the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen | Responsible AI and usage guidelines for Imagen}
@@ -1411,11 +1562,11 @@ export declare interface ImagenModelParams {
1411
1562
  *
1412
1563
  * @beta
1413
1564
  */
1414
- export declare enum ImagenPersonFilterLevel {
1565
+ export declare const ImagenPersonFilterLevel: {
1415
1566
  /**
1416
1567
  * Disallow generation of images containing people or faces; images of people are filtered out.
1417
1568
  */
1418
- BLOCK_ALL = "dont_allow",
1569
+ readonly BLOCK_ALL: "dont_allow";
1419
1570
  /**
1420
1571
  * Allow generation of images containing adults only; images of children are filtered out.
1421
1572
  *
@@ -1423,7 +1574,7 @@ export declare enum ImagenPersonFilterLevel {
1423
1574
  * reviewed and approved by Cloud support; see the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#person-face-gen | Responsible AI and usage guidelines}
1424
1575
  * for more details.
1425
1576
  */
1426
- ALLOW_ADULT = "allow_adult",
1577
+ readonly ALLOW_ADULT: "allow_adult";
1427
1578
  /**
1428
1579
  * Allow generation of images containing adults only; images of children are filtered out.
1429
1580
  *
@@ -1431,8 +1582,18 @@ export declare enum ImagenPersonFilterLevel {
1431
1582
  * reviewed and approved by Cloud support; see the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#person-face-gen | Responsible AI and usage guidelines}
1432
1583
  * for more details.
1433
1584
  */
1434
- ALLOW_ALL = "allow_all"
1435
- }
1585
+ readonly ALLOW_ALL: "allow_all";
1586
+ };
1587
+
1588
+ /**
1589
+ * A filter level controlling whether generation of images containing people or faces is allowed.
1590
+ *
1591
+ * See the <a href="http://firebase.google.com/docs/vertex-ai/generate-images">personGeneration</a>
1592
+ * documentation for more details.
1593
+ *
1594
+ * @beta
1595
+ */
1596
+ export declare type ImagenPersonFilterLevel = (typeof ImagenPersonFilterLevel)[keyof typeof ImagenPersonFilterLevel];
1436
1597
 
1437
1598
  /**
1438
1599
  * A filter level controlling how aggressively to filter sensitive content.
@@ -1446,27 +1607,41 @@ export declare enum ImagenPersonFilterLevel {
1446
1607
  *
1447
1608
  * @beta
1448
1609
  */
1449
- export declare enum ImagenSafetyFilterLevel {
1610
+ export declare const ImagenSafetyFilterLevel: {
1450
1611
  /**
1451
1612
  * The most aggressive filtering level; most strict blocking.
1452
1613
  */
1453
- BLOCK_LOW_AND_ABOVE = "block_low_and_above",
1614
+ readonly BLOCK_LOW_AND_ABOVE: "block_low_and_above";
1454
1615
  /**
1455
1616
  * Blocks some sensitive prompts and responses.
1456
1617
  */
1457
- BLOCK_MEDIUM_AND_ABOVE = "block_medium_and_above",
1618
+ readonly BLOCK_MEDIUM_AND_ABOVE: "block_medium_and_above";
1458
1619
  /**
1459
1620
  * Blocks few sensitive prompts and responses.
1460
1621
  */
1461
- BLOCK_ONLY_HIGH = "block_only_high",
1622
+ readonly BLOCK_ONLY_HIGH: "block_only_high";
1462
1623
  /**
1463
1624
  * The least aggressive filtering level; blocks very few sensitive prompts and responses.
1464
1625
  *
1465
1626
  * Access to this feature is restricted and may require your case to be reviewed and approved by
1466
1627
  * Cloud support.
1467
1628
  */
1468
- BLOCK_NONE = "block_none"
1469
- }
1629
+ readonly BLOCK_NONE: "block_none";
1630
+ };
1631
+
1632
+ /**
1633
+ * A filter level controlling how aggressively to filter sensitive content.
1634
+ *
1635
+ * Text prompts provided as inputs and images (generated or uploaded) through Imagen on Vertex AI
1636
+ * are assessed against a list of safety filters, which include 'harmful categories' (for example,
1637
+ * `violence`, `sexual`, `derogatory`, and `toxic`). This filter level controls how aggressively to
1638
+ * filter out potentially harmful content from responses. See the {@link http://firebase.google.com/docs/vertex-ai/generate-images | documentation }
1639
+ * and the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-filters | Responsible AI and usage guidelines}
1640
+ * for more details.
1641
+ *
1642
+ * @beta
1643
+ */
1644
+ export declare type ImagenSafetyFilterLevel = (typeof ImagenSafetyFilterLevel)[keyof typeof ImagenSafetyFilterLevel];
1470
1645
 
1471
1646
  /**
1472
1647
  * Settings for controlling the aggressiveness of filtering out sensitive content.
@@ -1515,32 +1690,38 @@ export declare class IntegerSchema extends Schema {
1515
1690
  * Content part modality.
1516
1691
  * @public
1517
1692
  */
1518
- export declare enum Modality {
1693
+ export declare const Modality: {
1519
1694
  /**
1520
1695
  * Unspecified modality.
1521
1696
  */
1522
- MODALITY_UNSPECIFIED = "MODALITY_UNSPECIFIED",
1697
+ readonly MODALITY_UNSPECIFIED: "MODALITY_UNSPECIFIED";
1523
1698
  /**
1524
1699
  * Plain text.
1525
1700
  */
1526
- TEXT = "TEXT",
1701
+ readonly TEXT: "TEXT";
1527
1702
  /**
1528
1703
  * Image.
1529
1704
  */
1530
- IMAGE = "IMAGE",
1705
+ readonly IMAGE: "IMAGE";
1531
1706
  /**
1532
1707
  * Video.
1533
1708
  */
1534
- VIDEO = "VIDEO",
1709
+ readonly VIDEO: "VIDEO";
1535
1710
  /**
1536
1711
  * Audio.
1537
1712
  */
1538
- AUDIO = "AUDIO",
1713
+ readonly AUDIO: "AUDIO";
1539
1714
  /**
1540
1715
  * Document (for example, PDF).
1541
1716
  */
1542
- DOCUMENT = "DOCUMENT"
1543
- }
1717
+ readonly DOCUMENT: "DOCUMENT";
1718
+ };
1719
+
1720
+ /**
1721
+ * Content part modality.
1722
+ * @public
1723
+ */
1724
+ export declare type Modality = (typeof Modality)[keyof typeof Modality];
1544
1725
 
1545
1726
  /**
1546
1727
  * Represents token counting info for a single modality.
@@ -1593,12 +1774,20 @@ export declare class ObjectSchema extends Schema {
1593
1774
  }
1594
1775
 
1595
1776
  /**
1596
- * Interface for {@link ObjectSchema} class.
1777
+ * Interface for JSON parameters in a schema of {@link SchemaType}
1778
+ * "object" when not using the `Schema.object()` helper.
1597
1779
  * @public
1598
1780
  */
1599
- export declare interface ObjectSchemaInterface extends SchemaInterface {
1600
- type: SchemaType.OBJECT;
1601
- optionalProperties?: string[];
1781
+ export declare interface ObjectSchemaRequest extends SchemaRequest {
1782
+ type: 'object';
1783
+ /**
1784
+ * This is not a property accepted in the final request to the backend, but is
1785
+ * a client-side convenience property that is only usable by constructing
1786
+ * a schema through the `Schema.object()` helper method. Populating this
1787
+ * property will cause response errors if the object is not wrapped with
1788
+ * `Schema.object()`.
1789
+ */
1790
+ optionalProperties?: never;
1602
1791
  }
1603
1792
 
1604
1793
  /**
@@ -1758,7 +1947,7 @@ export declare interface SafetySetting {
1758
1947
  export declare abstract class Schema implements SchemaInterface {
1759
1948
  /**
1760
1949
  * Optional. The type of the property. {@link
1761
- * SchemaType}.
1950
+ * (SchemaType:type)}.
1762
1951
  */
1763
1952
  type: SchemaType;
1764
1953
  /** Optional. The format of the property.
@@ -1774,9 +1963,9 @@ export declare abstract class Schema implements SchemaInterface {
1774
1963
  description?: string;
1775
1964
  /** Optional. The items of the property. */
1776
1965
  items?: SchemaInterface;
1777
- /** The minimum number of items (elements) in a schema of type {@link SchemaType.ARRAY}. */
1966
+ /** The minimum number of items (elements) in a schema of {@link (SchemaType:type)} `array`. */
1778
1967
  minItems?: number;
1779
- /** The maximum number of items (elements) in a schema of type {@link SchemaType.ARRAY}. */
1968
+ /** The maximum number of items (elements) in a schema of {@link (SchemaType:type)} `array`. */
1780
1969
  maxItems?: number;
1781
1970
  /** Optional. Whether the property is nullable. Defaults to false. */
1782
1971
  nullable: boolean;
@@ -1819,7 +2008,7 @@ export declare abstract class Schema implements SchemaInterface {
1819
2008
  export declare interface SchemaInterface extends SchemaShared<SchemaInterface> {
1820
2009
  /**
1821
2010
  * The type of the property. {@link
1822
- * SchemaType}.
2011
+ * (SchemaType:type)}.
1823
2012
  */
1824
2013
  type: SchemaType;
1825
2014
  }
@@ -1839,7 +2028,7 @@ export declare interface SchemaParams extends SchemaShared<SchemaInterface> {
1839
2028
  export declare interface SchemaRequest extends SchemaShared<SchemaRequest> {
1840
2029
  /**
1841
2030
  * The type of the property. {@link
1842
- * SchemaType}.
2031
+ * (SchemaType:type)}.
1843
2032
  */
1844
2033
  type: SchemaType;
1845
2034
  /** Optional. Array of required property. */
@@ -1867,9 +2056,9 @@ export declare interface SchemaShared<T> {
1867
2056
  title?: string;
1868
2057
  /** Optional. The items of the property. */
1869
2058
  items?: T;
1870
- /** The minimum number of items (elements) in a schema of type {@link SchemaType.ARRAY}. */
2059
+ /** The minimum number of items (elements) in a schema of {@link (SchemaType:type)} `array`. */
1871
2060
  minItems?: number;
1872
- /** The maximum number of items (elements) in a schema of type {@link SchemaType.ARRAY}. */
2061
+ /** The maximum number of items (elements) in a schema of {@link (SchemaType:type)} `array`. */
1873
2062
  maxItems?: number;
1874
2063
  /** Optional. Map of `Schema` objects. */
1875
2064
  properties?: {
@@ -1890,50 +2079,88 @@ export declare interface SchemaShared<T> {
1890
2079
  [key: string]: unknown;
1891
2080
  }
1892
2081
 
1893
- /**
1894
- * @license
1895
- * Copyright 2024 Google LLC
1896
- *
1897
- * Licensed under the Apache License, Version 2.0 (the "License");
1898
- * you may not use this file except in compliance with the License.
1899
- * You may obtain a copy of the License at
1900
- *
1901
- * http://www.apache.org/licenses/LICENSE-2.0
1902
- *
1903
- * Unless required by applicable law or agreed to in writing, software
1904
- * distributed under the License is distributed on an "AS IS" BASIS,
1905
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1906
- * See the License for the specific language governing permissions and
1907
- * limitations under the License.
1908
- */
1909
2082
  /**
1910
2083
  * Contains the list of OpenAPI data types
1911
2084
  * as defined by the
1912
2085
  * {@link https://swagger.io/docs/specification/data-models/data-types/ | OpenAPI specification}
1913
2086
  * @public
1914
2087
  */
1915
- export declare enum SchemaType {
2088
+ export declare const SchemaType: {
1916
2089
  /** String type. */
1917
- STRING = "string",
2090
+ readonly STRING: "string";
1918
2091
  /** Number type. */
1919
- NUMBER = "number",
2092
+ readonly NUMBER: "number";
1920
2093
  /** Integer type. */
1921
- INTEGER = "integer",
2094
+ readonly INTEGER: "integer";
1922
2095
  /** Boolean type. */
1923
- BOOLEAN = "boolean",
2096
+ readonly BOOLEAN: "boolean";
1924
2097
  /** Array type. */
1925
- ARRAY = "array",
2098
+ readonly ARRAY: "array";
1926
2099
  /** Object type. */
1927
- OBJECT = "object"
2100
+ readonly OBJECT: "object";
2101
+ };
2102
+
2103
+ /**
2104
+ * Contains the list of OpenAPI data types
2105
+ * as defined by the
2106
+ * {@link https://swagger.io/docs/specification/data-models/data-types/ | OpenAPI specification}
2107
+ * @public
2108
+ */
2109
+ export declare type SchemaType = (typeof SchemaType)[keyof typeof SchemaType];
2110
+
2111
+ /**
2112
+ * Google search entry point.
2113
+ *
2114
+ * @public
2115
+ */
2116
+ export declare interface SearchEntrypoint {
2117
+ /**
2118
+ * HTML/CSS snippet that must be embedded in a web page. The snippet is designed to avoid
2119
+ * undesired interaction with the rest of the page's CSS.
2120
+ *
2121
+ * To ensure proper rendering and prevent CSS conflicts, it is recommended
2122
+ * to encapsulate this `renderedContent` within a shadow DOM when embedding it
2123
+ * into a webpage. See {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_shadow_DOM | MDN: Using shadow DOM}.
2124
+ *
2125
+ * @example
2126
+ * ```javascript
2127
+ * const container = document.createElement('div');
2128
+ * document.body.appendChild(container);
2129
+ * container.attachShadow({ mode: 'open' }).innerHTML = renderedContent;
2130
+ * ```
2131
+ */
2132
+ renderedContent?: string;
1928
2133
  }
1929
2134
 
1930
2135
  /**
2136
+ * Represents a specific segment within a {@link Content} object, often used to
2137
+ * pinpoint the exact location of text or data that grounding information refers to.
2138
+ *
1931
2139
  * @public
1932
2140
  */
1933
2141
  export declare interface Segment {
2142
+ /**
2143
+ * The zero-based index of the {@link Part} object within the `parts` array
2144
+ * of its parent {@link Content} object. This identifies which part of the
2145
+ * content the segment belongs to.
2146
+ */
1934
2147
  partIndex: number;
2148
+ /**
2149
+ * The zero-based start index of the segment within the specified `Part`,
2150
+ * measured in UTF-8 bytes. This offset is inclusive, starting from 0 at the
2151
+ * beginning of the part's content (e.g., `Part.text`).
2152
+ */
1935
2153
  startIndex: number;
2154
+ /**
2155
+ * The zero-based end index of the segment within the specified `Part`,
2156
+ * measured in UTF-8 bytes. This offset is exclusive, meaning the character
2157
+ * at this index is not included in the segment.
2158
+ */
1936
2159
  endIndex: number;
2160
+ /**
2161
+ * The text corresponding to the segment from the response.
2162
+ */
2163
+ text: string;
1937
2164
  }
1938
2165
 
1939
2166
  /**
@@ -1972,11 +2199,36 @@ export declare interface TextPart {
1972
2199
  functionResponse?: never;
1973
2200
  }
1974
2201
 
2202
+ /**
2203
+ * Configuration for "thinking" behavior of compatible Gemini models.
2204
+ *
2205
+ * Certain models utilize a thinking process before generating a response. This allows them to
2206
+ * reason through complex problems and plan a more coherent and accurate answer.
2207
+ *
2208
+ * @public
2209
+ */
2210
+ export declare interface ThinkingConfig {
2211
+ /**
2212
+ * The thinking budget, in tokens.
2213
+ *
2214
+ * This parameter sets an upper limit on the number of tokens the model can use for its internal
2215
+ * "thinking" process. A higher budget may result in higher quality responses for complex tasks
2216
+ * but can also increase latency and cost.
2217
+ *
2218
+ * If you don't specify a budget, the model will determine the appropriate amount
2219
+ * of thinking based on the complexity of the prompt.
2220
+ *
2221
+ * An error will be thrown if you set a thinking budget for a model that does not support this
2222
+ * feature or if the specified budget is not within the model's supported range.
2223
+ */
2224
+ thinkingBudget?: number;
2225
+ }
2226
+
1975
2227
  /**
1976
2228
  * Defines a tool that model can call to access external knowledge.
1977
2229
  * @public
1978
2230
  */
1979
- export declare type Tool = FunctionDeclarationsTool;
2231
+ export declare type Tool = FunctionDeclarationsTool | GoogleSearchTool;
1980
2232
 
1981
2233
  /**
1982
2234
  * Tool config. This config is shared for all tools provided in the request.
@@ -2000,22 +2252,15 @@ export declare type TypedSchema = IntegerSchema | NumberSchema | StringSchema |
2000
2252
  export declare interface UsageMetadata {
2001
2253
  promptTokenCount: number;
2002
2254
  candidatesTokenCount: number;
2255
+ /**
2256
+ * The number of tokens used by the model's internal "thinking" process.
2257
+ */
2258
+ thoughtsTokenCount?: number;
2003
2259
  totalTokenCount: number;
2004
2260
  promptTokensDetails?: ModalityTokenCount[];
2005
2261
  candidatesTokensDetails?: ModalityTokenCount[];
2006
2262
  }
2007
2263
 
2008
- /**
2009
- * @deprecated Use the new {@link AI | AI} instead. The Vertex AI in Firebase SDK has been
2010
- * replaced with the Firebase AI SDK to accommodate the evolving set of supported features and
2011
- * services. For migration details, see the {@link https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk | migration guide}.
2012
- *
2013
- * An instance of the Firebase AI SDK.
2014
- *
2015
- * @public
2016
- */
2017
- export declare type VertexAI = AI;
2018
-
2019
2264
  /**
2020
2265
  * Configuration class for the Vertex AI Gemini API.
2021
2266
  *
@@ -2041,37 +2286,6 @@ export declare class VertexAIBackend extends Backend {
2041
2286
  constructor(location?: string);
2042
2287
  }
2043
2288
 
2044
- /**
2045
- * @deprecated Use the new {@link AIError} instead. The Vertex AI in Firebase SDK has been
2046
- * replaced with the Firebase AI SDK to accommodate the evolving set of supported features and
2047
- * services. For migration details, see the {@link https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk | migration guide}.
2048
- *
2049
- * Error class for the Firebase AI SDK.
2050
- *
2051
- * @public
2052
- */
2053
- export declare const VertexAIError: typeof AIError;
2054
-
2055
- /**
2056
- * @deprecated Use the new {@link AIModel} instead. The Vertex AI in Firebase SDK has been
2057
- * replaced with the Firebase AI SDK to accommodate the evolving set of supported features and
2058
- * services. For migration details, see the {@link https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk | migration guide}.
2059
- *
2060
- * Base class for Firebase AI model APIs.
2061
- *
2062
- * @public
2063
- */
2064
- export declare const VertexAIModel: typeof AIModel;
2065
-
2066
- /**
2067
- * Options when initializing the Firebase AI SDK.
2068
- *
2069
- * @public
2070
- */
2071
- export declare interface VertexAIOptions {
2072
- location?: string;
2073
- }
2074
-
2075
2289
  /**
2076
2290
  * Describes the input video content.
2077
2291
  * @public
@@ -2097,4 +2311,31 @@ export declare interface WebAttribution {
2097
2311
  title: string;
2098
2312
  }
2099
2313
 
2314
+ /**
2315
+ * A grounding chunk from the web.
2316
+ *
2317
+ * Important: If using Grounding with Google Search, you are required to comply with the
2318
+ * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search".
2319
+ *
2320
+ * @public
2321
+ */
2322
+ export declare interface WebGroundingChunk {
2323
+ /**
2324
+ * The URI of the retrieved web page.
2325
+ */
2326
+ uri?: string;
2327
+ /**
2328
+ * The title of the retrieved web page.
2329
+ */
2330
+ title?: string;
2331
+ /**
2332
+ * The domain of the original URI from which the content was retrieved.
2333
+ *
2334
+ * This property is only supported in the Vertex AI Gemini API ({@link VertexAIBackend}).
2335
+ * When using the Gemini Developer API ({@link GoogleAIBackend}), this property will be
2336
+ * `undefined`.
2337
+ */
2338
+ domain?: string;
2339
+ }
2340
+
2100
2341
  export { }