Message

使用者與系統互動時產生的訊息。

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 (UserMessage)
  },
  "systemMessage": {
    object (SystemMessage)
  }
  // End of mutually exclusive fields.
}
欄位
timestamp

string (Timestamp format)

僅供輸出。如果是使用者訊息,則是指系統收到訊息的時間。如果是系統訊息,則是指系統產生訊息的時間。

使用 RFC 3339,產生的輸出內容一律會經過 Z 正規化,並使用 0、3、6 或 9 個小數位數,也接受「Z」以外的偏移量。範例:"2014-10-02T15:01:23Z"、"2014-10-02T15:01:23.045123456Z" 或 "2014-10-02T15:01:23+05:30"。

messageId

string

選用。對話中訊息的專屬 ID,用於持續性。

訊息類型。以下是互斥欄位清單。回應中最多會設定下列其中一個欄位:
userMessage

object (UserMessage)

與系統互動的使用者訊息。

systemMessage

object (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

string

文字應使用這個欄位,而非 blob。

互斥欄位結束。

SystemMessage

系統回覆使用者的訊息。這則訊息也可以是使用者傳送的訊息,做為與系統進行多輪對話的歷來背景資訊。

JSON 表示法
{
  "citation": {
    object (Citation)
  },

  // The following is a list of mutually exclusive fields. At most one of the
  // fields will be set in a response:
  "text": {
    object (TextMessage)
  },
  "schema": {
    object (SchemaMessage)
  },
  "data": {
    object (DataMessage)
  },
  "analysis": {
    object (AnalysisMessage)
  },
  "chart": {
    object (ChartMessage)
  },
  "error": {
    object (ErrorMessage)
  },
  "exampleQueries": {
    object (ExampleQueries)
  },
  "clarification": {
    object (ClarificationMessage)
  }
  // End of mutually exclusive fields.
  "groupId": integer
}
欄位
citation

object (Citation)

僅供輸出。系統訊息的引用資訊。

系統訊息中的內容類型。以下是互斥欄位清單。回應中最多會設定下列其中一個欄位:
text

object (TextMessage)

直接以自然語言回覆使用者訊息。

schema

object (SchemaMessage)

結構定義解析期間產生的訊息。

data

object (DataMessage)

擷取資料時產生的訊息。

analysis

object (AnalysisMessage)

分析期間產生的訊息。

chart

object (ChartMessage)

生成圖表時產生的訊息。

error

object (ErrorMessage)

錯誤訊息。

exampleQueries

object (ExampleQueries)

選用。包含查詢範例的訊息。

clarification
(deprecated)

object (ClarificationMessage)

選用。已淘汰:請改用 TextMessage 搭配 TextType.FINAL_RESPONSE。包含釐清問題的訊息。

互斥欄位結束。
groupId

integer

用於識別事件所屬的群組。系統會將類似事件視為在邏輯上彼此相關,並在 UI 中一併顯示。

TextMessage

多部分簡訊。

JSON 表示法
{
  "parts": [
    string
  ],
  "textType": enum (TextType),
  "thoughtSignature": string
}
欄位
parts[]

string

選用。訊息的各個部分。

textType

enum (TextType)

選用。簡訊類型。

thoughtSignature

string (bytes format)

選用。思考過程的不透明簽章,可在後續要求中重複使用。

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 (SchemaQuery)
  },
  "result": {
    object (SchemaResult)
  }
  // End of mutually exclusive fields.
}
欄位
這則訊息是否包含結構定義解析的查詢或結果。以下是互斥欄位清單。回應中最多會設定下列其中一個欄位:
query

object (SchemaQuery)

結構定義解析查詢。

result

object (SchemaResult)

結構定義解析查詢的結果。

互斥欄位結束。

SchemaQuery

用於解析與問題相關結構定義的查詢。

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

string

選用。要傳送至系統以解析結構定義的問題。

SchemaResult

結構定義解析結果。

JSON 表示法
{
  "datasources": [
    {
      object (Datasource)
    }
  ]
}
欄位
datasources[]

