Method: answerQuery

Answers a query using grounded generation.

HTTP request

POST https://developerknowledge.googleapis.com/v1alpha:answerQuery

The URL uses gRPC Transcoding syntax.

Request body

The request body contains data with the following structure:

JSON representation
{
  "query": string
}
Fields
query

string

Required. The query to answer.

Response body

Response message for DeveloperKnowledge.AnswerQuery.

If successful, the response body contains data with the following structure:

JSON representation
{
  "answer": {
    object (Answer)
  }
}
Fields
answer

object (Answer)

The answer to the query.

Authorization scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/devprofiles.full_control
  • https://www.googleapis.com/auth/cloud-platform

For more information, see the OAuth 2.0 Overview.

Answer

An answer to a query.

JSON representation
{
  "answerText": string,
  "citations": [
    {
      object (AnswerCitation)
    }
  ],
  "references": [
    {
      object (AnswerReference)
    }
  ]
}
Fields
answerText

string

Contains the text of the answer.

citations[]

object (AnswerCitation)

Output only. Contains citations for the answer.

references[]

object (AnswerReference)

Output only. Contains references for the answer.

AnswerCitation

Citation info for a segment.

JSON representation
{
  "startIndex": integer,
  "endIndex": integer,
  "sources": [
    {
      object (CitationSource)
    }
  ]
}
Fields
startIndex

integer

Output only. Indicates the start of the segment, measured in bytes (UTF-8 unicode), inclusive. If there are multi-byte characters, such as non-ASCII characters, the index measurement is longer than the string length.

endIndex

integer

Output only. Indicates the end of the segment, measured in bytes (UTF-8 unicode), exclusive. If there are multi-byte characters, such as non-ASCII characters, the index measurement is longer than the string length.

sources[]

object (CitationSource)

Output only. Contains citation sources for the attributed segment.

CitationSource

Citation source.

JSON representation
{
  "referenceIndex": integer
}
Fields
referenceIndex

integer

Output only. Contains the index of the Answer.AnswerReference in the references repeated field.

AnswerReference

Represents a reference to a source.

JSON representation
{

  // Union field content can be only one of the following:
  "documentReference": {
    object (DocumentReference)
  }
  // End of list of possible types for union field content.
}
Fields
Union field content. Contains the content of the reference. content can be only one of the following:
documentReference

object (DocumentReference)

Output only. The reference document.

DocumentReference

Represents a reference to a document.

JSON representation
{
  "documentChunk": {
    object (DocumentChunk)
  }
}
Fields
documentChunk

object (DocumentChunk)

Output only. Contains the document chunk. The documentChunk.id field is not set and will be empty.