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