object (Datasource)

選用。用於解析結構定義查詢的資料來源。

資料來源

可用來回答問題的資料來源。

JSON 表示法
{
  "schema": {
    object (Schema)
  },
  "structSchema": {
    object
  },

  // The following is a list of mutually exclusive fields. At most one of the
  // fields will be set in a response:
  "bigqueryTableReference": {
    object (BigQueryTableReference)
  },
  "studioDatasourceId": string,
  "lookerExploreReference": {
    object (LookerExploreReference)
  },
  "alloyDbReference": {
    object (AlloyDbReference)
  },
  "spannerReference": {
    object (SpannerReference)
  },
  "cloudSqlReference": {
    object (CloudSqlReference)
  },
  "bigtableReference": {
    object (BigtableReference)
  },
  "bigqueryPropertyGraphReference": {
    object (BigQueryPropertyGraphReference)
  },
  "firestoreReference": {
    object (FirestoreReference)
  }
  // End of mutually exclusive fields.
}
欄位
schema

object (Schema)

選用。資料來源的結構定義。

structSchema

object (Struct format)

選用。結構定義的 struct 表示法。如果資料來源的結構定義無法由強型別 schema 欄位完整表示,系統就會填入這個欄位。

如果是 Looker 資料來源,這會對應至 LookmlModelExplore 類型:https://cloud.google.com/looker/docs/reference/looker-api/latest/types/LookmlModelExplore

資料來源的參照。以下是互斥欄位清單。回應中最多會設定下列其中一個欄位:
bigqueryTableReference

object (BigQueryTableReference)

BigQuery 資料表的參照。

studioDatasourceId

string

Looker Studio 資料來源的參照。

lookerExploreReference

object (LookerExploreReference)

Looker 探索的參照。

alloyDbReference

object (AlloyDbReference)

AlloyDB 資料庫的參照。

spannerReference

object (SpannerReference)

Spanner 資料庫的參照。

cloudSqlReference

object (CloudSqlReference)

Cloud SQL 資料庫的參照。

bigtableReference

object (BigtableReference)

Bigtable 執行個體的參照。

bigqueryPropertyGraphReference

object (BigQueryPropertyGraphReference)

BigQuery 屬性圖譜的參照。

firestoreReference

object (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 (DataQuery)
  },
  "generatedSql": string,
  "result": {
    object (DataResult)
  },
  "generatedLookerQuery": {
    object (LookerQuery)
  },
  "bigQueryJob": {
    object (BigQueryJob)
  },
  "matchedQuery": {
    object (MatchedQuery)
  }
  // End of mutually exclusive fields.
}
欄位
這則訊息是否包含查詢、結果或生成的 SQL,用於擷取資料。以下是互斥欄位清單。回應中最多會設定下列其中一個欄位:
query

object (DataQuery)

資料擷取查詢。

generatedSql

string

系統產生的 SQL,用於擷取資料。

result

object (DataResult)

擷取資料。

generatedLookerQuery
(deprecated)

object (LookerQuery)

已淘汰:生成的 Looker 查詢現在位於 DataQuery.looker 下方。系統生成的 Looker 查詢,用於擷取資料。

bigQueryJob

object (BigQueryJob)

系統執行的 BigQuery 工作,用於擷取資料。

matchedQuery

object (MatchedQuery)

與擷取資料相符的預先存在查詢。

互斥欄位結束。

DataQuery

用於擷取資料的查詢。

JSON 表示法
{
  "question": string,
  "name": string,
  "datasources": [
    {
      object (Datasource)
    }
  ],

  // The following is a list of mutually exclusive fields. At most one of the
  // fields will be set in a response:
  "looker": {
    object (LookerQuery)
  }
  // End of mutually exclusive fields.
}
欄位
question

string

選用。要回答的自然語言問題。

name

string

選用。查詢的蛇形命名法名稱,反映其意圖。用於命名對應的資料結果,以便在後續步驟中參照。

  • 例如:「total_sales_by_product」
  • 例如:「sales_for_product_12345」
