@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.
@@ -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.
@@ -216,24 +221,30 @@ export declare interface BaseParams {
216
221
  * Reason that a prompt was blocked.
217
222
  * @public
218
223
  */
219
- export declare enum BlockReason {
224
+ export declare const BlockReason: {
220
225
  /**
221
226
  * Content was blocked by safety settings.
222
227
  */
223
- SAFETY = "SAFETY",
228
+ readonly SAFETY: "SAFETY";
224
229
  /**
225
230
  * Content was blocked, but the reason is uncategorized.
226
231
  */
227
- OTHER = "OTHER",
232
+ readonly OTHER: "OTHER";
228
233
  /**
229
234
  * Content was blocked because it contained terms from the terminology blocklist.
230
235
  */
231
- BLOCKLIST = "BLOCKLIST",
236
+ readonly BLOCKLIST: "BLOCKLIST";
232
237
  /**
233
238
  * Content was blocked due to prohibited content.
234
239
  */
235
- PROHIBITED_CONTENT = "PROHIBITED_CONTENT"
236
- }
240
+ readonly PROHIBITED_CONTENT: "PROHIBITED_CONTENT";
241
+ };
242
+
243
+ /**
244
+ * Reason that a prompt was blocked.
245
+ * @public
246
+ */
247
+ export declare type BlockReason = (typeof BlockReason)[keyof typeof BlockReason];
237
248
 
238
249
  /**
239
250
  * Schema class for "boolean" types.
@@ -346,11 +357,10 @@ export declare interface CountTokensResponse {
346
357
  */
347
358
  totalTokens: number;
348
359
  /**
360
+ * @deprecated Use `totalTokens` instead. This property is undefined when using models greater than `gemini-1.5-*`.
361
+ *
349
362
  * The total number of billable characters counted across all instances
350
363
  * from the request.
351
- *
352
- * This property is only supported when using the Vertex AI Gemini API ({@link VertexAIBackend}).
353
- * When using the Gemini Developer API ({@link GoogleAIBackend}), this property is not supported and will default to 0.
354
364
  */
355
365
  totalBillableCharacters?: number;
356
366
  /**
@@ -451,44 +461,50 @@ export declare interface FileDataPart {
451
461
  * Reason that a candidate finished.
452
462
  * @public
453
463
  */
454
- export declare enum FinishReason {
464
+ export declare const FinishReason: {
455
465
  /**
456
466
  * Natural stop point of the model or provided stop sequence.
457
467
  */
458
- STOP = "STOP",
468
+ readonly STOP: "STOP";
459
469
  /**
460
470
  * The maximum number of tokens as specified in the request was reached.
461
471
  */
462
- MAX_TOKENS = "MAX_TOKENS",
472
+ readonly MAX_TOKENS: "MAX_TOKENS";
463
473
  /**
464
474
  * The candidate content was flagged for safety reasons.
465
475
  */
466
- SAFETY = "SAFETY",
476
+ readonly SAFETY: "SAFETY";
467
477
  /**
468
478
  * The candidate content was flagged for recitation reasons.
469
479
  */
470
- RECITATION = "RECITATION",
480
+ readonly RECITATION: "RECITATION";
471
481
  /**
472
482
  * Unknown reason.
473
483
  */
474
- OTHER = "OTHER",
484
+ readonly OTHER: "OTHER";
475
485
  /**
476
486
  * The candidate content contained forbidden terms.
477
487
  */
478
- BLOCKLIST = "BLOCKLIST",
488
+ readonly BLOCKLIST: "BLOCKLIST";
479
489
  /**
480
490
  * The candidate content potentially contained prohibited content.
481
491
  */
482
- PROHIBITED_CONTENT = "PROHIBITED_CONTENT",
492
+ readonly PROHIBITED_CONTENT: "PROHIBITED_CONTENT";
483
493
  /**
484
494
  * The candidate content potentially contained Sensitive Personally Identifiable Information (SPII).
485
495
  */
486
- SPII = "SPII",
496
+ readonly SPII: "SPII";
487
497
  /**
488
498
  * The function call generated by the model was invalid.
489
499
  */
490
- MALFORMED_FUNCTION_CALL = "MALFORMED_FUNCTION_CALL"
491
- }
500
+ readonly MALFORMED_FUNCTION_CALL: "MALFORMED_FUNCTION_CALL";
501
+ };
502
+
503
+ /**
504
+ * Reason that a candidate finished.
505
+ * @public
506
+ */
507
+ export declare type FinishReason = (typeof FinishReason)[keyof typeof FinishReason];
492
508
 
493
509
  /**
494
510
  * A predicted {@link FunctionCall} returned from the model
@@ -512,25 +528,27 @@ export declare interface FunctionCallingConfig {
512
528
  /**
513
529
  * @public
514
530
  */
515
- export declare enum FunctionCallingMode {
531
+ export declare const FunctionCallingMode: {
516
532
  /**
517
533
  * Default model behavior; model decides to predict either a function call
518
534
  * or a natural language response.
519
535
  */
520
- AUTO = "AUTO",
536
+ readonly AUTO: "AUTO";
521
537
  /**
522
538
  * Model is constrained to always predicting a function call only.
523
539
  * If `allowed_function_names` is set, the predicted function call will be
524
540
  * limited to any one of `allowed_function_names`, else the predicted
525
541
  * function call will be any one of the provided `function_declarations`.
526
542
  */
527
- ANY = "ANY",
543
+ readonly ANY: "ANY";
528
544
  /**
529
545
  * Model will not predict any function call. Model behavior is same as when
530
546
  * not passing any function declarations.
531
547
  */
532
- NONE = "NONE"
533
- }
548
+ readonly NONE: "NONE";
549
+ };
550
+
551
+ export declare type FunctionCallingMode = (typeof FunctionCallingMode)[keyof typeof FunctionCallingMode];
534
552
 
535
553
  /**
536
554
  * Content part interface if the part represents a {@link FunctionCall}.
@@ -569,7 +587,7 @@ export declare interface FunctionDeclaration {
569
587
  * format. Reflects the Open API 3.03 Parameter Object. Parameter names are
570
588
  * case-sensitive. For a function with no parameters, this can be left unset.
571
589
  */
572
- parameters?: ObjectSchemaInterface;
590
+ parameters?: ObjectSchema | ObjectSchemaRequest;
573
591
  }
