代理

用法

agent: agent_name {
  advanced_analytics: yes | no
  description: "string"
  instructions: "string"
  is_dashboard_agent: yes | no
  show_debuginfo: yes | no
  show_thinking: yes | no
}
层次结构
模型文件或 LookML 文件
agent
默认值

接受
  • advanced_analyticsyes | no(默认为 no)。
  • description:用于描述智能体的字符串。
  • instructions:用于指定自定义提示和行为规则的字符串。支持 LookML 常量 (@{CONSTANT_NAME})。
  • is_dashboard_agentyes | no(对于信息中心智能体,必须设置为 yes)。
  • show_debuginfoyes | no(默认为 no)。
  • show_thinkingyes | no(默认为 no)。

定义

agent 参数用于在 LookML 中声明数据智能体。借助信息中心智能体, 开发者可以在版本受控的 LookML 中定义自定义智能体指令、分析行为和 显示偏好设置,并使用 LookML 信息中心将智能体与 default_dashboard_agentdashboard_agents 参数相关联。

如需详细了解如何配置和使用 LookML 信息中心智能体, 请参阅创建和管理 LookML 信息中心数据智能体 文档页面。

子参数

信息中心智能体定义支持以下子参数:

advanced_analytics

advanced_analytics 子参数用于控制智能体是否可以使用 高级分析 来生成和运行 Python 代码,以进行复杂的计算和自定义 可视化。

接受 yesno。默认值为 no

description

description 子参数用于提供对智能体用途的可选文本说明。

agent: sales_agent {
  description: "Executive sales overview dashboard agent"
  is_dashboard_agent: yes
}

instructions

instructions 子参数接受自由格式的字符串,该字符串在处理对话问题时为智能体提供业务背景、首选字段、过滤规则或语气。

agent: sales_agent {
  instructions: "Focus on net revenue and filter by current quarter by default."
  is_dashboard_agent: yes
}

您可以使用 @{<var>CONSTANT_NAME</var>} 语法在 instructions 中引用 LookML 常量

agent: sales_agent {
  instructions: "Focus on net revenue. @{FISCAL_YEAR_RULE}"
  is_dashboard_agent: yes
}

如果省略,智能体将在没有自定义指令上下文的情况下运行。

is_dashboard_agent

is_dashboard_agent 子参数用于指定智能体是否配置为信息中心智能体。

接受 yesno。如需将智能体与 LookML 信息中心搭配使用,请将此参数设置为 yes

show_debuginfo

show_debuginfo 子参数用于确定智能体是否在对话回答中显示执行日志和诊断信息。

接受 yesno。默认值为 no

show_thinking

show_thinking 子参数用于确定智能体是否在对话回答中显示其推理步骤和中间查询规划。

接受 yesno。默认值为 no

示例

定义 LookML 信息中心智能体

以下示例定义了一个 LookML 信息中心智能体,该智能体具有自定义指令、启用了高级分析功能,并且开启了推理过程可见性:

agent: customer_insights_agent {
  instructions: "Address the user politely. Prioritize active subscriber metrics and churn analysis."
  description: "Dashboard agent for Customer Insights dashboard."
  is_dashboard_agent: yes
  advanced_analytics: yes
  show_thinking: yes
  show_debuginfo: no
}

如需在 LookML 信息中心上使用此智能体,请在 .dashboard.lookml 文件中对其进行映射:

- dashboard: customer_insights
  title: "Customer Insights"
  layout: newspaper
  enable_dashboard_agent: true
  default_dashboard_agent: customer_insights_agent
  dashboard_agents: [customer_insights_agent]

  elements:
  - name: active_subscribers
    type: single_value
    model: subscriptions
    explore: customers
    measures: [customers.count]