From b1badeaa176ac409a38c4cb3e5192c60d4a8dc9d Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Mon, 26 May 2025 14:21:21 -0400 Subject: [PATCH 1/8] feat(ai): add support for grounding with google search --- .changeset/five-kids-grow.md | 6 + common/api-review/ai.api.md | 47 ++++++- docs-devsite/_toc.yaml | 12 ++ docs-devsite/ai.googlesearch.md | 21 +++ docs-devsite/ai.googlesearchtool.md | 37 ++++++ docs-devsite/ai.groundingchunk.md | 35 +++++ docs-devsite/ai.groundingmetadata.md | 42 +++++- docs-devsite/ai.groundingsupport.md | 57 ++++++++ docs-devsite/ai.md | 10 +- docs-devsite/ai.searchentrypoint.md | 48 +++++++ docs-devsite/ai.segment.md | 24 +++- docs-devsite/ai.webgroundingchunk.md | 61 +++++++++ packages/ai/src/requests/request.ts | 2 + packages/ai/src/requests/stream-reader.ts | 2 + packages/ai/src/types/requests.ts | 28 +++- packages/ai/src/types/responses.ts | 150 +++++++++++++++++++++- 16 files changed, 562 insertions(+), 20 deletions(-) create mode 100644 .changeset/five-kids-grow.md create mode 100644 docs-devsite/ai.googlesearch.md create mode 100644 docs-devsite/ai.googlesearchtool.md create mode 100644 docs-devsite/ai.groundingchunk.md create mode 100644 docs-devsite/ai.groundingsupport.md create mode 100644 docs-devsite/ai.searchentrypoint.md create mode 100644 docs-devsite/ai.webgroundingchunk.md diff --git a/.changeset/five-kids-grow.md b/.changeset/five-kids-grow.md new file mode 100644 index 00000000000..4303518b6ff --- /dev/null +++ b/.changeset/five-kids-grow.md @@ -0,0 +1,6 @@ +--- +'firebase': minor +'@firebase/ai': minor +--- + +Add support for Grounding with Google Search. diff --git a/common/api-review/ai.api.md b/common/api-review/ai.api.md index 523b51d7533..b9fe496046b 100644 --- a/common/api-review/ai.api.md +++ b/common/api-review/ai.api.md @@ -485,6 +485,15 @@ export interface GoogleAIGenerateContentResponse { usageMetadata?: UsageMetadata; } +// @public +export interface GoogleSearch { +} + +// @public +export interface GoogleSearchTool { + googleSearch: GoogleSearch; +} + // @public @deprecated (undocumented) export interface GroundingAttribution { // (undocumented) @@ -497,16 +506,30 @@ export interface GroundingAttribution { web?: WebAttribution; } +// @public +export interface GroundingChunk { + web?: WebGroundingChunk; +} + // @public export interface GroundingMetadata { // @deprecated (undocumented) groundingAttributions: GroundingAttribution[]; - // (undocumented) + groundingChunks?: GroundingChunk[]; + groundingSupports?: GroundingSupport[]; + // @deprecated (undocumented) retrievalQueries?: string[]; - // (undocumented) + searchEntryPoint?: SearchEntrypoint; webSearchQueries?: string[]; } +// @public +export interface GroundingSupport { + confidenceScores?: number[]; + groundingChunkIndices?: number[]; + segment?: Segment; +} + // @public export enum HarmBlockMethod { PROBABILITY = "PROBABILITY", @@ -852,14 +875,17 @@ export enum SchemaType { STRING = "string" } -// @public (undocumented) +// @public +export interface SearchEntrypoint { + renderedContent: string; +} + +// @public export interface Segment { - // (undocumented) endIndex: number; - // (undocumented) partIndex: number; - // (undocumented) startIndex: number; + text: string; } // @public @@ -896,7 +922,7 @@ export interface TextPart { } // @public -export type Tool = FunctionDeclarationsTool; +export type Tool = FunctionDeclarationsTool | GoogleSearchTool; // @public export interface ToolConfig { @@ -956,5 +982,12 @@ export interface WebAttribution { uri: string; } +// @public +export interface WebGroundingChunk { + domain?: string; + title?: string; + uri?: string; +} + ``` diff --git a/docs-devsite/_toc.yaml b/docs-devsite/_toc.yaml index b77a6b5910e..bf1b8978b57 100644 --- a/docs-devsite/_toc.yaml +++ b/docs-devsite/_toc.yaml @@ -76,10 +76,18 @@ toc: path: /docs/reference/js/ai.generativemodel.md - title: GoogleAIBackend path: /docs/reference/js/ai.googleaibackend.md + - title: GoogleSearch + path: /docs/reference/js/ai.googlesearch.md + - title: GoogleSearchTool + path: /docs/reference/js/ai.googlesearchtool.md - title: GroundingAttribution path: /docs/reference/js/ai.groundingattribution.md + - title: GroundingChunk + path: /docs/reference/js/ai.groundingchunk.md - title: GroundingMetadata path: /docs/reference/js/ai.groundingmetadata.md + - title: GroundingSupport + path: /docs/reference/js/ai.groundingsupport.md - title: ImagenGCSImage path: /docs/reference/js/ai.imagengcsimage.md - title: ImagenGenerationConfig @@ -130,6 +138,8 @@ toc: path: /docs/reference/js/ai.schemarequest.md - title: SchemaShared path: /docs/reference/js/ai.schemashared.md + - title: SearchEntrypoint + path: /docs/reference/js/ai.searchentrypoint.md - title: Segment path: /docs/reference/js/ai.segment.md - title: StartChatParams @@ -150,6 +160,8 @@ toc: path: /docs/reference/js/ai.videometadata.md - title: WebAttribution path: /docs/reference/js/ai.webattribution.md + - title: WebGroundingChunk + path: /docs/reference/js/ai.webgroundingchunk.md - title: analytics path: /docs/reference/js/analytics.md section: diff --git a/docs-devsite/ai.googlesearch.md b/docs-devsite/ai.googlesearch.md new file mode 100644 index 00000000000..f2c206f9bfe --- /dev/null +++ b/docs-devsite/ai.googlesearch.md @@ -0,0 +1,21 @@ +Project: /docs/reference/js/_project.yaml +Book: /docs/reference/_book.yaml +page_type: reference + +{% comment %} +DO NOT EDIT THIS FILE! +This is generated by the JS SDK team, and any local changes will be +overwritten. Changes should be made in the source code at +https://github.com/firebase/firebase-js-sdk +{% endcomment %} + +# GoogleSearch interface +Configuration for the [GoogleSearchTool](./ai.googlesearchtool.md#googlesearchtool_interface). + +Currently, this interface is empty and serves as a placeholder for future configuration options. + +Signature: + +```typescript +export declare interface GoogleSearch +``` diff --git a/docs-devsite/ai.googlesearchtool.md b/docs-devsite/ai.googlesearchtool.md new file mode 100644 index 00000000000..69d172f3566 --- /dev/null +++ b/docs-devsite/ai.googlesearchtool.md @@ -0,0 +1,37 @@ +Project: /docs/reference/js/_project.yaml +Book: /docs/reference/_book.yaml +page_type: reference + +{% comment %} +DO NOT EDIT THIS FILE! +This is generated by the JS SDK team, and any local changes will be +overwritten. Changes should be made in the source code at +https://github.com/firebase/firebase-js-sdk +{% endcomment %} + +# 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). + +Signature: + +```typescript +export declare interface GoogleSearchTool +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [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. | + +## GoogleSearchTool.googleSearch + +Specifies the Google Search configuration. Currently, this is an empty object, but it's reserved for future configuration options. + +Signature: + +```typescript +googleSearch: GoogleSearch; +``` diff --git a/docs-devsite/ai.groundingchunk.md b/docs-devsite/ai.groundingchunk.md new file mode 100644 index 00000000000..2b84af29d8e --- /dev/null +++ b/docs-devsite/ai.groundingchunk.md @@ -0,0 +1,35 @@ +Project: /docs/reference/js/_project.yaml +Book: /docs/reference/_book.yaml +page_type: reference + +{% comment %} +DO NOT EDIT THIS FILE! +This is generated by the JS SDK team, and any local changes will be +overwritten. Changes should be made in the source code at +https://github.com/firebase/firebase-js-sdk +{% endcomment %} + +# 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. + +Signature: + +```typescript +export interface GroundingChunk +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [web](./ai.groundingchunk.md#groundingchunkweb) | [WebGroundingChunk](./ai.webgroundingchunk.md#webgroundingchunk_interface) | Contains details if the grounding chunk is from a web source. | + +## GroundingChunk.web + +Contains details if the grounding chunk is from a web source. + +Signature: + +```typescript +web?: WebGroundingChunk; +``` diff --git a/docs-devsite/ai.groundingmetadata.md b/docs-devsite/ai.groundingmetadata.md index 90994d9c01c..70534842415 100644 --- a/docs-devsite/ai.groundingmetadata.md +++ b/docs-devsite/ai.groundingmetadata.md @@ -23,8 +23,11 @@ export interface GroundingMetadata | Property | Type | Description | | --- | --- | --- | | [groundingAttributions](./ai.groundingmetadata.md#groundingmetadatagroundingattributions) | [GroundingAttribution](./ai.groundingattribution.md#groundingattribution_interface)\[\] | | +| [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. | +| [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 groundingChunks. | | [retrievalQueries](./ai.groundingmetadata.md#groundingmetadataretrievalqueries) | string\[\] | | -| [webSearchQueries](./ai.groundingmetadata.md#groundingmetadatawebsearchqueries) | string\[\] | | +| [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. | +| [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. | ## GroundingMetadata.groundingAttributions @@ -38,16 +41,53 @@ export interface GroundingMetadata groundingAttributions: GroundingAttribution[]; ``` +## GroundingMetadata.groundingChunks + +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. + +Signature: + +```typescript +groundingChunks?: GroundingChunk[]; +``` + +## GroundingMetadata.groundingSupports + +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`. + +Signature: + +```typescript +groundingSupports?: GroundingSupport[]; +``` + ## GroundingMetadata.retrievalQueries +> Warning: This API is now obsolete. +> +> Use [GroundingMetadata.groundingSupports](./ai.groundingmetadata.md#groundingmetadatagroundingsupports) instead. +> + Signature: ```typescript retrievalQueries?: string[]; ``` +## GroundingMetadata.searchEntryPoint + +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. + +Signature: + +```typescript +searchEntryPoint?: SearchEntrypoint; +``` + ## GroundingMetadata.webSearchQueries +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. + Signature: ```typescript diff --git a/docs-devsite/ai.groundingsupport.md b/docs-devsite/ai.groundingsupport.md new file mode 100644 index 00000000000..c2069fbd3cf --- /dev/null +++ b/docs-devsite/ai.groundingsupport.md @@ -0,0 +1,57 @@ +Project: /docs/reference/js/_project.yaml +Book: /docs/reference/_book.yaml +page_type: reference + +{% comment %} +DO NOT EDIT THIS FILE! +This is generated by the JS SDK team, and any local changes will be +overwritten. Changes should be made in the source code at +https://github.com/firebase/firebase-js-sdk +{% endcomment %} + +# GroundingSupport interface +Provides information about how a specific segment of the model's response is supported by the retrieved grounding chunks. + +Signature: + +```typescript +export interface GroundingSupport +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [confidenceScores](./ai.groundingsupport.md#groundingsupportconfidencescores) | number\[\] | 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. | +| [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 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. | +| [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. | + +## GroundingSupport.confidenceScores + +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`. + +Signature: + +```typescript +confidenceScores?: number[]; +``` + +## GroundingSupport.groundingChunkIndices + +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. + +Signature: + +```typescript +groundingChunkIndices?: number[]; +``` + +## GroundingSupport.segment + +Specifies the segment of the model's response content that this grounding support pertains to. + +Signature: + +```typescript +segment?: Segment; +``` diff --git a/docs-devsite/ai.md b/docs-devsite/ai.md index 286c8351fd7..cf72afa0bb8 100644 --- a/docs-devsite/ai.md +++ b/docs-devsite/ai.md @@ -95,8 +95,12 @@ The Firebase AI Web SDK. | [GenerateContentStreamResult](./ai.generatecontentstreamresult.md#generatecontentstreamresult_interface) | Result object returned from [GenerativeModel.generateContentStream()](./ai.generativemodel.md#generativemodelgeneratecontentstream) call. Iterate over stream to get chunks as they come in and/or use the response promise to get the aggregated response when the stream is done. | | [GenerationConfig](./ai.generationconfig.md#generationconfig_interface) | Config options for content-related requests | | [GenerativeContentBlob](./ai.generativecontentblob.md#generativecontentblob_interface) | Interface for sending an image. | +| [GoogleSearch](./ai.googlesearch.md#googlesearch_interface) | Configuration for the [GoogleSearchTool](./ai.googlesearchtool.md#googlesearchtool_interface). | +| [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). | | [GroundingAttribution](./ai.groundingattribution.md#groundingattribution_interface) | | +| [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. | | [GroundingMetadata](./ai.groundingmetadata.md#groundingmetadata_interface) | Metadata returned to client when grounding is enabled. | +| [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. | | [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. | | [ImagenGenerationConfig](./ai.imagengenerationconfig.md#imagengenerationconfig_interface) | (Public Preview) Configuration options for generating images with Imagen.See the [documentation](http://firebase.google.com/docs/vertex-ai/generate-images-imagen) for more details. | | [ImagenGenerationResponse](./ai.imagengenerationresponse.md#imagengenerationresponse_interface) | (Public Preview) The response from a request to generate images with Imagen. | @@ -116,7 +120,8 @@ The Firebase AI Web SDK. | [SchemaParams](./ai.schemaparams.md#schemaparams_interface) | Params passed to [Schema](./ai.schema.md#schema_class) static methods to create specific [Schema](./ai.schema.md#schema_class) classes. | | [SchemaRequest](./ai.schemarequest.md#schemarequest_interface) | Final format for [Schema](./ai.schema.md#schema_class) params passed to backend requests. | | [SchemaShared](./ai.schemashared.md#schemashared_interface) | Basic [Schema](./ai.schema.md#schema_class) properties shared across several Schema-related types. | -| [Segment](./ai.segment.md#segment_interface) | | +| [SearchEntrypoint](./ai.searchentrypoint.md#searchentrypoint_interface) | Google search entry point. | +| [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. | | [StartChatParams](./ai.startchatparams.md#startchatparams_interface) | Params for [GenerativeModel.startChat()](./ai.generativemodel.md#generativemodelstartchat). | | [TextPart](./ai.textpart.md#textpart_interface) | Content part interface if the part represents a text string. | | [ToolConfig](./ai.toolconfig.md#toolconfig_interface) | Tool config. This config is shared for all tools provided in the request. | @@ -124,6 +129,7 @@ The Firebase AI Web SDK. | [VertexAIOptions](./ai.vertexaioptions.md#vertexaioptions_interface) | Options when initializing the Firebase AI SDK. | | [VideoMetadata](./ai.videometadata.md#videometadata_interface) | Describes the input video content. | | [WebAttribution](./ai.webattribution.md#webattribution_interface) | | +| [WebGroundingChunk](./ai.webgroundingchunk.md#webgroundingchunk_interface) | A grounding chunk from the web. | ## Variables @@ -400,7 +406,7 @@ Defines a tool that model can call to access external knowledge. Signature: ```typescript -export declare type Tool = FunctionDeclarationsTool; +export declare type Tool = FunctionDeclarationsTool | GoogleSearchTool; ``` ## TypedSchema diff --git a/docs-devsite/ai.searchentrypoint.md b/docs-devsite/ai.searchentrypoint.md new file mode 100644 index 00000000000..cdfc43a9ac5 --- /dev/null +++ b/docs-devsite/ai.searchentrypoint.md @@ -0,0 +1,48 @@ +Project: /docs/reference/js/_project.yaml +Book: /docs/reference/_book.yaml +page_type: reference + +{% comment %} +DO NOT EDIT THIS FILE! +This is generated by the JS SDK team, and any local changes will be +overwritten. Changes should be made in the source code at +https://github.com/firebase/firebase-js-sdk +{% endcomment %} + +# SearchEntrypoint interface +Google search entry point. + +Signature: + +```typescript +export interface SearchEntrypoint +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [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 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). | + +## SearchEntrypoint.renderedContent + +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 `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). + +Signature: + +```typescript +renderedContent: string; +``` + +### Example + + +```javascript +const container = document.createElement('div'); +document.body.appendChild(container); +container.attachShadow({ mode: 'open' }).innerHTML = renderedContent; + +``` + diff --git a/docs-devsite/ai.segment.md b/docs-devsite/ai.segment.md index 69f4aaf8407..35db1be5e83 100644 --- a/docs-devsite/ai.segment.md +++ b/docs-devsite/ai.segment.md @@ -10,6 +10,7 @@ https://github.com/firebase/firebase-js-sdk {% endcomment %} # 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. Signature: @@ -21,12 +22,15 @@ export interface Segment | Property | Type | Description | | --- | --- | --- | -| [endIndex](./ai.segment.md#segmentendindex) | number | | -| [partIndex](./ai.segment.md#segmentpartindex) | number | | -| [startIndex](./ai.segment.md#segmentstartindex) | number | | +| [endIndex](./ai.segment.md#segmentendindex) | number | The zero-based end index of the segment within the specified Part, measured in UTF-8 bytes. This offset is exclusive, meaning the character at this index is not included in the segment. | +| [partIndex](./ai.segment.md#segmentpartindex) | number | The zero-based index of the [Part](./ai.md#part) object within the parts array of its parent [Content](./ai.content.md#content_interface) object. This identifies which part of the content the segment belongs to. | +| [startIndex](./ai.segment.md#segmentstartindex) | number | The zero-based start index of the segment within the specified Part, measured in UTF-8 bytes. This offset is inclusive, starting from 0 at the beginning of the part's content (e.g., Part.text). | +| [text](./ai.segment.md#segmenttext) | string | The text corresponding to the segment from the response. | ## Segment.endIndex +The zero-based end index of the segment within the specified `Part`, measured in UTF-8 bytes. This offset is exclusive, meaning the character at this index is not included in the segment. + Signature: ```typescript @@ -35,6 +39,8 @@ endIndex: number; ## Segment.partIndex +The zero-based index of the [Part](./ai.md#part) object within the `parts` array of its parent [Content](./ai.content.md#content_interface) object. This identifies which part of the content the segment belongs to. + Signature: ```typescript @@ -43,8 +49,20 @@ partIndex: number; ## Segment.startIndex +The zero-based start index of the segment within the specified `Part`, measured in UTF-8 bytes. This offset is inclusive, starting from 0 at the beginning of the part's content (e.g., `Part.text`). + Signature: ```typescript startIndex: number; ``` + +## Segment.text + +The text corresponding to the segment from the response. + +Signature: + +```typescript +text: string; +``` diff --git a/docs-devsite/ai.webgroundingchunk.md b/docs-devsite/ai.webgroundingchunk.md new file mode 100644 index 00000000000..de9c99adc89 --- /dev/null +++ b/docs-devsite/ai.webgroundingchunk.md @@ -0,0 +1,61 @@ +Project: /docs/reference/js/_project.yaml +Book: /docs/reference/_book.yaml +page_type: reference + +{% comment %} +DO NOT EDIT THIS FILE! +This is generated by the JS SDK team, and any local changes will be +overwritten. Changes should be made in the source code at +https://github.com/firebase/firebase-js-sdk +{% endcomment %} + +# WebGroundingChunk interface +A grounding chunk from the web. + +Signature: + +```typescript +export interface WebGroundingChunk +``` + +## Properties + +| Property | Type | Description | +| --- | --- | --- | +| [domain](./ai.webgroundingchunk.md#webgroundingchunkdomain) | string | The domain of the original URI from which the content was retrieved (e.g., example.com).This property is only supported in the Vertex AI Gemini API ([VertexAIBackend](./ai.vertexaibackend.md#vertexaibackend_class)). When using the Gemini Developer API ([GoogleAIBackend](./ai.googleaibackend.md#googleaibackend_class)), this property will be undefined. | +| [title](./ai.webgroundingchunk.md#webgroundingchunktitle) | string | The title of the retrieved web page. | +| [uri](./ai.webgroundingchunk.md#webgroundingchunkuri) | string | The URI of the retrieved web page. This URI is a Google-hosted proxy to the original source and typically contains the vertexaisearch subdomain (e.g., https://vertexaisearch.cloud.google.com/grounding-api-redirect/AWhgh4y9L4oeNGWCat....This proxied URI remains accessible for 30 days after the grounding result is generated. | + +## WebGroundingChunk.domain + +The domain of the original URI from which the content was retrieved (e.g., `example.com`). + +This property is only supported in the Vertex AI Gemini API ([VertexAIBackend](./ai.vertexaibackend.md#vertexaibackend_class)). When using the Gemini Developer API ([GoogleAIBackend](./ai.googleaibackend.md#googleaibackend_class)), this property will be undefined. + +Signature: + +```typescript +domain?: string; +``` + +## WebGroundingChunk.title + +The title of the retrieved web page. + +Signature: + +```typescript +title?: string; +``` + +## WebGroundingChunk.uri + +The URI of the retrieved web page. This URI is a Google-hosted proxy to the original source and typically contains the `vertexaisearch` subdomain (e.g., `https://vertexaisearch.cloud.google.com/grounding-api-redirect/AWhgh4y9L4oeNGWCat...`. + +This proxied URI remains accessible for 30 days after the grounding result is generated. + +Signature: + +```typescript +uri?: string; +``` diff --git a/packages/ai/src/requests/request.ts b/packages/ai/src/requests/request.ts index 31c5e9b8125..6af21b19572 100644 --- a/packages/ai/src/requests/request.ts +++ b/packages/ai/src/requests/request.ts @@ -185,7 +185,9 @@ export async function makeRequest( } if ( response.status === 403 && + errorDetails && errorDetails.some( + // FIXME: cannot read 'some' of undefined (detail: ErrorDetails) => detail.reason === 'SERVICE_DISABLED' ) && errorDetails.some((detail: ErrorDetails) => diff --git a/packages/ai/src/requests/stream-reader.ts b/packages/ai/src/requests/stream-reader.ts index 543d1d02266..c3a35b1da4a 100644 --- a/packages/ai/src/requests/stream-reader.ts +++ b/packages/ai/src/requests/stream-reader.ts @@ -190,6 +190,8 @@ export function aggregateResponses( candidate.finishMessage; aggregatedResponse.candidates[i].safetyRatings = candidate.safetyRatings; + aggregatedResponse.candidates[i].groundingMetadata = + candidate.groundingMetadata; /** * Candidates should always have content and parts, but this handles diff --git a/packages/ai/src/types/requests.ts b/packages/ai/src/types/requests.ts index 67f45095c2a..90df59f98c8 100644 --- a/packages/ai/src/types/requests.ts +++ b/packages/ai/src/types/requests.ts @@ -165,7 +165,7 @@ export interface RequestOptions { * Defines a tool that model can call to access external knowledge. * @public */ -export declare type Tool = FunctionDeclarationsTool; +export declare type Tool = FunctionDeclarationsTool | GoogleSearchTool; /** * Structured representation of a function declaration as defined by the @@ -196,6 +196,32 @@ export declare interface FunctionDeclaration { parameters?: ObjectSchemaInterface; } +/** + * 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 + * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms}. + * + * @public + */ +export declare interface GoogleSearchTool { + /** + * Specifies the Google Search configuration. + * Currently, this is an empty object, but it's reserved for future configuration options. + */ + googleSearch: GoogleSearch; +} + +/** + * Configuration for the {@link GoogleSearchTool}. + * + * @remarks Currently, this interface is empty and serves as a placeholder for future configuration options. + * @public + */ +export declare interface GoogleSearch {} + /** * A `FunctionDeclarationsTool` is a piece of code that enables the system to * interact with external systems to perform an action, or set of actions, diff --git a/packages/ai/src/types/responses.ts b/packages/ai/src/types/responses.ts index e33b8a86bd3..4036c14955a 100644 --- a/packages/ai/src/types/responses.ts +++ b/packages/ai/src/types/responses.ts @@ -172,10 +172,34 @@ export interface Citation { /** * Metadata returned to client when grounding is enabled. + * * @public */ export interface GroundingMetadata { + /** + * 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. + */ + searchEntryPoint?: SearchEntrypoint; + /** + * A list of {@link GroundingChunk} objects. Each chunk represents a piece of retrieved content + * (e.g. from a web page). that the model used to ground its response. + */ + groundingChunks?: GroundingChunk[]; + /** + * A list of {@link GroundingSupport} objects. Each object details how specific + * segments of the model's response are supported by the `groundingChunks`. + */ + groundingSupports?: GroundingSupport[]; + /** + * 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. + */ webSearchQueries?: string[]; + /** + * @deprecated Use {@link GroundingMetadata.groundingSupports} instead. + */ retrievalQueries?: string[]; /** * @deprecated @@ -184,23 +208,137 @@ export interface GroundingMetadata { } /** - * @deprecated + * Google search entry point. + * * @public */ -export interface GroundingAttribution { - segment: Segment; - confidenceScore?: number; - web?: WebAttribution; - retrievedContext?: RetrievedContextAttribution; +export interface SearchEntrypoint { + /** + * 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 `renderedContent` within a shadow DOM when embedding it + * into a webpage. See {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_shadow_DOM | MDN: Using shadow DOM}. + * + * @example + * ```javascript + * const container = document.createElement('div'); + * document.body.appendChild(container); + * container.attachShadow({ mode: 'open' }).innerHTML = renderedContent; + * ``` + */ + renderedContent: string; +} + +/** + * 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. + * + * @public + */ +export interface GroundingChunk { + /** + * Contains details if the grounding chunk is from a web source. + */ + web?: WebGroundingChunk; } /** + * A grounding chunk from the web. + * + * @public + */ +export interface WebGroundingChunk { + /** + * The URI of the retrieved web page. This URI is a Google-hosted proxy to the original source + * and typically contains the `vertexaisearch` subdomain (e.g., + * `https://vertexaisearch.cloud.google.com/grounding-api-redirect/AWhgh4y9L4oeNGWCat...`. + * + * This proxied URI remains accessible for 30 days after the grounding result is generated. + */ + uri?: string; + /** + * The title of the retrieved web page. + */ + title?: string; + /** + * The domain of the original URI from which the content was retrieved (e.g., `example.com`). + * + * This property is only supported in the Vertex AI Gemini API ({@link VertexAIBackend}). + * When using the Gemini Developer API ({@link GoogleAIBackend}), this property will be undefined. + */ + domain?: string; +} + +/** + * Provides information about how a specific segment of the model's response + * is supported by the retrieved grounding chunks. + * + * @public + */ +export interface GroundingSupport { + /** + * Specifies the segment of the model's response content that this grounding support pertains to. + */ + segment?: Segment; + /** + * A list of indices that refer to specific {@link GroundingChunk} objects within the + * {@link GroundingMetadata.groundingChunks} 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. + */ + groundingChunkIndices?: number[]; + /** + * 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`. + */ + confidenceScores?: number[]; +} + +/** + * Represents a specific segment within a {@link Content} object, often used to + * pinpoint the exact location of text or data that grounding information refers to. + * * @public */ export interface Segment { + /** + * The zero-based index of the {@link Part} object within the `parts` array + * of its parent {@link Content} object. This identifies which part of the + * content the segment belongs to. + */ partIndex: number; + /** + * The zero-based start index of the segment within the specified `Part`, + * measured in UTF-8 bytes. This offset is inclusive, starting from 0 at the + * beginning of the part's content (e.g., `Part.text`). + */ startIndex: number; + /** + * The zero-based end index of the segment within the specified `Part`, + * measured in UTF-8 bytes. This offset is exclusive, meaning the character + * at this index is not included in the segment. + */ endIndex: number; + /** + * The text corresponding to the segment from the response. + */ + text: string; +} + +/** + * @deprecated + * @public + */ +export interface GroundingAttribution { + segment: Segment; + confidenceScore?: number; + web?: WebAttribution; + retrievedContext?: RetrievedContextAttribution; } /** From 990ba1b0381f9ed6ad1d24bf3d47dcd1769bd29a Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Mon, 16 Jun 2025 10:26:10 -0400 Subject: [PATCH 2/8] Remove confidenceScores --- common/api-review/ai.api.md | 1 - docs-devsite/ai.groundingsupport.md | 11 ----------- packages/ai/src/types/responses.ts | 7 ------- 3 files changed, 19 deletions(-) diff --git a/common/api-review/ai.api.md b/common/api-review/ai.api.md index b9fe496046b..588c5c96590 100644 --- a/common/api-review/ai.api.md +++ b/common/api-review/ai.api.md @@ -525,7 +525,6 @@ export interface GroundingMetadata { // @public export interface GroundingSupport { - confidenceScores?: number[]; groundingChunkIndices?: number[]; segment?: Segment; } diff --git a/docs-devsite/ai.groundingsupport.md b/docs-devsite/ai.groundingsupport.md index c2069fbd3cf..67eb190497c 100644 --- a/docs-devsite/ai.groundingsupport.md +++ b/docs-devsite/ai.groundingsupport.md @@ -22,20 +22,9 @@ export interface GroundingSupport | Property | Type | Description | | --- | --- | --- | -| [confidenceScores](./ai.groundingsupport.md#groundingsupportconfidencescores) | number\[\] | 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. | | [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 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. | | [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. | -## GroundingSupport.confidenceScores - -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`. - -Signature: - -```typescript -confidenceScores?: number[]; -``` - ## GroundingSupport.groundingChunkIndices 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. diff --git a/packages/ai/src/types/responses.ts b/packages/ai/src/types/responses.ts index 4036c14955a..9311a02c74d 100644 --- a/packages/ai/src/types/responses.ts +++ b/packages/ai/src/types/responses.ts @@ -290,13 +290,6 @@ export interface GroundingSupport { * and `groundingChunks[4]` are the retrieved content supporting this part of the response. */ groundingChunkIndices?: number[]; - /** - * 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`. - */ - confidenceScores?: number[]; } /** From a7a9eb84cd80bbeebfc8caaedef0bd4666c89c83 Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Mon, 16 Jun 2025 11:01:36 -0400 Subject: [PATCH 3/8] Add unit and integration tests --- .../ai/integration/generate-content.test.ts | 40 ++++++++++++++++ .../ai/src/methods/generate-content.test.ts | 47 +++++++++++++++++++ 2 files changed, 87 insertions(+) diff --git a/packages/ai/integration/generate-content.test.ts b/packages/ai/integration/generate-content.test.ts index af877396cc8..4dd65d6469e 100644 --- a/packages/ai/integration/generate-content.test.ts +++ b/packages/ai/integration/generate-content.test.ts @@ -113,6 +113,46 @@ describe('Generate Content', () => { ).to.be.closeTo(4, TOKEN_COUNT_DELTA); }); + it('generateContent: google search grounding', async () => { + const model = getGenerativeModel(testConfig.ai, { + model: testConfig.model, + generationConfig: commonGenerationConfig, + safetySettings: commonSafetySettings, + tools: [{ googleSearch: {} }] + }); + + const result = await model.generateContent( + 'What is the speed of light in a vaccuum in meters per second?' + ); + const response = result.response; + const trimmedText = response.text().trim(); + const groundingMetadata = response.candidates?.[0].groundingMetadata; + expect(trimmedText).to.contain('299,792,458'); + expect(groundingMetadata).to.exist; + expect(groundingMetadata!.searchEntryPoint?.renderedContent).to.contain( + 'div' + ); + expect( + groundingMetadata!.groundingChunks + ).to.have.length.greaterThanOrEqual(1); + groundingMetadata!.groundingChunks!.forEach(groundingChunk => { + expect(groundingChunk.web).to.exist; + expect(groundingChunk.web!.uri).to.exist; + }); + expect( + groundingMetadata?.groundingSupports + ).to.have.length.greaterThanOrEqual(1); + groundingMetadata!.groundingSupports!.forEach(groundingSupport => { + expect( + groundingSupport.groundingChunkIndices + ).to.have.length.greaterThanOrEqual(1); + expect(groundingSupport.segment).to.exist; + expect(groundingSupport.segment?.endIndex).to.exist; + expect(groundingSupport.segment?.text).to.exist; + // Since partIndex and startIndex are commonly 0, they may be omitted from responses. + }); + }); + it('generateContentStream: text input, text output', async () => { const model = getGenerativeModel(testConfig.ai, { model: testConfig.model, diff --git a/packages/ai/src/methods/generate-content.test.ts b/packages/ai/src/methods/generate-content.test.ts index 13250fd83dd..a5e4c0d1b57 100644 --- a/packages/ai/src/methods/generate-content.test.ts +++ b/packages/ai/src/methods/generate-content.test.ts @@ -193,6 +193,53 @@ describe('generateContent()', () => { match.any ); }); + it('google search grounding', async () => { + const mockResponse = getMockResponse( + 'vertexAI', + 'unary-success-google-search-grounding.json' + ); + const makeRequestStub = stub(request, 'makeRequest').resolves( + mockResponse as Response + ); + const result = await generateContent( + fakeApiSettings, + 'model', + fakeRequestParams + ); + expect(result.response.text()).to.include('The temperature is 67°F (19°C)'); + const groundingMetadata = result.response.candidates?.[0].groundingMetadata; + expect(groundingMetadata).to.not.be.undefined; + expect(groundingMetadata!.searchEntryPoint?.renderedContent).to.contain( + 'div' + ); + expect(groundingMetadata!.groundingChunks?.length).to.equal(2); + expect(groundingMetadata!.groundingChunks?.[0].web?.uri).to.contain( + 'https://vertexaisearch.cloud.google.com' + ); + expect(groundingMetadata!.groundingChunks?.[0].web?.title).to.equal( + 'accuweather.com' + ); + expect(groundingMetadata!.groundingSupports?.length).to.equal(3); + expect( + groundingMetadata!.groundingSupports?.[0].groundingChunkIndices + ).to.deep.equal([0]); + expect(groundingMetadata!.groundingSupports?.[0].segment).to.deep.equal({ + endIndex: 56, + text: 'The current weather in London, United Kingdom is cloudy.' + }); + expect(groundingMetadata!.groundingSupports?.[0].segment?.partIndex).to.be + .undefined; + expect(groundingMetadata!.groundingSupports?.[0].segment?.startIndex).to.be + .undefined; + + expect(makeRequestStub).to.be.calledWith( + 'model', + Task.GENERATE_CONTENT, + fakeApiSettings, + false, + match.any + ); + }); it('blocked prompt', async () => { const mockResponse = getMockResponse( 'vertexAI', From 20256e5b767ddb521ca64ec5f540d70b4ea69f63 Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Fri, 20 Jun 2025 11:38:52 -0400 Subject: [PATCH 4/8] update docs --- docs-devsite/ai.groundingchunk.md | 2 ++ docs-devsite/ai.groundingmetadata.md | 23 +++++++++++++++++------ docs-devsite/ai.groundingsupport.md | 2 ++ docs-devsite/ai.md | 10 +++++----- docs-devsite/ai.searchentrypoint.md | 2 ++ docs-devsite/ai.webgroundingchunk.md | 2 ++ packages/ai/src/types/responses.ts | 28 +++++++++++++++++++++++----- 7 files changed, 53 insertions(+), 16 deletions(-) diff --git a/docs-devsite/ai.groundingchunk.md b/docs-devsite/ai.groundingchunk.md index 2b84af29d8e..72b17b54839 100644 --- a/docs-devsite/ai.groundingchunk.md +++ b/docs-devsite/ai.groundingchunk.md @@ -12,6 +12,8 @@ https://github.com/firebase/firebase-js-sdk # 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. +When using this feature, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". + Signature: ```typescript diff --git a/docs-devsite/ai.groundingmetadata.md b/docs-devsite/ai.groundingmetadata.md index 70534842415..aa5f8bf6197 100644 --- a/docs-devsite/ai.groundingmetadata.md +++ b/docs-devsite/ai.groundingmetadata.md @@ -12,6 +12,8 @@ https://github.com/firebase/firebase-js-sdk # GroundingMetadata interface Metadata returned to client when grounding is enabled. +If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". + Signature: ```typescript @@ -23,16 +25,17 @@ export interface GroundingMetadata | Property | Type | Description | | --- | --- | --- | | [groundingAttributions](./ai.groundingmetadata.md#groundingmetadatagroundingattributions) | [GroundingAttribution](./ai.groundingattribution.md#groundingattribution_interface)\[\] | | -| [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. | -| [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 groundingChunks. | +| [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.When using this feature, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". | +| [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 groundingChunks.When using this feature, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". | | [retrievalQueries](./ai.groundingmetadata.md#groundingmetadataretrievalqueries) | string\[\] | | -| [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. | -| [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. | +| [searchEntryPoint](./ai.groundingmetadata.md#groundingmetadatasearchentrypoint) | [SearchEntrypoint](./ai.searchentrypoint.md#searchentrypoint_interface) | Google search entry point for web searches. This contains An HTML/CSS snippet that \*must\* be embedded in an app to display a Google Search Entry point for follow-up web searches related to the model's "Grounded Response".When using this feature, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". | +| [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.When using this feature, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". | ## GroundingMetadata.groundingAttributions > Warning: This API is now obsolete. > +> Use [GroundingChunk](./ai.groundingchunk.md#groundingchunk_interface) instead. > Signature: @@ -45,6 +48,8 @@ groundingAttributions: GroundingAttribution[]; 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. +When using this feature, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". + Signature: ```typescript @@ -55,6 +60,8 @@ groundingChunks?: GroundingChunk[]; 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`. +When using this feature, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". + Signature: ```typescript @@ -65,7 +72,7 @@ groundingSupports?: GroundingSupport[]; > Warning: This API is now obsolete. > -> Use [GroundingMetadata.groundingSupports](./ai.groundingmetadata.md#groundingmetadatagroundingsupports) instead. +> Use [GroundingSupport](./ai.groundingsupport.md#groundingsupport_interface) instead. > Signature: @@ -76,7 +83,9 @@ retrievalQueries?: string[]; ## GroundingMetadata.searchEntryPoint -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. +Google search entry point for web searches. This contains An HTML/CSS snippet that \*must\* be embedded in an app to display a Google Search Entry point for follow-up web searches related to the model's "Grounded Response". + +When using this feature, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". Signature: @@ -88,6 +97,8 @@ searchEntryPoint?: SearchEntrypoint; 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. +When using this feature, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". + Signature: ```typescript diff --git a/docs-devsite/ai.groundingsupport.md b/docs-devsite/ai.groundingsupport.md index 67eb190497c..e311f95126e 100644 --- a/docs-devsite/ai.groundingsupport.md +++ b/docs-devsite/ai.groundingsupport.md @@ -12,6 +12,8 @@ https://github.com/firebase/firebase-js-sdk # GroundingSupport interface Provides information about how a specific segment of the model's response is supported by the retrieved grounding chunks. +When using this feature, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". + Signature: ```typescript diff --git a/docs-devsite/ai.md b/docs-devsite/ai.md index cf72afa0bb8..1aa68ef7cd6 100644 --- a/docs-devsite/ai.md +++ b/docs-devsite/ai.md @@ -98,9 +98,9 @@ The Firebase AI Web SDK. | [GoogleSearch](./ai.googlesearch.md#googlesearch_interface) | Configuration for the [GoogleSearchTool](./ai.googlesearchtool.md#googlesearchtool_interface). | | [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). | | [GroundingAttribution](./ai.groundingattribution.md#groundingattribution_interface) | | -| [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. | -| [GroundingMetadata](./ai.groundingmetadata.md#groundingmetadata_interface) | Metadata returned to client when grounding is enabled. | -| [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. | +| [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.When using this feature, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". | +| [GroundingMetadata](./ai.groundingmetadata.md#groundingmetadata_interface) | Metadata returned to client when grounding is enabled.If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". | +| [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.When using this feature, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". | | [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. | | [ImagenGenerationConfig](./ai.imagengenerationconfig.md#imagengenerationconfig_interface) | (Public Preview) Configuration options for generating images with Imagen.See the [documentation](http://firebase.google.com/docs/vertex-ai/generate-images-imagen) for more details. | | [ImagenGenerationResponse](./ai.imagengenerationresponse.md#imagengenerationresponse_interface) | (Public Preview) The response from a request to generate images with Imagen. | @@ -120,7 +120,7 @@ The Firebase AI Web SDK. | [SchemaParams](./ai.schemaparams.md#schemaparams_interface) | Params passed to [Schema](./ai.schema.md#schema_class) static methods to create specific [Schema](./ai.schema.md#schema_class) classes. | | [SchemaRequest](./ai.schemarequest.md#schemarequest_interface) | Final format for [Schema](./ai.schema.md#schema_class) params passed to backend requests. | | [SchemaShared](./ai.schemashared.md#schemashared_interface) | Basic [Schema](./ai.schema.md#schema_class) properties shared across several Schema-related types. | -| [SearchEntrypoint](./ai.searchentrypoint.md#searchentrypoint_interface) | Google search entry point. | +| [SearchEntrypoint](./ai.searchentrypoint.md#searchentrypoint_interface) | Google search entry point.When using this feature, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". | | [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. | | [StartChatParams](./ai.startchatparams.md#startchatparams_interface) | Params for [GenerativeModel.startChat()](./ai.generativemodel.md#generativemodelstartchat). | | [TextPart](./ai.textpart.md#textpart_interface) | Content part interface if the part represents a text string. | @@ -129,7 +129,7 @@ The Firebase AI Web SDK. | [VertexAIOptions](./ai.vertexaioptions.md#vertexaioptions_interface) | Options when initializing the Firebase AI SDK. | | [VideoMetadata](./ai.videometadata.md#videometadata_interface) | Describes the input video content. | | [WebAttribution](./ai.webattribution.md#webattribution_interface) | | -| [WebGroundingChunk](./ai.webgroundingchunk.md#webgroundingchunk_interface) | A grounding chunk from the web. | +| [WebGroundingChunk](./ai.webgroundingchunk.md#webgroundingchunk_interface) | A grounding chunk from the web.When using this feature, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". | ## Variables diff --git a/docs-devsite/ai.searchentrypoint.md b/docs-devsite/ai.searchentrypoint.md index cdfc43a9ac5..12aad94b63f 100644 --- a/docs-devsite/ai.searchentrypoint.md +++ b/docs-devsite/ai.searchentrypoint.md @@ -12,6 +12,8 @@ https://github.com/firebase/firebase-js-sdk # SearchEntrypoint interface Google search entry point. +When using this feature, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". + Signature: ```typescript diff --git a/docs-devsite/ai.webgroundingchunk.md b/docs-devsite/ai.webgroundingchunk.md index de9c99adc89..53413b5eb10 100644 --- a/docs-devsite/ai.webgroundingchunk.md +++ b/docs-devsite/ai.webgroundingchunk.md @@ -12,6 +12,8 @@ https://github.com/firebase/firebase-js-sdk # WebGroundingChunk interface A grounding chunk from the web. +When using this feature, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". + Signature: ```typescript diff --git a/packages/ai/src/types/responses.ts b/packages/ai/src/types/responses.ts index 9311a02c74d..8fa4e146aa9 100644 --- a/packages/ai/src/types/responses.ts +++ b/packages/ai/src/types/responses.ts @@ -173,36 +173,46 @@ export interface Citation { /** * Metadata returned to client when grounding is enabled. * + * If using Grounding with Google Search, you are required to comply with the {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search". + * * @public */ export interface GroundingMetadata { /** - * 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. + * Google search entry point for web searches. + * This contains An HTML/CSS snippet that *must* be embedded in an app to display a Google Search Entry point + * for follow-up web searches related to the model's "Grounded Response". + * + * When using this feature, you are required to comply with the {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search". */ searchEntryPoint?: SearchEntrypoint; /** * A list of {@link GroundingChunk} objects. Each chunk represents a piece of retrieved content * (e.g. from a web page). that the model used to ground its response. + * + * When using this feature, you are required to comply with the {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search". */ groundingChunks?: GroundingChunk[]; /** * A list of {@link GroundingSupport} objects. Each object details how specific * segments of the model's response are supported by the `groundingChunks`. + * + * When using this feature, you are required to comply with the {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search". */ groundingSupports?: GroundingSupport[]; /** * 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. + * + * When using this feature, you are required to comply with the {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search". */ webSearchQueries?: string[]; /** - * @deprecated Use {@link GroundingMetadata.groundingSupports} instead. + * @deprecated Use {@link GroundingSupport} instead. */ retrievalQueries?: string[]; /** - * @deprecated + * @deprecated Use {@link GroundingChunk} instead. */ groundingAttributions: GroundingAttribution[]; } @@ -210,6 +220,8 @@ export interface GroundingMetadata { /** * Google search entry point. * + * When using this feature, you are required to comply with the {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search". + * * @public */ export interface SearchEntrypoint { @@ -235,6 +247,8 @@ export interface SearchEntrypoint { * 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. * + * When using this feature, you are required to comply with the {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search". + * * @public */ export interface GroundingChunk { @@ -247,6 +261,8 @@ export interface GroundingChunk { /** * A grounding chunk from the web. * + * When using this feature, you are required to comply with the {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search". + * * @public */ export interface WebGroundingChunk { @@ -275,6 +291,8 @@ export interface WebGroundingChunk { * Provides information about how a specific segment of the model's response * is supported by the retrieved grounding chunks. * + * When using this feature, you are required to comply with the {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search". + * * @public */ export interface GroundingSupport { From 63c2f3b9032cad3a11a2d41a41b7d534b64a8345 Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Fri, 20 Jun 2025 14:58:12 -0400 Subject: [PATCH 5/8] update docs --- common/api-review/ai.api.md | 2 +- docs-devsite/ai.googlesearchtool.md | 2 +- docs-devsite/ai.groundingchunk.md | 2 +- docs-devsite/ai.groundingmetadata.md | 22 +++++++++------- docs-devsite/ai.groundingsupport.md | 2 +- docs-devsite/ai.md | 12 ++++----- docs-devsite/ai.searchentrypoint.md | 4 +-- docs-devsite/ai.webgroundingchunk.md | 8 +++--- packages/ai/src/types/requests.ts | 6 ++--- packages/ai/src/types/responses.ts | 39 ++++++++++++++++------------ 10 files changed, 53 insertions(+), 46 deletions(-) diff --git a/common/api-review/ai.api.md b/common/api-review/ai.api.md index 42be0eb13aa..7fec37c12a8 100644 --- a/common/api-review/ai.api.md +++ b/common/api-review/ai.api.md @@ -881,7 +881,7 @@ export enum SchemaType { // @public export interface SearchEntrypoint { - renderedContent: string; + renderedContent?: string; } // @public diff --git a/docs-devsite/ai.googlesearchtool.md b/docs-devsite/ai.googlesearchtool.md index 69d172f3566..a24ead3c680 100644 --- a/docs-devsite/ai.googlesearchtool.md +++ b/docs-devsite/ai.googlesearchtool.md @@ -12,7 +12,7 @@ https://github.com/firebase/firebase-js-sdk # 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). +When using Grounding with Google Search, you may receive a response with data generated from Google's search engine. This response is a "Grounded Result" subject to the Grounding with Google Search terms in the [Service Specific Terms](https://cloud.google.com/terms/service-terms). Signature: diff --git a/docs-devsite/ai.groundingchunk.md b/docs-devsite/ai.groundingchunk.md index 72b17b54839..382dcf65b38 100644 --- a/docs-devsite/ai.groundingchunk.md +++ b/docs-devsite/ai.groundingchunk.md @@ -12,7 +12,7 @@ https://github.com/firebase/firebase-js-sdk # 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. -When using this feature, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". +\*\*Important\*\*: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for \*Grounding with Google Search\*. Signature: diff --git a/docs-devsite/ai.groundingmetadata.md b/docs-devsite/ai.groundingmetadata.md index aa5f8bf6197..e40a6dae3fc 100644 --- a/docs-devsite/ai.groundingmetadata.md +++ b/docs-devsite/ai.groundingmetadata.md @@ -10,9 +10,11 @@ https://github.com/firebase/firebase-js-sdk {% endcomment %} # GroundingMetadata interface -Metadata returned to client when grounding is enabled. +Metadata returned when grounding is enabled. -If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". +Currently, the only way to use grounding is to include a [GoogleSearchTool](./ai.googlesearchtool.md#googlesearchtool_interface) in your [GenerationConfig](./ai.generationconfig.md#generationconfig_interface). + +\*\*Important\*\*: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for \*Grounding with Google Search\*. Signature: @@ -25,11 +27,11 @@ export interface GroundingMetadata | Property | Type | Description | | --- | --- | --- | | [groundingAttributions](./ai.groundingmetadata.md#groundingmetadatagroundingattributions) | [GroundingAttribution](./ai.groundingattribution.md#groundingattribution_interface)\[\] | | -| [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.When using this feature, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". | -| [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 groundingChunks.When using this feature, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". | +| [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.\*\*Important\*\*: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for \*Grounding with Google Search\*. | +| [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 groundingChunks.\*\*Important\*\*: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for \*Grounding with Google Search\*. | | [retrievalQueries](./ai.groundingmetadata.md#groundingmetadataretrievalqueries) | string\[\] | | -| [searchEntryPoint](./ai.groundingmetadata.md#groundingmetadatasearchentrypoint) | [SearchEntrypoint](./ai.searchentrypoint.md#searchentrypoint_interface) | Google search entry point for web searches. This contains An HTML/CSS snippet that \*must\* be embedded in an app to display a Google Search Entry point for follow-up web searches related to the model's "Grounded Response".When using this feature, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". | -| [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.When using this feature, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". | +| [searchEntryPoint](./ai.groundingmetadata.md#groundingmetadatasearchentrypoint) | [SearchEntrypoint](./ai.searchentrypoint.md#searchentrypoint_interface) | Google search entry point for web searches. This contains An HTML/CSS snippet that \*must\* be embedded in an app to display a Google Search Entry point for follow-up web searches related to the model's "Grounded Response".\*\*Important\*\*: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for \*Grounding with Google Search\*. | +| [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.\*\*Important\*\*: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for \*Grounding with Google Search\*. | ## GroundingMetadata.groundingAttributions @@ -48,7 +50,7 @@ groundingAttributions: GroundingAttribution[]; 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. -When using this feature, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". +\*\*Important\*\*: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for \*Grounding with Google Search\*. Signature: @@ -60,7 +62,7 @@ groundingChunks?: GroundingChunk[]; 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`. -When using this feature, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". +\*\*Important\*\*: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for \*Grounding with Google Search\*. Signature: @@ -85,7 +87,7 @@ retrievalQueries?: string[]; Google search entry point for web searches. This contains An HTML/CSS snippet that \*must\* be embedded in an app to display a Google Search Entry point for follow-up web searches related to the model's "Grounded Response". -When using this feature, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". +\*\*Important\*\*: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for \*Grounding with Google Search\*. Signature: @@ -97,7 +99,7 @@ searchEntryPoint?: SearchEntrypoint; 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. -When using this feature, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". +\*\*Important\*\*: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for \*Grounding with Google Search\*. Signature: diff --git a/docs-devsite/ai.groundingsupport.md b/docs-devsite/ai.groundingsupport.md index e311f95126e..5d8f4a74fc1 100644 --- a/docs-devsite/ai.groundingsupport.md +++ b/docs-devsite/ai.groundingsupport.md @@ -12,7 +12,7 @@ https://github.com/firebase/firebase-js-sdk # GroundingSupport interface Provides information about how a specific segment of the model's response is supported by the retrieved grounding chunks. -When using this feature, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". +\*\*Important\*\*: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for \*Grounding with Google Search\*. Signature: diff --git a/docs-devsite/ai.md b/docs-devsite/ai.md index 1aa68ef7cd6..a33b11fe351 100644 --- a/docs-devsite/ai.md +++ b/docs-devsite/ai.md @@ -96,11 +96,11 @@ The Firebase AI Web SDK. | [GenerationConfig](./ai.generationconfig.md#generationconfig_interface) | Config options for content-related requests | | [GenerativeContentBlob](./ai.generativecontentblob.md#generativecontentblob_interface) | Interface for sending an image. | | [GoogleSearch](./ai.googlesearch.md#googlesearch_interface) | Configuration for the [GoogleSearchTool](./ai.googlesearchtool.md#googlesearchtool_interface). | -| [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). | +| [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 using Grounding with Google Search, you may receive a response with data generated from Google's search engine. This response is a "Grounded Result" subject to the Grounding with Google Search terms in the [Service Specific Terms](https://cloud.google.com/terms/service-terms). | | [GroundingAttribution](./ai.groundingattribution.md#groundingattribution_interface) | | -| [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.When using this feature, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". | -| [GroundingMetadata](./ai.groundingmetadata.md#groundingmetadata_interface) | Metadata returned to client when grounding is enabled.If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". | -| [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.When using this feature, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". | +| [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.\*\*Important\*\*: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for \*Grounding with Google Search\*. | +| [GroundingMetadata](./ai.groundingmetadata.md#groundingmetadata_interface) | Metadata returned when grounding is enabled.Currently, the only way to use grounding is to include a [GoogleSearchTool](./ai.googlesearchtool.md#googlesearchtool_interface) in your [GenerationConfig](./ai.generationconfig.md#generationconfig_interface).\*\*Important\*\*: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for \*Grounding with Google Search\*. | +| [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.\*\*Important\*\*: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for \*Grounding with Google Search\*. | | [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. | | [ImagenGenerationConfig](./ai.imagengenerationconfig.md#imagengenerationconfig_interface) | (Public Preview) Configuration options for generating images with Imagen.See the [documentation](http://firebase.google.com/docs/vertex-ai/generate-images-imagen) for more details. | | [ImagenGenerationResponse](./ai.imagengenerationresponse.md#imagengenerationresponse_interface) | (Public Preview) The response from a request to generate images with Imagen. | @@ -120,7 +120,7 @@ The Firebase AI Web SDK. | [SchemaParams](./ai.schemaparams.md#schemaparams_interface) | Params passed to [Schema](./ai.schema.md#schema_class) static methods to create specific [Schema](./ai.schema.md#schema_class) classes. | | [SchemaRequest](./ai.schemarequest.md#schemarequest_interface) | Final format for [Schema](./ai.schema.md#schema_class) params passed to backend requests. | | [SchemaShared](./ai.schemashared.md#schemashared_interface) | Basic [Schema](./ai.schema.md#schema_class) properties shared across several Schema-related types. | -| [SearchEntrypoint](./ai.searchentrypoint.md#searchentrypoint_interface) | Google search entry point.When using this feature, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". | +| [SearchEntrypoint](./ai.searchentrypoint.md#searchentrypoint_interface) | Google search entry point.\*\*Important\*\*: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for \*Grounding with Google Search\*. | | [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. | | [StartChatParams](./ai.startchatparams.md#startchatparams_interface) | Params for [GenerativeModel.startChat()](./ai.generativemodel.md#generativemodelstartchat). | | [TextPart](./ai.textpart.md#textpart_interface) | Content part interface if the part represents a text string. | @@ -129,7 +129,7 @@ The Firebase AI Web SDK. | [VertexAIOptions](./ai.vertexaioptions.md#vertexaioptions_interface) | Options when initializing the Firebase AI SDK. | | [VideoMetadata](./ai.videometadata.md#videometadata_interface) | Describes the input video content. | | [WebAttribution](./ai.webattribution.md#webattribution_interface) | | -| [WebGroundingChunk](./ai.webgroundingchunk.md#webgroundingchunk_interface) | A grounding chunk from the web.When using this feature, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". | +| [WebGroundingChunk](./ai.webgroundingchunk.md#webgroundingchunk_interface) | A grounding chunk from the web.\*\*Important\*\*: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for \*Grounding with Google Search\*. | ## Variables diff --git a/docs-devsite/ai.searchentrypoint.md b/docs-devsite/ai.searchentrypoint.md index 12aad94b63f..81d8ea4e88e 100644 --- a/docs-devsite/ai.searchentrypoint.md +++ b/docs-devsite/ai.searchentrypoint.md @@ -12,7 +12,7 @@ https://github.com/firebase/firebase-js-sdk # SearchEntrypoint interface Google search entry point. -When using this feature, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". +\*\*Important\*\*: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for \*Grounding with Google Search\*. Signature: @@ -35,7 +35,7 @@ To ensure proper rendering and prevent CSS conflicts, it is recommended to encap Signature: ```typescript -renderedContent: string; +renderedContent?: string; ``` ### Example diff --git a/docs-devsite/ai.webgroundingchunk.md b/docs-devsite/ai.webgroundingchunk.md index 53413b5eb10..d7b38a712a3 100644 --- a/docs-devsite/ai.webgroundingchunk.md +++ b/docs-devsite/ai.webgroundingchunk.md @@ -12,7 +12,7 @@ https://github.com/firebase/firebase-js-sdk # WebGroundingChunk interface A grounding chunk from the web. -When using this feature, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". +\*\*Important\*\*: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for \*Grounding with Google Search\*. Signature: @@ -26,7 +26,7 @@ export interface WebGroundingChunk | --- | --- | --- | | [domain](./ai.webgroundingchunk.md#webgroundingchunkdomain) | string | The domain of the original URI from which the content was retrieved (e.g., example.com).This property is only supported in the Vertex AI Gemini API ([VertexAIBackend](./ai.vertexaibackend.md#vertexaibackend_class)). When using the Gemini Developer API ([GoogleAIBackend](./ai.googleaibackend.md#googleaibackend_class)), this property will be undefined. | | [title](./ai.webgroundingchunk.md#webgroundingchunktitle) | string | The title of the retrieved web page. | -| [uri](./ai.webgroundingchunk.md#webgroundingchunkuri) | string | The URI of the retrieved web page. This URI is a Google-hosted proxy to the original source and typically contains the vertexaisearch subdomain (e.g., https://vertexaisearch.cloud.google.com/grounding-api-redirect/AWhgh4y9L4oeNGWCat....This proxied URI remains accessible for 30 days after the grounding result is generated. | +| [uri](./ai.webgroundingchunk.md#webgroundingchunkuri) | string | The URI of the retrieved web page. | ## WebGroundingChunk.domain @@ -52,9 +52,7 @@ title?: string; ## WebGroundingChunk.uri -The URI of the retrieved web page. This URI is a Google-hosted proxy to the original source and typically contains the `vertexaisearch` subdomain (e.g., `https://vertexaisearch.cloud.google.com/grounding-api-redirect/AWhgh4y9L4oeNGWCat...`. - -This proxied URI remains accessible for 30 days after the grounding result is generated. +The URI of the retrieved web page. Signature: diff --git a/packages/ai/src/types/requests.ts b/packages/ai/src/types/requests.ts index 90df59f98c8..8c156164d72 100644 --- a/packages/ai/src/types/requests.ts +++ b/packages/ai/src/types/requests.ts @@ -200,9 +200,9 @@ export declare interface FunctionDeclaration { * 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 - * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms}. + * When using Grounding with Google Search, you may receive a response with data generated from + * Google's search engine. This response is a "Grounded Result" subject to the Grounding with Google Search + * terms in the {@link https://cloud.google.com/terms/service-terms | Service Specific Terms}. * * @public */ diff --git a/packages/ai/src/types/responses.ts b/packages/ai/src/types/responses.ts index 8fa4e146aa9..34d5bd3831e 100644 --- a/packages/ai/src/types/responses.ts +++ b/packages/ai/src/types/responses.ts @@ -171,9 +171,12 @@ export interface Citation { } /** - * Metadata returned to client when grounding is enabled. + * Metadata returned when grounding is enabled. * - * If using Grounding with Google Search, you are required to comply with the {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search". + * Currently, the only way to use grounding is to include a {@link GoogleSearchTool} in your {@link GenerationConfig}. + * + * **Important**: If using Grounding with Google Search, you are required to comply with the + * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for *Grounding with Google Search*. * * @public */ @@ -183,28 +186,32 @@ export interface GroundingMetadata { * This contains An HTML/CSS snippet that *must* be embedded in an app to display a Google Search Entry point * for follow-up web searches related to the model's "Grounded Response". * - * When using this feature, you are required to comply with the {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search". + * **Important**: If using Grounding with Google Search, you are required to comply with the + * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for *Grounding with Google Search*. */ searchEntryPoint?: SearchEntrypoint; /** * A list of {@link GroundingChunk} objects. Each chunk represents a piece of retrieved content * (e.g. from a web page). that the model used to ground its response. * - * When using this feature, you are required to comply with the {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search". + * **Important**: If using Grounding with Google Search, you are required to comply with the + * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for *Grounding with Google Search*. */ groundingChunks?: GroundingChunk[]; /** * A list of {@link GroundingSupport} objects. Each object details how specific * segments of the model's response are supported by the `groundingChunks`. * - * When using this feature, you are required to comply with the {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search". + * **Important**: If using Grounding with Google Search, you are required to comply with the + * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for *Grounding with Google Search*. */ groundingSupports?: GroundingSupport[]; /** * 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. * - * When using this feature, you are required to comply with the {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search". + * **Important**: If using Grounding with Google Search, you are required to comply with the + * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for *Grounding with Google Search*. */ webSearchQueries?: string[]; /** @@ -220,7 +227,8 @@ export interface GroundingMetadata { /** * Google search entry point. * - * When using this feature, you are required to comply with the {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search". + * **Important**: If using Grounding with Google Search, you are required to comply with the + * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for *Grounding with Google Search*. * * @public */ @@ -240,14 +248,15 @@ export interface SearchEntrypoint { * container.attachShadow({ mode: 'open' }).innerHTML = renderedContent; * ``` */ - renderedContent: string; + renderedContent?: string; } /** * 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. * - * When using this feature, you are required to comply with the {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search". + * **Important**: If using Grounding with Google Search, you are required to comply with the + * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for *Grounding with Google Search*. * * @public */ @@ -261,17 +270,14 @@ export interface GroundingChunk { /** * A grounding chunk from the web. * - * When using this feature, you are required to comply with the {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search". + * **Important**: If using Grounding with Google Search, you are required to comply with the + * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for *Grounding with Google Search*. * * @public */ export interface WebGroundingChunk { /** - * The URI of the retrieved web page. This URI is a Google-hosted proxy to the original source - * and typically contains the `vertexaisearch` subdomain (e.g., - * `https://vertexaisearch.cloud.google.com/grounding-api-redirect/AWhgh4y9L4oeNGWCat...`. - * - * This proxied URI remains accessible for 30 days after the grounding result is generated. + * The URI of the retrieved web page. */ uri?: string; /** @@ -291,7 +297,8 @@ export interface WebGroundingChunk { * Provides information about how a specific segment of the model's response * is supported by the retrieved grounding chunks. * - * When using this feature, you are required to comply with the {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search". + * **Important**: If using Grounding with Google Search, you are required to comply with the + * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for *Grounding with Google Search*. * * @public */ From 5a07a346b143ec53bdd0f981204c7afc56b34b0f Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Fri, 20 Jun 2025 15:28:28 -0400 Subject: [PATCH 6/8] update docs again!!! --- docs-devsite/ai.groundingchunk.md | 2 +- docs-devsite/ai.groundingmetadata.md | 18 +++++++------- docs-devsite/ai.groundingsupport.md | 2 +- docs-devsite/ai.md | 10 ++++---- docs-devsite/ai.searchentrypoint.md | 2 +- docs-devsite/ai.webgroundingchunk.md | 2 +- packages/ai/src/types/responses.ts | 36 ++++++++++++++-------------- 7 files changed, 36 insertions(+), 36 deletions(-) diff --git a/docs-devsite/ai.groundingchunk.md b/docs-devsite/ai.groundingchunk.md index 382dcf65b38..c2f4da04876 100644 --- a/docs-devsite/ai.groundingchunk.md +++ b/docs-devsite/ai.groundingchunk.md @@ -12,7 +12,7 @@ https://github.com/firebase/firebase-js-sdk # 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. -\*\*Important\*\*: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for \*Grounding with Google Search\*. +Important: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". Signature: diff --git a/docs-devsite/ai.groundingmetadata.md b/docs-devsite/ai.groundingmetadata.md index e40a6dae3fc..3b080fa6f84 100644 --- a/docs-devsite/ai.groundingmetadata.md +++ b/docs-devsite/ai.groundingmetadata.md @@ -14,7 +14,7 @@ Metadata returned when grounding is enabled. Currently, the only way to use grounding is to include a [GoogleSearchTool](./ai.googlesearchtool.md#googlesearchtool_interface) in your [GenerationConfig](./ai.generationconfig.md#generationconfig_interface). -\*\*Important\*\*: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for \*Grounding with Google Search\*. +Important: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". Signature: @@ -27,11 +27,11 @@ export interface GroundingMetadata | Property | Type | Description | | --- | --- | --- | | [groundingAttributions](./ai.groundingmetadata.md#groundingmetadatagroundingattributions) | [GroundingAttribution](./ai.groundingattribution.md#groundingattribution_interface)\[\] | | -| [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.\*\*Important\*\*: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for \*Grounding with Google Search\*. | -| [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 groundingChunks.\*\*Important\*\*: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for \*Grounding with Google Search\*. | +| [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.Important: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". | +| [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 groundingChunks.Important: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". | | [retrievalQueries](./ai.groundingmetadata.md#groundingmetadataretrievalqueries) | string\[\] | | -| [searchEntryPoint](./ai.groundingmetadata.md#groundingmetadatasearchentrypoint) | [SearchEntrypoint](./ai.searchentrypoint.md#searchentrypoint_interface) | Google search entry point for web searches. This contains An HTML/CSS snippet that \*must\* be embedded in an app to display a Google Search Entry point for follow-up web searches related to the model's "Grounded Response".\*\*Important\*\*: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for \*Grounding with Google Search\*. | -| [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.\*\*Important\*\*: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for \*Grounding with Google Search\*. | +| [searchEntryPoint](./ai.groundingmetadata.md#groundingmetadatasearchentrypoint) | [SearchEntrypoint](./ai.searchentrypoint.md#searchentrypoint_interface) | Google search entry point for web searches. This contains An HTML/CSS snippet that \*must\* be embedded in an app to display a Google Search Entry point for follow-up web searches related to the model's "Grounded Response".Important: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". | +| [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.Important: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". | ## GroundingMetadata.groundingAttributions @@ -50,7 +50,7 @@ groundingAttributions: GroundingAttribution[]; 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. -\*\*Important\*\*: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for \*Grounding with Google Search\*. +Important: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". Signature: @@ -62,7 +62,7 @@ groundingChunks?: GroundingChunk[]; 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`. -\*\*Important\*\*: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for \*Grounding with Google Search\*. +Important: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". Signature: @@ -87,7 +87,7 @@ retrievalQueries?: string[]; Google search entry point for web searches. This contains An HTML/CSS snippet that \*must\* be embedded in an app to display a Google Search Entry point for follow-up web searches related to the model's "Grounded Response". -\*\*Important\*\*: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for \*Grounding with Google Search\*. +Important: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". Signature: @@ -99,7 +99,7 @@ searchEntryPoint?: SearchEntrypoint; 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. -\*\*Important\*\*: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for \*Grounding with Google Search\*. +Important: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". Signature: diff --git a/docs-devsite/ai.groundingsupport.md b/docs-devsite/ai.groundingsupport.md index 5d8f4a74fc1..b9a15111651 100644 --- a/docs-devsite/ai.groundingsupport.md +++ b/docs-devsite/ai.groundingsupport.md @@ -12,7 +12,7 @@ https://github.com/firebase/firebase-js-sdk # GroundingSupport interface Provides information about how a specific segment of the model's response is supported by the retrieved grounding chunks. -\*\*Important\*\*: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for \*Grounding with Google Search\*. +Important: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". Signature: diff --git a/docs-devsite/ai.md b/docs-devsite/ai.md index a33b11fe351..c8fa00d7445 100644 --- a/docs-devsite/ai.md +++ b/docs-devsite/ai.md @@ -98,9 +98,9 @@ The Firebase AI Web SDK. | [GoogleSearch](./ai.googlesearch.md#googlesearch_interface) | Configuration for the [GoogleSearchTool](./ai.googlesearchtool.md#googlesearchtool_interface). | | [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 using Grounding with Google Search, you may receive a response with data generated from Google's search engine. This response is a "Grounded Result" subject to the Grounding with Google Search terms in the [Service Specific Terms](https://cloud.google.com/terms/service-terms). | | [GroundingAttribution](./ai.groundingattribution.md#groundingattribution_interface) | | -| [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.\*\*Important\*\*: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for \*Grounding with Google Search\*. | -| [GroundingMetadata](./ai.groundingmetadata.md#groundingmetadata_interface) | Metadata returned when grounding is enabled.Currently, the only way to use grounding is to include a [GoogleSearchTool](./ai.googlesearchtool.md#googlesearchtool_interface) in your [GenerationConfig](./ai.generationconfig.md#generationconfig_interface).\*\*Important\*\*: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for \*Grounding with Google Search\*. | -| [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.\*\*Important\*\*: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for \*Grounding with Google Search\*. | +| [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.Important: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". | +| [GroundingMetadata](./ai.groundingmetadata.md#groundingmetadata_interface) | Metadata returned when grounding is enabled.Currently, the only way to use grounding is to include a [GoogleSearchTool](./ai.googlesearchtool.md#googlesearchtool_interface) in your [GenerationConfig](./ai.generationconfig.md#generationconfig_interface).Important: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". | +| [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.Important: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". | | [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. | | [ImagenGenerationConfig](./ai.imagengenerationconfig.md#imagengenerationconfig_interface) | (Public Preview) Configuration options for generating images with Imagen.See the [documentation](http://firebase.google.com/docs/vertex-ai/generate-images-imagen) for more details. | | [ImagenGenerationResponse](./ai.imagengenerationresponse.md#imagengenerationresponse_interface) | (Public Preview) The response from a request to generate images with Imagen. | @@ -120,7 +120,7 @@ The Firebase AI Web SDK. | [SchemaParams](./ai.schemaparams.md#schemaparams_interface) | Params passed to [Schema](./ai.schema.md#schema_class) static methods to create specific [Schema](./ai.schema.md#schema_class) classes. | | [SchemaRequest](./ai.schemarequest.md#schemarequest_interface) | Final format for [Schema](./ai.schema.md#schema_class) params passed to backend requests. | | [SchemaShared](./ai.schemashared.md#schemashared_interface) | Basic [Schema](./ai.schema.md#schema_class) properties shared across several Schema-related types. | -| [SearchEntrypoint](./ai.searchentrypoint.md#searchentrypoint_interface) | Google search entry point.\*\*Important\*\*: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for \*Grounding with Google Search\*. | +| [SearchEntrypoint](./ai.searchentrypoint.md#searchentrypoint_interface) | Google search entry point.Important: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". | | [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. | | [StartChatParams](./ai.startchatparams.md#startchatparams_interface) | Params for [GenerativeModel.startChat()](./ai.generativemodel.md#generativemodelstartchat). | | [TextPart](./ai.textpart.md#textpart_interface) | Content part interface if the part represents a text string. | @@ -129,7 +129,7 @@ The Firebase AI Web SDK. | [VertexAIOptions](./ai.vertexaioptions.md#vertexaioptions_interface) | Options when initializing the Firebase AI SDK. | | [VideoMetadata](./ai.videometadata.md#videometadata_interface) | Describes the input video content. | | [WebAttribution](./ai.webattribution.md#webattribution_interface) | | -| [WebGroundingChunk](./ai.webgroundingchunk.md#webgroundingchunk_interface) | A grounding chunk from the web.\*\*Important\*\*: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for \*Grounding with Google Search\*. | +| [WebGroundingChunk](./ai.webgroundingchunk.md#webgroundingchunk_interface) | A grounding chunk from the web.Important: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". | ## Variables diff --git a/docs-devsite/ai.searchentrypoint.md b/docs-devsite/ai.searchentrypoint.md index 81d8ea4e88e..138778b0834 100644 --- a/docs-devsite/ai.searchentrypoint.md +++ b/docs-devsite/ai.searchentrypoint.md @@ -12,7 +12,7 @@ https://github.com/firebase/firebase-js-sdk # SearchEntrypoint interface Google search entry point. -\*\*Important\*\*: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for \*Grounding with Google Search\*. +Important: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". Signature: diff --git a/docs-devsite/ai.webgroundingchunk.md b/docs-devsite/ai.webgroundingchunk.md index d7b38a712a3..192940a2d4a 100644 --- a/docs-devsite/ai.webgroundingchunk.md +++ b/docs-devsite/ai.webgroundingchunk.md @@ -12,7 +12,7 @@ https://github.com/firebase/firebase-js-sdk # WebGroundingChunk interface A grounding chunk from the web. -\*\*Important\*\*: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for \*Grounding with Google Search\*. +Important: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". Signature: diff --git a/packages/ai/src/types/responses.ts b/packages/ai/src/types/responses.ts index 34d5bd3831e..1df8760d158 100644 --- a/packages/ai/src/types/responses.ts +++ b/packages/ai/src/types/responses.ts @@ -175,8 +175,8 @@ export interface Citation { * * Currently, the only way to use grounding is to include a {@link GoogleSearchTool} in your {@link GenerationConfig}. * - * **Important**: If using Grounding with Google Search, you are required to comply with the - * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for *Grounding with Google Search*. + * Important: If using Grounding with Google Search, you are required to comply with the + * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search". * * @public */ @@ -186,32 +186,32 @@ export interface GroundingMetadata { * This contains An HTML/CSS snippet that *must* be embedded in an app to display a Google Search Entry point * for follow-up web searches related to the model's "Grounded Response". * - * **Important**: If using Grounding with Google Search, you are required to comply with the - * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for *Grounding with Google Search*. + * Important: If using Grounding with Google Search, you are required to comply with the + * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search". */ searchEntryPoint?: SearchEntrypoint; /** * A list of {@link GroundingChunk} objects. Each chunk represents a piece of retrieved content * (e.g. from a web page). that the model used to ground its response. * - * **Important**: If using Grounding with Google Search, you are required to comply with the - * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for *Grounding with Google Search*. + * Important: If using Grounding with Google Search, you are required to comply with the + * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search". */ groundingChunks?: GroundingChunk[]; /** * A list of {@link GroundingSupport} objects. Each object details how specific * segments of the model's response are supported by the `groundingChunks`. * - * **Important**: If using Grounding with Google Search, you are required to comply with the - * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for *Grounding with Google Search*. + * Important: If using Grounding with Google Search, you are required to comply with the + * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search". */ groundingSupports?: GroundingSupport[]; /** * 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. * - * **Important**: If using Grounding with Google Search, you are required to comply with the - * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for *Grounding with Google Search*. + * Important: If using Grounding with Google Search, you are required to comply with the + * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search". */ webSearchQueries?: string[]; /** @@ -227,8 +227,8 @@ export interface GroundingMetadata { /** * Google search entry point. * - * **Important**: If using Grounding with Google Search, you are required to comply with the - * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for *Grounding with Google Search*. + * Important: If using Grounding with Google Search, you are required to comply with the + * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search". * * @public */ @@ -255,8 +255,8 @@ export interface SearchEntrypoint { * 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. * - * **Important**: If using Grounding with Google Search, you are required to comply with the - * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for *Grounding with Google Search*. + * Important: If using Grounding with Google Search, you are required to comply with the + * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search". * * @public */ @@ -270,8 +270,8 @@ export interface GroundingChunk { /** * A grounding chunk from the web. * - * **Important**: If using Grounding with Google Search, you are required to comply with the - * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for *Grounding with Google Search*. + * Important: If using Grounding with Google Search, you are required to comply with the + * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search". * * @public */ @@ -297,8 +297,8 @@ export interface WebGroundingChunk { * Provides information about how a specific segment of the model's response * is supported by the retrieved grounding chunks. * - * **Important**: If using Grounding with Google Search, you are required to comply with the - * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for *Grounding with Google Search*. + * Important: If using Grounding with Google Search, you are required to comply with the + * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search". * * @public */ From 62da1dd4c1abca194b81e15ef0ded3d8b6ca4443 Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Wed, 2 Jul 2025 16:09:04 -0400 Subject: [PATCH 7/8] update docs --- docs-devsite/ai.googlesearch.md | 4 +- docs-devsite/ai.googlesearchtool.md | 10 +++-- docs-devsite/ai.groundingchunk.md | 2 - docs-devsite/ai.groundingmetadata.md | 24 ++++-------- docs-devsite/ai.groundingsupport.md | 2 - docs-devsite/ai.md | 12 +++--- docs-devsite/ai.searchentrypoint.md | 6 +-- docs-devsite/ai.webgroundingchunk.md | 6 +-- packages/ai/src/types/requests.ts | 23 ++++++++---- packages/ai/src/types/responses.ts | 56 ++++++++++------------------ 10 files changed, 62 insertions(+), 83 deletions(-) diff --git a/docs-devsite/ai.googlesearch.md b/docs-devsite/ai.googlesearch.md index f2c206f9bfe..64d04eaeabc 100644 --- a/docs-devsite/ai.googlesearch.md +++ b/docs-devsite/ai.googlesearch.md @@ -10,9 +10,9 @@ https://github.com/firebase/firebase-js-sdk {% endcomment %} # GoogleSearch interface -Configuration for the [GoogleSearchTool](./ai.googlesearchtool.md#googlesearchtool_interface). +Specifies the Google Search configuration. -Currently, this interface is empty and serves as a placeholder for future configuration options. +Currently, this is an empty object, but it's reserved for future configuration options. Signature: diff --git a/docs-devsite/ai.googlesearchtool.md b/docs-devsite/ai.googlesearchtool.md index a24ead3c680..aec89aa200a 100644 --- a/docs-devsite/ai.googlesearchtool.md +++ b/docs-devsite/ai.googlesearchtool.md @@ -10,9 +10,9 @@ https://github.com/firebase/firebase-js-sdk {% endcomment %} # 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. +A tool that allows a Gemini model to connect to Google Search to access and incorporate up-to-date information from the web into its responses. -When using Grounding with Google Search, you may receive a response with data generated from Google's search engine. This response is a "Grounded Result" subject to the Grounding with Google Search terms in the [Service Specific Terms](https://cloud.google.com/terms/service-terms). +Important: If using Grounding with Google Search, you are required to comply with the "Grounding with Google Search" usage requirements for your chosen API provider: [Gemini Developer API](https://ai.google.dev/gemini-api/terms#grounding-with-google-search) or [Vertex AI Gemini API](https://cloud.google.com/terms/service-terms) (see Service Terms section within the Service Specific Terms). Signature: @@ -24,11 +24,13 @@ export declare interface GoogleSearchTool | Property | Type | Description | | --- | --- | --- | -| [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. | +| [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. Specifies the Google Search configuration. Currently, this is an empty object, but it's reserved for future configuration options.When using this feature, you are required to comply with the "Grounding with Google Search" usage requirements for your chosen API provider: [Gemini Developer API](https://ai.google.dev/gemini-api/terms#grounding-with-google-search) or [Vertex AI Gemini API](https://cloud.google.com/terms/service-terms) (see Service Terms section within the Service Specific Terms). | ## GoogleSearchTool.googleSearch -Specifies the Google Search configuration. Currently, this is an empty object, but it's reserved for future configuration options. +Specifies the Google Search configuration. Currently, this is an empty object, but it's reserved for future configuration options. Specifies the Google Search configuration. Currently, this is an empty object, but it's reserved for future configuration options. + +When using this feature, you are required to comply with the "Grounding with Google Search" usage requirements for your chosen API provider: [Gemini Developer API](https://ai.google.dev/gemini-api/terms#grounding-with-google-search) or [Vertex AI Gemini API](https://cloud.google.com/terms/service-terms) (see Service Terms section within the Service Specific Terms). Signature: diff --git a/docs-devsite/ai.groundingchunk.md b/docs-devsite/ai.groundingchunk.md index c2f4da04876..2b84af29d8e 100644 --- a/docs-devsite/ai.groundingchunk.md +++ b/docs-devsite/ai.groundingchunk.md @@ -12,8 +12,6 @@ https://github.com/firebase/firebase-js-sdk # 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. -Important: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". - Signature: ```typescript diff --git a/docs-devsite/ai.groundingmetadata.md b/docs-devsite/ai.groundingmetadata.md index 3b080fa6f84..d9dc1148c53 100644 --- a/docs-devsite/ai.groundingmetadata.md +++ b/docs-devsite/ai.groundingmetadata.md @@ -12,9 +12,9 @@ https://github.com/firebase/firebase-js-sdk # GroundingMetadata interface Metadata returned when grounding is enabled. -Currently, the only way to use grounding is to include a [GoogleSearchTool](./ai.googlesearchtool.md#googlesearchtool_interface) in your [GenerationConfig](./ai.generationconfig.md#generationconfig_interface). +Currently, only Grounding with Google Search is supported (see [GoogleSearchTool](./ai.googlesearchtool.md#googlesearchtool_interface)). -Important: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". +Important: If using Grounding with Google Search, you are required to comply with the "Grounding with Google Search" usage requirements for your chosen API provider: [Gemini Developer API](https://ai.google.dev/gemini-api/terms#grounding-with-google-search) or [Vertex AI Gemini API](https://cloud.google.com/terms/service-terms) (see Service Terms section within the Service Specific Terms). Signature: @@ -27,11 +27,11 @@ export interface GroundingMetadata | Property | Type | Description | | --- | --- | --- | | [groundingAttributions](./ai.groundingmetadata.md#groundingmetadatagroundingattributions) | [GroundingAttribution](./ai.groundingattribution.md#groundingattribution_interface)\[\] | | -| [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.Important: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". | -| [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 groundingChunks.Important: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". | +| [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 (for example, from a web page). that the model used to ground its response. | +| [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 groundingChunks. | | [retrievalQueries](./ai.groundingmetadata.md#groundingmetadataretrievalqueries) | string\[\] | | -| [searchEntryPoint](./ai.groundingmetadata.md#groundingmetadatasearchentrypoint) | [SearchEntrypoint](./ai.searchentrypoint.md#searchentrypoint_interface) | Google search entry point for web searches. This contains An HTML/CSS snippet that \*must\* be embedded in an app to display a Google Search Entry point for follow-up web searches related to the model's "Grounded Response".Important: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". | -| [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.Important: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". | +| [searchEntryPoint](./ai.groundingmetadata.md#groundingmetadatasearchentrypoint) | [SearchEntrypoint](./ai.searchentrypoint.md#searchentrypoint_interface) | Google Search entry point for web searches. This contains an HTML/CSS snippet that must be embedded in an app to display a Google Search entry point for follow-up web searches related to a model's “Grounded Response”. | +| [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. | ## GroundingMetadata.groundingAttributions @@ -48,9 +48,7 @@ groundingAttributions: GroundingAttribution[]; ## GroundingMetadata.groundingChunks -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. - -Important: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". +A list of [GroundingChunk](./ai.groundingchunk.md#groundingchunk_interface) objects. Each chunk represents a piece of retrieved content (for example, from a web page). that the model used to ground its response. Signature: @@ -62,8 +60,6 @@ groundingChunks?: GroundingChunk[]; 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`. -Important: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". - Signature: ```typescript @@ -85,9 +81,7 @@ retrievalQueries?: string[]; ## GroundingMetadata.searchEntryPoint -Google search entry point for web searches. This contains An HTML/CSS snippet that \*must\* be embedded in an app to display a Google Search Entry point for follow-up web searches related to the model's "Grounded Response". - -Important: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". +Google Search entry point for web searches. This contains an HTML/CSS snippet that must be embedded in an app to display a Google Search entry point for follow-up web searches related to a model's “Grounded Response”. Signature: @@ -99,8 +93,6 @@ searchEntryPoint?: SearchEntrypoint; 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. -Important: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". - Signature: ```typescript diff --git a/docs-devsite/ai.groundingsupport.md b/docs-devsite/ai.groundingsupport.md index b9a15111651..67eb190497c 100644 --- a/docs-devsite/ai.groundingsupport.md +++ b/docs-devsite/ai.groundingsupport.md @@ -12,8 +12,6 @@ https://github.com/firebase/firebase-js-sdk # GroundingSupport interface Provides information about how a specific segment of the model's response is supported by the retrieved grounding chunks. -Important: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". - Signature: ```typescript diff --git a/docs-devsite/ai.md b/docs-devsite/ai.md index c8fa00d7445..b698ed4db73 100644 --- a/docs-devsite/ai.md +++ b/docs-devsite/ai.md @@ -95,12 +95,12 @@ The Firebase AI Web SDK. | [GenerateContentStreamResult](./ai.generatecontentstreamresult.md#generatecontentstreamresult_interface) | Result object returned from [GenerativeModel.generateContentStream()](./ai.generativemodel.md#generativemodelgeneratecontentstream) call. Iterate over stream to get chunks as they come in and/or use the response promise to get the aggregated response when the stream is done. | | [GenerationConfig](./ai.generationconfig.md#generationconfig_interface) | Config options for content-related requests | | [GenerativeContentBlob](./ai.generativecontentblob.md#generativecontentblob_interface) | Interface for sending an image. | -| [GoogleSearch](./ai.googlesearch.md#googlesearch_interface) | Configuration for the [GoogleSearchTool](./ai.googlesearchtool.md#googlesearchtool_interface). | -| [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 using Grounding with Google Search, you may receive a response with data generated from Google's search engine. This response is a "Grounded Result" subject to the Grounding with Google Search terms in the [Service Specific Terms](https://cloud.google.com/terms/service-terms). | +| [GoogleSearch](./ai.googlesearch.md#googlesearch_interface) | Specifies the Google Search configuration. | +| [GoogleSearchTool](./ai.googlesearchtool.md#googlesearchtool_interface) | A tool that allows a Gemini model to connect to Google Search to access and incorporate up-to-date information from the web into its responses.Important: If using Grounding with Google Search, you are required to comply with the "Grounding with Google Search" usage requirements for your chosen API provider: [Gemini Developer API](https://ai.google.dev/gemini-api/terms#grounding-with-google-search) or [Vertex AI Gemini API](https://cloud.google.com/terms/service-terms) (see Service Terms section within the Service Specific Terms). | | [GroundingAttribution](./ai.groundingattribution.md#groundingattribution_interface) | | -| [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.Important: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". | -| [GroundingMetadata](./ai.groundingmetadata.md#groundingmetadata_interface) | Metadata returned when grounding is enabled.Currently, the only way to use grounding is to include a [GoogleSearchTool](./ai.googlesearchtool.md#googlesearchtool_interface) in your [GenerationConfig](./ai.generationconfig.md#generationconfig_interface).Important: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". | -| [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.Important: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". | +| [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. | +| [GroundingMetadata](./ai.groundingmetadata.md#groundingmetadata_interface) | Metadata returned when grounding is enabled.Currently, only Grounding with Google Search is supported (see [GoogleSearchTool](./ai.googlesearchtool.md#googlesearchtool_interface)).Important: If using Grounding with Google Search, you are required to comply with the "Grounding with Google Search" usage requirements for your chosen API provider: [Gemini Developer API](https://ai.google.dev/gemini-api/terms#grounding-with-google-search) or [Vertex AI Gemini API](https://cloud.google.com/terms/service-terms) (see Service Terms section within the Service Specific Terms). | +| [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. | | [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. | | [ImagenGenerationConfig](./ai.imagengenerationconfig.md#imagengenerationconfig_interface) | (Public Preview) Configuration options for generating images with Imagen.See the [documentation](http://firebase.google.com/docs/vertex-ai/generate-images-imagen) for more details. | | [ImagenGenerationResponse](./ai.imagengenerationresponse.md#imagengenerationresponse_interface) | (Public Preview) The response from a request to generate images with Imagen. | @@ -120,7 +120,7 @@ The Firebase AI Web SDK. | [SchemaParams](./ai.schemaparams.md#schemaparams_interface) | Params passed to [Schema](./ai.schema.md#schema_class) static methods to create specific [Schema](./ai.schema.md#schema_class) classes. | | [SchemaRequest](./ai.schemarequest.md#schemarequest_interface) | Final format for [Schema](./ai.schema.md#schema_class) params passed to backend requests. | | [SchemaShared](./ai.schemashared.md#schemashared_interface) | Basic [Schema](./ai.schema.md#schema_class) properties shared across several Schema-related types. | -| [SearchEntrypoint](./ai.searchentrypoint.md#searchentrypoint_interface) | Google search entry point.Important: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". | +| [SearchEntrypoint](./ai.searchentrypoint.md#searchentrypoint_interface) | Google search entry point. | | [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. | | [StartChatParams](./ai.startchatparams.md#startchatparams_interface) | Params for [GenerativeModel.startChat()](./ai.generativemodel.md#generativemodelstartchat). | | [TextPart](./ai.textpart.md#textpart_interface) | Content part interface if the part represents a text string. | diff --git a/docs-devsite/ai.searchentrypoint.md b/docs-devsite/ai.searchentrypoint.md index 138778b0834..db35db06a49 100644 --- a/docs-devsite/ai.searchentrypoint.md +++ b/docs-devsite/ai.searchentrypoint.md @@ -12,8 +12,6 @@ https://github.com/firebase/firebase-js-sdk # SearchEntrypoint interface Google search entry point. -Important: If using Grounding with Google Search, you are required to comply with the [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google Search". - Signature: ```typescript @@ -24,11 +22,11 @@ export interface SearchEntrypoint | Property | Type | Description | | --- | --- | --- | -| [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 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). | +| [renderedContent](./ai.searchentrypoint.md#searchentrypointrenderedcontent) | string | HTML/CSS snippet that must 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 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). | ## SearchEntrypoint.renderedContent -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. +HTML/CSS snippet that must 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 `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). diff --git a/docs-devsite/ai.webgroundingchunk.md b/docs-devsite/ai.webgroundingchunk.md index 192940a2d4a..8d4c59f7e23 100644 --- a/docs-devsite/ai.webgroundingchunk.md +++ b/docs-devsite/ai.webgroundingchunk.md @@ -24,15 +24,15 @@ export interface WebGroundingChunk | Property | Type | Description | | --- | --- | --- | -| [domain](./ai.webgroundingchunk.md#webgroundingchunkdomain) | string | The domain of the original URI from which the content was retrieved (e.g., example.com).This property is only supported in the Vertex AI Gemini API ([VertexAIBackend](./ai.vertexaibackend.md#vertexaibackend_class)). When using the Gemini Developer API ([GoogleAIBackend](./ai.googleaibackend.md#googleaibackend_class)), this property will be undefined. | +| [domain](./ai.webgroundingchunk.md#webgroundingchunkdomain) | string | The domain of the original URI from which the content was retrieved.This property is only supported in the Vertex AI Gemini API ([VertexAIBackend](./ai.vertexaibackend.md#vertexaibackend_class)). When using the Gemini Developer API ([GoogleAIBackend](./ai.googleaibackend.md#googleaibackend_class)), this property will be undefined. | | [title](./ai.webgroundingchunk.md#webgroundingchunktitle) | string | The title of the retrieved web page. | | [uri](./ai.webgroundingchunk.md#webgroundingchunkuri) | string | The URI of the retrieved web page. | ## WebGroundingChunk.domain -The domain of the original URI from which the content was retrieved (e.g., `example.com`). +The domain of the original URI from which the content was retrieved. -This property is only supported in the Vertex AI Gemini API ([VertexAIBackend](./ai.vertexaibackend.md#vertexaibackend_class)). When using the Gemini Developer API ([GoogleAIBackend](./ai.googleaibackend.md#googleaibackend_class)), this property will be undefined. +This property is only supported in the Vertex AI Gemini API ([VertexAIBackend](./ai.vertexaibackend.md#vertexaibackend_class)). When using the Gemini Developer API ([GoogleAIBackend](./ai.googleaibackend.md#googleaibackend_class)), this property will be `undefined`. Signature: diff --git a/packages/ai/src/types/requests.ts b/packages/ai/src/types/requests.ts index 8c156164d72..7097a7d9646 100644 --- a/packages/ai/src/types/requests.ts +++ b/packages/ai/src/types/requests.ts @@ -197,12 +197,13 @@ export declare interface FunctionDeclaration { } /** - * 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. + * A tool that allows a Gemini model to connect to Google Search to access and incorporate + * up-to-date information from the web into its responses. * - * When using Grounding with Google Search, you may receive a response with data generated from - * Google's search engine. This response is a "Grounded Result" subject to the Grounding with Google Search - * terms in the {@link https://cloud.google.com/terms/service-terms | Service Specific Terms}. + * Important: If using Grounding with Google Search, you are required to comply with the + * "Grounding with Google Search" usage requirements for your chosen API provider: {@link https://ai.google.dev/gemini-api/terms#grounding-with-google-search | Gemini Developer API} + * or {@link https://cloud.google.com/terms/service-terms | Vertex AI Gemini API} + * (see Service Terms section within the Service Specific Terms). * * @public */ @@ -210,14 +211,22 @@ export declare interface GoogleSearchTool { /** * Specifies the Google Search configuration. * Currently, this is an empty object, but it's reserved for future configuration options. + * Specifies the Google Search configuration. Currently, this is an empty object, but it's + * reserved for future configuration options. + * + * When using this feature, you are required to comply with the "Grounding with Google Search" + * usage requirements for your chosen API provider: {@link https://ai.google.dev/gemini-api/terms#grounding-with-google-search | Gemini Developer API} + * or {@link https://cloud.google.com/terms/service-terms | Vertex AI Gemini API} + * (see Service Terms section within the Service Specific Terms). */ googleSearch: GoogleSearch; } /** - * Configuration for the {@link GoogleSearchTool}. + * Specifies the Google Search configuration. + * + * @remarks Currently, this is an empty object, but it's reserved for future configuration options. * - * @remarks Currently, this interface is empty and serves as a placeholder for future configuration options. * @public */ export declare interface GoogleSearch {} diff --git a/packages/ai/src/types/responses.ts b/packages/ai/src/types/responses.ts index 1df8760d158..aa72f946ed9 100644 --- a/packages/ai/src/types/responses.ts +++ b/packages/ai/src/types/responses.ts @@ -173,45 +173,35 @@ export interface Citation { /** * Metadata returned when grounding is enabled. * - * Currently, the only way to use grounding is to include a {@link GoogleSearchTool} in your {@link GenerationConfig}. + * Currently, only Grounding with Google Search is supported (see {@link GoogleSearchTool}). * * Important: If using Grounding with Google Search, you are required to comply with the - * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search". + * "Grounding with Google Search" usage requirements for your chosen API provider: {@link https://ai.google.dev/gemini-api/terms#grounding-with-google-search | Gemini Developer API} + * or {@link https://cloud.google.com/terms/service-terms | Vertex AI Gemini API} + * (see Service Terms section within the Service Specific Terms). * * @public */ export interface GroundingMetadata { /** - * Google search entry point for web searches. - * This contains An HTML/CSS snippet that *must* be embedded in an app to display a Google Search Entry point - * for follow-up web searches related to the model's "Grounded Response". - * - * Important: If using Grounding with Google Search, you are required to comply with the - * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search". + * Google Search entry point for web searches. This contains an HTML/CSS snippet that must be + * embedded in an app to display a Google Search entry point for follow-up web searches related to + * a model's “Grounded Response”. */ searchEntryPoint?: SearchEntrypoint; /** * A list of {@link GroundingChunk} objects. Each chunk represents a piece of retrieved content - * (e.g. from a web page). that the model used to ground its response. - * - * Important: If using Grounding with Google Search, you are required to comply with the - * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search". + * (for example, from a web page). that the model used to ground its response. */ groundingChunks?: GroundingChunk[]; /** - * A list of {@link GroundingSupport} objects. Each object details how specific - * segments of the model's response are supported by the `groundingChunks`. - * - * Important: If using Grounding with Google Search, you are required to comply with the - * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search". + * A list of {@link GroundingSupport} objects. Each object details how specific segments of the + * model's response are supported by the `groundingChunks`. */ groundingSupports?: GroundingSupport[]; /** * 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. - * - * Important: If using Grounding with Google Search, you are required to comply with the - * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search". */ webSearchQueries?: string[]; /** @@ -227,15 +217,12 @@ export interface GroundingMetadata { /** * Google search entry point. * - * Important: If using Grounding with Google Search, you are required to comply with the - * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search". - * * @public */ export interface SearchEntrypoint { /** - * 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. + * HTML/CSS snippet that must 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 `renderedContent` within a shadow DOM when embedding it @@ -252,11 +239,8 @@ export interface SearchEntrypoint { } /** - * 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. - * - * Important: If using Grounding with Google Search, you are required to comply with the - * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search". + * 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. * * @public */ @@ -285,20 +269,18 @@ export interface WebGroundingChunk { */ title?: string; /** - * The domain of the original URI from which the content was retrieved (e.g., `example.com`). + * The domain of the original URI from which the content was retrieved. * * This property is only supported in the Vertex AI Gemini API ({@link VertexAIBackend}). - * When using the Gemini Developer API ({@link GoogleAIBackend}), this property will be undefined. + * When using the Gemini Developer API ({@link GoogleAIBackend}), this property will be + * `undefined`. */ domain?: string; } /** - * Provides information about how a specific segment of the model's response - * is supported by the retrieved grounding chunks. - * - * Important: If using Grounding with Google Search, you are required to comply with the - * {@link https://cloud.google.com/terms/service-terms | Service Specific Terms} for "Grounding with Google Search". + * Provides information about how a specific segment of the model's response is supported by the + * retrieved grounding chunks. * * @public */ From a028430c21e575cdc065f3265205bf3feae0bd37 Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Wed, 2 Jul 2025 16:14:13 -0400 Subject: [PATCH 8/8] remove 'declare' from types --- docs-devsite/ai.functiondeclaration.md | 2 +- docs-devsite/ai.functiondeclarationstool.md | 2 +- docs-devsite/ai.googlesearch.md | 2 +- docs-devsite/ai.googlesearchtool.md | 2 +- docs-devsite/ai.md | 2 +- packages/ai/src/requests/request.ts | 1 - packages/ai/src/types/requests.ts | 10 +++++----- 7 files changed, 10 insertions(+), 11 deletions(-) diff --git a/docs-devsite/ai.functiondeclaration.md b/docs-devsite/ai.functiondeclaration.md index 2a87d67ed47..6fa9e53cae9 100644 --- a/docs-devsite/ai.functiondeclaration.md +++ b/docs-devsite/ai.functiondeclaration.md @@ -15,7 +15,7 @@ Structured representation of a function declaration as defined by the [OpenAPI 3 Signature: ```typescript -export declare interface FunctionDeclaration +export interface FunctionDeclaration ``` ## Properties diff --git a/docs-devsite/ai.functiondeclarationstool.md b/docs-devsite/ai.functiondeclarationstool.md index bde785d730b..d72d9db2f53 100644 --- a/docs-devsite/ai.functiondeclarationstool.md +++ b/docs-devsite/ai.functiondeclarationstool.md @@ -15,7 +15,7 @@ A `FunctionDeclarationsTool` is a piece of code that enables the system to inter Signature: ```typescript -export declare interface FunctionDeclarationsTool +export interface FunctionDeclarationsTool ``` ## Properties diff --git a/docs-devsite/ai.googlesearch.md b/docs-devsite/ai.googlesearch.md index 64d04eaeabc..78fdef51606 100644 --- a/docs-devsite/ai.googlesearch.md +++ b/docs-devsite/ai.googlesearch.md @@ -17,5 +17,5 @@ Currently, this is an empty object, but it's reserved for future configuration o Signature: ```typescript -export declare interface GoogleSearch +export interface GoogleSearch ``` diff --git a/docs-devsite/ai.googlesearchtool.md b/docs-devsite/ai.googlesearchtool.md index aec89aa200a..49983bb8269 100644 --- a/docs-devsite/ai.googlesearchtool.md +++ b/docs-devsite/ai.googlesearchtool.md @@ -17,7 +17,7 @@ Important: If using Grounding with Google Search, you are required to comply wit Signature: ```typescript -export declare interface GoogleSearchTool +export interface GoogleSearchTool ``` ## Properties diff --git a/docs-devsite/ai.md b/docs-devsite/ai.md index b698ed4db73..079321332af 100644 --- a/docs-devsite/ai.md +++ b/docs-devsite/ai.md @@ -406,7 +406,7 @@ Defines a tool that model can call to access external knowledge. Signature: ```typescript -export declare type Tool = FunctionDeclarationsTool | GoogleSearchTool; +export type Tool = FunctionDeclarationsTool | GoogleSearchTool; ``` ## TypedSchema diff --git a/packages/ai/src/requests/request.ts b/packages/ai/src/requests/request.ts index 6af21b19572..3fa0b33012f 100644 --- a/packages/ai/src/requests/request.ts +++ b/packages/ai/src/requests/request.ts @@ -187,7 +187,6 @@ export async function makeRequest( response.status === 403 && errorDetails && errorDetails.some( - // FIXME: cannot read 'some' of undefined (detail: ErrorDetails) => detail.reason === 'SERVICE_DISABLED' ) && errorDetails.some((detail: ErrorDetails) => diff --git a/packages/ai/src/types/requests.ts b/packages/ai/src/types/requests.ts index 7097a7d9646..9d497a619d4 100644 --- a/packages/ai/src/types/requests.ts +++ b/packages/ai/src/types/requests.ts @@ -165,7 +165,7 @@ export interface RequestOptions { * Defines a tool that model can call to access external knowledge. * @public */ -export declare type Tool = FunctionDeclarationsTool | GoogleSearchTool; +export type Tool = FunctionDeclarationsTool | GoogleSearchTool; /** * Structured representation of a function declaration as defined by the @@ -176,7 +176,7 @@ export declare type Tool = FunctionDeclarationsTool | GoogleSearchTool; * as a Tool by the model and executed by the client. * @public */ -export declare interface FunctionDeclaration { +export interface FunctionDeclaration { /** * The name of the function to call. Must start with a letter or an * underscore. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with @@ -207,7 +207,7 @@ export declare interface FunctionDeclaration { * * @public */ -export declare interface GoogleSearchTool { +export interface GoogleSearchTool { /** * Specifies the Google Search configuration. * Currently, this is an empty object, but it's reserved for future configuration options. @@ -229,7 +229,7 @@ export declare interface GoogleSearchTool { * * @public */ -export declare interface GoogleSearch {} +export interface GoogleSearch {} /** * A `FunctionDeclarationsTool` is a piece of code that enables the system to @@ -237,7 +237,7 @@ export declare interface GoogleSearch {} * outside of knowledge and scope of the model. * @public */ -export declare interface FunctionDeclarationsTool { +export interface FunctionDeclarationsTool { /** * Optional. One or more function declarations * to be passed to the model along with the current user query. Model may