From 02ea368f1cd8eeab2dcab285223b717399ba1873 Mon Sep 17 00:00:00 2001 From: JXZhou Date: Fri, 17 Jan 2025 15:22:08 +0800 Subject: [PATCH] fix mypy errors --- .../sotopia_original_replica/llm_agent_sotopia.py | 4 ++-- sotopia/experimental/agents/evaluators.py | 2 +- sotopia/experimental/agents/moderator.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/experimental/sotopia_original_replica/llm_agent_sotopia.py b/examples/experimental/sotopia_original_replica/llm_agent_sotopia.py index 99780d22..46d299a1 100644 --- a/examples/experimental/sotopia_original_replica/llm_agent_sotopia.py +++ b/examples/experimental/sotopia_original_replica/llm_agent_sotopia.py @@ -39,7 +39,7 @@ def __init__( node_name: str, model_name: str, goal: str, - agent_name: str | None = None, + agent_name: str = "", background: dict[str, Any] | None = None, agent_pk: str | None = None, redis_url: str = "redis://localhost:6379/0", @@ -57,7 +57,7 @@ def __init__( self.goal: str = goal self.model_name: str = model_name self.agent_profile_pk: str | None = agent_pk - self.name: str | None = agent_name + self.name: str = agent_name self.background: dict[str, Any] | None = background self.awake: bool = False diff --git a/sotopia/experimental/agents/evaluators.py b/sotopia/experimental/agents/evaluators.py index 4b1aae74..d6ceaeda 100644 --- a/sotopia/experimental/agents/evaluators.py +++ b/sotopia/experimental/agents/evaluators.py @@ -82,7 +82,7 @@ async def aact(self, content: Observation) -> AgentAction: ), ) - async def aevaluate(self, episode: EpisodeLog) -> dict[str, Any]: + async def aevaluate(self, episode: EpisodeLog) -> Any: # TODO: below is a temporary implementation, need to replaced by using render_for_humans in EpisodeLog history = "\n".join( f"{msg[0][0]} said: {msg[0][2]}" for msg in episode.messages diff --git a/sotopia/experimental/agents/moderator.py b/sotopia/experimental/agents/moderator.py index 46fa0829..5848a848 100644 --- a/sotopia/experimental/agents/moderator.py +++ b/sotopia/experimental/agents/moderator.py @@ -89,7 +89,7 @@ def __init__( evaluator_channels ) > 0, "if evaluate_episode is True, evaluator_channels should not be empty" - self.epilog: EpisodeLog | None = None # will be initialized in booting process + self.epilog: EpisodeLog # will be initialized in booting process if self.action_order == "round-robin": pass