配置质量提醒

当客服人员的表现低于定义的阈值时,质量提醒会通知您。您可以使用这些提醒来检测质量漂移,即智能体性能随时间推移而出现的明显下降。即使基础模型保持不变,这种下降也可能会发生,通常是由真实世界中的用户行为变化、不断演变的数据模式或复杂提示链中的细微互动所致。

配置在线监控器后,系统会自动将数值评估得分导出到 Cloud Monitoring。这些指标会在 Cloud Monitoring 中触发突发事件。然后,您可以创建提醒政策,以便在出现质量问题时通知您的团队。

您可以为特定监控对象创建有针对性的提醒政策:

  1. 在 Google Cloud 控制台中,前往 Agent Platform > 智能体页面。
  2. 在左侧导航菜单中,选择评估

    前往“评估”页面

  3. 选择在线监控标签页。点击监控器的更多选项 ,然后选择创建提醒政策

  4. 查看适用于相应监控器的提醒政策模板

  5. 选择要启用的模板。系统会为监控器上配置的每个指标提供一个模板。

  6. 配置通知:选择您的通知渠道。如果您取消选中使用通知渠道,系统会执行检查,但不会主动通知用户。您仍然可以在 Monitoring > Alerting 页面上查看已触发的突发事件。

  7. 点击创建

评估信息中心提供了一个快捷方式,可为所有有效监控器启用广泛的质量保护措施:

  1. 在 Google Cloud 控制台中,前往 Agent Platform > 智能体页面。
  2. 在左侧导航菜单中,选择部署,然后选择您的代理。

    转到部署

  3. 选择信息中心标签页,然后选择评估子部分。

  4. 点击右上角的建议的提醒按钮。

  5. 查看可用的模板,例如:

    • 在线监控器 - 评估得分较低:如果监控器的汇总得分过低,则会触发此提醒。
    • 单个指标提醒:针对“任务成功率”或“工具使用质量”等指标设置的具体阈值。
  6. 选择模板和通知渠道,然后点击创建

以编程方式创建提醒

对于大规模部署,您可以使用 gcloud CLI 或 Cloud Monitoring API 配置质量提醒。

使用 gcloud

通过 JSON 或 YAML 配置文件创建提醒政策:

gcloud monitoring policies create --policy-from-file="policy.yaml"

以下是一个 policy.yaml 示例,如果 30 分钟内的平均任务成功得分低于 80%,则会触发该 policy.yaml

displayName: "Low Task Success Score"
conditions:
- displayName: "Task Success < 0.8"
  conditionThreshold:
    filter: >
      metric.type="aiplatform.googleapis.com/online_evaluator/scores"
      AND metric.labels.evaluation_metric_name="task_success"
    comparison: COMPARISON_LT
    thresholdValue: 0.8
    duration: 1800s
    aggregations:
    - alignmentPeriod: 60s
      perSeriesAligner: ALIGN_MEAN
combiner: OR
enabled: true
notificationChannels:
- "projects/YOUR_PROJECT_ID/notificationChannels/CHANNEL_ID"

使用 Agent Platform SDK

from google.cloud import monitoring_v3

client = monitoring_v3.AlertPolicyServiceClient()
project_name = f"projects/YOUR_PROJECT_ID"

policy = {
    "display_name": "Agent Quality Drift",
    "conditions": [{
        "display_name": "Low Evaluation Score",
        "condition_threshold": {
            "filter": (
                'metric.type="aiplatform.googleapis.com/online_evaluator/scores"'
            ),
            "comparison": monitoring_v3.ComparisonType.COMPARISON_LT,
            "threshold_value": 0.7,
            "duration": {"seconds": 3600},
            "aggregations": [{
                "alignment_period": {"seconds": 60},
                "per_series_aligner": monitoring_v3.Aggregation.Aligner.ALIGN_MEAN,
            }],
        },
    }],
    "combiner": monitoring_v3.AlertPolicy.ConditionCombinerType.OR,
    "enabled": True,
}

response = client.create_alert_policy(name=project_name, alert_policy=policy)
print(f"Created alerting policy {response.name}")

管理提醒政策

使用 Cloud Monitoring 控制台查看提醒政策的位置并优化其配置。每个突发事件都包含关联的在线监控器的标签,可帮助您调查根本原因。

转到提醒