datasources[]

object (Datasource)

選用。可用於回答問題的資料來源。

要執行的查詢類型。以下是互斥欄位清單。回應中最多會設定下列其中一個欄位:
looker

object (LookerQuery)

選用。從 Looker 探索擷取資料的查詢。

互斥欄位結束。

DataResult

擷取資料。

JSON 表示法
{
  "name": string,
  "schema": {
    object (Schema)
  },
  "data": [
    {
      object
    }
  ],
  "formattedData": [
    {
      object
    }
  ]
}
欄位
name

string

選用。資料結果的蛇形命名法名稱,反映其內容。這個名稱用於透過參照傳遞結果,並做為結果含義的信號。

  • 例如:「total_sales_by_product」
  • 例如:「sales_for_product_12345」
schema

object (Schema)

選用。資料的結構定義。

data[]

object (Struct format)

選用。資料內容。每個資料列都是符合結構定義的 struct。簡單值會以字串表示,巢狀結構則以清單或結構體表示。

formattedData[]

object (Struct format)

選用。資料的格式化表示法 (如適用)。每個資料列都是一個結構體,直接對應 data 欄位中相同索引的資料列。其值是原始資料的字串表示法,格式依資料來源規格而定 (例如貨幣為「$1,234.56」)。未設定格式的資料欄會預設為原始值表示法。如果沒有任何資料欄設有格式規則,這個欄位會留空。

BigQueryJob

由系統執行的 BigQuery 工作。

JSON 表示法
{
  "projectId": string,
  "jobId": string,
  "location": string,
  "destinationTable": {
    object (BigQueryTableReference)
  },
  "schema": {
    object (Schema)
  }
}
欄位
projectId

string

這是必要旗標,工作所屬的專案。

請參閱 JobReference。

jobId

string

這是必要旗標,工作的 ID。

請參閱 JobReference。

location

string

選用。工作地點。

請參閱 JobReference。

destinationTable

object (BigQueryTableReference)

選用。工作查詢結果目的地資料表的參照。

請參閱 JobConfigurationQuery。

schema

object (Schema)

選用。工作查詢結果的結構定義。

請參閱 JobStatistics2。

MatchedQuery

如果訊息指出查詢訊息相符,代表代理已比對出與目前問題相符的查詢示例。比對過程中,也會包含其他資訊。

JSON 表示法
{
  "exampleQuery": {
    object (ExampleQuery)
  },
  "queryParameterValues": [
    {
      object (QueryParameterValues)
    }
  ]
}
欄位
exampleQuery

object (ExampleQuery)

根據查詢示例比對出的查詢。

queryParameterValues[]

object (QueryParameterValues)

查詢參數的擷取值。

QueryParameterValues

查詢參數值訊息代表 LLM 根據範例查詢,從使用者問題中擷取的查詢參數值。

JSON 表示法
{
  "name": string,
  "value": string
}
欄位
name

string

這是必要旗標,參數的名稱。

value

string

這是必要旗標,參數的值。

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 (AnalysisQuery)
  },
  "progressEvent": {
    object (AnalysisEvent)
  }
  // End of mutually exclusive fields.
}
欄位
這則訊息是否包含查詢或分析中的其中一項事件。以下是互斥欄位清單。回應中最多會設定下列其中一個欄位:
query

object (AnalysisQuery)

分析查詢。

progressEvent

object (AnalysisEvent)

表示分析進度的事件。

互斥欄位結束。

AnalysisQuery

執行分析的查詢。

JSON 表示法
{
  "question": string,
  "dataResultNames": [
    string
  ]
}
欄位
question

string

選用。分析問題,協助回答使用者的原始問題。

dataResultNames[]

string

選用。先前擷取的資料結果名稱,用於分析。

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

string

Python 程式碼生成規劃器的推論。

coderInstruction

string

程式碼生成指令。

code

string

產生的程式碼。

executionOutput

string

執行程式碼的輸出內容。

executionError

string

