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)
  }
  // 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)

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

互斥欄位的結尾。
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)
  },
  "bigqueryPropertyGraphReference": {
    object (BigQueryPropertyGraphReference)
  }
  // End of mutually exclusive fields.
}
欄位
schema

object (Schema)

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

structSchema

object (Struct format)

選用。結構定義的結構體表示法。如果資料來源的結構定義無法完全以強型別 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 探索的參照。

bigqueryPropertyGraphReference

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

object (DataQuery)

資料擷取查詢。

generatedSql

string

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

result

object (DataResult)

擷取的資料。

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)

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

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

以 NL 字串形式呈現結果。

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 資料來源。

引用內容

內容的來源出處。

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 訊息範圍內是專屬 ID。

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。