@firebase/ai 2.3.0-canary.1bcf83d7f → 2.3.0-canary.7a7634f79
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 +128 -10
- package/dist/ai.d.ts +129 -10
- package/dist/esm/index.esm.js +56 -5
- package/dist/esm/index.esm.js.map +1 -1
- package/dist/esm/src/types/content.d.ts +4 -4
- package/dist/esm/src/types/enums.d.ts +4 -4
- package/dist/esm/src/types/googleai.d.ts +2 -1
- package/dist/esm/src/types/requests.d.ts +22 -2
- package/dist/esm/src/types/responses.d.ts +92 -0
- package/dist/index.cjs.js +56 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.node.cjs.js +56 -4
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +56 -5
- package/dist/index.node.mjs.map +1 -1
- package/dist/src/types/content.d.ts +4 -4
- package/dist/src/types/enums.d.ts +4 -4
- package/dist/src/types/googleai.d.ts +2 -1
- package/dist/src/types/requests.d.ts +22 -2
- package/dist/src/types/responses.d.ts +92 -0
- package/package.json +8 -8
|
@@ -138,7 +138,7 @@ export interface FileDataPart {
|
|
|
138
138
|
/**
|
|
139
139
|
* Represents the code that is executed by the model.
|
|
140
140
|
*
|
|
141
|
-
* @
|
|
141
|
+
* @beta
|
|
142
142
|
*/
|
|
143
143
|
export interface ExecutableCodePart {
|
|
144
144
|
text?: never;
|
|
@@ -157,7 +157,7 @@ export interface ExecutableCodePart {
|
|
|
157
157
|
/**
|
|
158
158
|
* Represents the code execution result from the model.
|
|
159
159
|
*
|
|
160
|
-
* @
|
|
160
|
+
* @beta
|
|
161
161
|
*/
|
|
162
162
|
export interface CodeExecutionResultPart {
|
|
163
163
|
text?: never;
|
|
@@ -176,7 +176,7 @@ export interface CodeExecutionResultPart {
|
|
|
176
176
|
/**
|
|
177
177
|
* An interface for executable code returned by the model.
|
|
178
178
|
*
|
|
179
|
-
* @
|
|
179
|
+
* @beta
|
|
180
180
|
*/
|
|
181
181
|
export interface ExecutableCode {
|
|
182
182
|
/**
|
|
@@ -191,7 +191,7 @@ export interface ExecutableCode {
|
|
|
191
191
|
/**
|
|
192
192
|
* The results of code execution run by the model.
|
|
193
193
|
*
|
|
194
|
-
* @
|
|
194
|
+
* @beta
|
|
195
195
|
*/
|
|
196
196
|
export interface CodeExecutionResult {
|
|
197
197
|
/**
|
|
@@ -352,7 +352,7 @@ export type InferenceMode = (typeof InferenceMode)[keyof typeof InferenceMode];
|
|
|
352
352
|
/**
|
|
353
353
|
* Represents the result of the code execution.
|
|
354
354
|
*
|
|
355
|
-
* @
|
|
355
|
+
* @beta
|
|
356
356
|
*/
|
|
357
357
|
export declare const Outcome: {
|
|
358
358
|
UNSPECIFIED: string;
|
|
@@ -363,13 +363,13 @@ export declare const Outcome: {
|
|
|
363
363
|
/**
|
|
364
364
|
* Represents the result of the code execution.
|
|
365
365
|
*
|
|
366
|
-
* @
|
|
366
|
+
* @beta
|
|
367
367
|
*/
|
|
368
368
|
export type Outcome = (typeof Outcome)[keyof typeof Outcome];
|
|
369
369
|
/**
|
|
370
370
|
* The programming language of the code.
|
|
371
371
|
*
|
|
372
|
-
* @
|
|
372
|
+
* @beta
|
|
373
373
|
*/
|
|
374
374
|
export declare const Language: {
|
|
375
375
|
UNSPECIFIED: string;
|
|
@@ -378,6 +378,6 @@ export declare const Language: {
|
|
|
378
378
|
/**
|
|
379
379
|
* The programming language of the code.
|
|
380
380
|
*
|
|
381
|
-
* @
|
|
381
|
+
* @beta
|
|
382
382
|
*/
|
|
383
383
|
export type Language = (typeof Language)[keyof typeof Language];
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
import { Tool, GenerationConfig, Citation, FinishReason, GroundingMetadata, PromptFeedback, SafetyRating, UsageMetadata } from '../public-types';
|
|
17
|
+
import { Tool, GenerationConfig, Citation, FinishReason, GroundingMetadata, PromptFeedback, SafetyRating, UsageMetadata, URLContextMetadata } from '../public-types';
|
|
18
18
|
import { Content, Part } from './content';
|
|
19
19
|
/**
|
|
20
20
|
* @internal
|
|
@@ -47,6 +47,7 @@ export interface GoogleAIGenerateContentCandidate {
|
|
|
47
47
|
safetyRatings?: SafetyRating[];
|
|
48
48
|
citationMetadata?: GoogleAICitationMetadata;
|
|
49
49
|
groundingMetadata?: GroundingMetadata;
|
|
50
|
+
urlContextMetadata?: URLContextMetadata;
|
|
50
51
|
}
|
|
51
52
|
/**
|
|
52
53
|
* @internal
|
|
@@ -218,7 +218,7 @@ export interface RequestOptions {
|
|
|
218
218
|
* Defines a tool that model can call to access external knowledge.
|
|
219
219
|
* @public
|
|
220
220
|
*/
|
|
221
|
-
export type Tool = FunctionDeclarationsTool | GoogleSearchTool | CodeExecutionTool;
|
|
221
|
+
export type Tool = FunctionDeclarationsTool | GoogleSearchTool | CodeExecutionTool | URLContextTool;
|
|
222
222
|
/**
|
|
223
223
|
* Structured representation of a function declaration as defined by the
|
|
224
224
|
* {@link https://spec.openapis.org/oas/v3.0.3 | OpenAPI 3.0 specification}.
|
|
@@ -273,7 +273,7 @@ export interface GoogleSearchTool {
|
|
|
273
273
|
/**
|
|
274
274
|
* A tool that enables the model to use code execution.
|
|
275
275
|
*
|
|
276
|
-
* @
|
|
276
|
+
* @beta
|
|
277
277
|
*/
|
|
278
278
|
export interface CodeExecutionTool {
|
|
279
279
|
/**
|
|
@@ -291,6 +291,26 @@ export interface CodeExecutionTool {
|
|
|
291
291
|
*/
|
|
292
292
|
export interface GoogleSearch {
|
|
293
293
|
}
|
|
294
|
+
/**
|
|
295
|
+
* A tool that allows you to provide additional context to the models in the form of public web
|
|
296
|
+
* URLs. By including URLs in your request, the Gemini model will access the content from those
|
|
297
|
+
* pages to inform and enhance its response.
|
|
298
|
+
*
|
|
299
|
+
* @beta
|
|
300
|
+
*/
|
|
301
|
+
export interface URLContextTool {
|
|
302
|
+
/**
|
|
303
|
+
* Specifies the URL Context configuration.
|
|
304
|
+
*/
|
|
305
|
+
urlContext: URLContext;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Specifies the URL Context configuration.
|
|
309
|
+
*
|
|
310
|
+
* @beta
|
|
311
|
+
*/
|
|
312
|
+
export interface URLContext {
|
|
313
|
+
}
|
|
294
314
|
/**
|
|
295
315
|
* A `FunctionDeclarationsTool` is a piece of code that enables the system to
|
|
296
316
|
* interact with external systems to perform an action, or set of actions,
|
|
@@ -102,8 +102,16 @@ export interface UsageMetadata {
|
|
|
102
102
|
*/
|
|
103
103
|
thoughtsTokenCount?: number;
|
|
104
104
|
totalTokenCount: number;
|
|
105
|
+
/**
|
|
106
|
+
* The number of tokens used by tools.
|
|
107
|
+
*/
|
|
108
|
+
toolUsePromptTokenCount?: number;
|
|
105
109
|
promptTokensDetails?: ModalityTokenCount[];
|
|
106
110
|
candidatesTokensDetails?: ModalityTokenCount[];
|
|
111
|
+
/**
|
|
112
|
+
* A list of tokens used by tools, broken down by modality.
|
|
113
|
+
*/
|
|
114
|
+
toolUsePromptTokensDetails?: ModalityTokenCount[];
|
|
107
115
|
}
|
|
108
116
|
/**
|
|
109
117
|
* Represents token counting info for a single modality.
|
|
@@ -143,6 +151,7 @@ export interface GenerateContentCandidate {
|
|
|
143
151
|
safetyRatings?: SafetyRating[];
|
|
144
152
|
citationMetadata?: CitationMetadata;
|
|
145
153
|
groundingMetadata?: GroundingMetadata;
|
|
154
|
+
urlContextMetadata?: URLContextMetadata;
|
|
146
155
|
}
|
|
147
156
|
/**
|
|
148
157
|
* Citation metadata that may be found on a {@link GenerateContentCandidate}.
|
|
@@ -323,6 +332,89 @@ export interface Segment {
|
|
|
323
332
|
*/
|
|
324
333
|
text: string;
|
|
325
334
|
}
|
|
335
|
+
/**
|
|
336
|
+
* Metadata related to {@link URLContextTool}.
|
|
337
|
+
*
|
|
338
|
+
* @beta
|
|
339
|
+
*/
|
|
340
|
+
export interface URLContextMetadata {
|
|
341
|
+
/**
|
|
342
|
+
* List of URL metadata used to provide context to the Gemini model.
|
|
343
|
+
*/
|
|
344
|
+
urlMetadata: URLMetadata[];
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Metadata for a single URL retrieved by the {@link URLContextTool} tool.
|
|
348
|
+
*
|
|
349
|
+
* @beta
|
|
350
|
+
*/
|
|
351
|
+
export interface URLMetadata {
|
|
352
|
+
/**
|
|
353
|
+
* The retrieved URL.
|
|
354
|
+
*/
|
|
355
|
+
retrievedUrl?: string;
|
|
356
|
+
/**
|
|
357
|
+
* The status of the URL retrieval.
|
|
358
|
+
*/
|
|
359
|
+
urlRetrievalStatus?: URLRetrievalStatus;
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* The status of a URL retrieval.
|
|
363
|
+
*
|
|
364
|
+
* @remarks
|
|
365
|
+
* <b>URL_RETRIEVAL_STATUS_UNSPECIFIED:</b> Unspecified retrieval status.
|
|
366
|
+
* <br/>
|
|
367
|
+
* <b>URL_RETRIEVAL_STATUS_SUCCESS:</b> The URL retrieval was successful.
|
|
368
|
+
* <br/>
|
|
369
|
+
* <b>URL_RETRIEVAL_STATUS_ERROR:</b> The URL retrieval failed.
|
|
370
|
+
* <br/>
|
|
371
|
+
* <b>URL_RETRIEVAL_STATUS_PAYWALL:</b> The URL retrieval failed because the content is behind a paywall.
|
|
372
|
+
* <br/>
|
|
373
|
+
* <b>URL_RETRIEVAL_STATUS_UNSAFE:</b> The URL retrieval failed because the content is unsafe.
|
|
374
|
+
* <br/>
|
|
375
|
+
*
|
|
376
|
+
* @beta
|
|
377
|
+
*/
|
|
378
|
+
export declare const URLRetrievalStatus: {
|
|
379
|
+
/**
|
|
380
|
+
* Unspecified retrieval status.
|
|
381
|
+
*/
|
|
382
|
+
URL_RETRIEVAL_STATUS_UNSPECIFIED: string;
|
|
383
|
+
/**
|
|
384
|
+
* The URL retrieval was successful.
|
|
385
|
+
*/
|
|
386
|
+
URL_RETRIEVAL_STATUS_SUCCESS: string;
|
|
387
|
+
/**
|
|
388
|
+
* The URL retrieval failed.
|
|
389
|
+
*/
|
|
390
|
+
URL_RETRIEVAL_STATUS_ERROR: string;
|
|
391
|
+
/**
|
|
392
|
+
* The URL retrieval failed because the content is behind a paywall.
|
|
393
|
+
*/
|
|
394
|
+
URL_RETRIEVAL_STATUS_PAYWALL: string;
|
|
395
|
+
/**
|
|
396
|
+
* The URL retrieval failed because the content is unsafe.
|
|
397
|
+
*/
|
|
398
|
+
URL_RETRIEVAL_STATUS_UNSAFE: string;
|
|
399
|
+
};
|
|
400
|
+
/**
|
|
401
|
+
* The status of a URL retrieval.
|
|
402
|
+
*
|
|
403
|
+
* @remarks
|
|
404
|
+
* <b>URL_RETRIEVAL_STATUS_UNSPECIFIED:</b> Unspecified retrieval status.
|
|
405
|
+
* <br/>
|
|
406
|
+
* <b>URL_RETRIEVAL_STATUS_SUCCESS:</b> The URL retrieval was successful.
|
|
407
|
+
* <br/>
|
|
408
|
+
* <b>URL_RETRIEVAL_STATUS_ERROR:</b> The URL retrieval failed.
|
|
409
|
+
* <br/>
|
|
410
|
+
* <b>URL_RETRIEVAL_STATUS_PAYWALL:</b> The URL retrieval failed because the content is behind a paywall.
|
|
411
|
+
* <br/>
|
|
412
|
+
* <b>URL_RETRIEVAL_STATUS_UNSAFE:</b> The URL retrieval failed because the content is unsafe.
|
|
413
|
+
* <br/>
|
|
414
|
+
*
|
|
415
|
+
* @beta
|
|
416
|
+
*/
|
|
417
|
+
export type URLRetrievalStatus = (typeof URLRetrievalStatus)[keyof typeof URLRetrievalStatus];
|
|
326
418
|
/**
|
|
327
419
|
* @public
|
|
328
420
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firebase/ai",
|
|
3
|
-
"version": "2.3.0-canary.
|
|
3
|
+
"version": "2.3.0-canary.7a7634f79",
|
|
4
4
|
"description": "The Firebase AI SDK",
|
|
5
5
|
"author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)",
|
|
6
6
|
"engines": {
|
|
@@ -48,19 +48,19 @@
|
|
|
48
48
|
"trusted-type-check": "tsec -p tsconfig.json --noEmit"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@firebase/app": "0.14.3-canary.
|
|
52
|
-
"@firebase/app-types": "0.9.3-canary.
|
|
51
|
+
"@firebase/app": "0.14.3-canary.7a7634f79",
|
|
52
|
+
"@firebase/app-types": "0.9.3-canary.7a7634f79"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@firebase/app-check-interop-types": "0.3.3-canary.
|
|
56
|
-
"@firebase/component": "0.7.0-canary.
|
|
57
|
-
"@firebase/logger": "0.5.0-canary.
|
|
58
|
-
"@firebase/util": "1.13.0-canary.
|
|
55
|
+
"@firebase/app-check-interop-types": "0.3.3-canary.7a7634f79",
|
|
56
|
+
"@firebase/component": "0.7.0-canary.7a7634f79",
|
|
57
|
+
"@firebase/logger": "0.5.0-canary.7a7634f79",
|
|
58
|
+
"@firebase/util": "1.13.0-canary.7a7634f79",
|
|
59
59
|
"tslib": "^2.1.0"
|
|
60
60
|
},
|
|
61
61
|
"license": "Apache-2.0",
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@firebase/app": "0.14.3-canary.
|
|
63
|
+
"@firebase/app": "0.14.3-canary.7a7634f79",
|
|
64
64
|
"@rollup/plugin-json": "6.1.0",
|
|
65
65
|
"rollup": "2.79.2",
|
|
66
66
|
"rollup-plugin-replace": "2.2.0",
|