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