From cec8afdee60dc8d76843de0a5c257b4eff048620 Mon Sep 17 00:00:00 2001 From: Sasha Vezhnevets Date: Thu, 14 Dec 2023 09:06:14 -0800 Subject: [PATCH] Improving the the call to action prompting by using answer prefix with the agents' name PiperOrigin-RevId: 590957259 Change-Id: Ieeb3ff89b10c3ae297b810636bc0c16e04f95916 --- concordia/agents/basic_agent.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/concordia/agents/basic_agent.py b/concordia/agents/basic_agent.py index 67530c6e..bb13857f 100644 --- a/concordia/agents/basic_agent.py +++ b/concordia/agents/basic_agent.py @@ -175,7 +175,8 @@ def state(self): with self._state_lock: return '\n'.join( f"{self._agent_name}'s " + (comp.name() + ':\n' + comp.state()) - for comp in self._components.values() if comp.state() + for comp in self._components.values() + if comp.state() ) def _maybe_update(self): @@ -224,10 +225,12 @@ def act( call_to_action + '\n', ) else: - output = prompt.open_question( + output = self._agent_name + ' ' + output += prompt.open_question( call_to_action, max_characters=1200, max_tokens=1200, + answer_prefix=output, ) elif action_spec.output_type == 'CHOICE': idx = prompt.multiple_choice_question(