執行程式碼時發生錯誤。

resultVegaChartJson

string

結果為 Vega 圖表 JSON 字串。

resultNaturalLanguage

string

以自然語言字串呈現的結果。

resultCsvData

string

結果為 CSV 字串。

resultReferenceData

string

結果為資料來源的參照。

error

string

一般錯誤訊息。

互斥欄位結束。

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 (ChartQuery)
  },
  "result": {
    object (ChartResult)
  }
  // End of mutually exclusive fields.
}
欄位
這則訊息是否包含查詢或圖表生成結果。以下是互斥欄位清單。回應中最多會設定下列其中一個欄位:
query

object (ChartQuery)

用於生成圖表的查詢。

result

object (ChartResult)

圖表生成查詢的結果。

互斥欄位結束。

ChartQuery

用於生成圖表的查詢。

JSON 表示法
{
  "instructions": string,
  "dataResultName": string
}
欄位
instructions

string

選用。生成圖表的自然語言指令。

dataResultName

string

選用。先前擷取的資料結果名稱,用於圖表。

ChartResult

圖表生成查詢的結果。

JSON 表示法
{
  "vegaConfig": {
    object
  },
  "image": {
    object (Blob)
  }
}
欄位
vegaConfig

object (Struct format)

選用。產生的 Vega 圖表設定。請參閱 https://vega.github.io/vega/docs/config/

image

object (Blob)

選用。如果要求在內容中顯示圖表,則會顯示圖表。

Blob

具有 MIME 類型的資料 blob。

JSON 表示法
{
  "mimeType": string,
  "data": string
}
欄位
mimeType

string

這是必要旗標,訊息資料的 IANA 標準 MIME 類型。

data

string (bytes format)

這是必要旗標,以位元組表示的資料。

Base64 編碼字串。

ErrorMessage

工具呼叫的錯誤訊息。這則訊息代表代理嘗試使用工具時發生錯誤。請注意,並非所有錯誤都會導致終止。許多錯誤都可以復原,代理可能會使用這則錯誤訊息中的資訊自我修正,並重試工具呼叫或嘗試其他方法。

舉例來說,如果資料查詢失敗,代理可能會收到 ErrorMessage,分析後再生成修正後的查詢。

用戶端應謹慎解讀這則訊息,不要將其視為明確的失敗。這可以是代理完成任務時,正常反覆執行的程序。如果直接向使用者顯示這些錯誤,卻未提供背景資訊 (例如「硬失敗」),可能會造成誤導。

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

string

僅供輸出。錯誤文字。

ExampleQueries

包含衍生和編寫範例查詢的訊息。

JSON 表示法
{
  "exampleQueries": [
    {
      object (ExampleQuery)
    }
  ]
}
欄位
exampleQueries[]

object (ExampleQuery)

選用。衍生和編寫的範例查詢清單,提供相關且常用的 SQL 查詢範例,以及對應的自然語言查詢 (如有)。目前僅用於 BigQuery 資料來源。

ClarificationMessage

已淘汰:請改用 TextMessage 搭配 TextType.FINAL_RESPONSE。一則訊息,內含問題,可協助釐清使用者的查詢。如果系統無法確定使用者問題的答案,就會傳回這個值。

JSON 表示法
{
  "questions": [
    {
      object (ClarificationQuestion)
    }
  ]
}
欄位
questions[]
(deprecated)

object (ClarificationQuestion)

這是必要旗標,已淘汰:上層訊息已淘汰。要向使用者提出的一批釐清問題。

ClarificationQuestion

已淘汰:請改用 TextMessage 搭配 TextType.FINAL_RESPONSE。代表向使用者提出的單一問題,用於釐清查詢內容。

JSON 表示法
{
  "question": string,
  "selectionMode": enum (SelectionMode),
  "options": [
    string
  ],
  "clarificationQuestionType": enum (ClarificationQuestionType)
}
欄位
question
(deprecated)

string

這是必要旗標,已淘汰:上層訊息已淘汰。要向使用者提出的自然語言問題。

