Method: answerQuery

使用以事實為依據的生成內容回答查詢。

HTTP 要求

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

這個網址使用 gRPC 轉碼語法。

要求主體

要求主體會包含結構如下的資料:

JSON 表示法
{
  "query": string
}
欄位
query

string

必填。要回答的查詢。

回應主體

DeveloperKnowledge.AnswerQuery 的回應訊息。

如果成功,回應主體會含有以下結構的資料:

JSON 表示法
{
  "answer": {
    object (Answer)
  }
}
欄位
answer

object (Answer)

查詢的答案。

授權範圍

需要下列其中一種 OAuth 範圍:

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

詳情請參閱OAuth 2.0 Overview

解答

查詢的答案。

JSON 表示法
{
  "answerText": string,
  "citations": [
    {
      object (AnswerCitation)
    }
  ],
  "references": [
    {
      object (AnswerReference)
    }
  ]
}
欄位
answerText

string

包含答案的文字。

citations[]

object (AnswerCitation)

僅供輸出。包含答案的引用內容。

references[]

object (AnswerReference)

僅供輸出。包含答案的參考資料。

AnswerCitation

區隔的引用資訊。

JSON 表示法
{
  "startIndex": integer,
  "endIndex": integer,
  "sources": [
    {
      object (CitationSource)
    }
  ]
}
欄位
startIndex

integer

僅供輸出。表示區隔的開始位置,以位元組 (UTF-8 Unicode) 為單位,包含在範圍內。如有非 ASCII 字元等多位元組字元,索引測量值會大於字串長度。

endIndex

integer

僅供輸出。表示區隔的結尾,以位元組 (UTF-8 Unicode) 為單位,不含結尾值。如有非 ASCII 字元等多位元組字元,索引測量值會大於字串長度。

sources[]

object (CitationSource)

僅供輸出。包含已歸因區隔的引用來源。

CitationSource

引用來源。

JSON 表示法
{
  "referenceIndex": integer
}
欄位
referenceIndex

integer

僅供輸出。包含 references 重複欄位中 Answer.AnswerReference 的索引。

AnswerReference

代表來源的參照。

JSON 表示法
{

  // Union field content can be only one of the following:
  "documentReference": {
    object (DocumentReference)
  }
  // End of list of possible types for union field content.
}
欄位
聯集欄位 content。包含參考資料的內容。content 只能是下列其中一項:
documentReference

object (DocumentReference)

僅供輸出。參考文件。

DocumentReference

代表文件的參照。

JSON 表示法
{
  "documentChunk": {
    object (DocumentChunk)
  }
}
欄位
documentChunk

object (DocumentChunk)

僅供輸出。包含文件區塊。documentChunk.id 欄位未設定,因此會留空。