使用以事實為依據的生成內容回答查詢。
HTTP 要求
POST https://developerknowledge.googleapis.com/v1alpha:answerQuery
這個網址使用 gRPC 轉碼語法。
要求主體
要求主體會包含結構如下的資料:
| JSON 表示法 |
|---|
{ "query": string } |
| 欄位 | |
|---|---|
query |
必填。要回答的查詢。 |
回應主體
DeveloperKnowledge.AnswerQuery 的回應訊息。
如果成功,回應主體會含有以下結構的資料:
| JSON 表示法 |
|---|
{
"answer": {
object ( |
| 欄位 | |
|---|---|
answer |
查詢的答案。 |
授權範圍
需要下列其中一種 OAuth 範圍:
https://www.googleapis.com/auth/devprofiles.full_controlhttps://www.googleapis.com/auth/cloud-platform
詳情請參閱OAuth 2.0 Overview。
解答
查詢的答案。
| JSON 表示法 |
|---|
{ "answerText": string, "citations": [ { object ( |
| 欄位 | |
|---|---|
answerText |
包含答案的文字。 |
citations[] |
僅供輸出。包含答案的引用內容。 |
references[] |
僅供輸出。包含答案的參考資料。 |
AnswerCitation
區隔的引用資訊。
| JSON 表示法 |
|---|
{
"startIndex": integer,
"endIndex": integer,
"sources": [
{
object ( |
| 欄位 | |
|---|---|
startIndex |
僅供輸出。表示區隔的開始位置,以位元組 (UTF-8 Unicode) 為單位,包含在範圍內。如有非 ASCII 字元等多位元組字元,索引測量值會大於字串長度。 |
endIndex |
僅供輸出。表示區隔的結尾,以位元組 (UTF-8 Unicode) 為單位,不含結尾值。如有非 ASCII 字元等多位元組字元,索引測量值會大於字串長度。 |
sources[] |
僅供輸出。包含已歸因區隔的引用來源。 |
CitationSource
引用來源。
| JSON 表示法 |
|---|
{ "referenceIndex": integer } |
| 欄位 | |
|---|---|
referenceIndex |
僅供輸出。包含 |
AnswerReference
代表來源的參照。
| JSON 表示法 |
|---|
{ // Union field |
| 欄位 | |
|---|---|
聯集欄位 content。包含參考資料的內容。content 只能是下列其中一項: |
|
documentReference |
僅供輸出。參考文件。 |
DocumentReference
代表文件的參照。
| JSON 表示法 |
|---|
{
"documentChunk": {
object ( |
| 欄位 | |
|---|---|
documentChunk |
僅供輸出。包含文件區塊。 |