Skip to content

Commit c0cf035

Browse files
add dummy user
1 parent 5c8582a commit c0cf035

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

experiments/eval/run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def main() -> None:
220220
"--simulated-user-type",
221221
type=str,
222222
default="none",
223-
help="Type of simulated user (co-planning, co-execution, co-planning-and-execution, none)",
223+
help="Type of simulated user (co-planning, co-execution, co-planning-and-execution, dummy, none)",
224224
)
225225
parser.add_argument(
226226
"--how-helpful-user-proxy",

experiments/eval/systems/magentic_ui_sim_user_system.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from magentic_ui.types import CheckpointEvent
2424
from magentic_ui.agents import WebSurfer, CoderAgent, FileSurfer
2525
from magentic_ui.teams import GroupChat
26-
from magentic_ui.agents.users import MetadataUserProxy
26+
from magentic_ui.agents.users import MetadataUserProxy, DummyUserProxy
2727
from magentic_ui.tools.playwright.browser import VncDockerPlaywrightBrowser
2828
from magentic_ui.tools.playwright.browser.utils import get_available_port
2929
from magentic_ui.approval_guard import (
@@ -106,7 +106,11 @@ def __init__(
106106
self,
107107
name: str = "MagenticUISimUserSystem",
108108
simulated_user_type: Literal[
109-
"co-planning", "co-execution", "co-planning-and-execution", "none"
109+
"co-planning",
110+
"co-execution",
111+
"co-planning-and-execution",
112+
"none",
113+
"dummy",
110114
] = "none",
111115
how_helpful_user_proxy: Literal["strict", "soft", "no_hints"] = "soft",
112116
web_surfer_only: bool = False,
@@ -217,7 +221,7 @@ async def _runner() -> Tuple[str, List[str]]:
217221
if self.simulated_user_type in ["co-execution", "none"]
218222
else True,
219223
autonomous_execution=True
220-
if self.simulated_user_type in ["co-planning", "none"]
224+
if self.simulated_user_type in ["co-planning", "none", "dummy"]
221225
else False,
222226
allow_follow_up_input=False,
223227
final_answer_prompt=FINAL_ANSWER_PROMPT,
@@ -312,6 +316,10 @@ def get_model_client(
312316

313317
if self.simulated_user_type == "none":
314318
user_proxy = None
319+
elif self.simulated_user_type == "dummy":
320+
user_proxy = DummyUserProxy(
321+
name="user_proxy",
322+
)
315323
else:
316324
user_proxy = MetadataUserProxy(
317325
name="user_proxy",
@@ -346,7 +354,7 @@ def get_model_client(
346354
from autogen_core import CancellationToken
347355
from autogen_core.models import UserMessage
348356

349-
prompt = f"""Rewrite the following helpful hints to help solve the task, but remove any information that directly reveals the answer. \nKeep the hints as close to the original as possible but remove any information that directly reveals the answer.\nHelpful hints: {task_metadata}\n\nAnswer: {getattr(task, 'ground_truth', '')}\n\nDo not include anything else in your response except the rewritten hints.\nRewritten helpful hints:"""
357+
prompt = f"""Rewrite the following helpful hints to help solve the task, but remove any information that directly reveals the answer. \nKeep the hints as close to the original as possible but remove any information that directly reveals the answer.\nHelpful hints: {task_metadata}\n\nAnswer: {getattr(task, "ground_truth", "")}\n\nDo not include anything else in your response except the rewritten hints.\nRewritten helpful hints:"""
350358
result = await model_client_orch.create(
351359
messages=[UserMessage(content=prompt, source="user")],
352360
cancellation_token=CancellationToken(),
@@ -418,9 +426,9 @@ def get_model_client(
418426
# remove the "FINAL ANSWER:" part and get the string after it
419427
answer = answer.split("FINAL ANSWER:")[1].strip()
420428

421-
assert isinstance(
422-
answer, str
423-
), f"Expected answer to be a string, got {type(answer)}"
429+
assert isinstance(answer, str), (
430+
f"Expected answer to be a string, got {type(answer)}"
431+
)
424432

425433
# save the usage of each of the client in a usage json file
426434
def get_usage(model_client: ChatCompletionClient) -> Dict[str, int]:

0 commit comments

Comments
 (0)