EvaluationAgent 🧐
EvaluationAgent
的目标是评估 Session
或 Round
是否已成功完成。EvaluationAgent
评估 HostAgent
和 AppAgent
在满足请求方面的表现。您可以在 config_dev.yaml
文件中配置是否启用 EvaluationAgent
,详细文档请参见此处。
注意
EvaluationAgent
完全由 LLM 驱动,并根据动作轨迹和截图进行评估。由于 LLM 可能会犯错,因此它可能不是 100% 准确。
我们通过下图说明评估过程
配置
要启用 EvaluationAgent
,您可以在 config_dev.yaml
文件中配置以下参数,以评估不同级别的任务完成状态
配置选项 | 描述 | 类型 | 默认值 |
---|---|---|---|
EVA_SESSION |
是否将会话包含在评估中。 | 布尔值 | True |
EVA_ROUND |
是否将回合包含在评估中。 | 布尔值 | False |
EVA_ALL_SCREENSHOTS |
是否将所有截图包含在评估中。 | 布尔值 | True |
评估输入
EvaluationAgent
接收以下输入进行评估
输入 | 描述 | 类型 |
---|---|---|
用户请求 | 要评估的用户请求。 | 字符串 |
API 描述 | 执行中使用的 API 描述。 | 字符串列表 |
动作轨迹 | 由 HostAgent 和 AppAgent 执行的动作轨迹。 |
字符串列表 |
截图 | 执行过程中捕获的截图。 | 图片列表 |
有关如何构建输入的更多详细信息,请参阅 ufo/prompter/eva_prompter.py
中的 EvaluationAgentPrompter
类。
提示
您可以在 config_dev.yaml
文件的 EVA_ALL_SCREENSHOTS
中配置是使用所有截图还是仅使用第一张和最后一张截图进行评估。
评估输出
EvaluationAgent
在评估后生成以下输出
输出 | 描述 | 类型 |
---|---|---|
原因 | 通过观察截图差异和详细的判断原因。 |
字符串 |
子分数 | 将评估分解为多个子目标后的评估子分数。 | 字典列表 |
完成 | 评估的完成状态,可以是 yes 、no 或 unsure 。 |
字符串 |
以下是评估输出的示例
{
"reason": "The agent successfully completed the task of sending 'hello' to Zac on Microsoft Teams.
The initial screenshot shows the Microsoft Teams application with the chat window of Chaoyun Zhang open.
The agent then focused on the chat window, input the message 'hello', and clicked the Send button.
The final screenshot confirms that the message 'hello' was sent to Zac.",
"sub_scores": {
"correct application focus": "yes",
"correct message input": "yes",
"message sent successfully": "yes"
},
"complete": "yes"}
信息
评估结果日志将保存在 logs/{task_name}/evaluation.log
文件中。
EvaluationAgent
采用 CoT 机制,首先将评估分解为多个子目标,然后分别评估每个子目标。然后聚合子分数以确定评估的总体完成状态。
参考
基类:BasicAgent
评估代理。
初始化 FollowAgent。:agent_type: 代理的类型。:is_visual: 指示代理是否为视觉代理的标志。
源代码位于 agents/agent/evaluation_agent.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
|
status_manager
property
获取状态管理器。
evaluate(request, log_path, eva_all_screenshots=True)
评估任务完成情况。
参数 |
|
---|
返回 |
|
---|
源代码位于 agents/agent/evaluation_agent.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
|
get_prompter(is_visual, prompt_template, example_prompt_template, api_prompt_template, root_name=None)
获取代理的提示器。
源代码位于 agents/agent/evaluation_agent.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
|
message_constructor(log_path, request, eva_all_screenshots=True)
构建消息。
参数 |
|
---|
返回 |
|
---|
源代码位于 agents/agent/evaluation_agent.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
|
print_response(response_dict)
打印评估的响应。
参数 |
|
---|
源代码位于 agents/agent/evaluation_agent.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
|
process_comfirmation()
确认,目前不执行任何操作。
源代码位于 agents/agent/evaluation_agent.py
119 120 121 122 123 |
|