selectionMode
(deprecated)

enum (SelectionMode)

這是必要旗標,已淘汰:上層訊息已淘汰。這個問題的選取模式。

options[]
(deprecated)

string

這是必要旗標,已淘汰:上層訊息已淘汰。列出可供使用者選擇的不同選項。選項數量上限為 5 個。

clarificationQuestionType
(deprecated)

enum (ClarificationQuestionType)

選用。已淘汰:上層訊息已淘汰。釐清問題的類型。

SelectionMode

已淘汰:上層訊息已淘汰。釐清問題的選取模式。

列舉
SELECTION_MODE_UNSPECIFIED

已淘汰:上層訊息已淘汰。未指定選取模式。

SINGLE_SELECT

已淘汰:上層訊息已淘汰。使用者只能選取一個選項。

MULTI_SELECT

已淘汰:上層訊息已淘汰。使用者可以選取多個選項。

ClarificationQuestionType

已淘汰:上層訊息已淘汰。釐清問題的類型。這個列舉日後可能會擴充新值。

列舉
CLARIFICATION_QUESTION_TYPE_UNSPECIFIED

已淘汰:上層訊息已淘汰。未指定釐清問題類型。

FILTER_VALUES

已淘汰:上層訊息已淘汰。釐清問題是針對篩選器值。

FIELDS

已淘汰:上層訊息已淘汰。釐清問題是針對資料欄位。這是通用術語,涵蓋 SQL 資料欄、Looker 欄位 (維度/測量指標) 或巢狀資料結構屬性。

引用內容

內容的來源出處。

JSON 表示法
{
  "sources": [
    {
      object (CitationSource)
    }
  ],
  "anchors": [
    {
      object (CitationAnchor)
    }
  ]
}
欄位
sources[]

object (CitationSource)

僅供輸出。列出引用的來源。

anchors[]

object (CitationAnchor)

僅供輸出。引用內容的錨點清單。

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 (ExampleQuery)
  },
  "glossaryTerm": {
    object (GlossaryTerm)
  }
  // End of mutually exclusive fields.
}
欄位
id

string

僅供輸出。來源的專屬 ID。這個 ID 由服務產生,在單一 Citation 訊息範圍內是唯一的。

title

string

僅供輸出。來源的標題。

引文來源,可以是支援的類型之一。以下是互斥欄位清單。回應中最多會設定下列其中一個欄位:
uri

string

僅供輸出。做為來源的 URI,例如網頁基準網址。

exampleQuery

object (ExampleQuery)

僅供輸出。做為來源的範例查詢。

glossaryTerm

object (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 (TextMessageCitationAnchor)
  }
  // End of mutually exclusive fields.
}
欄位
引用的錨定標記,可以是支援的類型之一。以下是互斥欄位清單。回應中最多會設定下列其中一個欄位:
textMessageAnchor

object (TextMessageCitationAnchor)

僅供輸出。只有在引用 TextMessage 時才設定。

互斥欄位結束。

TextMessageCitationAnchor

TextMessage 中的引用錨定標記。

JSON 表示法
{
  "partIndex": integer,
  "startOffsetBytes": integer,
  "endOffsetBytes": integer,
  "sourceIds": [
    string
  ]
}
欄位
partIndex

integer

僅供輸出。TextMessage.parts 欄位中,以 0 為基礎的索引。

startOffsetBytes

integer

僅供輸出。引用內容開頭 (含) 在部分字串中的偏移量,以 UTF-8 位元組為單位。範例:在「Hello, world」這段文字中,如果引用的是「world」,則起始偏移位元組 (含) 為 7,結束偏移位元組 (不含) 為 12。

endOffsetBytes

integer

僅供輸出。部分字串中引文結尾 (不含) 的偏移量,以 UTF-8 位元組為單位。範例:在「Hello, world」文字中,如果引用「world」,則起始偏移位元組 (含) 為 7,結束偏移位元組 (不含) 為 12。

sourceIds[]

string

僅供輸出。引用來源的 ID。