574
592
 
575
593
  /**
@@ -716,6 +734,10 @@ export declare interface GenerationConfig {
716
734
  * @beta
717
735
  */
718
736
  responseModalities?: ResponseModality[];
737
+ /**
738
+ * Configuration for "thinking" behavior of compatible Gemini models.
739
+ */
740
+ thinkingConfig?: ThinkingConfig;
719
741
  }
720
742
 
721
743
  /**
@@ -819,22 +841,6 @@ export declare function getGenerativeModel(ai: AI, modelParams: ModelParams, req
819
841
  */
820
842
  export declare function getImagenModel(ai: AI, modelParams: ImagenModelParams, requestOptions?: RequestOptions): ImagenModel;
821
843
 
822
- /**
823
- * @deprecated Use the new {@link getAI | getAI()} instead. The Vertex AI in Firebase SDK has been
824
- * replaced with the Firebase AI SDK to accommodate the evolving set of supported features and
825
- * services. For migration details, see the {@link https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk | migration guide}.
826
- *
827
- * Returns a {@link VertexAI} instance for the given app, configured to use the
828
- * Vertex AI Gemini API. This instance will be
829
- * configured to use the Vertex AI Gemini API.
830
- *
831
- * @param app - The {@link @firebase/app#FirebaseApp} to use.
832
- * @param options - Options to configure the Vertex AI instance, including the location.
833
- *
834
- * @public
835
- */
836
- export declare function getVertexAI(app?: FirebaseApp, options?: VertexAIOptions): VertexAI;
837
-
838
844
  /**
839
845
  * Configuration class for the Gemini Developer API.
840
846
  *
@@ -858,6 +864,42 @@ export declare class GoogleAIBackend extends Backend {
858
864
 
859
865
  /* Excluded from this release type: GoogleAIGenerateContentResponse */
860
866
 
867
+ /**
868
+ * Specifies the Google Search configuration.
869
+ *
870
+ * @remarks Currently, this is an empty object, but it's reserved for future configuration options.
871
+ *
872
+ * @public
873
+ */
874
+ export declare interface GoogleSearch {
875
+ }
876
+
877
+ /**
878
+ * A tool that allows a Gemini model to connect to Google Search to access and incorporate
879
+ * up-to-date information from the web into its responses.
880
+ *
881
+ * Important: If using Grounding with Google Search, you are required to comply with the
882
+ * "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}
883
+ * or Vertex AI Gemini API (see {@link https://cloud.google.com/terms/service-terms | Service Terms}
884
+ * section within the Service Specific Terms).
885
+ *
886
+ * @public
887
+ */
888
+ export declare interface GoogleSearchTool {
889
+ /**
890
+ * Specifies the Google Search configuration.
891
+ * Currently, this is an empty object, but it's reserved for future configuration options.
892
+ * Specifies the Google Search configuration. Currently, this is an empty object, but it's
893
+ * reserved for future configuration options.
894
+ *
895
+ * When using this feature, you are required to comply with the "Grounding with Google Search"
896
+ * usage requirements for your chosen API provider: {@link https://ai.google.dev/gemini-api/terms#grounding-with-google-search | Gemini Developer API}
897
+ * or Vertex AI Gemini API (see {@link https://cloud.google.com/terms/service-terms | Service Terms}
898
+ * section within the Service Specific Terms).
899
+ */
900
+ googleSearch: GoogleSearch;
901
+ }
902
+
861
903
  /**
862
904
  * @deprecated
863
905
  * @public
@@ -870,125 +912,221 @@ export declare interface GroundingAttribution {
870
912
  }
871
913
 
872
914
  /**
873
- * Metadata returned to client when grounding is enabled.
915
+ * Represents a chunk of retrieved data that supports a claim in the model's response. This is part
916
+ * of the grounding information provided when grounding is enabled.
917
+ *
918
+ * @public
919
+ */
920
+ export declare interface GroundingChunk {
921
+ /**
922
+ * Contains details if the grounding chunk is from a web source.
923
+ */
924
+ web?: WebGroundingChunk;
925
+ }
926
+
927
+ /**
928
+ * Metadata returned when grounding is enabled.
929
+ *
930
+ * Currently, only Grounding with Google Search is supported (see {@link GoogleSearchTool}).
931
+ *
932
+ * Important: If using Grounding with Google Search, you are required to comply with the
933
+ * "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}
934
+ * or Vertex AI Gemini API (see {@link https://cloud.google.com/terms/service-terms | Service Terms}
935
+ * section within the Service Specific Terms).
936
+ *
874
937
  * @public
875
938
  */
