Skip to content

Commit b26b61a

Browse files
committed
update docs
1 parent 11d3bde commit b26b61a

File tree

3 files changed

+37
-44
lines changed

3 files changed

+37
-44
lines changed

firebase-ai/src/main/kotlin/com/google/firebase/ai/type/Candidate.kt

Lines changed: 23 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import kotlinx.serialization.json.JsonNames
3333
* @property safetyRatings A list of [SafetyRating]s describing the generated content.
3434
* @property citationMetadata Metadata about the sources used to generate this content.
3535
* @property finishReason The reason the model stopped generating content, if it exist.
36+
* @property groundingMetadata Metadata returned to the client when grounding is enabled.
3637
*/
3738
public class Candidate
3839
internal constructor(
@@ -297,17 +298,18 @@ public class FinishReason private constructor(public val name: String, public va
297298
* Metadata returned to the client when grounding is enabled.
298299
*
299300
* If using Grounding with Google Search, you are required to comply with the
300-
* [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google
301-
* Search".
301+
* "Grounding with Google Search" usage requirements for your chosen API provider: [Gemini Developer
302+
* API](https://ai.google.dev/gemini-api/terms#grounding-with-google-search) or Vertex AI Gemini API
303+
* (see [Service Terms](https://cloud.google.com/terms/service-terms) section within the Service
304+
* Specific Terms).
302305
*
303306
* @property webSearchQueries The list of web search queries that the model performed to gather the
304307
* grounding information. These can be used to allow users to explore the search results themselves.
305308
* @property searchEntryPoint Google search entry point for web searches. This contains an HTML/CSS
306309
* snippet that **must** be embedded in an app to display a Google Search Entry point for follow-up
307-
* web searches related to the model's "Grounded Response". To ensure proper rendering, it's
308-
* recommended to display this content within a `WebView`.
309-
* @property groundingChunks The list of [GroundingChunk] objects. Each chunk represents a piece of
310-
* retrieved content (e.g. from a web page) that the model used to ground its response.
310+
* web searches related to the model's "Grounded Response".
311+
* @property groundingChunks The list of [GroundingChunk] classes. Each chunk represents a piece of
312+
* retrieved content that the model used to ground its response.
311313
* @property groundingSupports The list of [GroundingSupport] objects. Each object details how
312314
* specific segments of the model's response are supported by the `groundingChunks`.
313315
*/
@@ -345,13 +347,8 @@ public class GroundingMetadata(
345347
/**
346348
* Represents a Google Search entry point.
347349
*
348-
* When using this API, you are required to comply with the
349-
* [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google
350-
* Search".
351-
*
352-
* @property renderedContent An HTML/CSS snippet that can be embedded in your app. The snippet is
353-
* designed to avoid undesired interaction with the rest of the page's CSS. To ensure proper
354-
* rendering, it's recommended to display this content within a `WebView`.
350+
* @property renderedContent An HTML/CSS snippet that can be embedded in your app.
351+
* To ensure proper rendering, it's recommended to display this content within a `WebView`.
355352
* @property sdkBlob A blob of data for the client SDK to render the search entry point.
356353
*/
357354
public class SearchEntryPoint(
@@ -378,10 +375,6 @@ public class SearchEntryPoint(
378375
* Represents a chunk of retrieved data that supports a claim in the model's response. This is part
379376
* of the grounding information provided when grounding is enabled.
380377
*
381-
* When using this API, you are required to comply with the
382-
* [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google
383-
* Search".
384-
*
385378
* @property web Contains details if the grounding chunk is from a web source.
386379
*/
387380
public class GroundingChunk(
@@ -398,14 +391,10 @@ public class GroundingChunk(
398391
/**
399392
* A grounding chunk from the web.
400393
*
401-
* When using this API, you are required to comply with the
402-
* [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google
403-
* Search".
404-
*
405394
* @property uri The URI of the retrieved web page.
406395
* @property title The title of the retrieved web page.
407-
* @property domain The domain of the original URI from which the content was retrieved (e.g.,
408-
* `example.com`). This is only populated when using the Vertex AI Gemini API.
396+
* @property domain The domain of the original URI from which the content was retrieved.
397+
* This is only populated when using the Vertex AI Gemini API.
409398
*/
410399
public class WebGroundingChunk(
411400
public val uri: String?,
@@ -422,15 +411,13 @@ public class WebGroundingChunk(
422411
* Provides information about how a specific segment of the model's response is supported by the
423412
* retrieved grounding chunks.
424413
*
425-
* When using this API, you are required to comply with the
426-
* [Service Specific Terms](https://cloud.google.com/terms/service-terms) for "Grounding with Google
427-
* Search".
428-
*
429414
* @property segment Specifies the segment of the model's response content that this grounding
430415
* support pertains to.
431-
* @property groundingChunkIndices A list of indices that refer to specific [GroundingChunk] objects
416+
* @property groundingChunkIndices A list of indices that refer to specific [GroundingChunk] classes
432417
* within the [GroundingMetadata.groundingChunks] array. These referenced chunks are the sources
433-
* that support the claim made in the associated `segment` of the response.
418+
* that support the claim made in the associated `segment` of the response. For example, an array
419+
* `[1, 3, 4]` means that `groundingChunks[1]`, `groundingChunks[3]`, `groundingChunks[4]` are the
420+
* retrieved content supporting this part of the response.
434421
*/
435422
public class GroundingSupport(
436423
public val segment: Segment,
@@ -473,13 +460,15 @@ public class GroundingAttribution(
473460
* Represents a specific segment within a [Content] object, often used to pinpoint the exact
474461
* location of text or data that grounding information refers to.
475462
*
476-
* @property startIndex The zero-based start index of the segment within the specified [Part],
477-
* measured in UTF-8 bytes. This offset is inclusive.
478-
* @property endIndex The zero-based end index of the segment within the specified [Part], measured
479-
* in UTF-8 bytes. This offset is exclusive.
480463
* @property partIndex The zero-based index of the [Part] object within the `parts` array of its
481464
* parent [Content] object. This identifies which part of the content the segment belongs to.
482-
* @property text The text content of the segment.
465+
* @property startIndex The zero-based start index of the segment within the specified [Part],
466+
* measured in UTF-8 bytes. This offset is inclusive, starting from 0 at the beginning of the part's
467+
* content.
468+
* @property endIndex The zero-based end index of the segment within the specified [Part], measured
469+
* in UTF-8 bytes. This offset is exclusive, meaning the character at this index is not included in
470+
* the segment.
471+
* @property text The text corresponding to the segment from the response.
483472
*/
484473
public class Segment(
485474
public val startIndex: Int,

firebase-ai/src/main/kotlin/com/google/firebase/ai/type/GoogleSearch.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ import kotlinx.serialization.Serializable
2222
* A tool that allows the generative model to connect to Google Search to access and incorporate
2323
* up-to-date information from the web into its responses.
2424
*
25-
* When this tool is used, the model's responses may include "Grounded Results" which are subject to
26-
* the Grounding with Google Search terms outlined in the
27-
* [Service Specific Terms](https://cloud.google.com/terms/service-terms).
25+
* When using this feature, you are required to comply with the "Grounding with Google
26+
* Search" usage requirements for your chosen API provider: [Gemini Developer
27+
* API](https://ai.google.dev/gemini-api/terms#grounding-with-google-search) or Vertex AI Gemini API
28+
* (see [Service Terms](https://cloud.google.com/terms/service-terms) section within the Service
29+
* Specific Terms).
2830
*/
2931
public class GoogleSearch {
3032
@Serializable internal class Internal()

firebase-ai/src/main/kotlin/com/google/firebase/ai/type/Tool.kt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,20 @@ internal constructor(
5555
}
5656

5757
/**
58-
* Creates a [Tool] instance that enables the model to use Grounding with Google Search.
58+
* Creates a [Tool] instance that allows the model to use Grounding with Google Search.
5959
*
60-
* This allows the model to connect to Google Search to access and incorporate up-to-date
61-
* information from the web into its responses.
60+
* Grounding with Google Search can be used to allow the model to connect to Google Search to
61+
* access and incorporate up-to-date information from the web into it's responses.
6262
*
63-
* When this tool is used, the model's responses may include "Grounded Results" which are
64-
* subject to the Grounding with Google Search terms outlined in the
65-
* [Service Specific Terms](https://cloud.google.com/terms/service-terms).
63+
* When using this feature, you are required to comply with the "Grounding with
64+
* Google Search" usage requirements for your chosen API provider: [Gemini Developer
65+
* API](https://ai.google.dev/gemini-api/terms#grounding-with-google-search) or Vertex AI Gemini
66+
* API (see [Service Terms](https://cloud.google.com/terms/service-terms) section within the
67+
* Service Specific Terms).
6668
*
6769
* @param googleSearch An empty [GoogleSearch] object. The presence of this object in the list
6870
* of tools enables the model to use Google Search.
69-
* @return a [Tool] configured for Google Search.
71+
* @return A [Tool] configured for Google Search.
7072
*/
7173
@JvmStatic
7274
public fun googleSearch(googleSearch: GoogleSearch = GoogleSearch()): Tool {

0 commit comments

Comments
 (0)