@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/src/api.d.ts
CHANGED
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
import { FirebaseApp } from '@firebase/app';
|
|
18
18
|
import { AI_TYPE } from './constants';
|
|
19
19
|
import { AIService } from './service';
|
|
20
|
-
import { AI, AIOptions
|
|
21
|
-
import { ImagenModelParams, ModelParams, RequestOptions
|
|
20
|
+
import { AI, AIOptions } from './public-types';
|
|
21
|
+
import { ImagenModelParams, ModelParams, RequestOptions } from './types';
|
|
22
22
|
import { AIError } from './errors';
|
|
23
23
|
import { AIModel, GenerativeModel, ImagenModel } from './models';
|
|
24
24
|
export { ChatSession } from './methods/chat-session';
|
|
@@ -26,47 +26,11 @@ export * from './requests/schema-builder';
|
|
|
26
26
|
export { ImagenImageFormat } from './requests/imagen-image-format';
|
|
27
27
|
export { AIModel, GenerativeModel, ImagenModel, AIError };
|
|
28
28
|
export { Backend, VertexAIBackend, GoogleAIBackend } from './backend';
|
|
29
|
-
export { AIErrorCode as VertexAIErrorCode };
|
|
30
|
-
/**
|
|
31
|
-
* @deprecated Use the new {@link AIModel} instead. The Vertex AI in Firebase SDK has been
|
|
32
|
-
* replaced with the Firebase AI SDK to accommodate the evolving set of supported features and
|
|
33
|
-
* services. For migration details, see the {@link https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk | migration guide}.
|
|
34
|
-
*
|
|
35
|
-
* Base class for Firebase AI model APIs.
|
|
36
|
-
*
|
|
37
|
-
* @public
|
|
38
|
-
*/
|
|
39
|
-
export declare const VertexAIModel: typeof AIModel;
|
|
40
|
-
/**
|
|
41
|
-
* @deprecated Use the new {@link AIError} instead. The Vertex AI in Firebase SDK has been
|
|
42
|
-
* replaced with the Firebase AI SDK to accommodate the evolving set of supported features and
|
|
43
|
-
* services. For migration details, see the {@link https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk | migration guide}.
|
|
44
|
-
*
|
|
45
|
-
* Error class for the Firebase AI SDK.
|
|
46
|
-
*
|
|
47
|
-
* @public
|
|
48
|
-
*/
|
|
49
|
-
export declare const VertexAIError: typeof AIError;
|
|
50
29
|
declare module '@firebase/component' {
|
|
51
30
|
interface NameServiceMapping {
|
|
52
31
|
[AI_TYPE]: AIService;
|
|
53
32
|
}
|
|
54
33
|
}
|
|
55
|
-
/**
|
|
56
|
-
* @deprecated Use the new {@link getAI | getAI()} instead. The Vertex AI in Firebase SDK has been
|
|
57
|
-
* replaced with the Firebase AI SDK to accommodate the evolving set of supported features and
|
|
58
|
-
* services. For migration details, see the {@link https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk | migration guide}.
|
|
59
|
-
*
|
|
60
|
-
* Returns a {@link VertexAI} instance for the given app, configured to use the
|
|
61
|
-
* Vertex AI Gemini API. This instance will be
|
|
62
|
-
* configured to use the Vertex AI Gemini API.
|
|
63
|
-
*
|
|
64
|
-
* @param app - The {@link @firebase/app#FirebaseApp} to use.
|
|
65
|
-
* @param options - Options to configure the Vertex AI instance, including the location.
|
|
66
|
-
*
|
|
67
|
-
* @public
|
|
68
|
-
*/
|
|
69
|
-
export declare function getVertexAI(app?: FirebaseApp, options?: VertexAIOptions): VertexAI;
|
|
70
34
|
/**
|
|
71
35
|
* Returns the default {@link AI} instance that is associated with the provided
|
|
72
36
|
* {@link @firebase/app#FirebaseApp}. If no instance exists, initializes a new instance with the
|
package/dist/src/errors.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export declare class AIError extends FirebaseError {
|
|
|
27
27
|
/**
|
|
28
28
|
* Constructs a new instance of the `AIError` class.
|
|
29
29
|
*
|
|
30
|
-
* @param code - The error code from {@link AIErrorCode}.
|
|
30
|
+
* @param code - The error code from {@link (AIErrorCode:type)}.
|
|
31
31
|
* @param message - A human-readable message describing the error.
|
|
32
32
|
* @param customErrorData - Optional error data.
|
|
33
33
|
*/
|
|
@@ -17,24 +17,6 @@
|
|
|
17
17
|
import { FirebaseApp } from '@firebase/app';
|
|
18
18
|
import { Backend } from './backend';
|
|
19
19
|
export * from './types';
|
|
20
|
-
/**
|
|
21
|
-
* @deprecated Use the new {@link AI | AI} instead. The Vertex AI in Firebase SDK has been
|
|
22
|
-
* replaced with the Firebase AI SDK to accommodate the evolving set of supported features and
|
|
23
|
-
* services. For migration details, see the {@link https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk | migration guide}.
|
|
24
|
-
*
|
|
25
|
-
* An instance of the Firebase AI SDK.
|
|
26
|
-
*
|
|
27
|
-
* @public
|
|
28
|
-
*/
|
|
29
|
-
export type VertexAI = AI;
|
|
30
|
-
/**
|
|
31
|
-
* Options when initializing the Firebase AI SDK.
|
|
32
|
-
*
|
|
33
|
-
* @public
|
|
34
|
-
*/
|
|
35
|
-
export interface VertexAIOptions {
|
|
36
|
-
location?: string;
|
|
37
|
-
}
|
|
38
20
|
/**
|
|
39
21
|
* An instance of the Firebase AI SDK.
|
|
40
22
|
*
|
|
@@ -24,10 +24,11 @@ import { SchemaInterface, SchemaType, SchemaParams, SchemaRequest } from '../typ
|
|
|
24
24
|
*/
|
|
25
25
|
export declare abstract class Schema implements SchemaInterface {
|
|
26
26
|
/**
|
|
27
|
-
* Optional. The type of the property.
|
|
28
|
-
*
|
|
27
|
+
* Optional. The type of the property.
|
|
28
|
+
* This can only be undefined when using `anyOf` schemas, which do not have an
|
|
29
|
+
* explicit type in the {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#any-type | OpenAPI specification}.
|
|
29
30
|
*/
|
|
30
|
-
type
|
|
31
|
+
type?: SchemaType;
|
|
31
32
|
/** Optional. The format of the property.
|
|
32
33
|
* Supported formats:<br/>
|
|
33
34
|
* <ul>
|
|
@@ -41,9 +42,9 @@ export declare abstract class Schema implements SchemaInterface {
|
|
|
41
42
|
description?: string;
|
|
42
43
|
/** Optional. The items of the property. */
|
|
43
44
|
items?: SchemaInterface;
|
|
44
|
-
/** The minimum number of items (elements) in a schema of
|
|
45
|
+
/** The minimum number of items (elements) in a schema of {@link (SchemaType:type)} `array`. */
|
|
45
46
|
minItems?: number;
|
|
46
|
-
/** The maximum number of items (elements) in a schema of
|
|
47
|
+
/** The maximum number of items (elements) in a schema of {@link (SchemaType:type)} `array`. */
|
|
47
48
|
maxItems?: number;
|
|
48
49
|
/** Optional. Whether the property is nullable. Defaults to false. */
|
|
49
50
|
nullable: boolean;
|
|
@@ -77,12 +78,15 @@ export declare abstract class Schema implements SchemaInterface {
|
|
|
77
78
|
static integer(integerParams?: SchemaParams): IntegerSchema;
|
|
78
79
|
static number(numberParams?: SchemaParams): NumberSchema;
|
|
79
80
|
static boolean(booleanParams?: SchemaParams): BooleanSchema;
|
|
81
|
+
static anyOf(anyOfParams: SchemaParams & {
|
|
82
|
+
anyOf: TypedSchema[];
|
|
83
|
+
}): AnyOfSchema;
|
|
80
84
|
}
|
|
81
85
|
/**
|
|
82
86
|
* A type that includes all specific Schema types.
|
|
83
87
|
* @public
|
|
84
88
|
*/
|
|
85
|
-
export type TypedSchema = IntegerSchema | NumberSchema | StringSchema | BooleanSchema | ObjectSchema | ArraySchema;
|
|
89
|
+
export type TypedSchema = IntegerSchema | NumberSchema | StringSchema | BooleanSchema | ObjectSchema | ArraySchema | AnyOfSchema;
|
|
86
90
|
/**
|
|
87
91
|
* Schema class for "integer" types.
|
|
88
92
|
* @public
|
|
@@ -149,3 +153,18 @@ export declare class ObjectSchema extends Schema {
|
|
|
149
153
|
*/
|
|
150
154
|
toJSON(): SchemaRequest;
|
|
151
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* Schema class representing a value that can conform to any of the provided sub-schemas. This is
|
|
158
|
+
* useful when a field can accept multiple distinct types or structures.
|
|
159
|
+
* @public
|
|
160
|
+
*/
|
|
161
|
+
export declare class AnyOfSchema extends Schema {
|
|
162
|
+
anyOf: TypedSchema[];
|
|
163
|
+
constructor(schemaParams: SchemaParams & {
|
|
164
|
+
anyOf: TypedSchema[];
|
|
165
|
+
});
|
|
166
|
+
/**
|
|
167
|
+
* @internal
|
|
168
|
+
*/
|
|
169
|
+
toJSON(): SchemaRequest;
|
|
170
|
+
}
|
|
@@ -28,221 +28,263 @@ export declare const POSSIBLE_ROLES: readonly ["user", "model", "function", "sys
|
|
|
28
28
|
* Harm categories that would cause prompts or candidates to be blocked.
|
|
29
29
|
* @public
|
|
30
30
|
*/
|
|
31
|
-
export declare
|
|
32
|
-
HARM_CATEGORY_HATE_SPEECH
|
|
33
|
-
HARM_CATEGORY_SEXUALLY_EXPLICIT
|
|
34
|
-
HARM_CATEGORY_HARASSMENT
|
|
35
|
-
HARM_CATEGORY_DANGEROUS_CONTENT
|
|
36
|
-
}
|
|
31
|
+
export declare const HarmCategory: {
|
|
32
|
+
readonly HARM_CATEGORY_HATE_SPEECH: "HARM_CATEGORY_HATE_SPEECH";
|
|
33
|
+
readonly HARM_CATEGORY_SEXUALLY_EXPLICIT: "HARM_CATEGORY_SEXUALLY_EXPLICIT";
|
|
34
|
+
readonly HARM_CATEGORY_HARASSMENT: "HARM_CATEGORY_HARASSMENT";
|
|
35
|
+
readonly HARM_CATEGORY_DANGEROUS_CONTENT: "HARM_CATEGORY_DANGEROUS_CONTENT";
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Harm categories that would cause prompts or candidates to be blocked.
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
41
|
+
export type HarmCategory = (typeof HarmCategory)[keyof typeof HarmCategory];
|
|
37
42
|
/**
|
|
38
43
|
* Threshold above which a prompt or candidate will be blocked.
|
|
39
44
|
* @public
|
|
40
45
|
*/
|
|
41
|
-
export declare
|
|
46
|
+
export declare const HarmBlockThreshold: {
|
|
42
47
|
/**
|
|
43
48
|
* Content with `NEGLIGIBLE` will be allowed.
|
|
44
49
|
*/
|
|
45
|
-
BLOCK_LOW_AND_ABOVE
|
|
50
|
+
readonly BLOCK_LOW_AND_ABOVE: "BLOCK_LOW_AND_ABOVE";
|
|
46
51
|
/**
|
|
47
52
|
* Content with `NEGLIGIBLE` and `LOW` will be allowed.
|
|
48
53
|
*/
|
|
49
|
-
BLOCK_MEDIUM_AND_ABOVE
|
|
54
|
+
readonly BLOCK_MEDIUM_AND_ABOVE: "BLOCK_MEDIUM_AND_ABOVE";
|
|
50
55
|
/**
|
|
51
56
|
* Content with `NEGLIGIBLE`, `LOW`, and `MEDIUM` will be allowed.
|
|
52
57
|
*/
|
|
53
|
-
BLOCK_ONLY_HIGH
|
|
58
|
+
readonly BLOCK_ONLY_HIGH: "BLOCK_ONLY_HIGH";
|
|
54
59
|
/**
|
|
55
60
|
* All content will be allowed.
|
|
56
61
|
*/
|
|
57
|
-
BLOCK_NONE
|
|
62
|
+
readonly BLOCK_NONE: "BLOCK_NONE";
|
|
58
63
|
/**
|
|
59
64
|
* All content will be allowed. This is the same as `BLOCK_NONE`, but the metadata corresponding
|
|
60
65
|
* to the {@link HarmCategory} will not be present in the response.
|
|
61
66
|
*/
|
|
62
|
-
OFF
|
|
63
|
-
}
|
|
67
|
+
readonly OFF: "OFF";
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Threshold above which a prompt or candidate will be blocked.
|
|
71
|
+
* @public
|
|
72
|
+
*/
|
|
73
|
+
export type HarmBlockThreshold = (typeof HarmBlockThreshold)[keyof typeof HarmBlockThreshold];
|
|
64
74
|
/**
|
|
65
75
|
* This property is not supported in the Gemini Developer API ({@link GoogleAIBackend}).
|
|
66
76
|
*
|
|
67
77
|
* @public
|
|
68
78
|
*/
|
|
69
|
-
export declare
|
|
79
|
+
export declare const HarmBlockMethod: {
|
|
70
80
|
/**
|
|
71
81
|
* The harm block method uses both probability and severity scores.
|
|
72
82
|
*/
|
|
73
|
-
SEVERITY
|
|
83
|
+
readonly SEVERITY: "SEVERITY";
|
|
74
84
|
/**
|
|
75
85
|
* The harm block method uses the probability score.
|
|
76
86
|
*/
|
|
77
|
-
PROBABILITY
|
|
78
|
-
}
|
|
87
|
+
readonly PROBABILITY: "PROBABILITY";
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* This property is not supported in the Gemini Developer API ({@link GoogleAIBackend}).
|
|
91
|
+
*
|
|
92
|
+
* @public
|
|
93
|
+
*/
|
|
94
|
+
export type HarmBlockMethod = (typeof HarmBlockMethod)[keyof typeof HarmBlockMethod];
|
|
79
95
|
/**
|
|
80
96
|
* Probability that a prompt or candidate matches a harm category.
|
|
81
97
|
* @public
|
|
82
98
|
*/
|
|
83
|
-
export declare
|
|
99
|
+
export declare const HarmProbability: {
|
|
84
100
|
/**
|
|
85
101
|
* Content has a negligible chance of being unsafe.
|
|
86
102
|
*/
|
|
87
|
-
NEGLIGIBLE
|
|
103
|
+
readonly NEGLIGIBLE: "NEGLIGIBLE";
|
|
88
104
|
/**
|
|
89
105
|
* Content has a low chance of being unsafe.
|
|
90
106
|
*/
|
|
91
|
-
LOW
|
|
107
|
+
readonly LOW: "LOW";
|
|
92
108
|
/**
|
|
93
109
|
* Content has a medium chance of being unsafe.
|
|
94
110
|
*/
|
|
95
|
-
MEDIUM
|
|
111
|
+
readonly MEDIUM: "MEDIUM";
|
|
96
112
|
/**
|
|
97
113
|
* Content has a high chance of being unsafe.
|
|
98
114
|
*/
|
|
99
|
-
HIGH
|
|
100
|
-
}
|
|
115
|
+
readonly HIGH: "HIGH";
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Probability that a prompt or candidate matches a harm category.
|
|
119
|
+
* @public
|
|
120
|
+
*/
|
|
121
|
+
export type HarmProbability = (typeof HarmProbability)[keyof typeof HarmProbability];
|
|
101
122
|
/**
|
|
102
123
|
* Harm severity levels.
|
|
103
124
|
* @public
|
|
104
125
|
*/
|
|
105
|
-
export declare
|
|
126
|
+
export declare const HarmSeverity: {
|
|
106
127
|
/**
|
|
107
128
|
* Negligible level of harm severity.
|
|
108
129
|
*/
|
|
109
|
-
HARM_SEVERITY_NEGLIGIBLE
|
|
130
|
+
readonly HARM_SEVERITY_NEGLIGIBLE: "HARM_SEVERITY_NEGLIGIBLE";
|
|
110
131
|
/**
|
|
111
132
|
* Low level of harm severity.
|
|
112
133
|
*/
|
|
113
|
-
HARM_SEVERITY_LOW
|
|
134
|
+
readonly HARM_SEVERITY_LOW: "HARM_SEVERITY_LOW";
|
|
114
135
|
/**
|
|
115
136
|
* Medium level of harm severity.
|
|
116
137
|
*/
|
|
117
|
-
HARM_SEVERITY_MEDIUM
|
|
138
|
+
readonly HARM_SEVERITY_MEDIUM: "HARM_SEVERITY_MEDIUM";
|
|
118
139
|
/**
|
|
119
140
|
* High level of harm severity.
|
|
120
141
|
*/
|
|
121
|
-
HARM_SEVERITY_HIGH
|
|
142
|
+
readonly HARM_SEVERITY_HIGH: "HARM_SEVERITY_HIGH";
|
|
122
143
|
/**
|
|
123
144
|
* Harm severity is not supported.
|
|
124
145
|
*
|
|
125
146
|
* @remarks
|
|
126
147
|
* The GoogleAI backend does not support `HarmSeverity`, so this value is used as a fallback.
|
|
127
148
|
*/
|
|
128
|
-
HARM_SEVERITY_UNSUPPORTED
|
|
129
|
-
}
|
|
149
|
+
readonly HARM_SEVERITY_UNSUPPORTED: "HARM_SEVERITY_UNSUPPORTED";
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* Harm severity levels.
|
|
153
|
+
* @public
|
|
154
|
+
*/
|
|
155
|
+
export type HarmSeverity = (typeof HarmSeverity)[keyof typeof HarmSeverity];
|
|
130
156
|
/**
|
|
131
157
|
* Reason that a prompt was blocked.
|
|
132
158
|
* @public
|
|
133
159
|
*/
|
|
134
|
-
export declare
|
|
160
|
+
export declare const BlockReason: {
|
|
135
161
|
/**
|
|
136
162
|
* Content was blocked by safety settings.
|
|
137
163
|
*/
|
|
138
|
-
SAFETY
|
|
164
|
+
readonly SAFETY: "SAFETY";
|
|
139
165
|
/**
|
|
140
166
|
* Content was blocked, but the reason is uncategorized.
|
|
141
167
|
*/
|
|
142
|
-
OTHER
|
|
168
|
+
readonly OTHER: "OTHER";
|
|
143
169
|
/**
|
|
144
170
|
* Content was blocked because it contained terms from the terminology blocklist.
|
|
145
171
|
*/
|
|
146
|
-
BLOCKLIST
|
|
172
|
+
readonly BLOCKLIST: "BLOCKLIST";
|
|
147
173
|
/**
|
|
148
174
|
* Content was blocked due to prohibited content.
|
|
149
175
|
*/
|
|
150
|
-
PROHIBITED_CONTENT
|
|
151
|
-
}
|
|
176
|
+
readonly PROHIBITED_CONTENT: "PROHIBITED_CONTENT";
|
|
177
|
+
};
|
|
178
|
+
/**
|
|
179
|
+
* Reason that a prompt was blocked.
|
|
180
|
+
* @public
|
|
181
|
+
*/
|
|
182
|
+
export type BlockReason = (typeof BlockReason)[keyof typeof BlockReason];
|
|
152
183
|
/**
|
|
153
184
|
* Reason that a candidate finished.
|
|
154
185
|
* @public
|
|
155
186
|
*/
|
|
156
|
-
export declare
|
|
187
|
+
export declare const FinishReason: {
|
|
157
188
|
/**
|
|
158
189
|
* Natural stop point of the model or provided stop sequence.
|
|
159
190
|
*/
|
|
160
|
-
STOP
|
|
191
|
+
readonly STOP: "STOP";
|
|
161
192
|
/**
|
|
162
193
|
* The maximum number of tokens as specified in the request was reached.
|
|
163
194
|
*/
|
|
164
|
-
MAX_TOKENS
|
|
195
|
+
readonly MAX_TOKENS: "MAX_TOKENS";
|
|
165
196
|
/**
|
|
166
197
|
* The candidate content was flagged for safety reasons.
|
|
167
198
|
*/
|
|
168
|
-
SAFETY
|
|
199
|
+
readonly SAFETY: "SAFETY";
|
|
169
200
|
/**
|
|
170
201
|
* The candidate content was flagged for recitation reasons.
|
|
171
202
|
*/
|
|
172
|
-
RECITATION
|
|
203
|
+
readonly RECITATION: "RECITATION";
|
|
173
204
|
/**
|
|
174
205
|
* Unknown reason.
|
|
175
206
|
*/
|
|
176
|
-
OTHER
|
|
207
|
+
readonly OTHER: "OTHER";
|
|
177
208
|
/**
|
|
178
209
|
* The candidate content contained forbidden terms.
|
|
179
210
|
*/
|
|
180
|
-
BLOCKLIST
|
|
211
|
+
readonly BLOCKLIST: "BLOCKLIST";
|
|
181
212
|
/**
|
|
182
213
|
* The candidate content potentially contained prohibited content.
|
|
183
214
|
*/
|
|
184
|
-
PROHIBITED_CONTENT
|
|
215
|
+
readonly PROHIBITED_CONTENT: "PROHIBITED_CONTENT";
|
|
185
216
|
/**
|
|
186
217
|
* The candidate content potentially contained Sensitive Personally Identifiable Information (SPII).
|
|
187
218
|
*/
|
|
188
|
-
SPII
|
|
219
|
+
readonly SPII: "SPII";
|
|
189
220
|
/**
|
|
190
221
|
* The function call generated by the model was invalid.
|
|
191
222
|
*/
|
|
192
|
-
MALFORMED_FUNCTION_CALL
|
|
193
|
-
}
|
|
223
|
+
readonly MALFORMED_FUNCTION_CALL: "MALFORMED_FUNCTION_CALL";
|
|
224
|
+
};
|
|
225
|
+
/**
|
|
226
|
+
* Reason that a candidate finished.
|
|
227
|
+
* @public
|
|
228
|
+
*/
|
|
229
|
+
export type FinishReason = (typeof FinishReason)[keyof typeof FinishReason];
|
|
194
230
|
/**
|
|
195
231
|
* @public
|
|
196
232
|
*/
|
|
197
|
-
export declare
|
|
233
|
+
export declare const FunctionCallingMode: {
|
|
198
234
|
/**
|
|
199
235
|
* Default model behavior; model decides to predict either a function call
|
|
200
236
|
* or a natural language response.
|
|
201
237
|
*/
|
|
202
|
-
AUTO
|
|
238
|
+
readonly AUTO: "AUTO";
|
|
203
239
|
/**
|
|
204
240
|
* Model is constrained to always predicting a function call only.
|
|
205
241
|
* If `allowed_function_names` is set, the predicted function call will be
|
|
206
242
|
* limited to any one of `allowed_function_names`, else the predicted
|
|
207
243
|
* function call will be any one of the provided `function_declarations`.
|
|
208
244
|
*/
|
|
209
|
-
ANY
|
|
245
|
+
readonly ANY: "ANY";
|
|
210
246
|
/**
|
|
211
247
|
* Model will not predict any function call. Model behavior is same as when
|
|
212
248
|
* not passing any function declarations.
|
|
213
249
|
*/
|
|
214
|
-
NONE
|
|
215
|
-
}
|
|
250
|
+
readonly NONE: "NONE";
|
|
251
|
+
};
|
|
252
|
+
export type FunctionCallingMode = (typeof FunctionCallingMode)[keyof typeof FunctionCallingMode];
|
|
216
253
|
/**
|
|
217
254
|
* Content part modality.
|
|
218
255
|
* @public
|
|
219
256
|
*/
|
|
220
|
-
export declare
|
|
257
|
+
export declare const Modality: {
|
|
221
258
|
/**
|
|
222
259
|
* Unspecified modality.
|
|
223
260
|
*/
|
|
224
|
-
MODALITY_UNSPECIFIED
|
|
261
|
+
readonly MODALITY_UNSPECIFIED: "MODALITY_UNSPECIFIED";
|
|
225
262
|
/**
|
|
226
263
|
* Plain text.
|
|
227
264
|
*/
|
|
228
|
-
TEXT
|
|
265
|
+
readonly TEXT: "TEXT";
|
|
229
266
|
/**
|
|
230
267
|
* Image.
|
|
231
268
|
*/
|
|
232
|
-
IMAGE
|
|
269
|
+
readonly IMAGE: "IMAGE";
|
|
233
270
|
/**
|
|
234
271
|
* Video.
|
|
235
272
|
*/
|
|
236
|
-
VIDEO
|
|
273
|
+
readonly VIDEO: "VIDEO";
|
|
237
274
|
/**
|
|
238
275
|
* Audio.
|
|
239
276
|
*/
|
|
240
|
-
AUDIO
|
|
277
|
+
readonly AUDIO: "AUDIO";
|
|
241
278
|
/**
|
|
242
279
|
* Document (for example, PDF).
|
|
243
280
|
*/
|
|
244
|
-
DOCUMENT
|
|
245
|
-
}
|
|
281
|
+
readonly DOCUMENT: "DOCUMENT";
|
|
282
|
+
};
|
|
283
|
+
/**
|
|
284
|
+
* Content part modality.
|
|
285
|
+
* @public
|
|
286
|
+
*/
|
|
287
|
+
export type Modality = (typeof Modality)[keyof typeof Modality];
|
|
246
288
|
/**
|
|
247
289
|
* Generation modalities to be returned in generation responses.
|
|
248
290
|
*
|
|
@@ -51,31 +51,37 @@ export interface CustomErrorData {
|
|
|
51
51
|
*
|
|
52
52
|
* @public
|
|
53
53
|
*/
|
|
54
|
-
export declare const
|
|
54
|
+
export declare const AIErrorCode: {
|
|
55
55
|
/** A generic error occurred. */
|
|
56
|
-
ERROR
|
|
56
|
+
readonly ERROR: "error";
|
|
57
57
|
/** An error occurred in a request. */
|
|
58
|
-
REQUEST_ERROR
|
|
58
|
+
readonly REQUEST_ERROR: "request-error";
|
|
59
59
|
/** An error occurred in a response. */
|
|
60
|
-
RESPONSE_ERROR
|
|
60
|
+
readonly RESPONSE_ERROR: "response-error";
|
|
61
61
|
/** An error occurred while performing a fetch. */
|
|
62
|
-
FETCH_ERROR
|
|
62
|
+
readonly FETCH_ERROR: "fetch-error";
|
|
63
63
|
/** An error associated with a Content object. */
|
|
64
|
-
INVALID_CONTENT
|
|
64
|
+
readonly INVALID_CONTENT: "invalid-content";
|
|
65
65
|
/** An error due to the Firebase API not being enabled in the Console. */
|
|
66
|
-
API_NOT_ENABLED
|
|
66
|
+
readonly API_NOT_ENABLED: "api-not-enabled";
|
|
67
67
|
/** An error due to invalid Schema input. */
|
|
68
|
-
INVALID_SCHEMA
|
|
68
|
+
readonly INVALID_SCHEMA: "invalid-schema";
|
|
69
69
|
/** An error occurred due to a missing Firebase API key. */
|
|
70
|
-
NO_API_KEY
|
|
70
|
+
readonly NO_API_KEY: "no-api-key";
|
|
71
71
|
/** An error occurred due to a missing Firebase app ID. */
|
|
72
|
-
NO_APP_ID
|
|
72
|
+
readonly NO_APP_ID: "no-app-id";
|
|
73
73
|
/** An error occurred due to a model name not being specified during initialization. */
|
|
74
|
-
NO_MODEL
|
|
74
|
+
readonly NO_MODEL: "no-model";
|
|
75
75
|
/** An error occurred due to a missing project ID. */
|
|
76
|
-
NO_PROJECT_ID
|
|
76
|
+
readonly NO_PROJECT_ID: "no-project-id";
|
|
77
77
|
/** An error occurred while parsing. */
|
|
78
|
-
PARSE_FAILED
|
|
78
|
+
readonly PARSE_FAILED: "parse-failed";
|
|
79
79
|
/** An error occurred due an attempt to use an unsupported feature. */
|
|
80
|
-
UNSUPPORTED
|
|
81
|
-
}
|
|
80
|
+
readonly UNSUPPORTED: "unsupported";
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Standardized error codes that {@link AIError} can have.
|
|
84
|
+
*
|
|
85
|
+
* @public
|
|
86
|
+
*/
|
|
87
|
+
export type AIErrorCode = (typeof AIErrorCode)[keyof typeof AIErrorCode];
|