876
939
  export declare interface GroundingMetadata {
940
+ /**
941
+ * Google Search entry point for web searches. This contains an HTML/CSS snippet that must be
942
+ * embedded in an app to display a Google Search entry point for follow-up web searches related to
943
+ * a model's “Grounded Response”.
944
+ */
945
+ searchEntryPoint?: SearchEntrypoint;
946
+ /**
947
+ * A list of {@link GroundingChunk} objects. Each chunk represents a piece of retrieved content
948
+ * (for example, from a web page). that the model used to ground its response.
949
+ */
950
+ groundingChunks?: GroundingChunk[];
951
+ /**
952
+ * A list of {@link GroundingSupport} objects. Each object details how specific segments of the
953
+ * model's response are supported by the `groundingChunks`.
954
+ */
955
+ groundingSupports?: GroundingSupport[];
956
+ /**
957
+ * A list of web search queries that the model performed to gather the grounding information.
958
+ * These can be used to allow users to explore the search results themselves.
959
+ */
877
960
  webSearchQueries?: string[];
961
+ /**
962
+ * @deprecated Use {@link GroundingSupport} instead.
963
+ */
878
964
  retrievalQueries?: string[];
879
965
  /**
880
- * @deprecated
966
+ * @deprecated Use {@link GroundingChunk} instead.
881
967
  */
882
968
  groundingAttributions: GroundingAttribution[];
883
969
  }
884
970
 
971
+ /**
972
+ * Provides information about how a specific segment of the model's response is supported by the
973
+ * retrieved grounding chunks.
974
+ *
975
+ * @public
976
+ */
977
+ export declare interface GroundingSupport {
978
+ /**
979
+ * Specifies the segment of the model's response content that this grounding support pertains to.
980
+ */
981
+ segment?: Segment;
982
+ /**
983
+ * A list of indices that refer to specific {@link GroundingChunk} objects within the
984
+ * {@link GroundingMetadata.groundingChunks} array. These referenced chunks
985
+ * are the sources that support the claim made in the associated `segment` of the response.
986
+ * For example, an array `[1, 3, 4]` means that `groundingChunks[1]`, `groundingChunks[3]`,
987
+ * and `groundingChunks[4]` are the retrieved content supporting this part of the response.
988
+ */
989
+ groundingChunkIndices?: number[];
990
+ }
991
+
885
992
  /**
886
993
  * This property is not supported in the Gemini Developer API ({@link GoogleAIBackend}).
887
994
  *
888
995
  * @public
889
996
  */
890
- export declare enum HarmBlockMethod {
997
+ export declare const HarmBlockMethod: {
891
998
  /**
892
999
  * The harm block method uses both probability and severity scores.
893
1000
  */
894
- SEVERITY = "SEVERITY",
1001
+ readonly SEVERITY: "SEVERITY";
895
1002
  /**
896
1003
  * The harm block method uses the probability score.
897
1004
  */
898
- PROBABILITY = "PROBABILITY"
899
- }
1005
+ readonly PROBABILITY: "PROBABILITY";
1006
+ };
1007
+
1008
+ /**
1009
+ * This property is not supported in the Gemini Developer API ({@link GoogleAIBackend}).
1010
+ *
1011
+ * @public
1012
+ */
1013
+ export declare type HarmBlockMethod = (typeof HarmBlockMethod)[keyof typeof HarmBlockMethod];
900
1014
 
901
1015
  /**
902
1016
  * Threshold above which a prompt or candidate will be blocked.
903
1017
  * @public
904
1018
  */
905
- export declare enum HarmBlockThreshold {
1019
+ export declare const HarmBlockThreshold: {
906
1020
  /**
907
1021
  * Content with `NEGLIGIBLE` will be allowed.
908
1022
  */
909
- BLOCK_LOW_AND_ABOVE = "BLOCK_LOW_AND_ABOVE",
1023
+ readonly BLOCK_LOW_AND_ABOVE: "BLOCK_LOW_AND_ABOVE";
910
1024
  /**
911
1025
  * Content with `NEGLIGIBLE` and `LOW` will be allowed.
912
1026
  */
913
- BLOCK_MEDIUM_AND_ABOVE = "BLOCK_MEDIUM_AND_ABOVE",
1027
+ readonly BLOCK_MEDIUM_AND_ABOVE: "BLOCK_MEDIUM_AND_ABOVE";
914
1028
  /**
915
1029
  * Content with `NEGLIGIBLE`, `LOW`, and `MEDIUM` will be allowed.
916
1030
  */
917
- BLOCK_ONLY_HIGH = "BLOCK_ONLY_HIGH",
1031
+ readonly BLOCK_ONLY_HIGH: "BLOCK_ONLY_HIGH";
918
1032
  /**
919
1033
  * All content will be allowed.
920
1034
  */
921
- BLOCK_NONE = "BLOCK_NONE",
1035
+ readonly BLOCK_NONE: "BLOCK_NONE";
922
1036
  /**
923
1037
  * All content will be allowed. This is the same as `BLOCK_NONE`, but the metadata corresponding
924
1038
  * to the {@link HarmCategory} will not be present in the response.
925
1039
  */
926
- OFF = "OFF"
927
- }
1040
+ readonly OFF: "OFF";
1041
+ };
1042
+
1043
+ /**
1044
+ * Threshold above which a prompt or candidate will be blocked.
1045
+ * @public
1046
+ */
1047
+ export declare type HarmBlockThreshold = (typeof HarmBlockThreshold)[keyof typeof HarmBlockThreshold];
928
1048
 
929
1049
  /**
930
1050
  * Harm categories that would cause prompts or candidates to be blocked.
931
1051
  * @public
932
1052
  */
