Method: properties.chat

提供對話介面,透過 API 與 Google Analytics 資料互動。

本產品使用 AI 技術,可能會顯示不正確的資訊。您的即時通訊記錄可能會用於改良產品,使用本產品時,請務必遵守 Google 的《條款》、《AI 使用政策》和《隱私權政策》。進一步瞭解房源對話 AI 隱私權

HTTP 要求

POST https://analyticsdata.googleapis.com/v1alpha/{property=properties/*}:chat

這個網址使用 gRPC 轉碼語法。

路徑參數

參數
property

string

必填。要討論的房源。格式:properties/{property}

要求主體

要求主體會包含結構如下的資料:

JSON 表示法
{
  "userQuery": string,
  "returnPropertyQuota": boolean,
  "sessionId": string
}
欄位
userQuery

string

必填。使用者的查詢。

returnPropertyQuota

boolean

(選用步驟) 設為 true 時,回應會包含這個 Analytics 資源的目前配額狀態。配額會以 PropertyChatQuota 形式傳回。

sessionId

string

(選用步驟) 提供這個工作階段 ID,即可繼續現有對話並維持情境脈絡。如果這個欄位空白或未設定,系統會建立新的即時通訊工作階段。如果工作階段 ID 無效,系統會顯示錯誤訊息。

回應主體

properties.chat 方法的回應訊息。

如果成功,回應主體會含有以下結構的資料:

JSON 表示法
{
  "sessionId": string,
  "blocks": [
    {
      object (ResponseBlock)
    }
  ],
  "propertyQuota": {
    object (PropertyChatQuota)
  }
}
欄位
sessionId

string

這個即時通訊工作階段的專屬 ID。在後續要求中提供這個 ID,即可保留對話脈絡。

blocks[]

object (ResponseBlock)

組成即時通訊回覆的回覆區塊。包括文字、表格和清單。

propertyQuota

object (PropertyChatQuota)

這項 Analytics 資源的配額狀態,包括這項要求。

授權範圍

需要下列 OAuth 範圍:

  • https://www.googleapis.com/auth/analytics.chatbot.read

ResponseBlock

對話回覆中的一個結構化資料區塊。

JSON 表示法
{

  // The following is a list of mutually exclusive fields. At most one of the
  // fields will be set in a response:
  "text": string,
  "table": {
    object (DataTable)
  }
  // End of mutually exclusive fields.
}
欄位
一個結構化資料區塊。以下列出互斥的欄位。回應中最多只會設定一個欄位:
text

string

一段文字。

table

object (DataTable)

資料表資料區塊。

互斥欄位的結尾。

DataTable

資料表。

JSON 表示法
{
  "headers": [
    {
      object (DataTableHeader)
    }
  ],
  "rows": [
    {
      object (DataTableRow)
    }
  ]
}
欄位
headers[]

object (DataTableHeader)

說明維度資料欄。標題數量和標題順序與資料列中的維度相符。

rows[]

object (DataTableRow)

報表中的維度值組合和指標值列。

DataTableHeader

說明 DataTable 中的欄標題。

JSON 表示法
{
  "header": string,
  "dataType": string
}
欄位
header

string

標頭名稱。

dataType

string

資料類型。

DataTableRow

DataTable 中的資料列。

JSON 表示法
{
  "columns": [
    {
      object (DataTableCell)
    }
  ]
}
欄位
columns[]

object (DataTableCell)

資料列中的儲存格值。

DataTableCell

資料表中的儲存格。

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

string

儲存格的值。

PropertyChatQuota

聊天機器人專屬欄位的屬性配額。

JSON 表示法
{
  "tokensPerDay": {
    object (QuotaStatus)
  },
  "tokensPerHour": {
    object (QuotaStatus)
  }
}
欄位
tokensPerDay

object (QuotaStatus)

每天使用的 properties.chat 權杖。

tokensPerHour

object (QuotaStatus)

每小時消耗的 properties.chat 權杖。