firebase-functions 7.2.1 → 7.2.3
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/lib/common/providers/identity.js +11 -1
- package/lib/common/providers/tasks.js +1 -0
- package/lib/common/utilities/path-pattern.js +12 -3
- package/lib/esm/common/providers/identity.mjs +11 -1
- package/lib/esm/common/providers/tasks.mjs +1 -0
- package/lib/esm/common/utilities/path-pattern.mjs +11 -3
- package/lib/esm/v2/compat.mjs +19 -59
- package/lib/esm/v2/index.doc.mjs +1 -1
- package/lib/esm/v2/index.mjs +2 -2
- package/lib/esm/v2/providers/ai/index.mjs +187 -0
- package/lib/esm/v2/providers/ai/types/gemini/v1beta/index.mjs +6 -0
- package/lib/esm/v2/providers/ai/types/vertex/v1beta1/index.mjs +6 -0
- package/lib/esm/v2/providers/database.mjs +35 -2
- package/lib/esm/v2/providers/firestore.mjs +38 -6
- package/lib/esm/v2/providers/https.mjs +10 -2
- package/lib/esm/v2/providers/pubsub.mjs +41 -2
- package/lib/esm/v2/providers/remoteConfig.mjs +18 -1
- package/lib/esm/v2/providers/scheduler.mjs +12 -0
- package/lib/esm/v2/providers/storage.mjs +24 -1
- package/lib/v2/compat.d.ts +14 -12
- package/lib/v2/compat.js +19 -58
- package/lib/v2/index.d.ts +0 -1
- package/lib/v2/index.doc.js +1 -1
- package/lib/v2/index.js +2 -2
- package/lib/v2/providers/ai/index.d.ts +53 -0
- package/lib/v2/providers/ai/index.js +198 -0
- package/lib/v2/providers/ai/types/gemini/v1beta/index.d.ts +817 -0
- package/lib/v2/providers/ai/types/gemini/v1beta/index.js +8 -0
- package/lib/v2/providers/ai/types/vertex/v1beta1/index.d.ts +850 -0
- package/lib/v2/providers/ai/types/vertex/v1beta1/index.js +8 -0
- package/lib/v2/providers/database.d.ts +61 -4
- package/lib/v2/providers/database.js +35 -2
- package/lib/v2/providers/firestore.d.ts +127 -0
- package/lib/v2/providers/firestore.js +38 -5
- package/lib/v2/providers/https.d.ts +2 -2
- package/lib/v2/providers/https.js +10 -2
- package/lib/v2/providers/pubsub.d.ts +18 -4
- package/lib/v2/providers/pubsub.js +41 -2
- package/lib/v2/providers/remoteConfig.d.ts +16 -0
- package/lib/v2/providers/remoteConfig.js +18 -1
- package/lib/v2/providers/scheduler.d.ts +21 -0
- package/lib/v2/providers/scheduler.js +12 -0
- package/lib/v2/providers/storage.d.ts +127 -0
- package/lib/v2/providers/storage.js +24 -1
- package/lib/v2/providers/tasks.d.ts +20 -1
- package/package.json +1 -1
|
@@ -0,0 +1,817 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Describes an array, an ordered list of values.
|
|
3
|
+
*
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export declare interface ArraySchema extends BaseSchema {
|
|
7
|
+
type: typeof SchemaType.ARRAY;
|
|
8
|
+
/** A schema describing the entries in the array. */
|
|
9
|
+
items: Schema;
|
|
10
|
+
/** The minimum number of items in the array. */
|
|
11
|
+
minItems?: number;
|
|
12
|
+
/** The maximum number of items in the array. */
|
|
13
|
+
maxItems?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Base parameters for a number of methods.
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
export declare interface BaseParams {
|
|
20
|
+
safetySettings?: SafetySetting[];
|
|
21
|
+
generationConfig?: GenerationConfig;
|
|
22
|
+
}
|
|
23
|
+
declare enum BlockReason {
|
|
24
|
+
BLOCKED_REASON_UNSPECIFIED = "BLOCKED_REASON_UNSPECIFIED",
|
|
25
|
+
SAFETY = "SAFETY",
|
|
26
|
+
OTHER = "OTHER"
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Describes a boolean, either 'true' or 'false'.
|
|
30
|
+
*
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
export declare interface BooleanSchema extends BaseSchema {
|
|
34
|
+
type: typeof SchemaType.BOOLEAN;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Citation metadata that may be found on a {@link GenerateContentCandidate}.
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
|
+
export declare interface CitationMetadata {
|
|
41
|
+
citationSources: CitationSource[];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* A single citation source.
|
|
45
|
+
* @public
|
|
46
|
+
*/
|
|
47
|
+
export declare interface CitationSource {
|
|
48
|
+
startIndex?: number;
|
|
49
|
+
endIndex?: number;
|
|
50
|
+
uri?: string;
|
|
51
|
+
license?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Result of executing the `ExecutableCode`.
|
|
55
|
+
* Only generated when using code execution, and always follows a `Part`
|
|
56
|
+
* containing the `ExecutableCode`.
|
|
57
|
+
* @public
|
|
58
|
+
*/
|
|
59
|
+
export declare interface CodeExecutionResult {
|
|
60
|
+
/**
|
|
61
|
+
* Outcome of the code execution.
|
|
62
|
+
*/
|
|
63
|
+
outcome: Outcome;
|
|
64
|
+
/**
|
|
65
|
+
* Contains stdout when code execution is successful, stderr or other
|
|
66
|
+
* description otherwise.
|
|
67
|
+
*/
|
|
68
|
+
output: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Content part containing the result of executed code.
|
|
72
|
+
* @public
|
|
73
|
+
*/
|
|
74
|
+
export declare interface CodeExecutionResultPart {
|
|
75
|
+
text?: never;
|
|
76
|
+
inlineData?: never;
|
|
77
|
+
functionCall?: never;
|
|
78
|
+
functionResponse?: never;
|
|
79
|
+
fileData?: never;
|
|
80
|
+
executableCode?: never;
|
|
81
|
+
codeExecutionResult: CodeExecutionResult;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Enables the model to execute code as part of generation.
|
|
85
|
+
* @public
|
|
86
|
+
*/
|
|
87
|
+
export declare interface CodeExecutionTool {
|
|
88
|
+
/**
|
|
89
|
+
* Provide an empty object to enable code execution. This field may have
|
|
90
|
+
* subfields added in the future.
|
|
91
|
+
*/
|
|
92
|
+
codeExecution: {};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Content type for both prompts and response candidates.
|
|
96
|
+
* @public
|
|
97
|
+
*/
|
|
98
|
+
export declare interface Content {
|
|
99
|
+
role: string;
|
|
100
|
+
parts: Part[];
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Specifies the dynamic retrieval configuration for the given source.
|
|
104
|
+
* @public
|
|
105
|
+
*/
|
|
106
|
+
export declare interface DynamicRetrievalConfig {
|
|
107
|
+
/**
|
|
108
|
+
* The mode of the predictor to be used in dynamic retrieval.
|
|
109
|
+
*/
|
|
110
|
+
mode?: DynamicRetrievalMode;
|
|
111
|
+
/**
|
|
112
|
+
* The threshold to be used in dynamic retrieval. If not set, a system default
|
|
113
|
+
* value is used.
|
|
114
|
+
*/
|
|
115
|
+
dynamicThreshold?: number;
|
|
116
|
+
}
|
|
117
|
+
declare enum DynamicRetrievalMode {
|
|
118
|
+
MODE_UNSPECIFIED = "MODE_UNSPECIFIED",
|
|
119
|
+
MODE_DYNAMIC = "MODE_DYNAMIC"
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Describes a string enum
|
|
123
|
+
*
|
|
124
|
+
* @public
|
|
125
|
+
*/
|
|
126
|
+
export declare interface EnumStringSchema extends BaseSchema {
|
|
127
|
+
type: typeof SchemaType.STRING;
|
|
128
|
+
format: "enum";
|
|
129
|
+
/** Possible values for this enum */
|
|
130
|
+
enum: string[];
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Code generated by the model that is meant to be executed, where the result
|
|
134
|
+
* is returned to the model.
|
|
135
|
+
* Only generated when using the code execution tool, in which the code will
|
|
136
|
+
* be automatically executed, and a corresponding `CodeExecutionResult` will
|
|
137
|
+
* also be generated.
|
|
138
|
+
*
|
|
139
|
+
* @public
|
|
140
|
+
*/
|
|
141
|
+
export declare interface ExecutableCode {
|
|
142
|
+
/**
|
|
143
|
+
* Programming language of the `code`.
|
|
144
|
+
*/
|
|
145
|
+
language: ExecutableCodeLanguage;
|
|
146
|
+
/**
|
|
147
|
+
* The code to be executed.
|
|
148
|
+
*/
|
|
149
|
+
code: string;
|
|
150
|
+
}
|
|
151
|
+
declare enum ExecutableCodeLanguage {
|
|
152
|
+
LANGUAGE_UNSPECIFIED = "language_unspecified",
|
|
153
|
+
PYTHON = "python"
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Content part containing executable code generated by the model.
|
|
157
|
+
* @public
|
|
158
|
+
*/
|
|
159
|
+
export declare interface ExecutableCodePart {
|
|
160
|
+
text?: never;
|
|
161
|
+
inlineData?: never;
|
|
162
|
+
functionCall?: never;
|
|
163
|
+
functionResponse?: never;
|
|
164
|
+
fileData?: never;
|
|
165
|
+
executableCode: ExecutableCode;
|
|
166
|
+
codeExecutionResult?: never;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Data pointing to a file uploaded with the Files API.
|
|
170
|
+
* @public
|
|
171
|
+
*/
|
|
172
|
+
export declare interface FileData {
|
|
173
|
+
mimeType: string;
|
|
174
|
+
fileUri: string;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Content part interface if the part represents FileData.
|
|
178
|
+
* @public
|
|
179
|
+
*/
|
|
180
|
+
export declare interface FileDataPart {
|
|
181
|
+
text?: never;
|
|
182
|
+
inlineData?: never;
|
|
183
|
+
functionCall?: never;
|
|
184
|
+
functionResponse?: never;
|
|
185
|
+
fileData: FileData;
|
|
186
|
+
executableCode?: never;
|
|
187
|
+
codeExecutionResult?: never;
|
|
188
|
+
}
|
|
189
|
+
declare enum FinishReason {
|
|
190
|
+
FINISH_REASON_UNSPECIFIED = "FINISH_REASON_UNSPECIFIED",
|
|
191
|
+
STOP = "STOP",
|
|
192
|
+
MAX_TOKENS = "MAX_TOKENS",
|
|
193
|
+
SAFETY = "SAFETY",
|
|
194
|
+
RECITATION = "RECITATION",
|
|
195
|
+
LANGUAGE = "LANGUAGE",
|
|
196
|
+
BLOCKLIST = "BLOCKLIST",
|
|
197
|
+
PROHIBITED_CONTENT = "PROHIBITED_CONTENT",
|
|
198
|
+
SPII = "SPII",
|
|
199
|
+
MALFORMED_FUNCTION_CALL = "MALFORMED_FUNCTION_CALL",
|
|
200
|
+
OTHER = "OTHER"
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* A predicted [FunctionCall] returned from the model
|
|
204
|
+
* that contains a string representing the [FunctionDeclaration.name]
|
|
205
|
+
* and a structured JSON object containing the parameters and their values.
|
|
206
|
+
* @public
|
|
207
|
+
*/
|
|
208
|
+
export declare interface FunctionCall {
|
|
209
|
+
name: string;
|
|
210
|
+
args: object;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* @public
|
|
214
|
+
*/
|
|
215
|
+
export declare interface FunctionCallingConfig {
|
|
216
|
+
mode?: FunctionCallingMode;
|
|
217
|
+
allowedFunctionNames?: string[];
|
|
218
|
+
}
|
|
219
|
+
declare enum FunctionCallingMode {
|
|
220
|
+
MODE_UNSPECIFIED = "MODE_UNSPECIFIED",
|
|
221
|
+
AUTO = "AUTO",
|
|
222
|
+
ANY = "ANY",
|
|
223
|
+
NONE = "NONE"
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Content part interface if the part represents a FunctionCall.
|
|
227
|
+
* @public
|
|
228
|
+
*/
|
|
229
|
+
export declare interface FunctionCallPart {
|
|
230
|
+
text?: never;
|
|
231
|
+
inlineData?: never;
|
|
232
|
+
functionCall: FunctionCall;
|
|
233
|
+
functionResponse?: never;
|
|
234
|
+
fileData?: never;
|
|
235
|
+
executableCode?: never;
|
|
236
|
+
codeExecutionResult?: never;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Structured representation of a function declaration as defined by the
|
|
240
|
+
* [OpenAPI 3.0 specification](https://spec.openapis.org/oas/v3.0.3). Included
|
|
241
|
+
* in this declaration are the function name and parameters. This
|
|
242
|
+
* FunctionDeclaration is a representation of a block of code that can be used
|
|
243
|
+
* as a Tool by the model and executed by the client.
|
|
244
|
+
* @public
|
|
245
|
+
*/
|
|
246
|
+
export declare interface FunctionDeclaration {
|
|
247
|
+
/**
|
|
248
|
+
* The name of the function to call. Must start with a letter or an
|
|
249
|
+
* underscore. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with
|
|
250
|
+
* a max length of 64.
|
|
251
|
+
*/
|
|
252
|
+
name: string;
|
|
253
|
+
/**
|
|
254
|
+
* Optional. Description and purpose of the function. Model uses it to decide
|
|
255
|
+
* how and whether to call the function.
|
|
256
|
+
*/
|
|
257
|
+
description?: string;
|
|
258
|
+
/**
|
|
259
|
+
* Optional. Describes the parameters to this function in JSON Schema Object
|
|
260
|
+
* format. Reflects the Open API 3.03 Parameter Object. string Key: the name
|
|
261
|
+
* of the parameter. Parameter names are case sensitive. Schema Value: the
|
|
262
|
+
* Schema defining the type used for the parameter. For function with no
|
|
263
|
+
* parameters, this can be left unset.
|
|
264
|
+
*
|
|
265
|
+
* @example with 1 required and 1 optional parameter: type: OBJECT properties:
|
|
266
|
+
* ```
|
|
267
|
+
* param1:
|
|
268
|
+
*
|
|
269
|
+
* type: STRING
|
|
270
|
+
* param2:
|
|
271
|
+
*
|
|
272
|
+
* type: INTEGER
|
|
273
|
+
* required:
|
|
274
|
+
*
|
|
275
|
+
* - param1
|
|
276
|
+
* ```
|
|
277
|
+
*/
|
|
278
|
+
parameters?: FunctionDeclarationSchema;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Schema for parameters passed to {@link FunctionDeclaration.parameters}.
|
|
282
|
+
* @public
|
|
283
|
+
*/
|
|
284
|
+
export declare interface FunctionDeclarationSchema {
|
|
285
|
+
/** The type of the parameter. */
|
|
286
|
+
type: SchemaType;
|
|
287
|
+
/** The format of the parameter. */
|
|
288
|
+
properties: {
|
|
289
|
+
[k: string]: FunctionDeclarationSchemaProperty;
|
|
290
|
+
};
|
|
291
|
+
/** Optional. Description of the parameter. */
|
|
292
|
+
description?: string;
|
|
293
|
+
/** Optional. Array of required parameters. */
|
|
294
|
+
required?: string[];
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Schema for top-level function declaration
|
|
298
|
+
* @public
|
|
299
|
+
*/
|
|
300
|
+
export declare type FunctionDeclarationSchemaProperty = Schema;
|
|
301
|
+
/**
|
|
302
|
+
* A FunctionDeclarationsTool is a piece of code that enables the system to
|
|
303
|
+
* interact with external systems to perform an action, or set of actions,
|
|
304
|
+
* outside of knowledge and scope of the model.
|
|
305
|
+
* @public
|
|
306
|
+
*/
|
|
307
|
+
export declare interface FunctionDeclarationsTool {
|
|
308
|
+
/**
|
|
309
|
+
* Optional. One or more function declarations
|
|
310
|
+
* to be passed to the model along with the current user query. Model may
|
|
311
|
+
* decide to call a subset of these functions by populating
|
|
312
|
+
* [FunctionCall][content.part.functionCall] in the response. User should
|
|
313
|
+
* provide a [FunctionResponse][content.part.functionResponse] for each
|
|
314
|
+
* function call in the next turn. Based on the function responses, Model will
|
|
315
|
+
* generate the final response back to the user. Maximum 64 function
|
|
316
|
+
* declarations can be provided.
|
|
317
|
+
*/
|
|
318
|
+
functionDeclarations?: FunctionDeclaration[];
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* The result output from a [FunctionCall] that contains a string
|
|
322
|
+
* representing the [FunctionDeclaration.name]
|
|
323
|
+
* and a structured JSON object containing any output
|
|
324
|
+
* from the function is used as context to the model.
|
|
325
|
+
* This should contain the result of a [FunctionCall]
|
|
326
|
+
* made based on model prediction.
|
|
327
|
+
* @public
|
|
328
|
+
*/
|
|
329
|
+
export declare interface FunctionResponse {
|
|
330
|
+
name: string;
|
|
331
|
+
response: object;
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Content part interface if the part represents FunctionResponse.
|
|
335
|
+
* @public
|
|
336
|
+
*/
|
|
337
|
+
export declare interface FunctionResponsePart {
|
|
338
|
+
text?: never;
|
|
339
|
+
inlineData?: never;
|
|
340
|
+
functionCall?: never;
|
|
341
|
+
functionResponse: FunctionResponse;
|
|
342
|
+
fileData?: never;
|
|
343
|
+
executableCode?: never;
|
|
344
|
+
codeExecutionResult?: never;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* A candidate returned as part of a {@link GenerateContentResponse}.
|
|
348
|
+
* @public
|
|
349
|
+
*/
|
|
350
|
+
export declare interface GenerateContentCandidate {
|
|
351
|
+
index: number;
|
|
352
|
+
content: Content;
|
|
353
|
+
finishReason?: FinishReason;
|
|
354
|
+
finishMessage?: string;
|
|
355
|
+
safetyRatings?: SafetyRating[];
|
|
356
|
+
citationMetadata?: CitationMetadata;
|
|
357
|
+
/** Average log probability score of the candidate. */
|
|
358
|
+
avgLogprobs?: number;
|
|
359
|
+
/** Log-likelihood scores for the response tokens and top tokens. */
|
|
360
|
+
logprobsResult?: LogprobsResult;
|
|
361
|
+
/** Search grounding metadata. */
|
|
362
|
+
groundingMetadata?: GroundingMetadata;
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Request sent to `generateContent` endpoint.
|
|
366
|
+
* @public
|
|
367
|
+
*/
|
|
368
|
+
export declare interface GenerateContentRequest extends BaseParams {
|
|
369
|
+
contents: Content[];
|
|
370
|
+
tools?: Tool[];
|
|
371
|
+
toolConfig?: ToolConfig;
|
|
372
|
+
systemInstruction?: string | Part | Content;
|
|
373
|
+
/**
|
|
374
|
+
* This is the name of a `CachedContent` and not the cache object itself.
|
|
375
|
+
*/
|
|
376
|
+
cachedContent?: string;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Individual response from {@link GenerativeModel.generateContent} and
|
|
380
|
+
* {@link GenerativeModel.generateContentStream}.
|
|
381
|
+
* `generateContentStream()` will return one in each chunk until
|
|
382
|
+
* the stream is done.
|
|
383
|
+
* @public
|
|
384
|
+
*/
|
|
385
|
+
export declare interface GenerateContentResponse {
|
|
386
|
+
/** Candidate responses from the model. */
|
|
387
|
+
candidates?: GenerateContentCandidate[];
|
|
388
|
+
/** The prompt's feedback related to the content filters. */
|
|
389
|
+
promptFeedback?: PromptFeedback;
|
|
390
|
+
/** Metadata on the generation request's token usage. */
|
|
391
|
+
usageMetadata?: UsageMetadata;
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Config options for content-related requests
|
|
395
|
+
* @public
|
|
396
|
+
*/
|
|
397
|
+
export declare interface GenerationConfig {
|
|
398
|
+
candidateCount?: number;
|
|
399
|
+
stopSequences?: string[];
|
|
400
|
+
maxOutputTokens?: number;
|
|
401
|
+
temperature?: number;
|
|
402
|
+
topP?: number;
|
|
403
|
+
topK?: number;
|
|
404
|
+
/**
|
|
405
|
+
* Output response mimetype of the generated candidate text.
|
|
406
|
+
* Supported mimetype:
|
|
407
|
+
* `text/plain`: (default) Text output.
|
|
408
|
+
* `application/json`: JSON response in the candidates.
|
|
409
|
+
*/
|
|
410
|
+
responseMimeType?: string;
|
|
411
|
+
/**
|
|
412
|
+
* Output response schema of the generated candidate text.
|
|
413
|
+
* Note: This only applies when the specified `responseMIMEType` supports a schema; currently
|
|
414
|
+
* this is limited to `application/json`.
|
|
415
|
+
*/
|
|
416
|
+
responseSchema?: ResponseSchema;
|
|
417
|
+
/**
|
|
418
|
+
* Presence penalty applied to the next token's logprobs if the token has
|
|
419
|
+
* already been seen in the response.
|
|
420
|
+
*/
|
|
421
|
+
presencePenalty?: number;
|
|
422
|
+
/**
|
|
423
|
+
* Frequency penalty applied to the next token's logprobs, multiplied by the
|
|
424
|
+
* number of times each token has been seen in the respponse so far.
|
|
425
|
+
*/
|
|
426
|
+
frequencyPenalty?: number;
|
|
427
|
+
/**
|
|
428
|
+
* If True, export the logprobs results in response.
|
|
429
|
+
*/
|
|
430
|
+
responseLogprobs?: boolean;
|
|
431
|
+
/**
|
|
432
|
+
* Valid if responseLogProbs is set to True. This will set the number of top
|
|
433
|
+
* logprobs to return at each decoding step in the logprobsResult.
|
|
434
|
+
*/
|
|
435
|
+
logprobs?: number;
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Interface for sending an image.
|
|
439
|
+
* @public
|
|
440
|
+
*/
|
|
441
|
+
export declare interface GenerativeContentBlob {
|
|
442
|
+
mimeType: string;
|
|
443
|
+
/**
|
|
444
|
+
* Image as a base64 string.
|
|
445
|
+
*/
|
|
446
|
+
data: string;
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* Retrieval tool that is powered by Google search.
|
|
450
|
+
* @public
|
|
451
|
+
*/
|
|
452
|
+
export declare interface GoogleSearchRetrieval {
|
|
453
|
+
/**
|
|
454
|
+
* Specifies the dynamic retrieval configuration for the given source.
|
|
455
|
+
*/
|
|
456
|
+
dynamicRetrievalConfig?: DynamicRetrievalConfig;
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* Retrieval tool that is powered by Google search.
|
|
460
|
+
* @public
|
|
461
|
+
*/
|
|
462
|
+
export declare interface GoogleSearchRetrievalTool {
|
|
463
|
+
/**
|
|
464
|
+
* Google search retrieval tool config.
|
|
465
|
+
*/
|
|
466
|
+
googleSearchRetrieval?: GoogleSearchRetrieval;
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* Grounding chunk.
|
|
470
|
+
* @public
|
|
471
|
+
*/
|
|
472
|
+
export declare interface GroundingChunk {
|
|
473
|
+
/**
|
|
474
|
+
* Chunk from the web.
|
|
475
|
+
*/
|
|
476
|
+
web?: GroundingChunkWeb;
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Chunk from the web.
|
|
480
|
+
* @public
|
|
481
|
+
*/
|
|
482
|
+
export declare interface GroundingChunkWeb {
|
|
483
|
+
/**
|
|
484
|
+
* URI reference of the chunk.
|
|
485
|
+
*/
|
|
486
|
+
uri?: string;
|
|
487
|
+
/**
|
|
488
|
+
* Title of the chunk.
|
|
489
|
+
*/
|
|
490
|
+
title?: string;
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* Metadata returned to client when grounding is enabled.
|
|
494
|
+
* @public
|
|
495
|
+
*/
|
|
496
|
+
export declare interface GroundingMetadata {
|
|
497
|
+
/**
|
|
498
|
+
* Google search entry for the following-up web searches.
|
|
499
|
+
*/
|
|
500
|
+
searchEntryPoint?: SearchEntryPoint;
|
|
501
|
+
/**
|
|
502
|
+
* List of supporting references retrieved from specified grounding source.
|
|
503
|
+
*/
|
|
504
|
+
groundingChunks?: GroundingChunk[];
|
|
505
|
+
/**
|
|
506
|
+
* List of grounding support.
|
|
507
|
+
*/
|
|
508
|
+
groundingSupports?: GroundingSupport[];
|
|
509
|
+
/**
|
|
510
|
+
* Metadata related to retrieval in the grounding flow.
|
|
511
|
+
*/
|
|
512
|
+
retrievalMetadata?: RetrievalMetadata;
|
|
513
|
+
/**
|
|
514
|
+
* * Web search queries for the following-up web search.
|
|
515
|
+
*/
|
|
516
|
+
webSearchQueries: string[];
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* Grounding support.
|
|
520
|
+
* @public
|
|
521
|
+
*/
|
|
522
|
+
export declare interface GroundingSupport {
|
|
523
|
+
/**
|
|
524
|
+
* URI reference of the chunk.
|
|
525
|
+
*/
|
|
526
|
+
segment?: string;
|
|
527
|
+
/**
|
|
528
|
+
* A list of indices (into 'grounding_chunk') specifying the citations
|
|
529
|
+
* associated with the claim. For instance [1,3,4] means that
|
|
530
|
+
* grounding_chunk[1], grounding_chunk[3], grounding_chunk[4] are the
|
|
531
|
+
* retrieved content attributed to the claim.
|
|
532
|
+
*/
|
|
533
|
+
groundingChunckIndices?: number[];
|
|
534
|
+
/**
|
|
535
|
+
* Confidence score of the support references. Ranges from 0 to 1. 1 is the
|
|
536
|
+
* most confident. This list must have the same size as the
|
|
537
|
+
* grounding_chunk_indices.
|
|
538
|
+
*/
|
|
539
|
+
confidenceScores?: number[];
|
|
540
|
+
}
|
|
541
|
+
declare enum HarmBlockThreshold {
|
|
542
|
+
/** Threshold is unspecified. */
|
|
543
|
+
HARM_BLOCK_THRESHOLD_UNSPECIFIED = "HARM_BLOCK_THRESHOLD_UNSPECIFIED",
|
|
544
|
+
/** Content with NEGLIGIBLE will be allowed. */
|
|
545
|
+
BLOCK_LOW_AND_ABOVE = "BLOCK_LOW_AND_ABOVE",
|
|
546
|
+
/** Content with NEGLIGIBLE and LOW will be allowed. */
|
|
547
|
+
BLOCK_MEDIUM_AND_ABOVE = "BLOCK_MEDIUM_AND_ABOVE",
|
|
548
|
+
/** Content with NEGLIGIBLE, LOW, and MEDIUM will be allowed. */
|
|
549
|
+
BLOCK_ONLY_HIGH = "BLOCK_ONLY_HIGH",
|
|
550
|
+
/** All content will be allowed. */
|
|
551
|
+
BLOCK_NONE = "BLOCK_NONE"
|
|
552
|
+
}
|
|
553
|
+
declare enum HarmCategory {
|
|
554
|
+
HARM_CATEGORY_UNSPECIFIED = "HARM_CATEGORY_UNSPECIFIED",
|
|
555
|
+
HARM_CATEGORY_HATE_SPEECH = "HARM_CATEGORY_HATE_SPEECH",
|
|
556
|
+
HARM_CATEGORY_SEXUALLY_EXPLICIT = "HARM_CATEGORY_SEXUALLY_EXPLICIT",
|
|
557
|
+
HARM_CATEGORY_HARASSMENT = "HARM_CATEGORY_HARASSMENT",
|
|
558
|
+
HARM_CATEGORY_DANGEROUS_CONTENT = "HARM_CATEGORY_DANGEROUS_CONTENT",
|
|
559
|
+
HARM_CATEGORY_CIVIC_INTEGRITY = "HARM_CATEGORY_CIVIC_INTEGRITY"
|
|
560
|
+
}
|
|
561
|
+
declare enum HarmProbability {
|
|
562
|
+
/** Probability is unspecified. */
|
|
563
|
+
HARM_PROBABILITY_UNSPECIFIED = "HARM_PROBABILITY_UNSPECIFIED",
|
|
564
|
+
/** Content has a negligible chance of being unsafe. */
|
|
565
|
+
NEGLIGIBLE = "NEGLIGIBLE",
|
|
566
|
+
/** Content has a low chance of being unsafe. */
|
|
567
|
+
LOW = "LOW",
|
|
568
|
+
/** Content has a medium chance of being unsafe. */
|
|
569
|
+
MEDIUM = "MEDIUM",
|
|
570
|
+
/** Content has a high chance of being unsafe. */
|
|
571
|
+
HIGH = "HIGH"
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* Content part interface if the part represents an image.
|
|
575
|
+
* @public
|
|
576
|
+
*/
|
|
577
|
+
export declare interface InlineDataPart {
|
|
578
|
+
text?: never;
|
|
579
|
+
inlineData: GenerativeContentBlob;
|
|
580
|
+
functionCall?: never;
|
|
581
|
+
functionResponse?: never;
|
|
582
|
+
fileData?: never;
|
|
583
|
+
executableCode?: never;
|
|
584
|
+
codeExecutionResult?: never;
|
|
585
|
+
}
|
|
586
|
+
/**
|
|
587
|
+
* Describes a JSON-encodable integer.
|
|
588
|
+
*
|
|
589
|
+
* @public
|
|
590
|
+
*/
|
|
591
|
+
export declare interface IntegerSchema extends BaseSchema {
|
|
592
|
+
type: typeof SchemaType.INTEGER;
|
|
593
|
+
/** Optional. The format of the number. */
|
|
594
|
+
format?: "int32" | "int64";
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* Candidate for the logprobs token and score.
|
|
598
|
+
* @public
|
|
599
|
+
*/
|
|
600
|
+
export declare interface LogprobsCandidate {
|
|
601
|
+
/** The candidate's token string value. */
|
|
602
|
+
token: string;
|
|
603
|
+
/** The candidate's token id value. */
|
|
604
|
+
tokenID: number;
|
|
605
|
+
/** The candidate's log probability. */
|
|
606
|
+
logProbability: number;
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* Logprobs Result
|
|
610
|
+
* @public
|
|
611
|
+
*/
|
|
612
|
+
export declare interface LogprobsResult {
|
|
613
|
+
/** Length = total number of decoding steps. */
|
|
614
|
+
topCandidates: TopCandidates[];
|
|
615
|
+
/**
|
|
616
|
+
* Length = total number of decoding steps.
|
|
617
|
+
* The chosen candidates may or may not be in topCandidates.
|
|
618
|
+
*/
|
|
619
|
+
chosenCandidates: LogprobsCandidate[];
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* Describes a JSON-encodable floating point number.
|
|
623
|
+
*
|
|
624
|
+
* @public
|
|
625
|
+
*/
|
|
626
|
+
export declare interface NumberSchema extends BaseSchema {
|
|
627
|
+
type: typeof SchemaType.NUMBER;
|
|
628
|
+
/** Optional. The format of the number. */
|
|
629
|
+
format?: "float" | "double";
|
|
630
|
+
}
|
|
631
|
+
/**
|
|
632
|
+
* Describes a JSON object, a mapping of specific keys to values.
|
|
633
|
+
*
|
|
634
|
+
* @public
|
|
635
|
+
*/
|
|
636
|
+
export declare interface ObjectSchema extends BaseSchema {
|
|
637
|
+
type: typeof SchemaType.OBJECT;
|
|
638
|
+
/** Describes the properties of the JSON object. Must not be empty. */
|
|
639
|
+
properties: {
|
|
640
|
+
[k: string]: Schema;
|
|
641
|
+
};
|
|
642
|
+
/**
|
|
643
|
+
* A list of keys declared in the properties object.
|
|
644
|
+
* Required properties will always be present in the generated object.
|
|
645
|
+
*/
|
|
646
|
+
required?: string[];
|
|
647
|
+
}
|
|
648
|
+
declare enum Outcome {
|
|
649
|
+
/**
|
|
650
|
+
* Unspecified status. This value should not be used.
|
|
651
|
+
*/
|
|
652
|
+
OUTCOME_UNSPECIFIED = "outcome_unspecified",
|
|
653
|
+
/**
|
|
654
|
+
* Code execution completed successfully.
|
|
655
|
+
*/
|
|
656
|
+
OUTCOME_OK = "outcome_ok",
|
|
657
|
+
/**
|
|
658
|
+
* Code execution finished but with a failure. `stderr` should contain the
|
|
659
|
+
* reason.
|
|
660
|
+
*/
|
|
661
|
+
OUTCOME_FAILED = "outcome_failed",
|
|
662
|
+
/**
|
|
663
|
+
* Code execution ran for too long, and was cancelled. There may or may not
|
|
664
|
+
* be a partial output present.
|
|
665
|
+
*/
|
|
666
|
+
OUTCOME_DEADLINE_EXCEEDED = "outcome_deadline_exceeded"
|
|
667
|
+
}
|
|
668
|
+
/**
|
|
669
|
+
* Content part - includes text or image part types.
|
|
670
|
+
* @public
|
|
671
|
+
*/
|
|
672
|
+
export declare type Part = TextPart | InlineDataPart | FunctionCallPart | FunctionResponsePart | FileDataPart | ExecutableCodePart | CodeExecutionResultPart;
|
|
673
|
+
/**
|
|
674
|
+
* If the prompt was blocked, this will be populated with `blockReason` and
|
|
675
|
+
* the relevant `safetyRatings`.
|
|
676
|
+
* @public
|
|
677
|
+
*/
|
|
678
|
+
export declare interface PromptFeedback {
|
|
679
|
+
blockReason: BlockReason;
|
|
680
|
+
safetyRatings: SafetyRating[];
|
|
681
|
+
blockReasonMessage?: string;
|
|
682
|
+
}
|
|
683
|
+
/**
|
|
684
|
+
* Schema passed to `GenerationConfig.responseSchema`
|
|
685
|
+
* @public
|
|
686
|
+
*/
|
|
687
|
+
export declare type ResponseSchema = Schema;
|
|
688
|
+
/**
|
|
689
|
+
* Metadata related to retrieval in the grounding flow.
|
|
690
|
+
* @public
|
|
691
|
+
*/
|
|
692
|
+
export declare interface RetrievalMetadata {
|
|
693
|
+
/**
|
|
694
|
+
* Score indicating how likely information from google search could help
|
|
695
|
+
* answer the prompt. The score is in the range [0, 1], where 0 is the least
|
|
696
|
+
* likely and 1 is the most likely. This score is only populated when google
|
|
697
|
+
* search grounding and dynamic retrieval is enabled. It will becompared to
|
|
698
|
+
* the threshold to determine whether to trigger google search.
|
|
699
|
+
*/
|
|
700
|
+
googleSearchDynamicRetrievalScore?: number;
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* A safety rating associated with a {@link GenerateContentCandidate}
|
|
704
|
+
* @public
|
|
705
|
+
*/
|
|
706
|
+
export declare interface SafetyRating {
|
|
707
|
+
category: HarmCategory;
|
|
708
|
+
probability: HarmProbability;
|
|
709
|
+
}
|
|
710
|
+
/**
|
|
711
|
+
* Safety setting that can be sent as part of request parameters.
|
|
712
|
+
* @public
|
|
713
|
+
*/
|
|
714
|
+
export declare interface SafetySetting {
|
|
715
|
+
category: HarmCategory;
|
|
716
|
+
threshold: HarmBlockThreshold;
|
|
717
|
+
}
|
|
718
|
+
/**
|
|
719
|
+
* Schema is used to define the format of input/output data.
|
|
720
|
+
* Represents a select subset of an OpenAPI 3.0 schema object.
|
|
721
|
+
* More fields may be added in the future as needed.
|
|
722
|
+
* @public
|
|
723
|
+
*/
|
|
724
|
+
export declare type Schema = StringSchema | NumberSchema | IntegerSchema | BooleanSchema | ArraySchema | ObjectSchema;
|
|
725
|
+
declare enum SchemaType {
|
|
726
|
+
/** String type. */
|
|
727
|
+
STRING = "string",
|
|
728
|
+
/** Number type. */
|
|
729
|
+
NUMBER = "number",
|
|
730
|
+
/** Integer type. */
|
|
731
|
+
INTEGER = "integer",
|
|
732
|
+
/** Boolean type. */
|
|
733
|
+
BOOLEAN = "boolean",
|
|
734
|
+
/** Array type. */
|
|
735
|
+
ARRAY = "array",
|
|
736
|
+
/** Object type. */
|
|
737
|
+
OBJECT = "object"
|
|
738
|
+
}
|
|
739
|
+
/**
|
|
740
|
+
* Google search entry point.
|
|
741
|
+
* @public
|
|
742
|
+
*/
|
|
743
|
+
export declare interface SearchEntryPoint {
|
|
744
|
+
/**
|
|
745
|
+
* Web content snippet that can be embedded in a web page or an app webview.
|
|
746
|
+
*/
|
|
747
|
+
renderedContent?: string;
|
|
748
|
+
/**
|
|
749
|
+
* Base64 encoded JSON representing array of <search term, search url> tuple.
|
|
750
|
+
*/
|
|
751
|
+
sdkBlob?: string;
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* Describes a simple string schema, with or without format
|
|
755
|
+
*
|
|
756
|
+
* @public
|
|
757
|
+
*/
|
|
758
|
+
export declare interface SimpleStringSchema extends BaseSchema {
|
|
759
|
+
type: typeof SchemaType.STRING;
|
|
760
|
+
format?: "date-time" | undefined;
|
|
761
|
+
enum?: never;
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* Describes a string.
|
|
765
|
+
*
|
|
766
|
+
* @public
|
|
767
|
+
*/
|
|
768
|
+
export declare type StringSchema = SimpleStringSchema | EnumStringSchema;
|
|
769
|
+
/**
|
|
770
|
+
* Content part interface if the part represents a text string.
|
|
771
|
+
* @public
|
|
772
|
+
*/
|
|
773
|
+
export declare interface TextPart {
|
|
774
|
+
text: string;
|
|
775
|
+
inlineData?: never;
|
|
776
|
+
functionCall?: never;
|
|
777
|
+
functionResponse?: never;
|
|
778
|
+
fileData?: never;
|
|
779
|
+
executableCode?: never;
|
|
780
|
+
codeExecutionResult?: never;
|
|
781
|
+
}
|
|
782
|
+
/**
|
|
783
|
+
* Defines a tool that model can call to access external knowledge.
|
|
784
|
+
* @public
|
|
785
|
+
*/
|
|
786
|
+
export declare type Tool = FunctionDeclarationsTool | CodeExecutionTool | GoogleSearchRetrievalTool;
|
|
787
|
+
/**
|
|
788
|
+
* Tool config. This config is shared for all tools provided in the request.
|
|
789
|
+
* @public
|
|
790
|
+
*/
|
|
791
|
+
export declare interface ToolConfig {
|
|
792
|
+
functionCallingConfig: FunctionCallingConfig;
|
|
793
|
+
}
|
|
794
|
+
/**
|
|
795
|
+
* Candidates with top log probabilities at each decoding step
|
|
796
|
+
*/
|
|
797
|
+
export declare interface TopCandidates {
|
|
798
|
+
/** Sorted by log probability in descending order. */
|
|
799
|
+
candidates: LogprobsCandidate[];
|
|
800
|
+
}
|
|
801
|
+
/**
|
|
802
|
+
* Metadata on the generation request's token usage.
|
|
803
|
+
* @public
|
|
804
|
+
*/
|
|
805
|
+
export declare interface UsageMetadata {
|
|
806
|
+
/** Number of tokens in the prompt. */
|
|
807
|
+
promptTokenCount: number;
|
|
808
|
+
/** Total number of tokens across the generated candidates. */
|
|
809
|
+
candidatesTokenCount: number;
|
|
810
|
+
/** Total token count for the generation request (prompt + candidates). */
|
|
811
|
+
totalTokenCount: number;
|
|
812
|
+
/** Total token count in the cached part of the prompt, i.e. in the cached content. */
|
|
813
|
+
cachedContentTokenCount?: number;
|
|
814
|
+
}
|
|
815
|
+
export declare const requestTypeName = "type.googleapis.com/google.ai.generativelanguage.v1beta.GenerateContentRequest";
|
|
816
|
+
export declare const responseTypeName = "type.googleapis.com/google.ai.generativelanguage.v1beta.GenerateContentResponse";
|
|
817
|
+
export {};
|