933
- export declare enum HarmCategory {
934
- HARM_CATEGORY_HATE_SPEECH = "HARM_CATEGORY_HATE_SPEECH",
935
- HARM_CATEGORY_SEXUALLY_EXPLICIT = "HARM_CATEGORY_SEXUALLY_EXPLICIT",
936
- HARM_CATEGORY_HARASSMENT = "HARM_CATEGORY_HARASSMENT",
937
- HARM_CATEGORY_DANGEROUS_CONTENT = "HARM_CATEGORY_DANGEROUS_CONTENT"
938
- }
1053
+ export declare const HarmCategory: {
1054
+ readonly HARM_CATEGORY_HATE_SPEECH: "HARM_CATEGORY_HATE_SPEECH";
1055
+ readonly HARM_CATEGORY_SEXUALLY_EXPLICIT: "HARM_CATEGORY_SEXUALLY_EXPLICIT";
1056
+ readonly HARM_CATEGORY_HARASSMENT: "HARM_CATEGORY_HARASSMENT";
1057
+ readonly HARM_CATEGORY_DANGEROUS_CONTENT: "HARM_CATEGORY_DANGEROUS_CONTENT";
1058
+ };
1059
+
1060
+ /**
1061
+ * Harm categories that would cause prompts or candidates to be blocked.
1062
+ * @public
1063
+ */
1064
+ export declare type HarmCategory = (typeof HarmCategory)[keyof typeof HarmCategory];
939
1065
 
940
1066
  /**
941
1067
  * Probability that a prompt or candidate matches a harm category.
942
1068
  * @public
943
1069
  */
944
- export declare enum HarmProbability {
1070
+ export declare const HarmProbability: {
945
1071
  /**
946
1072
  * Content has a negligible chance of being unsafe.
947
1073
  */
948
- NEGLIGIBLE = "NEGLIGIBLE",
1074
+ readonly NEGLIGIBLE: "NEGLIGIBLE";
949
1075
  /**
950
1076
  * Content has a low chance of being unsafe.
951
1077
  */
952
- LOW = "LOW",
1078
+ readonly LOW: "LOW";
953
1079
  /**
954
1080
  * Content has a medium chance of being unsafe.
955
1081
  */
956
- MEDIUM = "MEDIUM",
1082
+ readonly MEDIUM: "MEDIUM";
957
1083
  /**
958
1084
  * Content has a high chance of being unsafe.
959
1085
  */
960
- HIGH = "HIGH"
961
- }
1086
+ readonly HIGH: "HIGH";
1087
+ };
1088
+
1089
+ /**
1090
+ * Probability that a prompt or candidate matches a harm category.
1091
+ * @public
1092
+ */
1093
+ export declare type HarmProbability = (typeof HarmProbability)[keyof typeof HarmProbability];
962
1094
 
963
1095
  /**
964
1096
  * Harm severity levels.
965
1097
  * @public
966
1098
  */
967
- export declare enum HarmSeverity {
1099
+ export declare const HarmSeverity: {
968
1100
  /**
969
1101
  * Negligible level of harm severity.
970
1102
  */
971
- HARM_SEVERITY_NEGLIGIBLE = "HARM_SEVERITY_NEGLIGIBLE",
1103
+ readonly HARM_SEVERITY_NEGLIGIBLE: "HARM_SEVERITY_NEGLIGIBLE";
972
1104
  /**
973
1105
  * Low level of harm severity.
974
1106
  */
975
- HARM_SEVERITY_LOW = "HARM_SEVERITY_LOW",
1107
+ readonly HARM_SEVERITY_LOW: "HARM_SEVERITY_LOW";
976
1108
  /**
977
1109
  * Medium level of harm severity.
978
1110
  */
979
- HARM_SEVERITY_MEDIUM = "HARM_SEVERITY_MEDIUM",
1111
+ readonly HARM_SEVERITY_MEDIUM: "HARM_SEVERITY_MEDIUM";
980
1112
  /**
981
1113
  * High level of harm severity.
982
1114
  */
983
- HARM_SEVERITY_HIGH = "HARM_SEVERITY_HIGH",
1115
+ readonly HARM_SEVERITY_HIGH: "HARM_SEVERITY_HIGH";
984
1116
  /**
985
1117
  * Harm severity is not supported.
986
1118
  *
987
1119
  * @remarks
988
1120
  * The GoogleAI backend does not support `HarmSeverity`, so this value is used as a fallback.
989
1121
  */
990
- HARM_SEVERITY_UNSUPPORTED = "HARM_SEVERITY_UNSUPPORTED"
991
- }
1122
+ readonly HARM_SEVERITY_UNSUPPORTED: "HARM_SEVERITY_UNSUPPORTED";
1123
+ };
1124
+
1125
+ /**
1126
+ * Harm severity levels.
1127
+ * @public
1128
+ */
1129
+ export declare type HarmSeverity = (typeof HarmSeverity)[keyof typeof HarmSeverity];
992
1130
 
993
1131
  /**
994
1132
  * Aspect ratios for Imagen images.
@@ -1001,28 +1139,41 @@ export declare enum HarmSeverity {
1001
1139
  *
1002
1140
  * @beta
1003
1141
  */
1004
- export declare enum ImagenAspectRatio {
1142
+ export declare const ImagenAspectRatio: {
1005
1143
  /**
1006
1144
  * Square (1:1) aspect ratio.
1007
1145
  */
1008
- SQUARE = "1:1",
1146
+ readonly SQUARE: "1:1";
1009
1147
  /**
1010
1148
  * Landscape (3:4) aspect ratio.
1011
1149
  */
1012
- LANDSCAPE_3x4 = "3:4",
1150
+ readonly LANDSCAPE_3x4: "3:4";
1013
1151
  /**
1014
1152
  * Portrait (4:3) aspect ratio.
1015
1153
  */
1016
- PORTRAIT_4x3 = "4:3",
1154
+ readonly PORTRAIT_4x3: "4:3";
1017
1155
  /**
1018
1156
  * Landscape (16:9) aspect ratio.
1019
1157
  */
1020
- LANDSCAPE_16x9 = "16:9",
1158
+ readonly LANDSCAPE_16x9: "16:9";
1021
1159
  /**
1022
1160
  * Portrait (9:16) aspect ratio.
1023
1161
  */
1024
- PORTRAIT_9x16 = "9:16"
1025
- }
1162
+ readonly PORTRAIT_9x16: "9:16";
1163
+ };
1164
+
1165
+ /**
1166
+ * Aspect ratios for Imagen images.
1167
+ *
1168
+ * To specify an aspect ratio for generated images, set the `aspectRatio` property in your
1169
+ * {@link ImagenGenerationConfig}.
1170
+ *
1171
+ * See the the {@link http://firebase.google.com/docs/vertex-ai/generate-images | documentation }
1172
+ * for more details and examples of the supported aspect ratios.
1173
+ *
1174
+ * @beta
1175
+ */
1176
+ export declare type ImagenAspectRatio = (typeof ImagenAspectRatio)[keyof typeof ImagenAspectRatio];
1026
1177
 
