- HTTP request
- Path parameters
- Request body
- Response body
- Authorization scopes
- GroundedGenerationContent
- Part
- GenerationSpec
- GroundingSpec
- GroundingSource
- InlineSource
- SearchSource
- GoogleSearchSource
- DynamicRetrievalConfiguration
- DynamicRetrievalPredictor
- Version
- Candidate
- GroundingMetadata
- RetrievalMetadata
- Source
- DynamicRetrievalMetadata
- DynamicRetrievalPredictorMetadata
- Version
- SearchEntryPoint
- GroundingSupport
Generates grounded content.
HTTP request
POST https://discoveryengine.googleapis.com/v1alpha/{location=projects/*/locations/*}:generateGroundedContent
The URL uses gRPC Transcoding syntax.
Path parameters
Parameters | |
---|---|
location |
Required. Location resource. Format: |
Request body
The request body contains data with the following structure:
JSON representation |
---|
{ "systemInstruction": { object ( |
Fields | |
---|---|
system |
Content of the system instruction for the current API. These instructions will take priority over any other prompt instructions if the selected model is supporting them. |
contents[] |
Content of the current conversation with the model. For single-turn queries, this is a single instance. For multi-turn queries, this is a repeated field that contains conversation history + latest request. |
generation |
Content generation specification. |
grounding |
Grounding specification. |
user |
The user labels applied to a resource must meet the following requirements:
See Google Cloud Document for more details. |
Response body
Response for the locations.generateGroundedContent
method.
If successful, the response body contains data with the following structure:
JSON representation |
---|
{
"candidates": [
{
object ( |
Fields | |
---|---|
candidates[] |
Generated candidates. |
Authorization scopes
Requires the following OAuth scope:
https://www.googleapis.com/auth/cloud-platform
For more information, see the Authentication Overview.
GroundedGenerationContent
Base structured datatype containing multi-part content of a message.
JSON representation |
---|
{
"role": string,
"parts": [
{
object ( |
Fields | |
---|---|
role |
producer of the content. Must be either Intended to be used for multi-turn conversations. Otherwise, it can be left unset. |
parts[] |
Ordered |
Part
Single part of content.
JSON representation |
---|
{ // Union field |
Fields | |
---|---|
Union field data . Holder of data. It only supports text for now. data can be only one of the following: |
|
text |
Inline text. |
GenerationSpec
Content generation specification.
JSON representation |
---|
{ "modelId": string, "languageCode": string, "temperature": number, "topP": number, "topK": integer, "frequencyPenalty": number, "seed": integer, "presencePenalty": number, "maxOutputTokens": integer } |
Fields | |
---|---|
model |
Specifies which Vertex model id to use for generation. |
language |
Language code for content. Use language tags defined by BCP47. |
temperature |
If specified, custom value for the temperature will be used. |
top |
If specified, custom value for nucleus sampling will be used. |
top |
If specified, custom value for top-k sampling will be used. |
frequency |
If specified, custom value for frequency penalty will be used. |
seed |
If specified, custom value for the seed will be used. |
presence |
If specified, custom value for presence penalty will be used. |
max |
If specified, custom value for max output tokens will be used. |
GroundingSpec
Grounding specification.
JSON representation |
---|
{
"groundingSources": [
{
object ( |
Fields | |
---|---|
grounding |
Grounding sources. |
GroundingSource
Grounding source.
JSON representation |
---|
{ // Union field |
Fields | |
---|---|
Union field source . Sources. source can be only one of the following: |
|
inline |
If set, grounding is performed with inline content. |
search |
If set, grounding is performed with Vertex AI Search. |
google |
If set, grounding is performed with Google Search. |
InlineSource
Message to be used for grounding based on inline content.
JSON representation |
---|
{
"groundingFacts": [
{
object ( |
Fields | |
---|---|
grounding |
List of facts to be used for grounding. |
attributes |
Attributes associated with the content. Common attributes include |
SearchSource
Message to be used for grounding with Vertex AI Search.
JSON representation |
---|
{ "servingConfig": string, "maxResultCount": integer, "filter": string, "safeSearch": boolean } |
Fields | |
---|---|
serving |
The resource name of the Engine to use. Format: |
max |
Number of search results to return. The default value is 10. The maximumm allowed value is 10. |
filter |
Filter expression to be applied to the search. The syntax is the same as |
safe |
If set, safe search is enabled in Vertex AI Search requests. |
GoogleSearchSource
Google Search config parameters.
JSON representation |
---|
{
"dynamicRetrievalConfig": {
object ( |
Fields | |
---|---|
dynamic |
Optional. Specifies the dynamic retrieval configuration for the given source. |
DynamicRetrievalConfiguration
Describes the options to customize dynamic retrieval.
JSON representation |
---|
{
"predictor": {
object ( |
Fields | |
---|---|
predictor |
Specification for the predictor for dynamic retrieval. |
DynamicRetrievalPredictor
Describes the predictor settings for dynamic retrieval.
JSON representation |
---|
{
"version": enum ( |
Fields | |
---|---|
version |
The version of the predictor to be used in dynamic retrieval. |
threshold |
The value of the threshold. If the predictor will predict a value smaller than this, it would suppress grounding in the source. |
Version
The version of the predictor to be used in dynamic retrieval.
Enums | |
---|---|
VERSION_UNSPECIFIED |
Automatically choose the best version of the retrieval predictor. |
V1_INDEPENDENT |
The V1 model which is evaluating each source independently. |
Candidate
A response candidate generated from the model.
JSON representation |
---|
{ "index": integer, "content": { object ( |
Fields | |
---|---|
index |
Index of the candidate. |
content |
Content of the candidate. |
grounding |
Grounding metadata for the generated content. |
grounding |
The overall grounding score for the candidate, in the range of [0, 1]. |
GroundingMetadata
Citation for the generated content.
JSON representation |
---|
{ "retrievalMetadata": [ { object ( |
Fields | |
---|---|
retrieval |
Retrieval metadata to provide an understanding in the retrieval steps performed by the model. There can be multiple such messages which can correspond to different parts of the retrieval. This is a mechanism used to ensure transparency to our users. |
support |
List of chunks to be attributed across all claims in the candidate. These are derived from the grounding sources supplied in the request. |
web |
Web search queries for the following-up web search. |
search |
Google search entry for the following-up web searches. |
grounding |
GroundingSupport across all claims in the answer candidate. An support to a fact indicates that the claim is supported by the fact. |
RetrievalMetadata
Describes the metadata associated with a retrieval step.
JSON representation |
---|
{ "source": enum ( |
Fields | |
---|---|
source |
Describes the source to which the metadata is referring to. |
dynamic |
metadata for dynamic retrieval. |
Source
Describes the source to which the metadata is associated to.
Enums | |
---|---|
SOURCE_UNSPECIFIED |
Unspecified source. |
VERTEX_AI_SEARCH |
Vertex AI search. |
GOOGLE_SEARCH |
Google Search. |
INLINE_CONTENT |
User inline provided content. |
GOOGLE_MAPS |
Google Maps. |
DynamicRetrievalMetadata
Describes the metadata about dynamic retrieval.
JSON representation |
---|
{
"predictorMetadata": {
object ( |
Fields | |
---|---|
predictor |
metadata for the dynamic retrieval predictor. |
DynamicRetrievalPredictorMetadata
Describes the metadata about the dynamic retrieval predictor.
JSON representation |
---|
{
"version": enum ( |
Fields | |
---|---|
version |
The version of the predictor which was used in dynamic retrieval. |
prediction |
The value of the predictor. This should be between [0, 1] where a value of 0 means that the query would not benefit from grounding, while a value of 1.0 means that the query would benefit the most. In between values allow to differentiate between different usefulness scores for grounding. |
Version
The version of the predictor which was used in dynamic retrieval.
Enums | |
---|---|
VERSION_UNSPECIFIED |
Unspecified version, should never be used. |
V1_INDEPENDENT |
The V1 model which is evaluating each source independently. |
SearchEntryPoint
Google search entry point.
JSON representation |
---|
{ "renderedContent": string, "sdkBlob": string } |
Fields | |
---|---|
rendered |
Web content snippet that can be embedded in a web page or an app webview. |
sdk |
Base64 encoded JSON representing array of <search term, search url> tuple. A base64-encoded string. |
GroundingSupport
Grounding info for a claim in the candidate and its support.
JSON representation |
---|
{ "claimText": string, "supportChunkIndices": [ integer ], "supportScore": number } |
Fields | |
---|---|
claim |
Text for the claim in the candidate. Always provided when a support is found. |
support |
A list of indices (into 'supportChunks') specifying the citations associated with the claim. For instance [1,3,4] means that supportChunks[1], supportChunks[3], supportChunks[4] are the chunks attributed to the claim. |
support |
A score in the range of [0, 1] describing how grounded is a specific claim in the support chunks indicated. Higher value means that the claim is better supported by the chunks. |