-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquantifier_agent.py
45 lines (39 loc) · 2.01 KB
/
quantifier_agent.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from typing import Optional
from autogen_agentchat.agents import AssistantAgent
from autogen_core.models import ChatCompletionClient
class QuantifierAgent(AssistantAgent):
"""
An agent for quantifying the performance of a system using the provided criteria.
"""
DEFAULT_SYSTEM_MESSAGE = """"You are a helpful assistant. You quantify the output of different tasks based on the given criteria.
The criterion is given in a json list format where each element is a distinct criteria.
The each element is a dictionary as follows {"name": name of the criterion, "description": criteria description , "accepted_values": possible accepted inputs for this key}
You are going to quantify each of the crieria for a given task based on the task description.
Return a dictionary where the keys are the criteria and the values are the assessed performance based on accepted values for each criteria.
Return only the dictionary, no code."""
DEFAULT_DESCRIPTION = "An AI agent for quantifing the performance of a system using the provided criteria."
def __init__(
self,
model_client: ChatCompletionClient,
name="quantifier",
system_message: Optional[str] = DEFAULT_SYSTEM_MESSAGE,
description: Optional[str] = DEFAULT_DESCRIPTION,
**kwargs,
):
"""
Args:
model_client (ChatCompletionClient): The model client for ChatCompletion inference.
name (str): agent name.
system_message (str): system message for the ChatCompletion inference.
Please override this attribute if you want to reprogram the agent.
description (str): The description of the agent.
**kwargs (dict): Please refer to other kwargs in
[AssistantAgent](../../assistant_agent#__init__).
"""
super().__init__(
name=name,
system_message=system_message,
description=description,
model_client=model_client,
**kwargs,
)