1027
1178
  /**
1028
1179
  * An image generated by Imagen, stored in a Cloud Storage for Firebase bucket.
@@ -1074,7 +1225,7 @@ export declare interface ImagenGenerationConfig {
1074
1225
  numberOfImages?: number;
1075
1226
  /**
1076
1227
  * The aspect ratio of the generated images. The default value is square 1:1.
1077
- * Supported aspect ratios depend on the Imagen model, see {@link ImagenAspectRatio}
1228
+ * Supported aspect ratios depend on the Imagen model, see {@link (ImagenAspectRatio:type)}
1078
1229
  * for more details.
1079
1230
  */
1080
1231
  aspectRatio?: ImagenAspectRatio;
@@ -1116,8 +1267,8 @@ export declare interface ImagenGenerationResponse<T extends ImagenInlineImage |
1116
1267
  * The reason that images were filtered out. This property will only be defined if one
1117
1268
  * or more images were filtered.
1118
1269
  *
1119
- * Images may be filtered out due to the {@link ImagenSafetyFilterLevel},
1120
- * {@link ImagenPersonFilterLevel}, or filtering included in the model.
1270
+ * Images may be filtered out due to the {@link (ImagenSafetyFilterLevel:type)},
1271
+ * {@link (ImagenPersonFilterLevel:type)}, or filtering included in the model.
1121
1272
  * The filter levels may be adjusted in your {@link ImagenSafetySettings}.
1122
1273
  *
1123
1274
  * See the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen | Responsible AI and usage guidelines for Imagen}
