Skip to content

Commit 45a014f

Browse files
committed
Update docs
1 parent 05633c8 commit 45a014f

File tree

9 files changed

+41
-27
lines changed

9 files changed

+41
-27
lines changed

docs-devsite/ai.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ The Firebase AI Web SDK.
136136
| [ToolConfig](./ai.toolconfig.md#toolconfig_interface) | Tool config. This config is shared for all tools provided in the request. |
137137
| [URLContext](./ai.urlcontext.md#urlcontext_interface) | Specifies the URL Context configuration. |
138138
| [URLContextMetadata](./ai.urlcontextmetadata.md#urlcontextmetadata_interface) | Metadata related to [URLContextTool](./ai.urlcontexttool.md#urlcontexttool_interface)<!-- -->. |
139-
| [URLContextTool](./ai.urlcontexttool.md#urlcontexttool_interface) | A tool that allows you to provide additional context to the models in the form of URLs. By including URLs in your request, the Gemini model will access the content from those pages to inform and enhance its response. |
140-
| [URLMetadata](./ai.urlmetadata.md#urlmetadata_interface) | Metadata for a URL that was used to provide context to the Gemini model. |
139+
| [URLContextTool](./ai.urlcontexttool.md#urlcontexttool_interface) | A tool that allows you to provide additional context to the models in the form of public web URLs. By including URLs in your request, the Gemini model will access the content from those pages to inform and enhance its response. |
140+
| [URLMetadata](./ai.urlmetadata.md#urlmetadata_interface) | Metadata for a single URL retrieved by the [URLContextTool](./ai.urlcontexttool.md#urlcontexttool_interface) tool. |
141141
| [UsageMetadata](./ai.usagemetadata.md#usagemetadata_interface) | Usage metadata about a [GenerateContentResponse](./ai.generatecontentresponse.md#generatecontentresponse_interface)<!-- -->. |
142142
| [VideoMetadata](./ai.videometadata.md#videometadata_interface) | Describes the input video content. |
143143
| [VoiceConfig](./ai.voiceconfig.md#voiceconfig_interface) | <b><i>(Public Preview)</i></b> Configuration for the voice to used in speech synthesis. |
@@ -762,6 +762,8 @@ SchemaType: {
762762

763763
The status of a URL retrieval.
764764

765+
<b>URL\_RETRIEVAL\_STATUS\_UNSPECIFIED:</b> Unspecified retrieval status. <br/> <b>URL\_RETRIEVAL\_STATUS\_SUCCESS:</b> The URL retrieval was successful. <br/> <b>URL\_RETRIEVAL\_STATUS\_ERROR:</b> The URL retrieval failed. <br/> <b>URL\_RETRIEVAL\_STATUS\_PAYWALL:</b> The URL retrieval failed because the content is behind a paywall. <br/> <b>URL\_RETRIEVAL\_STATUS\_UNSAFE:</b> The URL retrieval failed because the content is unsafe. <br/>
766+
765767
<b>Signature:</b>
766768

767769
```typescript
@@ -1070,7 +1072,7 @@ export type TypedSchema = IntegerSchema | NumberSchema | StringSchema | BooleanS
10701072

10711073
The status of a URL retrieval.
10721074

1073-
<b>URL\_RETRIEVAL\_STATUS\_UNSPECIFIED:</b> Unspecified retrieval status. <br/> <b>URL\_RETRIEVAL\_STATUS\_SUCCESS:</b> The URL retrieval was successful. <br/> <b>URL\_RETRIEVAL\_STATUS\_ERROR:</b> The URL retrieval failed due to an error. <br/> <b>URL\_RETRIEVAL\_STATUS\_PAYWALL:</b> The URL retrieval failed because the content is behind a paywall. <br/> <b>URL\_RETRIEVAL\_STATUS\_UNSAFE:</b> The URL retrieval failed because the content is unsafe. <br/>
1075+
<b>URL\_RETRIEVAL\_STATUS\_UNSPECIFIED:</b> Unspecified retrieval status. <br/> <b>URL\_RETRIEVAL\_STATUS\_SUCCESS:</b> The URL retrieval was successful. <br/> <b>URL\_RETRIEVAL\_STATUS\_ERROR:</b> The URL retrieval failed. <br/> <b>URL\_RETRIEVAL\_STATUS\_PAYWALL:</b> The URL retrieval failed because the content is behind a paywall. <br/> <b>URL\_RETRIEVAL\_STATUS\_UNSAFE:</b> The URL retrieval failed because the content is unsafe. <br/>
10741076

10751077
<b>Signature:</b>
10761078

docs-devsite/ai.urlcontext.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ https://github.com/firebase/firebase-js-sdk
1212
# URLContext interface
1313
Specifies the URL Context configuration.
1414

15-
Currently, this is an empty object, but it's reserved for future configuration.
16-
1715
<b>Signature:</b>
1816

1917
```typescript

docs-devsite/ai.urlcontextmetadata.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ export interface URLContextMetadata
2222

2323
| Property | Type | Description |
2424
| --- | --- | --- |
25-
| [urlMetadata](./ai.urlcontextmetadata.md#urlcontextmetadataurlmetadata) | [URLMetadata](./ai.urlmetadata.md#urlmetadata_interface)<!-- -->\[\] | List of URL metadata were used to provide context to the Gemini model. |
25+
| [urlMetadata](./ai.urlcontextmetadata.md#urlcontextmetadataurlmetadata) | [URLMetadata](./ai.urlmetadata.md#urlmetadata_interface)<!-- -->\[\] | List of URL metadata used to provide context to the Gemini model. |
2626

2727
## URLContextMetadata.urlMetadata
2828

29-
List of URL metadata were used to provide context to the Gemini model.
29+
List of URL metadata used to provide context to the Gemini model.
3030

3131
<b>Signature:</b>
3232

docs-devsite/ai.urlcontexttool.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ https://github.com/firebase/firebase-js-sdk
1010
{% endcomment %}
1111

1212
# URLContextTool interface
13-
A tool that allows you to provide additional context to the models in the form of URLs. By including URLs in your request, the Gemini model will access the content from those pages to inform and enhance its response.
13+
A tool that allows you to provide additional context to the models in the form of public web URLs. By including URLs in your request, the Gemini model will access the content from those pages to inform and enhance its response.
1414

1515
<b>Signature:</b>
1616

docs-devsite/ai.urlmetadata.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ https://github.com/firebase/firebase-js-sdk
1010
{% endcomment %}
1111

1212
# URLMetadata interface
13-
Metadata for a URL that was used to provide context to the Gemini model.
13+
Metadata for a single URL retrieved by the [URLContextTool](./ai.urlcontexttool.md#urlcontexttool_interface) tool.
1414

1515
<b>Signature:</b>
1616

docs-devsite/ai.usagemetadata.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ export interface UsageMetadata
2727
| [promptTokenCount](./ai.usagemetadata.md#usagemetadataprompttokencount) | number | |
2828
| [promptTokensDetails](./ai.usagemetadata.md#usagemetadataprompttokensdetails) | [ModalityTokenCount](./ai.modalitytokencount.md#modalitytokencount_interface)<!-- -->\[\] | |
2929
| [thoughtsTokenCount](./ai.usagemetadata.md#usagemetadatathoughtstokencount) | number | The number of tokens used by the model's internal "thinking" process. |
30-
| [toolUsePromptTokenCount](./ai.usagemetadata.md#usagemetadatatooluseprompttokencount) | number | The number of tokens in the results from tool executions, which are provided back to the model as input. |
31-
| [toolUsePromptTokensDetails](./ai.usagemetadata.md#usagemetadatatooluseprompttokensdetails) | [ModalityTokenCount](./ai.modalitytokencount.md#modalitytokencount_interface)<!-- -->\[\] | A list of tokens used by tools whose usage was triggered from a prompt, broken down by modality. |
30+
| [toolUsePromptTokenCount](./ai.usagemetadata.md#usagemetadatatooluseprompttokencount) | number | The number of tokens used by tools. |
31+
| [toolUsePromptTokensDetails](./ai.usagemetadata.md#usagemetadatatooluseprompttokensdetails) | [ModalityTokenCount](./ai.modalitytokencount.md#modalitytokencount_interface)<!-- -->\[\] | A list of tokens used by tools, broken down by modality. |
3232
| [totalTokenCount](./ai.usagemetadata.md#usagemetadatatotaltokencount) | number | |
3333

3434
## UsageMetadata.candidatesTokenCount
@@ -75,7 +75,7 @@ thoughtsTokenCount?: number;
7575

7676
## UsageMetadata.toolUsePromptTokenCount
7777

78-
The number of tokens in the results from tool executions, which are provided back to the model as input.
78+
The number of tokens used by tools.
7979

8080
<b>Signature:</b>
8181

@@ -85,7 +85,7 @@ toolUsePromptTokenCount?: number;
8585

8686
## UsageMetadata.toolUsePromptTokensDetails
8787

88-
A list of tokens used by tools whose usage was triggered from a prompt, broken down by modality.
88+
A list of tokens used by tools, broken down by modality.
8989

9090
<b>Signature:</b>
9191

packages/ai/src/requests/stream-reader.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,13 @@ export function aggregateResponses(
198198
// make sure that we don't overwrite the first value urlContextMetadata object with undefined.
199199
// FIXME: What happens if we receive a second, valid urlContextMetadata object?
200200
const urlContextMetadata = candidate.urlContextMetadata as unknown;
201-
if (typeof urlContextMetadata === 'object' && urlContextMetadata !== null && Object.keys(urlContextMetadata).length > 0) {
202-
aggregatedResponse.candidates[i].urlContextMetadata = urlContextMetadata as URLContextMetadata;
201+
if (
202+
typeof urlContextMetadata === 'object' &&
203+
urlContextMetadata !== null &&
204+
Object.keys(urlContextMetadata).length > 0
205+
) {
206+
aggregatedResponse.candidates[i].urlContextMetadata =
207+
urlContextMetadata as URLContextMetadata;
203208
}
204209

205210
/**

packages/ai/src/types/requests.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,9 @@ export interface CodeExecutionTool {
321321
export interface GoogleSearch {}
322322

323323
/**
324-
* A tool that allows you to provide additional context to the models in the form of URLs.
325-
* By including URLs in your request, the Gemini model will access the content from those pages
326-
* to inform and enhance its response.
324+
* A tool that allows you to provide additional context to the models in the form of public web
325+
* URLs. By including URLs in your request, the Gemini model will access the content from those
326+
* pages to inform and enhance its response.
327327
*
328328
* @public
329329
*/
@@ -337,8 +337,6 @@ export interface URLContextTool {
337337
/**
338338
* Specifies the URL Context configuration.
339339
*
340-
* @remarks Currently, this is an empty object, but it's reserved for future configuration.
341-
*
342340
* @public
343341
*/
344342
export interface URLContext {}

packages/ai/src/types/responses.ts

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,13 @@ export interface UsageMetadata {
117117
thoughtsTokenCount?: number;
118118
totalTokenCount: number;
119119
/**
120-
* The number of tokens in the results from tool executions, which are provided back to the
121-
* model as input.
120+
* The number of tokens used by tools.
122121
*/
123122
toolUsePromptTokenCount?: number;
124123
promptTokensDetails?: ModalityTokenCount[];
125124
candidatesTokensDetails?: ModalityTokenCount[];
126125
/**
127-
* A list of tokens used by tools whose usage was triggered from a prompt, broken down by modality.
126+
* A list of tokens used by tools, broken down by modality.
128127
*/
129128
toolUsePromptTokensDetails?: ModalityTokenCount[];
130129
}
@@ -366,13 +365,13 @@ export interface Segment {
366365
*/
367366
export interface URLContextMetadata {
368367
/**
369-
* List of URL metadata were used to provide context to the Gemini model.
368+
* List of URL metadata used to provide context to the Gemini model.
370369
*/
371370
urlMetadata: URLMetadata[];
372371
}
373372

374373
/**
375-
* Metadata for a URL that was used to provide context to the Gemini model.
374+
* Metadata for a single URL retrieved by the {@link URLContextTool} tool.
376375
*
377376
* @public
378377
*/
@@ -390,6 +389,18 @@ export interface URLMetadata {
390389
/**
391390
* The status of a URL retrieval.
392391
*
392+
* @remarks
393+
* <b>URL_RETRIEVAL_STATUS_UNSPECIFIED:</b> Unspecified retrieval status.
394+
* <br/>
395+
* <b>URL_RETRIEVAL_STATUS_SUCCESS:</b> The URL retrieval was successful.
396+
* <br/>
397+
* <b>URL_RETRIEVAL_STATUS_ERROR:</b> The URL retrieval failed.
398+
* <br/>
399+
* <b>URL_RETRIEVAL_STATUS_PAYWALL:</b> The URL retrieval failed because the content is behind a paywall.
400+
* <br/>
401+
* <b>URL_RETRIEVAL_STATUS_UNSAFE:</b> The URL retrieval failed because the content is unsafe.
402+
* <br/>
403+
*
393404
* @public
394405
*/
395406
export const URLRetrievalStatus = {
@@ -402,7 +413,7 @@ export const URLRetrievalStatus = {
402413
*/
403414
URL_RETRIEVAL_STATUS_SUCCESS: 'URL_RETRIEVAL_STATUS_SUCCESS',
404415
/**
405-
* The URL retrieval failed due to an error.
416+
* The URL retrieval failed.
406417
*/
407418
URL_RETRIEVAL_STATUS_ERROR: 'URL_RETRIEVAL_STATUS_ERROR',
408419
/**
@@ -423,7 +434,7 @@ export const URLRetrievalStatus = {
423434
* <br/>
424435
* <b>URL_RETRIEVAL_STATUS_SUCCESS:</b> The URL retrieval was successful.
425436
* <br/>
426-
* <b>URL_RETRIEVAL_STATUS_ERROR:</b> The URL retrieval failed due to an error.
437+
* <b>URL_RETRIEVAL_STATUS_ERROR:</b> The URL retrieval failed.
427438
* <br/>
428439
* <b>URL_RETRIEVAL_STATUS_PAYWALL:</b> The URL retrieval failed because the content is behind a paywall.
429440
* <br/>

0 commit comments

Comments
 (0)