@firebase/ai 1.4.1-20250626140224 → 1.4.1-canary.2d720995d
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-public.d.ts +437 -195
- package/dist/ai.d.ts +437 -195
- package/dist/esm/{index.esm2017.js → index.esm.js} +311 -276
- package/dist/esm/index.esm.js.map +1 -0
- package/dist/esm/src/api.d.ts +2 -38
- package/dist/esm/src/errors.d.ts +1 -1
- package/dist/esm/src/public-types.d.ts +0 -18
- package/dist/esm/src/requests/schema-builder.d.ts +3 -3
- package/dist/esm/src/types/enums.d.ts +102 -60
- package/dist/esm/src/types/error.d.ts +21 -15
- package/dist/esm/src/types/imagen/requests.d.ts +53 -19
- package/dist/esm/src/types/imagen/responses.d.ts +2 -2
- package/dist/esm/src/types/requests.d.ts +68 -6
- package/dist/esm/src/types/responses.d.ts +146 -8
- package/dist/esm/src/types/schema.d.ts +31 -16
- package/dist/index.cjs.js +325 -279
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.node.cjs.js +325 -279
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +310 -275
- package/dist/index.node.mjs.map +1 -1
- package/dist/src/api.d.ts +2 -38
- package/dist/src/errors.d.ts +1 -1
- package/dist/src/public-types.d.ts +0 -18
- package/dist/src/requests/schema-builder.d.ts +3 -3
- package/dist/src/types/enums.d.ts +102 -60
- package/dist/src/types/error.d.ts +21 -15
- package/dist/src/types/imagen/requests.d.ts +53 -19
- package/dist/src/types/imagen/responses.d.ts +2 -2
- package/dist/src/types/requests.d.ts +68 -6
- package/dist/src/types/responses.d.ts +146 -8
- package/dist/src/types/schema.d.ts +31 -16
- package/package.json +12 -12
- package/dist/esm/index.esm2017.js.map +0 -1
package/dist/ai-public.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
|
|
61
|
+
export declare const AIErrorCode: {
|
|
62
62
|
/** A generic error occurred. */
|
|
63
|
-
ERROR
|
|
63
|
+
readonly ERROR: "error";
|
|
64
64
|
/** An error occurred in a request. */
|
|
65
|
-
REQUEST_ERROR
|
|
65
|
+
readonly REQUEST_ERROR: "request-error";
|
|
66
66
|
/** An error occurred in a response. */
|
|
67
|
-
RESPONSE_ERROR
|
|
67
|
+
readonly RESPONSE_ERROR: "response-error";
|
|
68
68
|
/** An error occurred while performing a fetch. */
|
|
69
|
-
FETCH_ERROR
|
|
69
|
+
readonly FETCH_ERROR: "fetch-error";
|
|
70
70
|
/** An error associated with a Content object. */
|
|
71
|
-
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
|
|
73
|
+
readonly API_NOT_ENABLED: "api-not-enabled";
|
|
74
74
|
/** An error due to invalid Schema input. */
|
|
75
|
-
INVALID_SCHEMA
|
|
75
|
+
readonly INVALID_SCHEMA: "invalid-schema";
|
|
76
76
|
/** An error occurred due to a missing Firebase API key. */
|
|
77
|
-
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
|
|
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
|
|
81
|
+
readonly NO_MODEL: "no-model";
|
|
82
82
|
/** An error occurred due to a missing project ID. */
|
|
83
|
-
NO_PROJECT_ID
|
|
83
|
+
readonly NO_PROJECT_ID: "no-project-id";
|
|
84
84
|
/** An error occurred while parsing. */
|
|
85
|
-
PARSE_FAILED
|
|
85
|
+
readonly PARSE_FAILED: "parse-failed";
|
|
86
86
|
/** An error occurred due an attempt to use an unsupported feature. */
|
|
87
|
-
UNSUPPORTED
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
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
|
|
224
|
+
export declare const BlockReason: {
|
|
220
225
|
/**
|
|
221
226
|
* Content was blocked by safety settings.
|
|
222
227
|
*/
|
|
223
|
-
SAFETY
|
|
228
|
+
readonly SAFETY: "SAFETY";
|
|
224
229
|
/**
|
|
225
230
|
* Content was blocked, but the reason is uncategorized.
|
|
226
231
|
*/
|
|
227
|
-
OTHER
|
|
232
|
+
readonly OTHER: "OTHER";
|
|
228
233
|
/**
|
|
229
234
|
* Content was blocked because it contained terms from the terminology blocklist.
|
|
230
235
|
*/
|
|
231
|
-
BLOCKLIST
|
|
236
|
+
readonly BLOCKLIST: "BLOCKLIST";
|
|
232
237
|
/**
|
|
233
238
|
* Content was blocked due to prohibited content.
|
|
234
239
|
*/
|
|
235
|
-
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.
|
|
@@ -450,44 +461,50 @@ export declare interface FileDataPart {
|
|
|
450
461
|
* Reason that a candidate finished.
|
|
451
462
|
* @public
|
|
452
463
|
*/
|
|
453
|
-
export declare
|
|
464
|
+
export declare const FinishReason: {
|
|
454
465
|
/**
|
|
455
466
|
* Natural stop point of the model or provided stop sequence.
|
|
456
467
|
*/
|
|
457
|
-
STOP
|
|
468
|
+
readonly STOP: "STOP";
|
|
458
469
|
/**
|
|
459
470
|
* The maximum number of tokens as specified in the request was reached.
|
|
460
471
|
*/
|
|
461
|
-
MAX_TOKENS
|
|
472
|
+
readonly MAX_TOKENS: "MAX_TOKENS";
|
|
462
473
|
/**
|
|
463
474
|
* The candidate content was flagged for safety reasons.
|
|
464
475
|
*/
|
|
465
|
-
SAFETY
|
|
476
|
+
readonly SAFETY: "SAFETY";
|
|
466
477
|
/**
|
|
467
478
|
* The candidate content was flagged for recitation reasons.
|
|
468
479
|
*/
|
|
469
|
-
RECITATION
|
|
480
|
+
readonly RECITATION: "RECITATION";
|
|
470
481
|
/**
|
|
471
482
|
* Unknown reason.
|
|
472
483
|
*/
|
|
473
|
-
OTHER
|
|
484
|
+
readonly OTHER: "OTHER";
|
|
474
485
|
/**
|
|
475
486
|
* The candidate content contained forbidden terms.
|
|
476
487
|
*/
|
|
477
|
-
BLOCKLIST
|
|
488
|
+
readonly BLOCKLIST: "BLOCKLIST";
|
|
478
489
|
/**
|
|
479
490
|
* The candidate content potentially contained prohibited content.
|
|
480
491
|
*/
|
|
481
|
-
PROHIBITED_CONTENT
|
|
492
|
+
readonly PROHIBITED_CONTENT: "PROHIBITED_CONTENT";
|
|
482
493
|
/**
|
|
483
494
|
* The candidate content potentially contained Sensitive Personally Identifiable Information (SPII).
|
|
484
495
|
*/
|
|
485
|
-
SPII
|
|
496
|
+
readonly SPII: "SPII";
|
|
486
497
|
/**
|
|
487
498
|
* The function call generated by the model was invalid.
|
|
488
499
|
*/
|
|
489
|
-
MALFORMED_FUNCTION_CALL
|
|
490
|
-
}
|
|
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];
|
|
491
508
|
|
|
492
509
|
/**
|
|
493
510
|
* A predicted {@link FunctionCall} returned from the model
|
|
@@ -511,25 +528,27 @@ export declare interface FunctionCallingConfig {
|
|
|
511
528
|
/**
|
|
512
529
|
* @public
|
|
513
530
|
*/
|
|
514
|
-
export declare
|
|
531
|
+
export declare const FunctionCallingMode: {
|
|
515
532
|
/**
|
|
516
533
|
* Default model behavior; model decides to predict either a function call
|
|
517
534
|
* or a natural language response.
|
|
518
535
|
*/
|
|
519
|
-
AUTO
|
|
536
|
+
readonly AUTO: "AUTO";
|
|
520
537
|
/**
|
|
521
538
|
* Model is constrained to always predicting a function call only.
|
|
522
539
|
* If `allowed_function_names` is set, the predicted function call will be
|
|
523
540
|
* limited to any one of `allowed_function_names`, else the predicted
|
|
524
541
|
* function call will be any one of the provided `function_declarations`.
|
|
525
542
|
*/
|
|
526
|
-
ANY
|
|
543
|
+
readonly ANY: "ANY";
|
|
527
544
|
/**
|
|
528
545
|
* Model will not predict any function call. Model behavior is same as when
|
|
529
546
|
* not passing any function declarations.
|
|
530
547
|
*/
|
|
531
|
-
NONE
|
|
532
|
-
}
|
|
548
|
+
readonly NONE: "NONE";
|
|
549
|
+
};
|
|
550
|
+
|
|
551
|
+
export declare type FunctionCallingMode = (typeof FunctionCallingMode)[keyof typeof FunctionCallingMode];
|
|
533
552
|
|
|
534
553
|
/**
|
|
535
554
|
* Content part interface if the part represents a {@link FunctionCall}.
|
|
@@ -568,7 +587,7 @@ export declare interface FunctionDeclaration {
|
|
|
568
587
|
* format. Reflects the Open API 3.03 Parameter Object. Parameter names are
|
|
569
588
|
* case-sensitive. For a function with no parameters, this can be left unset.
|
|
570
589
|
*/
|
|
571
|
-
parameters?:
|
|
590
|
+
parameters?: ObjectSchema | ObjectSchemaRequest;
|
|
572
591
|
}
|
|
573
592
|
|
|
574
593
|
/**
|
|
@@ -715,6 +734,10 @@ export declare interface GenerationConfig {
|
|
|
715
734
|
* @beta
|
|
716
735
|
*/
|
|
717
736
|
responseModalities?: ResponseModality[];
|
|
737
|
+
/**
|
|
738
|
+
* Configuration for "thinking" behavior of compatible Gemini models.
|
|
739
|
+
*/
|
|
740
|
+
thinkingConfig?: ThinkingConfig;
|
|
718
741
|
}
|
|
719
742
|
|
|
720
743
|
/**
|
|
@@ -818,22 +841,6 @@ export declare function getGenerativeModel(ai: AI, modelParams: ModelParams, req
|
|
|
818
841
|
*/
|
|
819
842
|
export declare function getImagenModel(ai: AI, modelParams: ImagenModelParams, requestOptions?: RequestOptions): ImagenModel;
|
|
820
843
|
|
|
821
|
-
/**
|
|
822
|
-
* @deprecated Use the new {@link getAI | getAI()} instead. The Vertex AI in Firebase SDK has been
|
|
823
|
-
* replaced with the Firebase AI SDK to accommodate the evolving set of supported features and
|
|
824
|
-
* services. For migration details, see the {@link https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk | migration guide}.
|
|
825
|
-
*
|
|
826
|
-
* Returns a {@link VertexAI} instance for the given app, configured to use the
|
|
827
|
-
* Vertex AI Gemini API. This instance will be
|
|
828
|
-
* configured to use the Vertex AI Gemini API.
|
|
829
|
-
*
|
|
830
|
-
* @param app - The {@link @firebase/app#FirebaseApp} to use.
|
|
831
|
-
* @param options - Options to configure the Vertex AI instance, including the location.
|
|
832
|
-
*
|
|
833
|
-
* @public
|
|
834
|
-
*/
|
|
835
|
-
export declare function getVertexAI(app?: FirebaseApp, options?: VertexAIOptions): VertexAI;
|
|
836
|
-
|
|
837
844
|
/**
|
|
838
845
|
* Configuration class for the Gemini Developer API.
|
|
839
846
|
*
|
|
@@ -857,6 +864,42 @@ export declare class GoogleAIBackend extends Backend {
|
|
|
857
864
|
|
|
858
865
|
/* Excluded from this release type: GoogleAIGenerateContentResponse */
|
|
859
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
|
+
|
|
860
903
|
/**
|
|
861
904
|
* @deprecated
|
|
862
905
|
* @public
|
|
@@ -869,125 +912,221 @@ export declare interface GroundingAttribution {
|
|
|
869
912
|
}
|
|
870
913
|
|
|
871
914
|
/**
|
|
872
|
-
*
|
|
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
|
+
*
|
|
873
937
|
* @public
|
|
874
938
|
*/
|
|
875
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
|
+
*/
|
|
876
960
|
webSearchQueries?: string[];
|
|
961
|
+
/**
|
|
962
|
+
* @deprecated Use {@link GroundingSupport} instead.
|
|
963
|
+
*/
|
|
877
964
|
retrievalQueries?: string[];
|
|
878
965
|
/**
|
|
879
|
-
* @deprecated
|
|
966
|
+
* @deprecated Use {@link GroundingChunk} instead.
|
|
880
967
|
*/
|
|
881
968
|
groundingAttributions: GroundingAttribution[];
|
|
882
969
|
}
|
|
883
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
|
+
|
|
884
992
|
/**
|
|
885
993
|
* This property is not supported in the Gemini Developer API ({@link GoogleAIBackend}).
|
|
886
994
|
*
|
|
887
995
|
* @public
|
|
888
996
|
*/
|
|
889
|
-
export declare
|
|
997
|
+
export declare const HarmBlockMethod: {
|
|
890
998
|
/**
|
|
891
999
|
* The harm block method uses both probability and severity scores.
|
|
892
1000
|
*/
|
|
893
|
-
SEVERITY
|
|
1001
|
+
readonly SEVERITY: "SEVERITY";
|
|
894
1002
|
/**
|
|
895
1003
|
* The harm block method uses the probability score.
|
|
896
1004
|
*/
|
|
897
|
-
PROBABILITY
|
|
898
|
-
}
|
|
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];
|
|
899
1014
|
|
|
900
1015
|
/**
|
|
901
1016
|
* Threshold above which a prompt or candidate will be blocked.
|
|
902
1017
|
* @public
|
|
903
1018
|
*/
|
|
904
|
-
export declare
|
|
1019
|
+
export declare const HarmBlockThreshold: {
|
|
905
1020
|
/**
|
|
906
1021
|
* Content with `NEGLIGIBLE` will be allowed.
|
|
907
1022
|
*/
|
|
908
|
-
BLOCK_LOW_AND_ABOVE
|
|
1023
|
+
readonly BLOCK_LOW_AND_ABOVE: "BLOCK_LOW_AND_ABOVE";
|
|
909
1024
|
/**
|
|
910
1025
|
* Content with `NEGLIGIBLE` and `LOW` will be allowed.
|
|
911
1026
|
*/
|
|
912
|
-
BLOCK_MEDIUM_AND_ABOVE
|
|
1027
|
+
readonly BLOCK_MEDIUM_AND_ABOVE: "BLOCK_MEDIUM_AND_ABOVE";
|
|
913
1028
|
/**
|
|
914
1029
|
* Content with `NEGLIGIBLE`, `LOW`, and `MEDIUM` will be allowed.
|
|
915
1030
|
*/
|
|
916
|
-
BLOCK_ONLY_HIGH
|
|
1031
|
+
readonly BLOCK_ONLY_HIGH: "BLOCK_ONLY_HIGH";
|
|
917
1032
|
/**
|
|
918
1033
|
* All content will be allowed.
|
|
919
1034
|
*/
|
|
920
|
-
BLOCK_NONE
|
|
1035
|
+
readonly BLOCK_NONE: "BLOCK_NONE";
|
|
921
1036
|
/**
|
|
922
1037
|
* All content will be allowed. This is the same as `BLOCK_NONE`, but the metadata corresponding
|
|
923
1038
|
* to the {@link HarmCategory} will not be present in the response.
|
|
924
1039
|
*/
|
|
925
|
-
OFF
|
|
926
|
-
}
|
|
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];
|
|
927
1048
|
|
|
928
1049
|
/**
|
|
929
1050
|
* Harm categories that would cause prompts or candidates to be blocked.
|
|
930
1051
|
* @public
|
|
931
1052
|
*/
|
|
932
|
-
export declare
|
|
933
|
-
HARM_CATEGORY_HATE_SPEECH
|
|
934
|
-
HARM_CATEGORY_SEXUALLY_EXPLICIT
|
|
935
|
-
HARM_CATEGORY_HARASSMENT
|
|
936
|
-
HARM_CATEGORY_DANGEROUS_CONTENT
|
|
937
|
-
}
|
|
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];
|
|
938
1065
|
|
|
939
1066
|
/**
|
|
940
1067
|
* Probability that a prompt or candidate matches a harm category.
|
|
941
1068
|
* @public
|
|
942
1069
|
*/
|
|
943
|
-
export declare
|
|
1070
|
+
export declare const HarmProbability: {
|
|
944
1071
|
/**
|
|
945
1072
|
* Content has a negligible chance of being unsafe.
|
|
946
1073
|
*/
|
|
947
|
-
NEGLIGIBLE
|
|
1074
|
+
readonly NEGLIGIBLE: "NEGLIGIBLE";
|
|
948
1075
|
/**
|
|
949
1076
|
* Content has a low chance of being unsafe.
|
|
950
1077
|
*/
|
|
951
|
-
LOW
|
|
1078
|
+
readonly LOW: "LOW";
|
|
952
1079
|
/**
|
|
953
1080
|
* Content has a medium chance of being unsafe.
|
|
954
1081
|
*/
|
|
955
|
-
MEDIUM
|
|
1082
|
+
readonly MEDIUM: "MEDIUM";
|
|
956
1083
|
/**
|
|
957
1084
|
* Content has a high chance of being unsafe.
|
|
958
1085
|
*/
|
|
959
|
-
HIGH
|
|
960
|
-
}
|
|
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];
|
|
961
1094
|
|
|
962
1095
|
/**
|
|
963
1096
|
* Harm severity levels.
|
|
964
1097
|
* @public
|
|
965
1098
|
*/
|
|
966
|
-
export declare
|
|
1099
|
+
export declare const HarmSeverity: {
|
|
967
1100
|
/**
|
|
968
1101
|
* Negligible level of harm severity.
|
|
969
1102
|
*/
|
|
970
|
-
HARM_SEVERITY_NEGLIGIBLE
|
|
1103
|
+
readonly HARM_SEVERITY_NEGLIGIBLE: "HARM_SEVERITY_NEGLIGIBLE";
|
|
971
1104
|
/**
|
|
972
1105
|
* Low level of harm severity.
|
|
973
1106
|
*/
|
|
974
|
-
HARM_SEVERITY_LOW
|
|
1107
|
+
readonly HARM_SEVERITY_LOW: "HARM_SEVERITY_LOW";
|
|
975
1108
|
/**
|
|
976
1109
|
* Medium level of harm severity.
|
|
977
1110
|
*/
|
|
978
|
-
HARM_SEVERITY_MEDIUM
|
|
1111
|
+
readonly HARM_SEVERITY_MEDIUM: "HARM_SEVERITY_MEDIUM";
|
|
979
1112
|
/**
|
|
980
1113
|
* High level of harm severity.
|
|
981
1114
|
*/
|
|
982
|
-
HARM_SEVERITY_HIGH
|
|
1115
|
+
readonly HARM_SEVERITY_HIGH: "HARM_SEVERITY_HIGH";
|
|
983
1116
|
/**
|
|
984
1117
|
* Harm severity is not supported.
|
|
985
1118
|
*
|
|
986
1119
|
* @remarks
|
|
987
1120
|
* The GoogleAI backend does not support `HarmSeverity`, so this value is used as a fallback.
|
|
988
1121
|
*/
|
|
989
|
-
HARM_SEVERITY_UNSUPPORTED
|
|
990
|
-
}
|
|
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];
|
|
991
1130
|
|
|
992
1131
|
/**
|
|
993
1132
|
* Aspect ratios for Imagen images.
|
|
@@ -1000,28 +1139,41 @@ export declare enum HarmSeverity {
|
|
|
1000
1139
|
*
|
|
1001
1140
|
* @beta
|
|
1002
1141
|
*/
|
|
1003
|
-
export declare
|
|
1142
|
+
export declare const ImagenAspectRatio: {
|
|
1004
1143
|
/**
|
|
1005
1144
|
* Square (1:1) aspect ratio.
|
|
1006
1145
|
*/
|
|
1007
|
-
SQUARE
|
|
1146
|
+
readonly SQUARE: "1:1";
|
|
1008
1147
|
/**
|
|
1009
1148
|
* Landscape (3:4) aspect ratio.
|
|
1010
1149
|
*/
|
|
1011
|
-
LANDSCAPE_3x4
|
|
1150
|
+
readonly LANDSCAPE_3x4: "3:4";
|
|
1012
1151
|
/**
|
|
1013
1152
|
* Portrait (4:3) aspect ratio.
|
|
1014
1153
|
*/
|
|
1015
|
-
PORTRAIT_4x3
|
|
1154
|
+
readonly PORTRAIT_4x3: "4:3";
|
|
1016
1155
|
/**
|
|
1017
1156
|
* Landscape (16:9) aspect ratio.
|
|
1018
1157
|
*/
|
|
1019
|
-
LANDSCAPE_16x9
|
|
1158
|
+
readonly LANDSCAPE_16x9: "16:9";
|
|
1020
1159
|
/**
|
|
1021
1160
|
* Portrait (9:16) aspect ratio.
|
|
1022
1161
|
*/
|
|
1023
|
-
PORTRAIT_9x16
|
|
1024
|
-
}
|
|
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];
|
|
1025
1177
|
|
|
1026
1178
|
/**
|
|
1027
1179
|
* An image generated by Imagen, stored in a Cloud Storage for Firebase bucket.
|
|
@@ -1073,7 +1225,7 @@ export declare interface ImagenGenerationConfig {
|
|
|
1073
1225
|
numberOfImages?: number;
|
|
1074
1226
|
/**
|
|
1075
1227
|
* The aspect ratio of the generated images. The default value is square 1:1.
|
|
1076
|
-
* Supported aspect ratios depend on the Imagen model, see {@link ImagenAspectRatio}
|
|
1228
|
+
* Supported aspect ratios depend on the Imagen model, see {@link (ImagenAspectRatio:type)}
|
|
1077
1229
|
* for more details.
|
|
1078
1230
|
*/
|
|
1079
1231
|
aspectRatio?: ImagenAspectRatio;
|
|
@@ -1115,8 +1267,8 @@ export declare interface ImagenGenerationResponse<T extends ImagenInlineImage |
|
|
|
1115
1267
|
* The reason that images were filtered out. This property will only be defined if one
|
|
1116
1268
|
* or more images were filtered.
|
|
1117
1269
|
*
|
|
1118
|
-
* Images may be filtered out due to the {@link ImagenSafetyFilterLevel},
|
|
1119
|
-
* {@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.
|
|
1120
1272
|
* The filter levels may be adjusted in your {@link ImagenSafetySettings}.
|
|
1121
1273
|
*
|
|
1122
1274
|
* See the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen | Responsible AI and usage guidelines for Imagen}
|
|
@@ -1320,11 +1472,11 @@ export declare interface ImagenModelParams {
|
|
|
1320
1472
|
*
|
|
1321
1473
|
* @beta
|
|
1322
1474
|
*/
|
|
1323
|
-
export declare
|
|
1475
|
+
export declare const ImagenPersonFilterLevel: {
|
|
1324
1476
|
/**
|
|
1325
1477
|
* Disallow generation of images containing people or faces; images of people are filtered out.
|
|
1326
1478
|
*/
|
|
1327
|
-
BLOCK_ALL
|
|
1479
|
+
readonly BLOCK_ALL: "dont_allow";
|
|
1328
1480
|
/**
|
|
1329
1481
|
* Allow generation of images containing adults only; images of children are filtered out.
|
|
1330
1482
|
*
|
|
@@ -1332,7 +1484,7 @@ export declare enum ImagenPersonFilterLevel {
|
|
|
1332
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}
|
|
1333
1485
|
* for more details.
|
|
1334
1486
|
*/
|
|
1335
|
-
ALLOW_ADULT
|
|
1487
|
+
readonly ALLOW_ADULT: "allow_adult";
|
|
1336
1488
|
/**
|
|
1337
1489
|
* Allow generation of images containing adults only; images of children are filtered out.
|
|
1338
1490
|
*
|
|
@@ -1340,8 +1492,18 @@ export declare enum ImagenPersonFilterLevel {
|
|
|
1340
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}
|
|
1341
1493
|
* for more details.
|
|
1342
1494
|
*/
|
|
1343
|
-
ALLOW_ALL
|
|
1344
|
-
}
|
|
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];
|
|
1345
1507
|
|
|
1346
1508
|
/**
|
|
1347
1509
|
* A filter level controlling how aggressively to filter sensitive content.
|
|
@@ -1355,27 +1517,41 @@ export declare enum ImagenPersonFilterLevel {
|
|
|
1355
1517
|
*
|
|
1356
1518
|
* @beta
|
|
1357
1519
|
*/
|
|
1358
|
-
export declare
|
|
1520
|
+
export declare const ImagenSafetyFilterLevel: {
|
|
1359
1521
|
/**
|
|
1360
1522
|
* The most aggressive filtering level; most strict blocking.
|
|
1361
1523
|
*/
|
|
1362
|
-
BLOCK_LOW_AND_ABOVE
|
|
1524
|
+
readonly BLOCK_LOW_AND_ABOVE: "block_low_and_above";
|
|
1363
1525
|
/**
|
|
1364
1526
|
* Blocks some sensitive prompts and responses.
|
|
1365
1527
|
*/
|
|
1366
|
-
BLOCK_MEDIUM_AND_ABOVE
|
|
1528
|
+
readonly BLOCK_MEDIUM_AND_ABOVE: "block_medium_and_above";
|
|
1367
1529
|
/**
|
|
1368
1530
|
* Blocks few sensitive prompts and responses.
|
|
1369
1531
|
*/
|
|
1370
|
-
BLOCK_ONLY_HIGH
|
|
1532
|
+
readonly BLOCK_ONLY_HIGH: "block_only_high";
|
|
1371
1533
|
/**
|
|
1372
1534
|
* The least aggressive filtering level; blocks very few sensitive prompts and responses.
|
|
1373
1535
|
*
|
|
1374
1536
|
* Access to this feature is restricted and may require your case to be reviewed and approved by
|
|
1375
1537
|
* Cloud support.
|
|
1376
1538
|
*/
|
|
1377
|
-
BLOCK_NONE
|
|
1378
|
-
}
|
|
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];
|
|
1379
1555
|
|
|
1380
1556
|
/**
|
|
1381
1557
|
* Settings for controlling the aggressiveness of filtering out sensitive content.
|
|
@@ -1424,32 +1600,38 @@ export declare class IntegerSchema extends Schema {
|
|
|
1424
1600
|
* Content part modality.
|
|
1425
1601
|
* @public
|
|
1426
1602
|
*/
|
|
1427
|
-
export declare
|
|
1603
|
+
export declare const Modality: {
|
|
1428
1604
|
/**
|
|
1429
1605
|
* Unspecified modality.
|
|
1430
1606
|
*/
|
|
1431
|
-
MODALITY_UNSPECIFIED
|
|
1607
|
+
readonly MODALITY_UNSPECIFIED: "MODALITY_UNSPECIFIED";
|
|
1432
1608
|
/**
|
|
1433
1609
|
* Plain text.
|
|
1434
1610
|
*/
|
|
1435
|
-
TEXT
|
|
1611
|
+
readonly TEXT: "TEXT";
|
|
1436
1612
|
/**
|
|
1437
1613
|
* Image.
|
|
1438
1614
|
*/
|
|
1439
|
-
IMAGE
|
|
1615
|
+
readonly IMAGE: "IMAGE";
|
|
1440
1616
|
/**
|
|
1441
1617
|
* Video.
|
|
1442
1618
|
*/
|
|
1443
|
-
VIDEO
|
|
1619
|
+
readonly VIDEO: "VIDEO";
|
|
1444
1620
|
/**
|
|
1445
1621
|
* Audio.
|
|
1446
1622
|
*/
|
|
1447
|
-
AUDIO
|
|
1623
|
+
readonly AUDIO: "AUDIO";
|
|
1448
1624
|
/**
|
|
1449
1625
|
* Document (for example, PDF).
|
|
1450
1626
|
*/
|
|
1451
|
-
DOCUMENT
|
|
1452
|
-
}
|
|
1627
|
+
readonly DOCUMENT: "DOCUMENT";
|
|
1628
|
+
};
|
|
1629
|
+
|
|
1630
|
+
/**
|
|
1631
|
+
* Content part modality.
|
|
1632
|
+
* @public
|
|
1633
|
+
*/
|
|
1634
|
+
export declare type Modality = (typeof Modality)[keyof typeof Modality];
|
|
1453
1635
|
|
|
1454
1636
|
/**
|
|
1455
1637
|
* Represents token counting info for a single modality.
|
|
@@ -1499,12 +1681,20 @@ export declare class ObjectSchema extends Schema {
|
|
|
1499
1681
|
}
|
|
1500
1682
|
|
|
1501
1683
|
/**
|
|
1502
|
-
* Interface for {@link
|
|
1684
|
+
* Interface for JSON parameters in a schema of {@link SchemaType}
|
|
1685
|
+
* "object" when not using the `Schema.object()` helper.
|
|
1503
1686
|
* @public
|
|
1504
1687
|
*/
|
|
1505
|
-
export declare interface
|
|
1506
|
-
type:
|
|
1507
|
-
|
|
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;
|
|
1508
1698
|
}
|
|
1509
1699
|
|
|
1510
1700
|
/**
|
|
@@ -1664,7 +1854,7 @@ export declare interface SafetySetting {
|
|
|
1664
1854
|
export declare abstract class Schema implements SchemaInterface {
|
|
1665
1855
|
/**
|
|
1666
1856
|
* Optional. The type of the property. {@link
|
|
1667
|
-
* SchemaType}.
|
|
1857
|
+
* (SchemaType:type)}.
|
|
1668
1858
|
*/
|
|
1669
1859
|
type: SchemaType;
|
|
1670
1860
|
/** Optional. The format of the property.
|
|
@@ -1680,9 +1870,9 @@ export declare abstract class Schema implements SchemaInterface {
|
|
|
1680
1870
|
description?: string;
|
|
1681
1871
|
/** Optional. The items of the property. */
|
|
1682
1872
|
items?: SchemaInterface;
|
|
1683
|
-
/** The minimum number of items (elements) in a schema of
|
|
1873
|
+
/** The minimum number of items (elements) in a schema of {@link (SchemaType:type)} `array`. */
|
|
1684
1874
|
minItems?: number;
|
|
1685
|
-
/** The maximum number of items (elements) in a schema of
|
|
1875
|
+
/** The maximum number of items (elements) in a schema of {@link (SchemaType:type)} `array`. */
|
|
1686
1876
|
maxItems?: number;
|
|
1687
1877
|
/** Optional. Whether the property is nullable. Defaults to false. */
|
|
1688
1878
|
nullable: boolean;
|
|
@@ -1720,7 +1910,7 @@ export declare abstract class Schema implements SchemaInterface {
|
|
|
1720
1910
|
export declare interface SchemaInterface extends SchemaShared<SchemaInterface> {
|
|
1721
1911
|
/**
|
|
1722
1912
|
* The type of the property. {@link
|
|
1723
|
-
* SchemaType}.
|
|
1913
|
+
* (SchemaType:type)}.
|
|
1724
1914
|
*/
|
|
1725
1915
|
type: SchemaType;
|
|
1726
1916
|
}
|
|
@@ -1740,7 +1930,7 @@ export declare interface SchemaParams extends SchemaShared<SchemaInterface> {
|
|
|
1740
1930
|
export declare interface SchemaRequest extends SchemaShared<SchemaRequest> {
|
|
1741
1931
|
/**
|
|
1742
1932
|
* The type of the property. {@link
|
|
1743
|
-
* SchemaType}.
|
|
1933
|
+
* (SchemaType:type)}.
|
|
1744
1934
|
*/
|
|
1745
1935
|
type: SchemaType;
|
|
1746
1936
|
/** Optional. Array of required property. */
|
|
@@ -1768,9 +1958,9 @@ export declare interface SchemaShared<T> {
|
|
|
1768
1958
|
title?: string;
|
|
1769
1959
|
/** Optional. The items of the property. */
|
|
1770
1960
|
items?: T;
|
|
1771
|
-
/** The minimum number of items (elements) in a schema of
|
|
1961
|
+
/** The minimum number of items (elements) in a schema of {@link (SchemaType:type)} `array`. */
|
|
1772
1962
|
minItems?: number;
|
|
1773
|
-
/** The maximum number of items (elements) in a schema of
|
|
1963
|
+
/** The maximum number of items (elements) in a schema of {@link (SchemaType:type)} `array`. */
|
|
1774
1964
|
maxItems?: number;
|
|
1775
1965
|
/** Optional. Map of `Schema` objects. */
|
|
1776
1966
|
properties?: {
|
|
@@ -1791,50 +1981,88 @@ export declare interface SchemaShared<T> {
|
|
|
1791
1981
|
[key: string]: unknown;
|
|
1792
1982
|
}
|
|
1793
1983
|
|
|
1794
|
-
/**
|
|
1795
|
-
* @license
|
|
1796
|
-
* Copyright 2024 Google LLC
|
|
1797
|
-
*
|
|
1798
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1799
|
-
* you may not use this file except in compliance with the License.
|
|
1800
|
-
* You may obtain a copy of the License at
|
|
1801
|
-
*
|
|
1802
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1803
|
-
*
|
|
1804
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1805
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1806
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1807
|
-
* See the License for the specific language governing permissions and
|
|
1808
|
-
* limitations under the License.
|
|
1809
|
-
*/
|
|
1810
1984
|
/**
|
|
1811
1985
|
* Contains the list of OpenAPI data types
|
|
1812
1986
|
* as defined by the
|
|
1813
1987
|
* {@link https://swagger.io/docs/specification/data-models/data-types/ | OpenAPI specification}
|
|
1814
1988
|
* @public
|
|
1815
1989
|
*/
|
|
1816
|
-
export declare
|
|
1990
|
+
export declare const SchemaType: {
|
|
1817
1991
|
/** String type. */
|
|
1818
|
-
STRING
|
|
1992
|
+
readonly STRING: "string";
|
|
1819
1993
|
/** Number type. */
|
|
1820
|
-
NUMBER
|
|
1994
|
+
readonly NUMBER: "number";
|
|
1821
1995
|
/** Integer type. */
|
|
1822
|
-
INTEGER
|
|
1996
|
+
readonly INTEGER: "integer";
|
|
1823
1997
|
/** Boolean type. */
|
|
1824
|
-
BOOLEAN
|
|
1998
|
+
readonly BOOLEAN: "boolean";
|
|
1825
1999
|
/** Array type. */
|
|
1826
|
-
ARRAY
|
|
2000
|
+
readonly ARRAY: "array";
|
|
1827
2001
|
/** Object type. */
|
|
1828
|
-
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;
|
|
1829
2035
|
}
|
|
1830
2036
|
|
|
1831
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
|
+
*
|
|
1832
2041
|
* @public
|
|
1833
2042
|
*/
|
|
1834
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
|
+
*/
|
|
1835
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
|
+
*/
|
|
1836
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
|
+
*/
|
|
1837
2061
|
endIndex: number;
|
|
2062
|
+
/**
|
|
2063
|
+
* The text corresponding to the segment from the response.
|
|
2064
|
+
*/
|
|
2065
|
+
text: string;
|
|
1838
2066
|
}
|
|
1839
2067
|
|
|
1840
2068
|
/**
|
|
@@ -1870,11 +2098,36 @@ export declare interface TextPart {
|
|
|
1870
2098
|
functionResponse?: never;
|
|
1871
2099
|
}
|
|
1872
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
|
+
|
|
1873
2126
|
/**
|
|
1874
2127
|
* Defines a tool that model can call to access external knowledge.
|
|
1875
2128
|
* @public
|
|
1876
2129
|
*/
|
|
1877
|
-
export declare type Tool = FunctionDeclarationsTool;
|
|
2130
|
+
export declare type Tool = FunctionDeclarationsTool | GoogleSearchTool;
|
|
1878
2131
|
|
|
1879
2132
|
/**
|
|
1880
2133
|
* Tool config. This config is shared for all tools provided in the request.
|
|
@@ -1898,22 +2151,15 @@ export declare type TypedSchema = IntegerSchema | NumberSchema | StringSchema |
|
|
|
1898
2151
|
export declare interface UsageMetadata {
|
|
1899
2152
|
promptTokenCount: number;
|
|
1900
2153
|
candidatesTokenCount: number;
|
|
2154
|
+
/**
|
|
2155
|
+
* The number of tokens used by the model's internal "thinking" process.
|
|
2156
|
+
*/
|
|
2157
|
+
thoughtsTokenCount?: number;
|
|
1901
2158
|
totalTokenCount: number;
|
|
1902
2159
|
promptTokensDetails?: ModalityTokenCount[];
|
|
1903
2160
|
candidatesTokensDetails?: ModalityTokenCount[];
|
|
1904
2161
|
}
|
|
1905
2162
|
|
|
1906
|
-
/**
|
|
1907
|
-
* @deprecated Use the new {@link AI | AI} instead. The Vertex AI in Firebase SDK has been
|
|
1908
|
-
* replaced with the Firebase AI SDK to accommodate the evolving set of supported features and
|
|
1909
|
-
* services. For migration details, see the {@link https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk | migration guide}.
|
|
1910
|
-
*
|
|
1911
|
-
* An instance of the Firebase AI SDK.
|
|
1912
|
-
*
|
|
1913
|
-
* @public
|
|
1914
|
-
*/
|
|
1915
|
-
export declare type VertexAI = AI;
|
|
1916
|
-
|
|
1917
2163
|
/**
|
|
1918
2164
|
* Configuration class for the Vertex AI Gemini API.
|
|
1919
2165
|
*
|
|
@@ -1939,37 +2185,6 @@ export declare class VertexAIBackend extends Backend {
|
|
|
1939
2185
|
constructor(location?: string);
|
|
1940
2186
|
}
|
|
1941
2187
|
|
|
1942
|
-
/**
|
|
1943
|
-
* @deprecated Use the new {@link AIError} instead. The Vertex AI in Firebase SDK has been
|
|
1944
|
-
* replaced with the Firebase AI SDK to accommodate the evolving set of supported features and
|
|
1945
|
-
* services. For migration details, see the {@link https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk | migration guide}.
|
|
1946
|
-
*
|
|
1947
|
-
* Error class for the Firebase AI SDK.
|
|
1948
|
-
*
|
|
1949
|
-
* @public
|
|
1950
|
-
*/
|
|
1951
|
-
export declare const VertexAIError: typeof AIError;
|
|
1952
|
-
|
|
1953
|
-
/**
|
|
1954
|
-
* @deprecated Use the new {@link AIModel} instead. The Vertex AI in Firebase SDK has been
|
|
1955
|
-
* replaced with the Firebase AI SDK to accommodate the evolving set of supported features and
|
|
1956
|
-
* services. For migration details, see the {@link https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk | migration guide}.
|
|
1957
|
-
*
|
|
1958
|
-
* Base class for Firebase AI model APIs.
|
|
1959
|
-
*
|
|
1960
|
-
* @public
|
|
1961
|
-
*/
|
|
1962
|
-
export declare const VertexAIModel: typeof AIModel;
|
|
1963
|
-
|
|
1964
|
-
/**
|
|
1965
|
-
* Options when initializing the Firebase AI SDK.
|
|
1966
|
-
*
|
|
1967
|
-
* @public
|
|
1968
|
-
*/
|
|
1969
|
-
export declare interface VertexAIOptions {
|
|
1970
|
-
location?: string;
|
|
1971
|
-
}
|
|
1972
|
-
|
|
1973
2188
|
/**
|
|
1974
2189
|
* Describes the input video content.
|
|
1975
2190
|
* @public
|
|
@@ -1995,4 +2210,31 @@ export declare interface WebAttribution {
|
|
|
1995
2210
|
title: string;
|
|
1996
2211
|
}
|
|
1997
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
|
+
|
|
1998
2240
|
export { }
|