- JSON 表示法
- UserMessage
- SystemMessage
- TextMessage
- TextType
- SchemaMessage
- SchemaQuery
- SchemaResult
- 資料來源
- DataMessage
- DataQuery
- DataResult
- BigQueryJob
- MatchedQuery
- QueryParameterValues
- AnalysisMessage
- AnalysisQuery
- AnalysisEvent
- ChartMessage
- ChartQuery
- ChartResult
- Blob
- ErrorMessage
- ExampleQueries
- 引用
- CitationSource
- CitationAnchor
- TextMessageCitationAnchor
使用者與系統互動時傳送的訊息。
| JSON 表示法 |
|---|
{ "timestamp": string, "messageId": string, // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "userMessage": { object ( |
| 欄位 | |
|---|---|
timestamp |
僅供輸出。如果是使用者訊息,這是指系統收到訊息的時間。如果是系統訊息,則為系統產生訊息的時間。 使用 RFC 3339,產生的輸出內容一律會經過 Z 正規化,並使用 0、3、6 或 9 個小數位數,也接受「Z」以外的偏移量。範例: |
messageId |
選用。對話中訊息的專屬 ID,用於保留對話。 |
| 訊息類型。以下列出互斥欄位。回應中最多會設定一個欄位: | |
userMessage |
與系統互動的使用者傳送的訊息。 |
systemMessage |
系統回覆使用者的訊息。 |
| 互斥欄位的結尾。 | |
UserMessage
與系統互動的使用者傳送的訊息。
| JSON 表示法 |
|---|
{ // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "text": string // End of mutually exclusive fields. } |
| 欄位 | |
|---|---|
| 使用者訊息中的內容類型。以下列出互斥欄位。回應中最多會設定一個欄位: | |
text |
文字應使用這個欄位,而非 Blob。 |
| 互斥欄位的結尾。 | |
SystemMessage
系統回覆使用者的訊息。這則訊息也可能是使用者與系統進行多輪對話時的歷史脈絡。
| JSON 表示法 |
|---|
{ "citation": { object ( |
| 欄位 | |
|---|---|
citation |
僅供輸出。系統訊息的引用資訊。 |
| 系統訊息中的內容類型。以下列出互斥欄位。回應中最多會設定一個欄位: | |
text |
直接以自然語言回覆使用者訊息。 |
schema |
結構定義解析期間產生的訊息。 |
data |
在資料擷取期間產生的訊息。 |
analysis |
分析期間產生的訊息。 |
chart |
圖表生成期間產生的訊息。 |
error |
錯誤訊息。 |
exampleQueries |
選用。包含查詢範例的訊息。 |
| 互斥欄位的結尾。 | |
groupId |
用於識別事件所屬的群組。系統會將類似事件視為彼此在邏輯上相關,並應在 UI 中一起顯示。 |
TextMessage
多部分簡訊。
| JSON 表示法 |
|---|
{
"parts": [
string
],
"textType": enum ( |
| 欄位 | |
|---|---|
parts[] |
選用。郵件的各個部分。 |
textType |
選用。簡訊類型。 |
thoughtSignature |
選用。想法的不透明簽章,可在後續要求中重複使用。 Base64 編碼字串。 |
TextType
簡訊類型。
| 列舉 | |
|---|---|
TEXT_TYPE_UNSPECIFIED |
預設文字類型。 |
FINAL_RESPONSE |
這段文字是使用者問題的最終回覆。 |
THOUGHT |
這段文字是模型生成的想法。 |
PROGRESS |
這段文字是關於代理程式進度的資訊訊息,例如工具的叫用情形。這與代理的內部思考過程 (THOUGHT) 和給使用者的最終回覆 (FINAL_RESPONSE) 不同。這些訊息可深入瞭解代理的動作。 |
FOLLOWUP_QUESTIONS |
這段文字是建議的後續問題清單。parts 中的每個項目都是後續問題。 |
SchemaMessage
結構定義解析期間產生的訊息。
| JSON 表示法 |
|---|
{ // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "query": { object ( |
| 欄位 | |
|---|---|
| 這則訊息是否包含查詢或結構定義解析結果。以下列出互斥欄位。回應中最多會設定一個欄位: | |
query |
結構定義解析查詢。 |
result |
結構定義解析查詢的結果。 |
| 互斥欄位的結尾。 | |
SchemaQuery
查詢,用於解析與所提問題相關的結構定義。
| JSON 表示法 |
|---|
{ "question": string } |
| 欄位 | |
|---|---|
question |
選用。要傳送給系統以解決結構定義的問題。 |
SchemaResult
結構定義解析結果。
| JSON 表示法 |
|---|
{
"datasources": [
{
object ( |
| 欄位 | |
|---|---|
datasources[] |
選用。用於解析結構定義查詢的資料來源。 |
資料來源
可用於回答問題的資料來源。
| JSON 表示法 |
|---|
{ "schema": { object ( |
| 欄位 | |
|---|---|
schema |
選用。資料來源的結構定義。 |
structSchema |
選用。結構定義的結構體表示法。如果資料來源的結構定義無法完全以強型別 如果是 Looker 資料來源,這會對應至 LookmlModelExplore 型別:https://cloud.google.com/looker/docs/reference/looker-api/latest/types/LookmlModelExplore |
| 資料來源的參照。以下列出互斥欄位。回應中最多會設定一個欄位: | |
bigqueryTableReference |
BigQuery 資料表的參照。 |
studioDatasourceId |
Looker Studio 資料來源的參照。 |
lookerExploreReference |
Looker 探索的參照。 |
bigqueryPropertyGraphReference |
BigQuery 屬性圖形的參照。 |
| 互斥欄位的結尾。 | |
DataMessage
在資料擷取期間產生的訊息。
| JSON 表示法 |
|---|
{ // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "query": { object ( |
| 欄位 | |
|---|---|
| 這則訊息是否包含查詢、結果,或是擷取資料時產生的 SQL。以下列出互斥欄位。回應中最多會設定一個欄位: | |
query |
資料擷取查詢。 |
generatedSql |
系統生成的 SQL,用於擷取資料。 |
result |
擷取的資料。 |
bigQueryJob |
系統執行的 BigQuery 工作,用於擷取資料。 |
matchedQuery |
系統比對後用於擷取資料的現有查詢。 |
| 互斥欄位的結尾。 | |
DataQuery
用於擷取資料的查詢。
| JSON 表示法 |
|---|
{ "question": string, "name": string, "datasources": [ { object ( |
| 欄位 | |
|---|---|
question |
選用。要回答的自然語言問題。 |
name |
選用。查詢的蛇形命名名稱,可反映查詢意圖。這個名稱用於命名對應的資料結果,以便在後續步驟中參照。
|
datasources[] |
選用。可用於回答問題的資料來源。 |
| 要執行的查詢類型。以下列出互斥欄位。回應中最多會設定一個欄位: | |
looker |
選用。從 Looker 探索擷取資料的查詢。 |
| 互斥欄位的結尾。 | |
DataResult
擷取的資料。
| JSON 表示法 |
|---|
{
"name": string,
"schema": {
object ( |
| 欄位 | |
|---|---|
name |
選用。資料結果的蛇形命名法名稱,可反映其內容。這個名稱用於依參照傳遞結果,並做為其意義的信號。
|
schema |
選用。資料的結構定義。 |
data[] |
選用。資料內容。每個資料列都是符合結構定義的結構體。簡單值會以字串表示,巢狀結構則會以清單或結構體表示。 |
formattedData[] |
選用。資料的格式化表示方式 (如適用)。每個資料列都是一個結構體,直接對應 |
BigQueryJob
系統執行的 BigQuery 工作。
| JSON 表示法 |
|---|
{ "projectId": string, "jobId": string, "location": string, "destinationTable": { object ( |
| 欄位 | |
|---|---|
projectId |
這是必要旗標,工作所屬的專案。 請參閱「JobReference」。 |
jobId |
這是必要旗標,工作 ID。 請參閱「JobReference」。 |
location |
選用。工作地點。 請參閱「JobReference」。 |
destinationTable |
選用。這項工作查詢結果目的地資料表的參照。 請參閱「JobConfigurationQuery」。 |
schema |
選用。作業查詢結果的結構定義。 請參閱 JobStatistics2。 |
MatchedQuery
如果查詢訊息相符,表示代理程式已比對出適用於目前問題的查詢範例。比對程序也會提供額外資訊。
| JSON 表示法 |
|---|
{ "exampleQuery": { object ( |
| 欄位 | |
|---|---|
exampleQuery |
根據查詢範例比對到的查詢。 |
queryParameterValues[] |
查詢參數的擷取值。 |
QueryParameterValues
查詢參數值訊息代表 LLM 根據範例查詢,從使用者問題中擷取的查詢參數值。
| JSON 表示法 |
|---|
{ "name": string, "value": string } |
| 欄位 | |
|---|---|
name |
這是必要旗標,參數的名稱。 |
value |
這是必要旗標,參數值。 |
AnalysisMessage
分析期間產生的訊息。
| JSON 表示法 |
|---|
{ // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "query": { object ( |
| 欄位 | |
|---|---|
| 這封郵件是否包含查詢或分析中的其中一個事件。以下列出互斥欄位。回應中最多會設定一個欄位: | |
query |
分析查詢。 |
progressEvent |
表示分析進度的事件。 |
| 互斥欄位的結尾。 | |
AnalysisQuery
用於執行分析的查詢。
| JSON 表示法 |
|---|
{ "question": string, "dataResultNames": [ string ] } |
| 欄位 | |
|---|---|
question |
選用。分析問題,協助回答使用者的原始問題。 |
dataResultNames[] |
選用。要分析的先前擷取資料結果名稱。 |
AnalysisEvent
表示分析進度的事件。
| JSON 表示法 |
|---|
{ // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "plannerReasoning": string, "coderInstruction": string, "code": string, "executionOutput": string, "executionError": string, "resultVegaChartJson": string, "resultNaturalLanguage": string, "resultCsvData": string, "resultReferenceData": string, "error": string // End of mutually exclusive fields. } |
| 欄位 | |
|---|---|
| 分析期間發生的事件類型。以下列出互斥欄位。回應中最多會設定一個欄位: | |
plannerReasoning |
Python 程式碼產生器規劃工具的推論。 |
coderInstruction |
生成程式碼的指令。 |
code |
產生的程式碼。 |
executionOutput |
執行程式碼的輸出內容。 |
executionError |
執行程式碼時發生錯誤。 |
resultVegaChartJson |
以 Vega 圖表 JSON 字串的形式傳回結果。 |
resultNaturalLanguage |
以 NL 字串形式呈現結果。 |
resultCsvData |
以 CSV 字串形式傳回結果。 |
resultReferenceData |
結果做為資料來源的參照。 |
error |
一般錯誤訊息。 |
| 互斥欄位的結尾。 | |
ChartMessage
圖表生成期間產生的訊息。
| JSON 表示法 |
|---|
{ // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "query": { object ( |
| 欄位 | |
|---|---|
| 這則訊息是否包含查詢內容或圖表生成結果。以下列出互斥欄位。回應中最多會設定一個欄位: | |
query |
生成圖表的查詢。 |
result |
圖表生成查詢的結果。 |
| 互斥欄位的結尾。 | |
ChartQuery
生成圖表的查詢。
| JSON 表示法 |
|---|
{ "instructions": string, "dataResultName": string } |
| 欄位 | |
|---|---|
instructions |
選用。生成圖表的自然語言指令。 |
dataResultName |
選用。先前擷取的資料結果名稱,用於圖表。 |
ChartResult
圖表生成查詢的結果。
| JSON 表示法 |
|---|
{
"vegaConfig": {
object
},
"image": {
object ( |
| 欄位 | |
|---|---|
vegaConfig |
選用。產生的 Vega 圖表設定。請參閱 https://vega.github.io/vega/docs/config/ |
image |
選用。如果是在內容中要求,則會顯示圖表的算繪結果。 |
Blob
具有 MIME 類型的資料 Blob。
| JSON 表示法 |
|---|
{ "mimeType": string, "data": string } |
| 欄位 | |
|---|---|
mimeType |
這是必要旗標,訊息資料的 IANA 標準 MIME 類型。 |
data |
這是必要旗標,以位元組表示的資料。 Base64 編碼字串。 |
ErrorMessage
工具呼叫傳回的錯誤訊息。這則訊息代表代理程式嘗試使用工具時發生錯誤。請注意,並非所有錯誤都是終端錯誤。許多錯誤都能復原,代理程式可能會使用這則錯誤訊息中的資訊自行修正,然後重試工具呼叫或嘗試其他方法。
舉例來說,如果資料查詢失敗,代理程式可能會收到 ErrorMessage、分析該查詢,然後生成修正後的查詢。
用戶端應謹慎解讀這則訊息,不宜視為明確的失敗。這可能是代理程式完成工作時,正常反覆程序的一部分。如果直接向使用者顯示這些錯誤,但未提供相關背景資訊 (例如以「硬性失敗」的形式),可能會造成誤導。
| JSON 表示法 |
|---|
{ "text": string } |
| 欄位 | |
|---|---|
text |
僅供輸出。錯誤文字。 |
ExampleQueries
包含衍生和撰寫範例查詢的訊息。
| JSON 表示法 |
|---|
{
"exampleQueries": [
{
object ( |
| 欄位 | |
|---|---|
exampleQueries[] |
選用。衍生和撰寫的範例查詢清單,提供相關且常用的 SQL 查詢範例,以及對應的自然語言查詢 (如有)。目前僅適用於 BigQuery 資料來源。 |
引用內容
內容的來源出處。
| JSON 表示法 |
|---|
{ "sources": [ { object ( |
| 欄位 | |
|---|---|
sources[] |
僅供輸出。列出引用的來源。 |
anchors[] |
僅供輸出。引用內容的錨點清單。 |
CitationSource
引文的來源。
| JSON 表示法 |
|---|
{ "id": string, "title": string, // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "uri": string, "exampleQuery": { object ( |
| 欄位 | |
|---|---|
id |
僅供輸出。來源的專屬 ID。這個 ID 由服務產生,在單一 |
title |
僅供輸出。來源的標題。 |
| 引文來源,可以是其中一種支援的類型。以下列出互斥欄位。回應中最多會設定一個欄位: | |
uri |
僅供輸出。做為來源的 URI,例如網頁基礎網址。 |
exampleQuery |
僅供輸出。做為來源的查詢範例。 |
glossaryTerm |
僅供輸出。做為來源的詞彙表字詞。 |
| 互斥欄位的結尾。 | |
CitationAnchor
引文的錨點。
| JSON 表示法 |
|---|
{
// The following is a list of mutually exclusive fields. At most one of the
// fields will be set in a response:
"textMessageAnchor": {
object ( |
| 欄位 | |
|---|---|
| 引文的錨點,可以是其中一種支援的類型。以下列出互斥欄位。回應中最多會設定一個欄位: | |
textMessageAnchor |
僅供輸出。只有在引文是 TextMessage 時才設定。 |
| 互斥欄位的結尾。 | |
TextMessageCitationAnchor
TextMessage 中的引用錨點。
| JSON 表示法 |
|---|
{ "partIndex": integer, "startOffsetBytes": integer, "endOffsetBytes": integer, "sourceIds": [ string ] } |
| 欄位 | |
|---|---|
partIndex |
僅供輸出。TextMessage.parts 欄位中部分的索引 (從 0 開始)。 |
startOffsetBytes |
僅供輸出。引用內容在部分字串中的起始偏移值 (以 UTF-8 位元組為單位,含)。舉例來說,在「Hello, world」這段文字中,如果「world」是引用的內容,則開始位移位元組 (含) 為 7,結束位移位元組 (不含) 為 12。 |
endOffsetBytes |
僅供輸出。引用內容在部分字串中的結束位置 (不含),以 UTF-8 位元組為單位。舉例來說,在「Hello, world」這段文字中,如果「world」是引用的內容,則開始位移位元組 (含) 為 7,結束位移位元組 (不含) 為 12。 |
sourceIds[] |
僅供輸出。引用來源的 ID。 |