- JSON 表示法
- UserMessage
- SystemMessage
- TextMessage
- TextType
- SchemaMessage
- SchemaQuery
- SchemaResult
- Datasource
- DataMessage
- DataQuery
- DataResult
- BigQueryJob
- MatchedQuery
- QueryParameterValues
- AnalysisMessage
- AnalysisQuery
- AnalysisEvent
- ChartMessage
- ChartQuery
- ChartResult
- Blob
- ErrorMessage
- ExampleQueries
- ClarificationMessage
- ClarificationQuestion
- SelectionMode
- ClarificationQuestionType
- 引用
- 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 |
選用。包含查詢範例的訊息。 |
clarification |
選用。已淘汰:請改用 TextMessage 搭配 TextType.FINAL_RESPONSE。包含釐清問題的訊息。 |
| 互斥欄位結束。 | |
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 |
選用。結構定義的 struct 表示法。如果資料來源的結構定義無法由強型別 如果是 Looker 資料來源,這會對應至 LookmlModelExplore 類型:https://cloud.google.com/looker/docs/reference/looker-api/latest/types/LookmlModelExplore |
| 資料來源的參照。以下是互斥欄位清單。回應中最多會設定下列其中一個欄位: | |
bigqueryTableReference |
BigQuery 資料表的參照。 |
studioDatasourceId |
Looker Studio 資料來源的參照。 |
lookerExploreReference |
Looker 探索的參照。 |
alloyDbReference |
AlloyDB 資料庫的參照。 |
spannerReference |
Spanner 資料庫的參照。 |
cloudSqlReference |
Cloud SQL 資料庫的參照。 |
bigtableReference |
Bigtable 執行個體的參照。 |
bigqueryPropertyGraphReference |
BigQuery 屬性圖譜的參照。 |
firestoreReference |
Firestore 資料庫的參照。 |
| 互斥欄位結束。 | |
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 |
擷取資料。 |
generatedLookerQuery |
已淘汰:生成的 Looker 查詢現在位於 DataQuery.looker 下方。系統生成的 Looker 查詢,用於擷取資料。 |
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[] |
選用。資料內容。每個資料列都是符合結構定義的 struct。簡單值會以字串表示,巢狀結構則以清單或結構體表示。 |
formattedData[] |
選用。資料的格式化表示法 (如適用)。每個資料列都是一個結構體,直接對應 |
BigQueryJob
由系統執行的 BigQuery 工作。
| JSON 表示法 |
|---|
{ "projectId": string, "jobId": string, "location": string, "destinationTable": { object ( |
| 欄位 | |
|---|---|
projectId |
這是必要旗標,工作所屬的專案。 請參閱 JobReference。 |
jobId |
這是必要旗標,工作的 ID。 請參閱 JobReference。 |
location |
選用。工作地點。 請參閱 JobReference。 |
destinationTable |
選用。工作查詢結果目的地資料表的參照。 |
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 |
以自然語言字串呈現的結果。 |
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 資料來源。 |
ClarificationMessage
已淘汰:請改用 TextMessage 搭配 TextType.FINAL_RESPONSE。一則訊息,內含問題,可協助釐清使用者的查詢。如果系統無法確定使用者問題的答案,就會傳回這個值。
| JSON 表示法 |
|---|
{
"questions": [
{
object ( |
| 欄位 | |
|---|---|
questions[] |
這是必要旗標,已淘汰:上層訊息已淘汰。要向使用者提出的一批釐清問題。 |
ClarificationQuestion
已淘汰:請改用 TextMessage 搭配 TextType.FINAL_RESPONSE。代表向使用者提出的單一問題,用於釐清查詢內容。
| JSON 表示法 |
|---|
{ "question": string, "selectionMode": enum ( |
| 欄位 | |
|---|---|
question |
這是必要旗標,已淘汰:上層訊息已淘汰。要向使用者提出的自然語言問題。 |
selectionMode |
這是必要旗標,已淘汰:上層訊息已淘汰。這個問題的選取模式。 |
options[] |
這是必要旗標,已淘汰:上層訊息已淘汰。列出可供使用者選擇的不同選項。選項數量上限為 5 個。 |
clarificationQuestionType |
選用。已淘汰:上層訊息已淘汰。釐清問題的類型。 |
SelectionMode
已淘汰:上層訊息已淘汰。釐清問題的選取模式。
| 列舉 | |
|---|---|
SELECTION_MODE_UNSPECIFIED |
已淘汰:上層訊息已淘汰。未指定選取模式。 |
SINGLE_SELECT |
已淘汰:上層訊息已淘汰。使用者只能選取一個選項。 |
MULTI_SELECT |
已淘汰:上層訊息已淘汰。使用者可以選取多個選項。 |
ClarificationQuestionType
已淘汰:上層訊息已淘汰。釐清問題的類型。這個列舉日後可能會擴充新值。
| 列舉 | |
|---|---|
CLARIFICATION_QUESTION_TYPE_UNSPECIFIED |
已淘汰:上層訊息已淘汰。未指定釐清問題類型。 |
FILTER_VALUES |
已淘汰:上層訊息已淘汰。釐清問題是針對篩選器值。 |
FIELDS |
已淘汰:上層訊息已淘汰。釐清問題是針對資料欄位。這是通用術語,涵蓋 SQL 資料欄、Looker 欄位 (維度/測量指標) 或巢狀資料結構屬性。 |
引用內容
內容的來源出處。
| 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。 |