Skip to content

Commit 49255b9

Browse files
committed
Improve docs
1 parent 1de9eac commit 49255b9

File tree

12 files changed

+143
-110
lines changed

12 files changed

+143
-110
lines changed

common/api-review/ai.api.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,6 @@ export interface GoogleSearch {
491491

492492
// @public
493493
export interface GoogleSearchTool {
494-
// (undocumented)
495494
googleSearch: GoogleSearch;
496495
}
497496

@@ -518,7 +517,7 @@ export interface GroundingMetadata {
518517
groundingAttributions: GroundingAttribution[];
519518
groundingChunks?: GroundingChunk[];
520519
groundingSupports?: GroundingSupport[];
521-
// (undocumented)
520+
// @deprecated (undocumented)
522521
retrievalQueries?: string[];
523522
searchEntryPoint?: SearchEntrypoint;
524523
webSearchQueries?: string[];
@@ -874,8 +873,6 @@ export enum SchemaType {
874873
// @public
875874
export interface SearchEntrypoint {
876875
renderedContent: string;
877-
renderedContentElement: HTMLDivElement;
878-
sdkBlob?: string;
879876
}
880877

881878
// @public
@@ -992,6 +989,7 @@ export interface WebAttribution {
992989

993990
// @public
994991
export interface WebGroundingChunk {
992+
domain?: string;
995993
title?: string;
996994
uri?: string;
997995
}

docs-devsite/ai.googlesearch.md

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

1212
# GoogleSearch interface
13-
TODO(dlarocque)
13+
Configuration for the [GoogleSearchTool](./ai.googlesearchtool.md#googlesearchtool_interface)<!-- -->.
14+
15+
Currently, this interface is empty and serves as a placeholder for future configuration options.
1416

1517
<b>Signature:</b>
1618

docs-devsite/ai.googlesearchtool.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ https://github.com/firebase/firebase-js-sdk
1010
{% endcomment %}
1111

1212
# GoogleSearchTool interface
13-
TODO(dlarocque)
13+
A tool that allows the generative model to connect to Google Search to access and incorporate up-to-date information from the web into its responses.
14+
15+
When this tool is used, the model's responses may include "Grounded Results" which are subject to the Grounding with Google Search terms outlined in the [Service Specific Terms](https://cloud.google.com/terms/service-terms)<!-- -->.
1416

1517
<b>Signature:</b>
1618

@@ -22,10 +24,12 @@ export declare interface GoogleSearchTool
2224

2325
| Property | Type | Description |
2426
| --- | --- | --- |
25-
| [googleSearch](./ai.googlesearchtool.md#googlesearchtoolgooglesearch) | [GoogleSearch](./ai.googlesearch.md#googlesearch_interface) | |
27+
| [googleSearch](./ai.googlesearchtool.md#googlesearchtoolgooglesearch) | [GoogleSearch](./ai.googlesearch.md#googlesearch_interface) | Specifies the Google Search configuration. Currently, this is an empty object, but it's reserved for future configuration options. |
2628

2729
## GoogleSearchTool.googleSearch
2830

31+
Specifies the Google Search configuration. Currently, this is an empty object, but it's reserved for future configuration options.
32+
2933
<b>Signature:</b>
3034

3135
```typescript

docs-devsite/ai.groundingchunk.md

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

1212
# GroundingChunk interface
13-
A grounding chunk.
13+
Represents a chunk of retrieved data that supports a claim in the model's response. This is part of the grounding information provided when grounding is enabled.
1414

1515
<b>Signature:</b>
1616

@@ -22,11 +22,11 @@ export interface GroundingChunk
2222

2323
| Property | Type | Description |
2424
| --- | --- | --- |
25-
| [web](./ai.groundingchunk.md#groundingchunkweb) | [WebGroundingChunk](./ai.webgroundingchunk.md#webgroundingchunk_interface) | A grounding chunk from the web. |
25+
| [web](./ai.groundingchunk.md#groundingchunkweb) | [WebGroundingChunk](./ai.webgroundingchunk.md#webgroundingchunk_interface) | Contains details if the grounding chunk is from a web source. |
2626

2727
## GroundingChunk.web
2828

29-
A grounding chunk from the web.
29+
Contains details if the grounding chunk is from a web source.
3030

3131
<b>Signature:</b>
3232

docs-devsite/ai.groundingmetadata.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ export interface GroundingMetadata
2323
| Property | Type | Description |
2424
| --- | --- | --- |
2525
| [groundingAttributions](./ai.groundingmetadata.md#groundingmetadatagroundingattributions) | [GroundingAttribution](./ai.groundingattribution.md#groundingattribution_interface)<!-- -->\[\] | |
26-
| [groundingChunks](./ai.groundingmetadata.md#groundingmetadatagroundingchunks) | [GroundingChunk](./ai.groundingchunk.md#groundingchunk_interface)<!-- -->\[\] | List of supporting references retrieved from the specified grounding source. |
27-
| [groundingSupports](./ai.groundingmetadata.md#groundingmetadatagroundingsupports) | [GroundingSupport](./ai.groundingsupport.md#groundingsupport_interface)<!-- -->\[\] | List of grounding support. |
26+
| [groundingChunks](./ai.groundingmetadata.md#groundingmetadatagroundingchunks) | [GroundingChunk](./ai.groundingchunk.md#groundingchunk_interface)<!-- -->\[\] | A list of [GroundingChunk](./ai.groundingchunk.md#groundingchunk_interface) objects. Each chunk represents a piece of retrieved content (e.g. from a web page). that the model used to ground its response. |
27+
| [groundingSupports](./ai.groundingmetadata.md#groundingmetadatagroundingsupports) | [GroundingSupport](./ai.groundingsupport.md#groundingsupport_interface)<!-- -->\[\] | A list of [GroundingSupport](./ai.groundingsupport.md#groundingsupport_interface) objects. Each object details how specific segments of the model's response are supported by the <code>groundingChunks</code>. |
2828
| [retrievalQueries](./ai.groundingmetadata.md#groundingmetadataretrievalqueries) | string\[\] | |
29-
| [searchEntryPoint](./ai.groundingmetadata.md#groundingmetadatasearchentrypoint) | [SearchEntrypoint](./ai.searchentrypoint.md#searchentrypoint_interface) | Google search entry for the following web searches. |
30-
| [webSearchQueries](./ai.groundingmetadata.md#groundingmetadatawebsearchqueries) | string\[\] | Web search queries for the following-up web search. |
29+
| [searchEntryPoint](./ai.groundingmetadata.md#groundingmetadatasearchentrypoint) | [SearchEntrypoint](./ai.searchentrypoint.md#searchentrypoint_interface) | Google search entry for the following web searches. An HTML/CSS snippet that can be embedded in a web page to display a Google Search Entry point for follow-up web searches related to the model's response. |
30+
| [webSearchQueries](./ai.groundingmetadata.md#groundingmetadatawebsearchqueries) | string\[\] | A list of web search queries that the model performed to gather the grounding information. These can be used to allow users to explore the search results themselves. |
3131

3232
## GroundingMetadata.groundingAttributions
3333

@@ -43,7 +43,7 @@ groundingAttributions: GroundingAttribution[];
4343

4444
## GroundingMetadata.groundingChunks
4545

46-
List of supporting references retrieved from the specified grounding source.
46+
A list of [GroundingChunk](./ai.groundingchunk.md#groundingchunk_interface) objects. Each chunk represents a piece of retrieved content (e.g. from a web page). that the model used to ground its response.
4747

4848
<b>Signature:</b>
4949

@@ -53,7 +53,7 @@ groundingChunks?: GroundingChunk[];
5353

5454
## GroundingMetadata.groundingSupports
5555

56-
List of grounding support.
56+
A list of [GroundingSupport](./ai.groundingsupport.md#groundingsupport_interface) objects. Each object details how specific segments of the model's response are supported by the `groundingChunks`<!-- -->.
5757

5858
<b>Signature:</b>
5959

@@ -63,6 +63,11 @@ groundingSupports?: GroundingSupport[];
6363

6464
## GroundingMetadata.retrievalQueries
6565

66+
> Warning: This API is now obsolete.
67+
>
68+
> Use [GroundingMetadata.groundingSupports](./ai.groundingmetadata.md#groundingmetadatagroundingsupports) instead.
69+
>
70+
6671
<b>Signature:</b>
6772

6873
```typescript
@@ -71,7 +76,7 @@ retrievalQueries?: string[];
7176

7277
## GroundingMetadata.searchEntryPoint
7378

74-
Google search entry for the following web searches.
79+
Google search entry for the following web searches. An HTML/CSS snippet that can be embedded in a web page to display a Google Search Entry point for follow-up web searches related to the model's response.
7580

7681
<b>Signature:</b>
7782

@@ -81,7 +86,7 @@ searchEntryPoint?: SearchEntrypoint;
8186

8287
## GroundingMetadata.webSearchQueries
8388

84-
Web search queries for the following-up web search.
89+
A list of web search queries that the model performed to gather the grounding information. These can be used to allow users to explore the search results themselves.
8590

8691
<b>Signature:</b>
8792

docs-devsite/ai.groundingsupport.md

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

1212
# GroundingSupport interface
13-
Grounding support.
13+
Provides information about how a specific segment of the model's response is supported by the retrieved grounding chunks.
1414

1515
<b>Signature:</b>
1616

@@ -22,13 +22,13 @@ export interface GroundingSupport
2222

2323
| Property | Type | Description |
2424
| --- | --- | --- |
25-
| [confidenceScores](./ai.groundingsupport.md#groundingsupportconfidencescores) | number\[\] | Confidence score of the supporting references. Ranges from 0 to 1, where 1 is the most confident. This list must have the same size has the <code>groundingChunkIndices</code>. |
26-
| [groundingChunkIndices](./ai.groundingsupport.md#groundingsupportgroundingchunkindices) | number\[\] | A list of indices into <code>groundingChunk</code> specifying the citations associated with the claim. For example, <code>[1,3,4]</code> means that <code>groundingChunk[1]</code>, <code>groundingChunk[3]</code>, and <code>groundingChunk[4]</code> are the retrieved content to the attributed claim. |
27-
| [segment](./ai.groundingsupport.md#groundingsupportsegment) | [Segment](./ai.segment.md#segment_interface) | Segment of the content that this support is associated with. |
25+
| [confidenceScores](./ai.groundingsupport.md#groundingsupportconfidencescores) | number\[\] | A list of confidence scores, corresponding to each index in <code>groundingChunkIndices</code>. Each score indicates the model's confidence that the correspondingly indexed grounding chunk supports the claim in the response segment. Scores range from 0.0 to 1.0, where 1.0 is the highest confidence. This list will have the same number of elements as <code>groundingChunkIndices</code>. |
26+
| [groundingChunkIndices](./ai.groundingsupport.md#groundingsupportgroundingchunkindices) | number\[\] | A list of indices that refer to specific [GroundingChunk](./ai.groundingchunk.md#groundingchunk_interface) objects within the [GroundingMetadata.groundingChunks](./ai.groundingmetadata.md#groundingmetadatagroundingchunks) array. These referenced chunks are the sources that support the claim made in the associated <code>segment</code> of the response. For example, an array <code>[1, 3, 4]</code> means that <code>groundingChunks[1]</code>, <code>groundingChunks[3]</code>, and <code>groundingChunks[4]</code> are the retrieved content supporting this part of the response. |
27+
| [segment](./ai.groundingsupport.md#groundingsupportsegment) | [Segment](./ai.segment.md#segment_interface) | Specifies the segment of the model's response content that this grounding support pertains to. |
2828

2929
## GroundingSupport.confidenceScores
3030

31-
Confidence score of the supporting references. Ranges from 0 to 1, where 1 is the most confident. This list must have the same size has the `groundingChunkIndices`<!-- -->.
31+
A list of confidence scores, corresponding to each index in `groundingChunkIndices`<!-- -->. Each score indicates the model's confidence that the correspondingly indexed grounding chunk supports the claim in the response segment. Scores range from 0.0 to 1.0, where 1.0 is the highest confidence. This list will have the same number of elements as `groundingChunkIndices`<!-- -->.
3232

3333
<b>Signature:</b>
3434

@@ -38,7 +38,7 @@ confidenceScores?: number[];
3838

3939
## GroundingSupport.groundingChunkIndices
4040

41-
A list of indices into `groundingChunk` specifying the citations associated with the claim. For example, `[1,3,4]` means that `groundingChunk[1]`<!-- -->, `groundingChunk[3]`<!-- -->, and `groundingChunk[4]` are the retrieved content to the attributed claim.
41+
A list of indices that refer to specific [GroundingChunk](./ai.groundingchunk.md#groundingchunk_interface) objects within the [GroundingMetadata.groundingChunks](./ai.groundingmetadata.md#groundingmetadatagroundingchunks) array. These referenced chunks are the sources that support the claim made in the associated `segment` of the response. For example, an array `[1, 3, 4]` means that `groundingChunks[1]`<!-- -->, `groundingChunks[3]`<!-- -->, and `groundingChunks[4]` are the retrieved content supporting this part of the response.
4242

4343
<b>Signature:</b>
4444

@@ -48,7 +48,7 @@ groundingChunkIndices?: number[];
4848

4949
## GroundingSupport.segment
5050

51-
Segment of the content that this support is associated with.
51+
Specifies the segment of the model's response content that this grounding support pertains to.
5252

5353
<b>Signature:</b>
5454

docs-devsite/ai.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,12 @@ The Firebase AI Web SDK.
9595
| [GenerateContentStreamResult](./ai.generatecontentstreamresult.md#generatecontentstreamresult_interface) | Result object returned from [GenerativeModel.generateContentStream()](./ai.generativemodel.md#generativemodelgeneratecontentstream) call. Iterate over <code>stream</code> to get chunks as they come in and/or use the <code>response</code> promise to get the aggregated response when the stream is done. |
9696
| [GenerationConfig](./ai.generationconfig.md#generationconfig_interface) | Config options for content-related requests |
9797
| [GenerativeContentBlob](./ai.generativecontentblob.md#generativecontentblob_interface) | Interface for sending an image. |
98-
| [GoogleSearch](./ai.googlesearch.md#googlesearch_interface) | TODO(dlarocque) |
99-
| [GoogleSearchTool](./ai.googlesearchtool.md#googlesearchtool_interface) | TODO(dlarocque) |
98+
| [GoogleSearch](./ai.googlesearch.md#googlesearch_interface) | Configuration for the [GoogleSearchTool](./ai.googlesearchtool.md#googlesearchtool_interface)<!-- -->. |
99+
| [GoogleSearchTool](./ai.googlesearchtool.md#googlesearchtool_interface) | A tool that allows the generative model to connect to Google Search to access and incorporate up-to-date information from the web into its responses.<!-- -->When this tool is used, the model's responses may include "Grounded Results" which are subject to the Grounding with Google Search terms outlined in the [Service Specific Terms](https://cloud.google.com/terms/service-terms)<!-- -->. |
100100
| [GroundingAttribution](./ai.groundingattribution.md#groundingattribution_interface) | |
101-
| [GroundingChunk](./ai.groundingchunk.md#groundingchunk_interface) | A grounding chunk. |
101+
| [GroundingChunk](./ai.groundingchunk.md#groundingchunk_interface) | Represents a chunk of retrieved data that supports a claim in the model's response. This is part of the grounding information provided when grounding is enabled. |
102102
| [GroundingMetadata](./ai.groundingmetadata.md#groundingmetadata_interface) | Metadata returned to client when grounding is enabled. |
103-
| [GroundingSupport](./ai.groundingsupport.md#groundingsupport_interface) | Grounding support. |
103+
| [GroundingSupport](./ai.groundingsupport.md#groundingsupport_interface) | Provides information about how a specific segment of the model's response is supported by the retrieved grounding chunks. |
104104
| [ImagenGCSImage](./ai.imagengcsimage.md#imagengcsimage_interface) | An image generated by Imagen, stored in a Cloud Storage for Firebase bucket.<!-- -->This feature is not available yet. |
105105
| [ImagenGenerationConfig](./ai.imagengenerationconfig.md#imagengenerationconfig_interface) | <b><i>(Public Preview)</i></b> Configuration options for generating images with Imagen.<!-- -->See the [documentation](http://firebase.google.com/docs/vertex-ai/generate-images-imagen) for more details. |
106106
| [ImagenGenerationResponse](./ai.imagengenerationresponse.md#imagengenerationresponse_interface) | <b><i>(Public Preview)</i></b> The response from a request to generate images with Imagen. |
@@ -121,15 +121,15 @@ The Firebase AI Web SDK.
121121
| [SchemaRequest](./ai.schemarequest.md#schemarequest_interface) | Final format for [Schema](./ai.schema.md#schema_class) params passed to backend requests. |
122122
| [SchemaShared](./ai.schemashared.md#schemashared_interface) | Basic [Schema](./ai.schema.md#schema_class) properties shared across several Schema-related types. |
123123
| [SearchEntrypoint](./ai.searchentrypoint.md#searchentrypoint_interface) | Google search entry point. |
124-
| [Segment](./ai.segment.md#segment_interface) | Segment of the content |
124+
| [Segment](./ai.segment.md#segment_interface) | Represents a specific segment within a [Content](./ai.content.md#content_interface) object, often used to pinpoint the exact location of text or data that grounding information refers to. |
125125
| [StartChatParams](./ai.startchatparams.md#startchatparams_interface) | Params for [GenerativeModel.startChat()](./ai.generativemodel.md#generativemodelstartchat)<!-- -->. |
126126
| [TextPart](./ai.textpart.md#textpart_interface) | Content part interface if the part represents a text string. |
127127
| [ToolConfig](./ai.toolconfig.md#toolconfig_interface) | Tool config. This config is shared for all tools provided in the request. |
128128
| [UsageMetadata](./ai.usagemetadata.md#usagemetadata_interface) | Usage metadata about a [GenerateContentResponse](./ai.generatecontentresponse.md#generatecontentresponse_interface)<!-- -->. |
129129
| [VertexAIOptions](./ai.vertexaioptions.md#vertexaioptions_interface) | Options when initializing the Firebase AI SDK. |
130130
| [VideoMetadata](./ai.videometadata.md#videometadata_interface) | Describes the input video content. |
131131
| [WebAttribution](./ai.webattribution.md#webattribution_interface) | |
132-
| [WebGroundingChunk](./ai.webgroundingchunk.md#webgroundingchunk_interface) | A grounding reference from the web. |
132+
| [WebGroundingChunk](./ai.webgroundingchunk.md#webgroundingchunk_interface) | A grounding chunk from the web. |
133133

134134
## Variables
135135

docs-devsite/ai.searchentrypoint.md

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,38 +22,27 @@ export interface SearchEntrypoint
2222

2323
| Property | Type | Description |
2424
| --- | --- | --- |
25-
| [renderedContent](./ai.searchentrypoint.md#searchentrypointrenderedcontent) | string | Web content snippet that can be embedded in a web page. |
26-
| [renderedContentElement](./ai.searchentrypoint.md#searchentrypointrenderedcontentelement) | HTMLDivElement | attachShadow(<!-- -->{<!-- -->mode: 'open'<!-- -->}<!-- -->).innerHTML = renderedContent https://developer.mozilla.org/en-US/docs/Web/API/Web\_components/Using\_shadow\_DOM - prevents CSS conflicts - "black box" structure that can't be modified by accident (very good in this context)<!-- -->this could be a helper method createEncapsulatedElement(htmlContent): HTMLDivElement |
27-
| [sdkBlob](./ai.searchentrypoint.md#searchentrypointsdkblob) | string | Base64-encoded JSON array of &lt;<!-- -->search term, search url<!-- -->&gt; |
25+
| [renderedContent](./ai.searchentrypoint.md#searchentrypointrenderedcontent) | string | HTML/CSS snippet that can be embedded in a web page. The snippet is designed to avoid undesired interaction with the rest of the page's CSS.<!-- -->To ensure proper rendering and prevent CSS conflicts, it is recommended to encapsulate this <code>renderedContent</code> within a shadow DOM when embedding it into a webpage. See [MDN: Using shadow DOM](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_shadow_DOM)<!-- -->. |
2826

2927
## SearchEntrypoint.renderedContent
3028

31-
Web content snippet that can be embedded in a web page.
29+
HTML/CSS snippet that can be embedded in a web page. The snippet is designed to avoid undesired interaction with the rest of the page's CSS.
30+
31+
To ensure proper rendering and prevent CSS conflicts, it is recommended to encapsulate this `renderedContent` within a shadow DOM when embedding it into a webpage. See [MDN: Using shadow DOM](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_shadow_DOM)<!-- -->.
3232

3333
<b>Signature:</b>
3434

3535
```typescript
3636
renderedContent: string;
3737
```
3838

39-
## SearchEntrypoint.renderedContentElement
40-
41-
attachShadow(<!-- -->{<!-- -->mode: 'open'<!-- -->}<!-- -->).innerHTML = renderedContent https://developer.mozilla.org/en-US/docs/Web/API/Web\_components/Using\_shadow\_DOM - prevents CSS conflicts - "black box" structure that can't be modified by accident (very good in this context)
39+
### Example
4240

43-
this could be a helper method createEncapsulatedElement(htmlContent): HTMLDivElement
4441

45-
<b>Signature:</b>
42+
```javascript
43+
const container = document.createElement('div');
44+
document.body.appendChild(container);
45+
container.attachShadow({ mode: 'open' }).innerHTML = renderedContent;
4646

47-
```typescript
48-
renderedContentElement: HTMLDivElement;
4947
```
5048

51-
## SearchEntrypoint.sdkBlob
52-
53-
Base64-encoded JSON array of &lt;<!-- -->search term, search url<!-- -->&gt;
54-
55-
<b>Signature:</b>
56-
57-
```typescript
58-
sdkBlob?: string;
59-
```

0 commit comments

Comments
 (0)