代理

用法

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_analytics:yes | no(默认值为 no)。
  • description:描述代理的字符串。
  • instructions:一个字符串,用于指定自定义提示和行为规则。支持 LookML 常量 (@{CONSTANT_NAME})。
  • is_dashboard_agent:yes | no(对于信息中心代理,必须为 yes)。
  • show_debuginfo:yes | no(默认值为 no)。
  • show_thinking:yes | no(默认值为 no)。

定义

agent 参数用于为 LookML 信息中心定义数据代理。开发者可以使用此参数及其子参数,在版本受控的 LookML 中为与单个 LookML 信息中心关联的单个智能体定义自定义智能体指令、分析行为和显示偏好设置。

开发者可以使用 default_dashboard_agent 参数将信息中心代理与单个 LookML 信息中心相关联。

无法在 LookML 中为用户定义的信息中心或探索定义数据代理。

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

子形参

信息中心代理定义支持以下子参数:

advanced_analytics

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

接受 yes 或 no。默认值为 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 子参数用于指定代理是否配置为信息中心代理。

接受 yes 或 no。如需将代理与 LookML 信息中心搭配使用,请将此参数设置为 yes。

show_debuginfo

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

接受 yes 或 no。默认值为 no。

show_thinking

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

接受 yes 或 no。默认值为 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
  enabled_dashboard_agents: true
  default_dashboard_agent: customer_insights_agent

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