@@ -1321,11 +1472,11 @@ export declare interface ImagenModelParams {
1321
1472
  *
1322
1473
  * @beta
1323
1474
  */
1324
- export declare enum ImagenPersonFilterLevel {
1475
+ export declare const ImagenPersonFilterLevel: {
1325
1476
  /**
1326
1477
  * Disallow generation of images containing people or faces; images of people are filtered out.
1327
1478
  */
1328
- BLOCK_ALL = "dont_allow",
1479
+ readonly BLOCK_ALL: "dont_allow";
1329
1480
  /**
1330
1481
  * Allow generation of images containing adults only; images of children are filtered out.
1331
1482
  *
@@ -1333,7 +1484,7 @@ export declare enum ImagenPersonFilterLevel {
1333
1484
  * 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}
1334
1485
  * for more details.
1335
1486
  */
1336
- ALLOW_ADULT = "allow_adult",
1487
+ readonly ALLOW_ADULT: "allow_adult";
1337
1488
  /**
1338
1489
  * Allow generation of images containing adults only; images of children are filtered out.
1339
1490
  *
@@ -1341,8 +1492,18 @@ export declare enum ImagenPersonFilterLevel {
1341
1492
  * 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}
1342
1493
  * for more details.
1343
1494
  */
1344
- ALLOW_ALL = "allow_all"
1345
- }
1495
+ readonly ALLOW_ALL: "allow_all";
1496
+ };
1497
+
1498
+ /**
1499
+ * A filter level controlling whether generation of images containing people or faces is allowed.
1500
+ *
1501
+ * See the <a href="http://firebase.google.com/docs/vertex-ai/generate-images">personGeneration</a>
1502
+ * documentation for more details.
1503
+ *
1504
+ * @beta
1505
+ */
1506
+ export declare type ImagenPersonFilterLevel = (typeof ImagenPersonFilterLevel)[keyof typeof ImagenPersonFilterLevel];
1346
1507
 
1347
1508
  /**
1348
1509
  * A filter level controlling how aggressively to filter sensitive content.
@@ -1356,27 +1517,41 @@ export declare enum ImagenPersonFilterLevel {
1356
1517
  *
1357
1518
  * @beta
1358
1519
  */
1359
- export declare enum ImagenSafetyFilterLevel {
1520
+ export declare const ImagenSafetyFilterLevel: {
1360
1521
  /**
1361
1522
  * The most aggressive filtering level; most strict blocking.
1362
1523
  */
1363
- BLOCK_LOW_AND_ABOVE = "block_low_and_above",
1524
+ readonly BLOCK_LOW_AND_ABOVE: "block_low_and_above";
1364
1525
  /**
1365
1526
  * Blocks some sensitive prompts and responses.
1366
1527
  */
1367
- BLOCK_MEDIUM_AND_ABOVE = "block_medium_and_above",
1528
+ readonly BLOCK_MEDIUM_AND_ABOVE: "block_medium_and_above";
1368
1529
  /**
1369
1530
  * Blocks few sensitive prompts and responses.
1370
1531
  */
1371
- BLOCK_ONLY_HIGH = "block_only_high",
1532
+ readonly BLOCK_ONLY_HIGH: "block_only_high";
1372
1533
  /**
1373
1534
  * The least aggressive filtering level; blocks very few sensitive prompts and responses.
1374
1535
  *
1375
1536
  * Access to this feature is restricted and may require your case to be reviewed and approved by
1376
1537
  * Cloud support.
1377
1538
  */
1378
- BLOCK_NONE = "block_none"
1379
- }
1539
+ readonly BLOCK_NONE: "block_none";
1540
+ };
1541
+
1542
+ /**
1543
+ * A filter level controlling how aggressively to filter sensitive content.
1544
+ *
1545
+ * Text prompts provided as inputs and images (generated or uploaded) through Imagen on Vertex AI
1546
+ * are assessed against a list of safety filters, which include 'harmful categories' (for example,
1547
+ * `violence`, `sexual`, `derogatory`, and `toxic`). This filter level controls how aggressively to
1548
+ * filter out potentially harmful content from responses. See the {@link http://firebase.google.com/docs/vertex-ai/generate-images | documentation }
1549
+ * and the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-filters | Responsible AI and usage guidelines}
1550
+ * for more details.
1551
+ *
1552
+ * @beta
1553
+ */
1554
+ export declare type ImagenSafetyFilterLevel = (typeof ImagenSafetyFilterLevel)[keyof typeof ImagenSafetyFilterLevel];
1380
1555
 
1381
1556
  /**
1382
1557
  * Settings for controlling the aggressiveness of filtering out sensitive content.
@@ -1425,32 +1600,38 @@ export declare class IntegerSchema extends Schema {
1425
1600
  * Content part modality.
1426
1601
  * @public
1427
1602
  */
1428
- export declare enum Modality {
1603
+ export declare const Modality: {
1429
1604
  /**
1430
1605
  * Unspecified modality.
1431
1606
  */
1432
- MODALITY_UNSPECIFIED = "MODALITY_UNSPECIFIED",
1607
+ readonly MODALITY_UNSPECIFIED: "MODALITY_UNSPECIFIED";
1433
1608
  /**
1434
1609
  * Plain text.
1435
1610
  */
1436
- TEXT = "TEXT",
1611
+ readonly TEXT: "TEXT";
1437
1612
  /**
1438
1613
  * Image.
1439
1614
  */
1440
- IMAGE = "IMAGE",
1615
+ readonly IMAGE: "IMAGE";
1441
1616
  /**
1442
1617
  * Video.
1443
1618
  */
1444
- VIDEO = "VIDEO",
1619
+ readonly VIDEO: "VIDEO";
1445
1620
  /**
1446
1621
  * Audio.
1447
1622
  */
1448
- AUDIO = "AUDIO",
1623
+ readonly AUDIO: "AUDIO";
1449
1624
  /**
1450
1625
  * Document (for example, PDF).
1451
1626
  */
1452
- DOCUMENT = "DOCUMENT"
1453
- }
1627
+ readonly DOCUMENT: "DOCUMENT";
1628
+ };
1629
+
1630
+ /**
1631
+ * Content part modality.
1632
+ * @public
1633
+ */
1634
+ export declare type Modality = (typeof Modality)[keyof typeof Modality];
1454
1635
 
1455
1636
  /**
1456
1637
  * Represents token counting info for a single modality.
@@ -1500,12 +1681,20 @@ export declare class ObjectSchema extends Schema {
1500
1681
  }
1501
1682
 
1502
1683
  /**
1503
- * Interface for {@link ObjectSchema} class.
1684
+ * Interface for JSON parameters in a schema of {@link SchemaType}
1685
+ * "object" when not using the `Schema.object()` helper.
1504
1686
  * @public
1505
1687
  */
1506
- export declare interface ObjectSchemaInterface extends SchemaInterface {
1507
- type: SchemaType.OBJECT;
1508
- optionalProperties?: string[];
1688
+ export declare interface ObjectSchemaRequest extends SchemaRequest {
1689
+ type: 'object';
1690
+ /**
1691
+ * This is not a property accepted in the final request to the backend, but is
1692
+ * a client-side convenience property that is only usable by constructing
1693
+ * a schema through the `Schema.object()` helper method. Populating this
1694
+ * property will cause response errors if the object is not wrapped with
1695
+ * `Schema.object()`.
1696
+ */
1697
+ optionalProperties?: never;
1509
1698
  }
1510
1699
 
1511
1700
  /**
@@ -1665,7 +1854,7 @@ export declare interface SafetySetting {
1665
1854
  export declare abstract class Schema implements SchemaInterface {
1666
1855
  /**
1667
1856
  * Optional. The type of the property. {@link
1668
- * SchemaType}.
1857
+ * (SchemaType:type)}.
1669
1858
  */
1670
1859
  type: SchemaType;
1671
1860
  /** Optional. The format of the property.
@@ -1681,9 +1870,9 @@ export declare abstract class Schema implements SchemaInterface {
1681
1870
  description?: string;
1682
1871
  /** Optional. The items of the property. */
1683
1872
  items?: SchemaInterface;
1684
- /** The minimum number of items (elements) in a schema of type {@link SchemaType.ARRAY}. */
1873
+ /** The minimum number of items (elements) in a schema of {@link (SchemaType:type)} `array`. */
1685
1874
  minItems?: number;
1686
- /** The maximum number of items (elements) in a schema of type {@link SchemaType.ARRAY}. */
1875
+ /** The maximum number of items (elements) in a schema of {@link (SchemaType:type)} `array`. */
1687
1876
  maxItems?: number;
1688
1877
  /** Optional. Whether the property is nullable. Defaults to false. */
1689
1878
  nullable: boolean;
@@ -1721,7 +1910,7 @@ export declare abstract class Schema implements SchemaInterface {
1721
1910
  export declare interface SchemaInterface extends SchemaShared<SchemaInterface> {
1722
1911
  /**
1723
1912
  * The type of the property. {@link
1724
- * SchemaType}.
1913
+ * (SchemaType:type)}.
1725
1914
  */
1726
1915
  type: SchemaType;
1727
1916
  }
@@ -1741,7 +1930,7 @@ export declare interface SchemaParams extends SchemaShared<SchemaInterface> {
1741
1930
  export declare interface SchemaRequest extends SchemaShared<SchemaRequest> {
1742
1931
  /**
1743
1932
  * The type of the property. {@link
1744
- * SchemaType}.
1933
+ * (SchemaType:type)}.
1745
1934
  */
1746
1935
  type: SchemaType;
1747
1936
  /** Optional. Array of required property. */
@@ -1769,9 +1958,9 @@ export declare interface SchemaShared<T> {
1769
1958
  title?: string;
1770
1959
  /** Optional. The items of the property. */
1771
1960
  items?: T;
1772
- /** The minimum number of items (elements) in a schema of type {@link SchemaType.ARRAY}. */
1961
+ /** The minimum number of items (elements) in a schema of {@link (SchemaType:type)} `array`. */
1773
1962
  minItems?: number;
1774
- /** The maximum number of items (elements) in a schema of type {@link SchemaType.ARRAY}. */
1963
+ /** The maximum number of items (elements) in a schema of {@link (SchemaType:type)} `array`. */
1775
1964
  maxItems?: number;
1776
1965
  /** Optional. Map of `Schema` objects. */
1777
1966
  properties?: {
@@ -1792,50 +1981,88 @@ export declare interface SchemaShared<T> {
1792
1981
  [key: string]: unknown;
1793
1982
  }
1794
1983
 
1795
- /**
1796
- * @license
1797
- * Copyright 2024 Google LLC
1798
- *
1799
- * Licensed under the Apache License, Version 2.0 (the "License");
1800
- * you may not use this file except in compliance with the License.
1801
- * You may obtain a copy of the License at
1802
- *
1803
- * http://www.apache.org/licenses/LICENSE-2.0
1804
- *
1805
- * Unless required by applicable law or agreed to in writing, software
1806
- * distributed under the License is distributed on an "AS IS" BASIS,
1807
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1808
- * See the License for the specific language governing permissions and
1809
- * limitations under the License.
1810
- */
1811
1984
  /**
1812
1985
  * Contains the list of OpenAPI data types
1813
1986
  * as defined by the
1814
1987
  * {@link https://swagger.io/docs/specification/data-models/data-types/ | OpenAPI specification}
1815
1988
  * @public
1816
1989
  */
1817
- export declare enum SchemaType {
1990
+ export declare const SchemaType: {
1818
1991
  /** String type. */
1819
- STRING = "string",
1992
+ readonly STRING: "string";
1820
1993
  /** Number type. */
1821
- NUMBER = "number",
1994
+ readonly NUMBER: "number";
1822
1995
  /** Integer type. */
1823
- INTEGER = "integer",
1996
+ readonly INTEGER: "integer";
1824
1997
  /** Boolean type. */
1825
- BOOLEAN = "boolean",
1998
+ readonly BOOLEAN: "boolean";
1826
1999
  /** Array type. */
1827
- ARRAY = "array",
2000
+ readonly ARRAY: "array";
1828
2001
  /** Object type. */
1829
- OBJECT = "object"
2002
+ readonly OBJECT: "object";
2003
+ };
2004
+
2005
+ /**
2006
+ * Contains the list of OpenAPI data types
2007
+ * as defined by the
2008
+ * {@link https://swagger.io/docs/specification/data-models/data-types/ | OpenAPI specification}
2009
+ * @public
2010
+ */
2011
+ export declare type SchemaType = (typeof SchemaType)[keyof typeof SchemaType];
2012
+
2013
+ /**
2014
+ * Google search entry point.
2015
+ *
2016
+ * @public
2017
+ */
2018
+ export declare interface SearchEntrypoint {
2019
+ /**
2020
+ * HTML/CSS snippet that must be embedded in a web page. The snippet is designed to avoid
2021
+ * undesired interaction with the rest of the page's CSS.
2022
+ *
2023
+ * To ensure proper rendering and prevent CSS conflicts, it is recommended
2024
+ * to encapsulate this `renderedContent` within a shadow DOM when embedding it
2025
+ * into a webpage. See {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_shadow_DOM | MDN: Using shadow DOM}.
2026
+ *
2027
+ * @example
2028
+ * ```javascript
2029
+ * const container = document.createElement('div');
2030
+ * document.body.appendChild(container);
2031
+ * container.attachShadow({ mode: 'open' }).innerHTML = renderedContent;
2032
+ * ```
2033
+ */
2034
+ renderedContent?: string;
1830
2035
  }
1831
2036
 
1832
2037
  /**
2038
+ * Represents a specific segment within a {@link Content} object, often used to
2039
+ * pinpoint the exact location of text or data that grounding information refers to.
2040
+ *
1833
2041
  * @public
1834
2042
  */
1835
2043
  export declare interface Segment {
2044
+ /**
2045
+ * The zero-based index of the {@link Part} object within the `parts` array
2046
+ * of its parent {@link Content} object. This identifies which part of the
2047
+ * content the segment belongs to.
2048
+ */
1836
2049
  partIndex: number;
2050
+ /**
2051
+ * The zero-based start index of the segment within the specified `Part`,
2052
+ * measured in UTF-8 bytes. This offset is inclusive, starting from 0 at the
2053
+ * beginning of the part's content (e.g., `Part.text`).
2054
+ */
1837
2055
  startIndex: number;
2056
+ /**
2057
+ * The zero-based end index of the segment within the specified `Part`,
2058
+ * measured in UTF-8 bytes. This offset is exclusive, meaning the character
2059
+ * at this index is not included in the segment.
2060
+ */
1838
2061
  endIndex: number;
2062
+ /**
2063
+ * The text corresponding to the segment from the response.
2064
+ */
2065
+ text: string;
1839
2066
  }
1840
2067
 
1841
2068
  /**
@@ -1871,11 +2098,36 @@ export declare interface TextPart {
1871
2098
  functionResponse?: never;
1872
2099
  }
1873
2100
 
2101
+ /**
2102
+ * Configuration for "thinking" behavior of compatible Gemini models.
2103
+ *
2104
+ * Certain models utilize a thinking process before generating a response. This allows them to
2105
+ * reason through complex problems and plan a more coherent and accurate answer.
2106
+ *
2107
+ * @public
2108
+ */
2109
+ export declare interface ThinkingConfig {
2110
+ /**
2111
+ * The thinking budget, in tokens.
2112
+ *
2113
+ * This parameter sets an upper limit on the number of tokens the model can use for its internal
2114
+ * "thinking" process. A higher budget may result in higher quality responses for complex tasks
2115
+ * but can also increase latency and cost.
2116
+ *
2117
+ * If you don't specify a budget, the model will determine the appropriate amount
2118
+ * of thinking based on the complexity of the prompt.
2119
+ *
2120
+ * An error will be thrown if you set a thinking budget for a model that does not support this
2121
+ * feature or if the specified budget is not within the model's supported range.
2122
+ */
2123
+ thinkingBudget?: number;
2124
+ }
2125
+
1874
2126
  /**
1875
2127
  * Defines a tool that model can call to access external knowledge.
1876
2128
  * @public
1877
2129
  */
1878
- export declare type Tool = FunctionDeclarationsTool;
2130
+ export declare type Tool = FunctionDeclarationsTool | GoogleSearchTool;
1879
2131
 
1880
2132
  /**
1881
2133
  * Tool config. This config is shared for all tools provided in the request.
@@ -1899,22 +2151,15 @@ export declare type TypedSchema = IntegerSchema | NumberSchema | StringSchema |
1899
2151
  export declare interface UsageMetadata {
1900
2152
  promptTokenCount: number;
1901
2153
  candidatesTokenCount: number;
2154
+ /**
2155
+ * The number of tokens used by the model's internal "thinking" process.
2156
+ */
2157
+ thoughtsTokenCount?: number;
1902
2158
  totalTokenCount: number;
1903
2159
  promptTokensDetails?: ModalityTokenCount[];
1904
2160
  candidatesTokensDetails?: ModalityTokenCount[];
1905
2161
  }
1906
2162
 
1907
- /**
1908
- * @deprecated Use the new {@link AI | AI} instead. The Vertex AI in Firebase SDK has been
1909
- * replaced with the Firebase AI SDK to accommodate the evolving set of supported features and
1910
- * services. For migration details, see the {@link https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk | migration guide}.
1911
- *
1912
- * An instance of the Firebase AI SDK.
1913
- *
1914
- * @public
1915
- */
1916
- export declare type VertexAI = AI;
1917
-
1918
2163
  /**
1919
2164
  * Configuration class for the Vertex AI Gemini API.
1920
2165
  *
@@ -1940,37 +2185,6 @@ export declare class VertexAIBackend extends Backend {
1940
2185
  constructor(location?: string);
1941
2186
  }
1942
2187
 
1943
- /**
1944
- * @deprecated Use the new {@link AIError} instead. The Vertex AI in Firebase SDK has been
1945
- * replaced with the Firebase AI SDK to accommodate the evolving set of supported features and
1946
- * services. For migration details, see the {@link https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk | migration guide}.
1947
- *
1948
- * Error class for the Firebase AI SDK.
1949
- *
1950
- * @public
1951
- */
1952
- export declare const VertexAIError: typeof AIError;
1953
-
1954
- /**
1955
- * @deprecated Use the new {@link AIModel} instead. The Vertex AI in Firebase SDK has been
1956
- * replaced with the Firebase AI SDK to accommodate the evolving set of supported features and
1957
- * services. For migration details, see the {@link https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk | migration guide}.
1958
- *
1959
- * Base class for Firebase AI model APIs.
1960
- *
1961
- * @public
1962
- */
1963
- export declare const VertexAIModel: typeof AIModel;
1964
-
1965
- /**
1966
- * Options when initializing the Firebase AI SDK.
1967
- *
1968
- * @public
1969
- */
1970
- export declare interface VertexAIOptions {
1971
- location?: string;
1972
- }
1973
-
1974
2188
  /**
1975
2189
  * Describes the input video content.
1976
2190
  * @public
@@ -1996,4 +2210,31 @@ export declare interface WebAttribution {
1996
2210
  title: string;
1997
2211
  }
1998
2212
 
2213
+ /**
2214
+ * A grounding chunk from the web.
2215
+ *
2216
+ * Important: If using Grounding with Google Search, you are required to comply with the
2217
+ * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search".
2218
+ *
2219
+ * @public
2220
+ */
2221
+ export declare interface WebGroundingChunk {
2222
+ /**
2223
+ * The URI of the retrieved web page.
2224
+ */
2225
+ uri?: string;
2226
+ /**
2227
+ * The title of the retrieved web page.
2228
+ */
2229
+ title?: string;
2230
+ /**
2231
+ * The domain of the original URI from which the content was retrieved.
2232
+ *
2233
+ * This property is only supported in the Vertex AI Gemini API ({@link VertexAIBackend}).
2234
+ * When using the Gemini Developer API ({@link GoogleAIBackend}), this property will be
2235
+ * `undefined`.
2236
+ */
2237
+ domain?: string;
2238
+ }
2239
+
1999
2240
  export { }