@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.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.
|
|
@@ -253,24 +258,30 @@ export declare interface BaseParams {
|
|
|
253
258
|
* Reason that a prompt was blocked.
|
|
254
259
|
* @public
|
|
255
260
|
*/
|
|
256
|
-
export declare
|
|
261
|
+
export declare const BlockReason: {
|
|
257
262
|
/**
|
|
258
263
|
* Content was blocked by safety settings.
|
|
259
264
|
*/
|
|
260
|
-
SAFETY
|
|
265
|
+
readonly SAFETY: "SAFETY";
|
|
261
266
|
/**
|
|
262
267
|
* Content was blocked, but the reason is uncategorized.
|
|
263
268
|
*/
|
|
264
|
-
OTHER
|
|
269
|
+
readonly OTHER: "OTHER";
|
|
265
270
|
/**
|
|
266
271
|
* Content was blocked because it contained terms from the terminology blocklist.
|
|
267
272
|
*/
|
|
268
|
-
BLOCKLIST
|
|
273
|
+
readonly BLOCKLIST: "BLOCKLIST";
|
|
269
274
|
/**
|
|
270
275
|
* Content was blocked due to prohibited content.
|
|
271
276
|
*/
|
|
272
|
-
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.
|
|
@@ -487,44 +498,50 @@ export declare interface FileDataPart {
|
|
|
487
498
|
* Reason that a candidate finished.
|
|
488
499
|
* @public
|
|
489
500
|
*/
|
|
490
|
-
export declare
|
|
501
|
+
export declare const FinishReason: {
|
|
491
502
|
/**
|
|
492
503
|
* Natural stop point of the model or provided stop sequence.
|
|
493
504
|
*/
|
|
494
|
-
STOP
|
|
505
|
+
readonly STOP: "STOP";
|
|
495
506
|
/**
|
|
496
507
|
* The maximum number of tokens as specified in the request was reached.
|
|
497
508
|
*/
|
|
498
|
-
MAX_TOKENS
|
|
509
|
+
readonly MAX_TOKENS: "MAX_TOKENS";
|
|
499
510
|
/**
|
|
500
511
|
* The candidate content was flagged for safety reasons.
|
|
501
512
|
*/
|
|
502
|
-
SAFETY
|
|
513
|
+
readonly SAFETY: "SAFETY";
|
|
503
514
|
/**
|
|
504
515
|
* The candidate content was flagged for recitation reasons.
|
|
505
516
|
*/
|
|
506
|
-
RECITATION
|
|
517
|
+
readonly RECITATION: "RECITATION";
|
|
507
518
|
/**
|
|
508
519
|
* Unknown reason.
|
|
509
520
|
*/
|
|
510
|
-
OTHER
|
|
521
|
+
readonly OTHER: "OTHER";
|
|
511
522
|
/**
|
|
512
523
|
* The candidate content contained forbidden terms.
|
|
513
524
|
*/
|
|
514
|
-
BLOCKLIST
|
|
525
|
+
readonly BLOCKLIST: "BLOCKLIST";
|
|
515
526
|
/**
|
|
516
527
|
* The candidate content potentially contained prohibited content.
|
|
517
528
|
*/
|
|
518
|
-
PROHIBITED_CONTENT
|
|
529
|
+
readonly PROHIBITED_CONTENT: "PROHIBITED_CONTENT";
|
|
519
530
|
/**
|
|
520
531
|
* The candidate content potentially contained Sensitive Personally Identifiable Information (SPII).
|
|
521
532
|
*/
|
|
522
|
-
SPII
|
|
533
|
+
readonly SPII: "SPII";
|
|
523
534
|
/**
|
|
524
535
|
* The function call generated by the model was invalid.
|
|
525
536
|
*/
|
|
526
|
-
MALFORMED_FUNCTION_CALL
|
|
527
|
-
}
|
|
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];
|
|
528
545
|
|
|
529
546
|
/**
|
|
530
547
|
* A predicted {@link FunctionCall} returned from the model
|
|
@@ -548,25 +565,27 @@ export declare interface FunctionCallingConfig {
|
|
|
548
565
|
/**
|
|
549
566
|
* @public
|
|
550
567
|
*/
|
|
551
|
-
export declare
|
|
568
|
+
export declare const FunctionCallingMode: {
|
|
552
569
|
/**
|
|
553
570
|
* Default model behavior; model decides to predict either a function call
|
|
554
571
|
* or a natural language response.
|
|
555
572
|
*/
|
|
556
|
-
AUTO
|
|
573
|
+
readonly AUTO: "AUTO";
|
|
557
574
|
/**
|
|
558
575
|
* Model is constrained to always predicting a function call only.
|
|
559
576
|
* If `allowed_function_names` is set, the predicted function call will be
|
|
560
577
|
* limited to any one of `allowed_function_names`, else the predicted
|
|
561
578
|
* function call will be any one of the provided `function_declarations`.
|
|
562
579
|
*/
|
|
563
|
-
ANY
|
|
580
|
+
readonly ANY: "ANY";
|
|
564
581
|
/**
|
|
565
582
|
* Model will not predict any function call. Model behavior is same as when
|
|
566
583
|
* not passing any function declarations.
|
|
567
584
|
*/
|
|
568
|
-
NONE
|
|
569
|
-
}
|
|
585
|
+
readonly NONE: "NONE";
|
|
586
|
+
};
|
|
587
|
+
|
|
588
|
+
export declare type FunctionCallingMode = (typeof FunctionCallingMode)[keyof typeof FunctionCallingMode];
|
|
570
589
|
|
|
571
590
|
/**
|
|
572
591
|
* Content part interface if the part represents a {@link FunctionCall}.
|
|
@@ -605,7 +624,7 @@ export declare interface FunctionDeclaration {
|
|
|
605
624
|
* format. Reflects the Open API 3.03 Parameter Object. Parameter names are
|
|
606
625
|
* case-sensitive. For a function with no parameters, this can be left unset.
|
|
607
626
|
*/
|
|
608
|
-
parameters?:
|
|
627
|
+
parameters?: ObjectSchema | ObjectSchemaRequest;
|
|
609
628
|
}
|
|
610
629
|
|
|
611
630
|
/**
|
|
@@ -752,6 +771,10 @@ export declare interface GenerationConfig {
|
|
|
752
771
|
* @beta
|
|
753
772
|
*/
|
|
754
773
|
responseModalities?: ResponseModality[];
|
|
774
|
+
/**
|
|
775
|
+
* Configuration for "thinking" behavior of compatible Gemini models.
|
|
776
|
+
*/
|
|
777
|
+
thinkingConfig?: ThinkingConfig;
|
|
755
778
|
}
|
|
756
779
|
|
|
757
780
|
/**
|
|
@@ -855,22 +878,6 @@ export declare function getGenerativeModel(ai: AI, modelParams: ModelParams, req
|
|
|
855
878
|
*/
|
|
856
879
|
export declare function getImagenModel(ai: AI, modelParams: ImagenModelParams, requestOptions?: RequestOptions): ImagenModel;
|
|
857
880
|
|
|
858
|
-
/**
|
|
859
|
-
* @deprecated Use the new {@link getAI | getAI()} instead. The Vertex AI in Firebase SDK has been
|
|
860
|
-
* replaced with the Firebase AI SDK to accommodate the evolving set of supported features and
|
|
861
|
-
* services. For migration details, see the {@link https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk | migration guide}.
|
|
862
|
-
*
|
|
863
|
-
* Returns a {@link VertexAI} instance for the given app, configured to use the
|
|
864
|
-
* Vertex AI Gemini API. This instance will be
|
|
865
|
-
* configured to use the Vertex AI Gemini API.
|
|
866
|
-
*
|
|
867
|
-
* @param app - The {@link @firebase/app#FirebaseApp} to use.
|
|
868
|
-
* @param options - Options to configure the Vertex AI instance, including the location.
|
|
869
|
-
*
|
|
870
|
-
* @public
|
|
871
|
-
*/
|
|
872
|
-
export declare function getVertexAI(app?: FirebaseApp, options?: VertexAIOptions): VertexAI;
|
|
873
|
-
|
|
874
881
|
/**
|
|
875
882
|
* Configuration class for the Gemini Developer API.
|
|
876
883
|
*
|
|
@@ -928,6 +935,42 @@ export declare interface GoogleAIGenerateContentResponse {
|
|
|
928
935
|
usageMetadata?: UsageMetadata;
|
|
929
936
|
}
|
|
930
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
|
+
|
|
931
974
|
/**
|
|
932
975
|
* @deprecated
|
|
933
976
|
* @public
|
|
@@ -940,125 +983,221 @@ export declare interface GroundingAttribution {
|
|
|
940
983
|
}
|
|
941
984
|
|
|
942
985
|
/**
|
|
943
|
-
*
|
|
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
|
+
*
|
|
944
1008
|
* @public
|
|
945
1009
|
*/
|
|
946
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
|
+
*/
|
|
947
1031
|
webSearchQueries?: string[];
|
|
1032
|
+
/**
|
|
1033
|
+
* @deprecated Use {@link GroundingSupport} instead.
|
|
1034
|
+
*/
|
|
948
1035
|
retrievalQueries?: string[];
|
|
949
1036
|
/**
|
|
950
|
-
* @deprecated
|
|
1037
|
+
* @deprecated Use {@link GroundingChunk} instead.
|
|
951
1038
|
*/
|
|
952
1039
|
groundingAttributions: GroundingAttribution[];
|
|
953
1040
|
}
|
|
954
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
|
+
|
|
955
1063
|
/**
|
|
956
1064
|
* This property is not supported in the Gemini Developer API ({@link GoogleAIBackend}).
|
|
957
1065
|
*
|
|
958
1066
|
* @public
|
|
959
1067
|
*/
|
|
960
|
-
export declare
|
|
1068
|
+
export declare const HarmBlockMethod: {
|
|
961
1069
|
/**
|
|
962
1070
|
* The harm block method uses both probability and severity scores.
|
|
963
1071
|
*/
|
|
964
|
-
SEVERITY
|
|
1072
|
+
readonly SEVERITY: "SEVERITY";
|
|
965
1073
|
/**
|
|
966
1074
|
* The harm block method uses the probability score.
|
|
967
1075
|
*/
|
|
968
|
-
PROBABILITY
|
|
969
|
-
}
|
|
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];
|
|
970
1085
|
|
|
971
1086
|
/**
|
|
972
1087
|
* Threshold above which a prompt or candidate will be blocked.
|
|
973
1088
|
* @public
|
|
974
1089
|
*/
|
|
975
|
-
export declare
|
|
1090
|
+
export declare const HarmBlockThreshold: {
|
|
976
1091
|
/**
|
|
977
1092
|
* Content with `NEGLIGIBLE` will be allowed.
|
|
978
1093
|
*/
|
|
979
|
-
BLOCK_LOW_AND_ABOVE
|
|
1094
|
+
readonly BLOCK_LOW_AND_ABOVE: "BLOCK_LOW_AND_ABOVE";
|
|
980
1095
|
/**
|
|
981
1096
|
* Content with `NEGLIGIBLE` and `LOW` will be allowed.
|
|
982
1097
|
*/
|
|
983
|
-
BLOCK_MEDIUM_AND_ABOVE
|
|
1098
|
+
readonly BLOCK_MEDIUM_AND_ABOVE: "BLOCK_MEDIUM_AND_ABOVE";
|
|
984
1099
|
/**
|
|
985
1100
|
* Content with `NEGLIGIBLE`, `LOW`, and `MEDIUM` will be allowed.
|
|
986
1101
|
*/
|
|
987
|
-
BLOCK_ONLY_HIGH
|
|
1102
|
+
readonly BLOCK_ONLY_HIGH: "BLOCK_ONLY_HIGH";
|
|
988
1103
|
/**
|
|
989
1104
|
* All content will be allowed.
|
|
990
1105
|
*/
|
|
991
|
-
BLOCK_NONE
|
|
1106
|
+
readonly BLOCK_NONE: "BLOCK_NONE";
|
|
992
1107
|
/**
|
|
993
1108
|
* All content will be allowed. This is the same as `BLOCK_NONE`, but the metadata corresponding
|
|
994
1109
|
* to the {@link HarmCategory} will not be present in the response.
|
|
995
1110
|
*/
|
|
996
|
-
OFF
|
|
997
|
-
}
|
|
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];
|
|
998
1119
|
|
|
999
1120
|
/**
|
|
1000
1121
|
* Harm categories that would cause prompts or candidates to be blocked.
|
|
1001
1122
|
* @public
|
|
1002
1123
|
*/
|
|
1003
|
-
export declare
|
|
1004
|
-
HARM_CATEGORY_HATE_SPEECH
|
|
1005
|
-
HARM_CATEGORY_SEXUALLY_EXPLICIT
|
|
1006
|
-
HARM_CATEGORY_HARASSMENT
|
|
1007
|
-
HARM_CATEGORY_DANGEROUS_CONTENT
|
|
1008
|
-
}
|
|
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];
|
|
1009
1136
|
|
|
1010
1137
|
/**
|
|
1011
1138
|
* Probability that a prompt or candidate matches a harm category.
|
|
1012
1139
|
* @public
|
|
1013
1140
|
*/
|
|
1014
|
-
export declare
|
|
1141
|
+
export declare const HarmProbability: {
|
|
1015
1142
|
/**
|
|
1016
1143
|
* Content has a negligible chance of being unsafe.
|
|
1017
1144
|
*/
|
|
1018
|
-
NEGLIGIBLE
|
|
1145
|
+
readonly NEGLIGIBLE: "NEGLIGIBLE";
|
|
1019
1146
|
/**
|
|
1020
1147
|
* Content has a low chance of being unsafe.
|
|
1021
1148
|
*/
|
|
1022
|
-
LOW
|
|
1149
|
+
readonly LOW: "LOW";
|
|
1023
1150
|
/**
|
|
1024
1151
|
* Content has a medium chance of being unsafe.
|
|
1025
1152
|
*/
|
|
1026
|
-
MEDIUM
|
|
1153
|
+
readonly MEDIUM: "MEDIUM";
|
|
1027
1154
|
/**
|
|
1028
1155
|
* Content has a high chance of being unsafe.
|
|
1029
1156
|
*/
|
|
1030
|
-
HIGH
|
|
1031
|
-
}
|
|
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];
|
|
1032
1165
|
|
|
1033
1166
|
/**
|
|
1034
1167
|
* Harm severity levels.
|
|
1035
1168
|
* @public
|
|
1036
1169
|
*/
|
|
1037
|
-
export declare
|
|
1170
|
+
export declare const HarmSeverity: {
|
|
1038
1171
|
/**
|
|
1039
1172
|
* Negligible level of harm severity.
|
|
1040
1173
|
*/
|
|
1041
|
-
HARM_SEVERITY_NEGLIGIBLE
|
|
1174
|
+
readonly HARM_SEVERITY_NEGLIGIBLE: "HARM_SEVERITY_NEGLIGIBLE";
|
|
1042
1175
|
/**
|
|
1043
1176
|
* Low level of harm severity.
|
|
1044
1177
|
*/
|
|
1045
|
-
HARM_SEVERITY_LOW
|
|
1178
|
+
readonly HARM_SEVERITY_LOW: "HARM_SEVERITY_LOW";
|
|
1046
1179
|
/**
|
|
1047
1180
|
* Medium level of harm severity.
|
|
1048
1181
|
*/
|
|
1049
|
-
HARM_SEVERITY_MEDIUM
|
|
1182
|
+
readonly HARM_SEVERITY_MEDIUM: "HARM_SEVERITY_MEDIUM";
|
|
1050
1183
|
/**
|
|
1051
1184
|
* High level of harm severity.
|
|
1052
1185
|
*/
|
|
1053
|
-
HARM_SEVERITY_HIGH
|
|
1186
|
+
readonly HARM_SEVERITY_HIGH: "HARM_SEVERITY_HIGH";
|
|
1054
1187
|
/**
|
|
1055
1188
|
* Harm severity is not supported.
|
|
1056
1189
|
*
|
|
1057
1190
|
* @remarks
|
|
1058
1191
|
* The GoogleAI backend does not support `HarmSeverity`, so this value is used as a fallback.
|
|
1059
1192
|
*/
|
|
1060
|
-
HARM_SEVERITY_UNSUPPORTED
|
|
1061
|
-
}
|
|
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];
|
|
1062
1201
|
|
|
1063
1202
|
/**
|
|
1064
1203
|
* Aspect ratios for Imagen images.
|
|
@@ -1071,28 +1210,41 @@ export declare enum HarmSeverity {
|
|
|
1071
1210
|
*
|
|
1072
1211
|
* @beta
|
|
1073
1212
|
*/
|
|
1074
|
-
export declare
|
|
1213
|
+
export declare const ImagenAspectRatio: {
|
|
1075
1214
|
/**
|
|
1076
1215
|
* Square (1:1) aspect ratio.
|
|
1077
1216
|
*/
|
|
1078
|
-
SQUARE
|
|
1217
|
+
readonly SQUARE: "1:1";
|
|
1079
1218
|
/**
|
|
1080
1219
|
* Landscape (3:4) aspect ratio.
|
|
1081
1220
|
*/
|
|
1082
|
-
LANDSCAPE_3x4
|
|
1221
|
+
readonly LANDSCAPE_3x4: "3:4";
|
|
1083
1222
|
/**
|
|
1084
1223
|
* Portrait (4:3) aspect ratio.
|
|
1085
1224
|
*/
|
|
1086
|
-
PORTRAIT_4x3
|
|
1225
|
+
readonly PORTRAIT_4x3: "4:3";
|
|
1087
1226
|
/**
|
|
1088
1227
|
* Landscape (16:9) aspect ratio.
|
|
1089
1228
|
*/
|
|
1090
|
-
LANDSCAPE_16x9
|
|
1229
|
+
readonly LANDSCAPE_16x9: "16:9";
|
|
1091
1230
|
/**
|
|
1092
1231
|
* Portrait (9:16) aspect ratio.
|
|
1093
1232
|
*/
|
|
1094
|
-
PORTRAIT_9x16
|
|
1095
|
-
}
|
|
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];
|
|
1096
1248
|
|
|
1097
1249
|
/**
|
|
1098
1250
|
* An image generated by Imagen, stored in a Cloud Storage for Firebase bucket.
|
|
@@ -1144,7 +1296,7 @@ export declare interface ImagenGenerationConfig {
|
|
|
1144
1296
|
numberOfImages?: number;
|
|
1145
1297
|
/**
|
|
1146
1298
|
* The aspect ratio of the generated images. The default value is square 1:1.
|
|
1147
|
-
* Supported aspect ratios depend on the Imagen model, see {@link ImagenAspectRatio}
|
|
1299
|
+
* Supported aspect ratios depend on the Imagen model, see {@link (ImagenAspectRatio:type)}
|
|
1148
1300
|
* for more details.
|
|
1149
1301
|
*/
|
|
1150
1302
|
aspectRatio?: ImagenAspectRatio;
|
|
@@ -1186,8 +1338,8 @@ export declare interface ImagenGenerationResponse<T extends ImagenInlineImage |
|
|
|
1186
1338
|
* The reason that images were filtered out. This property will only be defined if one
|
|
1187
1339
|
* or more images were filtered.
|
|
1188
1340
|
*
|
|
1189
|
-
* Images may be filtered out due to the {@link ImagenSafetyFilterLevel},
|
|
1190
|
-
* {@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.
|
|
1191
1343
|
* The filter levels may be adjusted in your {@link ImagenSafetySettings}.
|
|
1192
1344
|
*
|
|
1193
1345
|
* See the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen | Responsible AI and usage guidelines for Imagen}
|
|
@@ -1410,11 +1562,11 @@ export declare interface ImagenModelParams {
|
|
|
1410
1562
|
*
|
|
1411
1563
|
* @beta
|
|
1412
1564
|
*/
|
|
1413
|
-
export declare
|
|
1565
|
+
export declare const ImagenPersonFilterLevel: {
|
|
1414
1566
|
/**
|
|
1415
1567
|
* Disallow generation of images containing people or faces; images of people are filtered out.
|
|
1416
1568
|
*/
|
|
1417
|
-
BLOCK_ALL
|
|
1569
|
+
readonly BLOCK_ALL: "dont_allow";
|
|
1418
1570
|
/**
|
|
1419
1571
|
* Allow generation of images containing adults only; images of children are filtered out.
|
|
1420
1572
|
*
|
|
@@ -1422,7 +1574,7 @@ export declare enum ImagenPersonFilterLevel {
|
|
|
1422
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}
|
|
1423
1575
|
* for more details.
|
|
1424
1576
|
*/
|
|
1425
|
-
ALLOW_ADULT
|
|
1577
|
+
readonly ALLOW_ADULT: "allow_adult";
|
|
1426
1578
|
/**
|
|
1427
1579
|
* Allow generation of images containing adults only; images of children are filtered out.
|
|
1428
1580
|
*
|
|
@@ -1430,8 +1582,18 @@ export declare enum ImagenPersonFilterLevel {
|
|
|
1430
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}
|
|
1431
1583
|
* for more details.
|
|
1432
1584
|
*/
|
|
1433
|
-
ALLOW_ALL
|
|
1434
|
-
}
|
|
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];
|
|
1435
1597
|
|
|
1436
1598
|
/**
|
|
1437
1599
|
* A filter level controlling how aggressively to filter sensitive content.
|
|
@@ -1445,27 +1607,41 @@ export declare enum ImagenPersonFilterLevel {
|
|
|
1445
1607
|
*
|
|
1446
1608
|
* @beta
|
|
1447
1609
|
*/
|
|
1448
|
-
export declare
|
|
1610
|
+
export declare const ImagenSafetyFilterLevel: {
|
|
1449
1611
|
/**
|
|
1450
1612
|
* The most aggressive filtering level; most strict blocking.
|
|
1451
1613
|
*/
|
|
1452
|
-
BLOCK_LOW_AND_ABOVE
|
|
1614
|
+
readonly BLOCK_LOW_AND_ABOVE: "block_low_and_above";
|
|
1453
1615
|
/**
|
|
1454
1616
|
* Blocks some sensitive prompts and responses.
|
|
1455
1617
|
*/
|
|
1456
|
-
BLOCK_MEDIUM_AND_ABOVE
|
|
1618
|
+
readonly BLOCK_MEDIUM_AND_ABOVE: "block_medium_and_above";
|
|
1457
1619
|
/**
|
|
1458
1620
|
* Blocks few sensitive prompts and responses.
|
|
1459
1621
|
*/
|
|
1460
|
-
BLOCK_ONLY_HIGH
|
|
1622
|
+
readonly BLOCK_ONLY_HIGH: "block_only_high";
|
|
1461
1623
|
/**
|
|
1462
1624
|
* The least aggressive filtering level; blocks very few sensitive prompts and responses.
|
|
1463
1625
|
*
|
|
1464
1626
|
* Access to this feature is restricted and may require your case to be reviewed and approved by
|
|
1465
1627
|
* Cloud support.
|
|
1466
1628
|
*/
|
|
1467
|
-
BLOCK_NONE
|
|
1468
|
-
}
|
|
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];
|
|
1469
1645
|
|
|
1470
1646
|
/**
|
|
1471
1647
|
* Settings for controlling the aggressiveness of filtering out sensitive content.
|
|
@@ -1514,32 +1690,38 @@ export declare class IntegerSchema extends Schema {
|
|
|
1514
1690
|
* Content part modality.
|
|
1515
1691
|
* @public
|
|
1516
1692
|
*/
|
|
1517
|
-
export declare
|
|
1693
|
+
export declare const Modality: {
|
|
1518
1694
|
/**
|
|
1519
1695
|
* Unspecified modality.
|
|
1520
1696
|
*/
|
|
1521
|
-
MODALITY_UNSPECIFIED
|
|
1697
|
+
readonly MODALITY_UNSPECIFIED: "MODALITY_UNSPECIFIED";
|
|
1522
1698
|
/**
|
|
1523
1699
|
* Plain text.
|
|
1524
1700
|
*/
|
|
1525
|
-
TEXT
|
|
1701
|
+
readonly TEXT: "TEXT";
|
|
1526
1702
|
/**
|
|
1527
1703
|
* Image.
|
|
1528
1704
|
*/
|
|
1529
|
-
IMAGE
|
|
1705
|
+
readonly IMAGE: "IMAGE";
|
|
1530
1706
|
/**
|
|
1531
1707
|
* Video.
|
|
1532
1708
|
*/
|
|
1533
|
-
VIDEO
|
|
1709
|
+
readonly VIDEO: "VIDEO";
|
|
1534
1710
|
/**
|
|
1535
1711
|
* Audio.
|
|
1536
1712
|
*/
|
|
1537
|
-
AUDIO
|
|
1713
|
+
readonly AUDIO: "AUDIO";
|
|
1538
1714
|
/**
|
|
1539
1715
|
* Document (for example, PDF).
|
|
1540
1716
|
*/
|
|
1541
|
-
DOCUMENT
|
|
1542
|
-
}
|
|
1717
|
+
readonly DOCUMENT: "DOCUMENT";
|
|
1718
|
+
};
|
|
1719
|
+
|
|
1720
|
+
/**
|
|
1721
|
+
* Content part modality.
|
|
1722
|
+
* @public
|
|
1723
|
+
*/
|
|
1724
|
+
export declare type Modality = (typeof Modality)[keyof typeof Modality];
|
|
1543
1725
|
|
|
1544
1726
|
/**
|
|
1545
1727
|
* Represents token counting info for a single modality.
|
|
@@ -1592,12 +1774,20 @@ export declare class ObjectSchema extends Schema {
|
|
|
1592
1774
|
}
|
|
1593
1775
|
|
|
1594
1776
|
/**
|
|
1595
|
-
* Interface for {@link
|
|
1777
|
+
* Interface for JSON parameters in a schema of {@link SchemaType}
|
|
1778
|
+
* "object" when not using the `Schema.object()` helper.
|
|
1596
1779
|
* @public
|
|
1597
1780
|
*/
|
|
1598
|
-
export declare interface
|
|
1599
|
-
type:
|
|
1600
|
-
|
|
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;
|
|
1601
1791
|
}
|
|
1602
1792
|
|
|
1603
1793
|
/**
|
|
@@ -1757,7 +1947,7 @@ export declare interface SafetySetting {
|
|
|
1757
1947
|
export declare abstract class Schema implements SchemaInterface {
|
|
1758
1948
|
/**
|
|
1759
1949
|
* Optional. The type of the property. {@link
|
|
1760
|
-
* SchemaType}.
|
|
1950
|
+
* (SchemaType:type)}.
|
|
1761
1951
|
*/
|
|
1762
1952
|
type: SchemaType;
|
|
1763
1953
|
/** Optional. The format of the property.
|
|
@@ -1773,9 +1963,9 @@ export declare abstract class Schema implements SchemaInterface {
|
|
|
1773
1963
|
description?: string;
|
|
1774
1964
|
/** Optional. The items of the property. */
|
|
1775
1965
|
items?: SchemaInterface;
|
|
1776
|
-
/** The minimum number of items (elements) in a schema of
|
|
1966
|
+
/** The minimum number of items (elements) in a schema of {@link (SchemaType:type)} `array`. */
|
|
1777
1967
|
minItems?: number;
|
|
1778
|
-
/** The maximum number of items (elements) in a schema of
|
|
1968
|
+
/** The maximum number of items (elements) in a schema of {@link (SchemaType:type)} `array`. */
|
|
1779
1969
|
maxItems?: number;
|
|
1780
1970
|
/** Optional. Whether the property is nullable. Defaults to false. */
|
|
1781
1971
|
nullable: boolean;
|
|
@@ -1818,7 +2008,7 @@ export declare abstract class Schema implements SchemaInterface {
|
|
|
1818
2008
|
export declare interface SchemaInterface extends SchemaShared<SchemaInterface> {
|
|
1819
2009
|
/**
|
|
1820
2010
|
* The type of the property. {@link
|
|
1821
|
-
* SchemaType}.
|
|
2011
|
+
* (SchemaType:type)}.
|
|
1822
2012
|
*/
|
|
1823
2013
|
type: SchemaType;
|
|
1824
2014
|
}
|
|
@@ -1838,7 +2028,7 @@ export declare interface SchemaParams extends SchemaShared<SchemaInterface> {
|
|
|
1838
2028
|
export declare interface SchemaRequest extends SchemaShared<SchemaRequest> {
|
|
1839
2029
|
/**
|
|
1840
2030
|
* The type of the property. {@link
|
|
1841
|
-
* SchemaType}.
|
|
2031
|
+
* (SchemaType:type)}.
|
|
1842
2032
|
*/
|
|
1843
2033
|
type: SchemaType;
|
|
1844
2034
|
/** Optional. Array of required property. */
|
|
@@ -1866,9 +2056,9 @@ export declare interface SchemaShared<T> {
|
|
|
1866
2056
|
title?: string;
|
|
1867
2057
|
/** Optional. The items of the property. */
|
|
1868
2058
|
items?: T;
|
|
1869
|
-
/** The minimum number of items (elements) in a schema of
|
|
2059
|
+
/** The minimum number of items (elements) in a schema of {@link (SchemaType:type)} `array`. */
|
|
1870
2060
|
minItems?: number;
|
|
1871
|
-
/** The maximum number of items (elements) in a schema of
|
|
2061
|
+
/** The maximum number of items (elements) in a schema of {@link (SchemaType:type)} `array`. */
|
|
1872
2062
|
maxItems?: number;
|
|
1873
2063
|
/** Optional. Map of `Schema` objects. */
|
|
1874
2064
|
properties?: {
|
|
@@ -1889,50 +2079,88 @@ export declare interface SchemaShared<T> {
|
|
|
1889
2079
|
[key: string]: unknown;
|
|
1890
2080
|
}
|
|
1891
2081
|
|
|
1892
|
-
/**
|
|
1893
|
-
* @license
|
|
1894
|
-
* Copyright 2024 Google LLC
|
|
1895
|
-
*
|
|
1896
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1897
|
-
* you may not use this file except in compliance with the License.
|
|
1898
|
-
* You may obtain a copy of the License at
|
|
1899
|
-
*
|
|
1900
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1901
|
-
*
|
|
1902
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1903
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1904
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1905
|
-
* See the License for the specific language governing permissions and
|
|
1906
|
-
* limitations under the License.
|
|
1907
|
-
*/
|
|
1908
2082
|
/**
|
|
1909
2083
|
* Contains the list of OpenAPI data types
|
|
1910
2084
|
* as defined by the
|
|
1911
2085
|
* {@link https://swagger.io/docs/specification/data-models/data-types/ | OpenAPI specification}
|
|
1912
2086
|
* @public
|
|
1913
2087
|
*/
|
|
1914
|
-
export declare
|
|
2088
|
+
export declare const SchemaType: {
|
|
1915
2089
|
/** String type. */
|
|
1916
|
-
STRING
|
|
2090
|
+
readonly STRING: "string";
|
|
1917
2091
|
/** Number type. */
|
|
1918
|
-
NUMBER
|
|
2092
|
+
readonly NUMBER: "number";
|
|
1919
2093
|
/** Integer type. */
|
|
1920
|
-
INTEGER
|
|
2094
|
+
readonly INTEGER: "integer";
|
|
1921
2095
|
/** Boolean type. */
|
|
1922
|
-
BOOLEAN
|
|
2096
|
+
readonly BOOLEAN: "boolean";
|
|
1923
2097
|
/** Array type. */
|
|
1924
|
-
ARRAY
|
|
2098
|
+
readonly ARRAY: "array";
|
|
1925
2099
|
/** Object type. */
|
|
1926
|
-
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;
|
|
1927
2133
|
}
|
|
1928
2134
|
|
|
1929
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
|
+
*
|
|
1930
2139
|
* @public
|
|
1931
2140
|
*/
|
|
1932
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
|
+
*/
|
|
1933
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
|
+
*/
|
|
1934
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
|
+
*/
|
|
1935
2159
|
endIndex: number;
|
|
2160
|
+
/**
|
|
2161
|
+
* The text corresponding to the segment from the response.
|
|
2162
|
+
*/
|
|
2163
|
+
text: string;
|
|
1936
2164
|
}
|
|
1937
2165
|
|
|
1938
2166
|
/**
|
|
@@ -1971,11 +2199,36 @@ export declare interface TextPart {
|
|
|
1971
2199
|
functionResponse?: never;
|
|
1972
2200
|
}
|
|
1973
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
|
+
|
|
1974
2227
|
/**
|
|
1975
2228
|
* Defines a tool that model can call to access external knowledge.
|
|
1976
2229
|
* @public
|
|
1977
2230
|
*/
|
|
1978
|
-
export declare type Tool = FunctionDeclarationsTool;
|
|
2231
|
+
export declare type Tool = FunctionDeclarationsTool | GoogleSearchTool;
|
|
1979
2232
|
|
|
1980
2233
|
/**
|
|
1981
2234
|
* Tool config. This config is shared for all tools provided in the request.
|
|
@@ -1999,22 +2252,15 @@ export declare type TypedSchema = IntegerSchema | NumberSchema | StringSchema |
|
|
|
1999
2252
|
export declare interface UsageMetadata {
|
|
2000
2253
|
promptTokenCount: number;
|
|
2001
2254
|
candidatesTokenCount: number;
|
|
2255
|
+
/**
|
|
2256
|
+
* The number of tokens used by the model's internal "thinking" process.
|
|
2257
|
+
*/
|
|
2258
|
+
thoughtsTokenCount?: number;
|
|
2002
2259
|
totalTokenCount: number;
|
|
2003
2260
|
promptTokensDetails?: ModalityTokenCount[];
|
|
2004
2261
|
candidatesTokensDetails?: ModalityTokenCount[];
|
|
2005
2262
|
}
|
|
2006
2263
|
|
|
2007
|
-
/**
|
|
2008
|
-
* @deprecated Use the new {@link AI | AI} instead. The Vertex AI in Firebase SDK has been
|
|
2009
|
-
* replaced with the Firebase AI SDK to accommodate the evolving set of supported features and
|
|
2010
|
-
* services. For migration details, see the {@link https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk | migration guide}.
|
|
2011
|
-
*
|
|
2012
|
-
* An instance of the Firebase AI SDK.
|
|
2013
|
-
*
|
|
2014
|
-
* @public
|
|
2015
|
-
*/
|
|
2016
|
-
export declare type VertexAI = AI;
|
|
2017
|
-
|
|
2018
2264
|
/**
|
|
2019
2265
|
* Configuration class for the Vertex AI Gemini API.
|
|
2020
2266
|
*
|
|
@@ -2040,37 +2286,6 @@ export declare class VertexAIBackend extends Backend {
|
|
|
2040
2286
|
constructor(location?: string);
|
|
2041
2287
|
}
|
|
2042
2288
|
|
|
2043
|
-
/**
|
|
2044
|
-
* @deprecated Use the new {@link AIError} instead. The Vertex AI in Firebase SDK has been
|
|
2045
|
-
* replaced with the Firebase AI SDK to accommodate the evolving set of supported features and
|
|
2046
|
-
* services. For migration details, see the {@link https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk | migration guide}.
|
|
2047
|
-
*
|
|
2048
|
-
* Error class for the Firebase AI SDK.
|
|
2049
|
-
*
|
|
2050
|
-
* @public
|
|
2051
|
-
*/
|
|
2052
|
-
export declare const VertexAIError: typeof AIError;
|
|
2053
|
-
|
|
2054
|
-
/**
|
|
2055
|
-
* @deprecated Use the new {@link AIModel} instead. The Vertex AI in Firebase SDK has been
|
|
2056
|
-
* replaced with the Firebase AI SDK to accommodate the evolving set of supported features and
|
|
2057
|
-
* services. For migration details, see the {@link https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk | migration guide}.
|
|
2058
|
-
*
|
|
2059
|
-
* Base class for Firebase AI model APIs.
|
|
2060
|
-
*
|
|
2061
|
-
* @public
|
|
2062
|
-
*/
|
|
2063
|
-
export declare const VertexAIModel: typeof AIModel;
|
|
2064
|
-
|
|
2065
|
-
/**
|
|
2066
|
-
* Options when initializing the Firebase AI SDK.
|
|
2067
|
-
*
|
|
2068
|
-
* @public
|
|
2069
|
-
*/
|
|
2070
|
-
export declare interface VertexAIOptions {
|
|
2071
|
-
location?: string;
|
|
2072
|
-
}
|
|
2073
|
-
|
|
2074
2289
|
/**
|
|
2075
2290
|
* Describes the input video content.
|
|
2076
2291
|
* @public
|
|
@@ -2096,4 +2311,31 @@ export declare interface WebAttribution {
|
|
|
2096
2311
|
title: string;
|
|
2097
2312
|
}
|
|
2098
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
|
+
|
|
2099
2341
|
export { }
|