- HTTP request
- Request body
- Response body
- Authorization scopes
- Answer
- AnswerCitation
- CitationSource
- AnswerReference
- DocumentReference
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 |
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 ( |
| Fields | |
|---|---|
answer |
The answer to the query. |
Authorization scopes
Requires one of the following OAuth scopes:
https://www.googleapis.com/auth/devprofiles.full_controlhttps://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 ( |
| Fields | |
|---|---|
answerText |
Contains the text of the answer. |
citations[] |
Output only. Contains citations for the answer. |
references[] |
Output only. Contains references for the answer. |
AnswerCitation
Citation info for a segment.
| JSON representation |
|---|
{
"startIndex": integer,
"endIndex": integer,
"sources": [
{
object ( |
| Fields | |
|---|---|
startIndex |
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 |
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[] |
Output only. Contains citation sources for the attributed segment. |
CitationSource
Citation source.
| JSON representation |
|---|
{ "referenceIndex": integer } |
| Fields | |
|---|---|
referenceIndex |
Output only. Contains the index of the |
AnswerReference
Represents a reference to a source.
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field content. Contains the content of the reference. content can be only one of the following: |
|
documentReference |
Output only. The reference document. |
DocumentReference
Represents a reference to a document.
| JSON representation |
|---|
{
"documentChunk": {
object ( |
| Fields | |
|---|---|
documentChunk |
Output only. Contains the document chunk. The |