Skip to content

Commit

Permalink
Fix bug which was causing agents to repeat a single phrase over and over
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 587719414
Change-Id: If284d44d7c9ae93d40299537326bf2afc37259d1
  • Loading branch information
jzleibo authored and copybara-github committed Dec 4, 2023
1 parent 1bf3281 commit 4b4f2f3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
13 changes: 5 additions & 8 deletions concordia/agents/basic_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def __init__(
update_interval: how often to update components. In game time according to
the clock argument.
verbose: whether to print chains of thought or not
user_controlled: if True, would query user input for speach and action
user_controlled: if True, would query user input for speech and action
print_colour: which colour to use for printing
"""
self._verbose = verbose
Expand Down Expand Up @@ -261,19 +261,16 @@ def say(self, conversation: str) -> str:
f'{self._agent_name} is in the following'
f' conversation:\n{conversation}\n'
)
call_to_speach = (
f'Given the above, what should {self._agent_name} say next? Respond in'
f' the format `{self._agent_name} says: "..."` For example, '
'Cristina says: "Hello! Mighty fine weather today, right?" '
'or Ichabod says: "I wonder if the alfalfa is ready to harvest.\n'
call_to_speech = agent.DEFAULT_CALL_TO_SPEECH.format(
agent_name=self._agent_name,
)
if self._user_controlled:
utterance = self._ask_for_input(
convo_context + call_to_speach, f'{self._agent_name}:'
convo_context + call_to_speech, f'{self._agent_name}:'
)
else:
utterance = self.act(
action_spec=agent.ActionSpec(convo_context + call_to_speach, 'FREE'),
action_spec=agent.ActionSpec(convo_context + call_to_speech, 'FREE'),
)

return utterance
2 changes: 1 addition & 1 deletion concordia/typing/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class ActionSpec:
OUTPUT_TYPES = ['FREE', 'CHOICE', 'FLOAT']

DEFAULT_CALL_TO_SPEECH = (
'Given the above, what did {agent_name} say? Respond in'
'Given the above, what is {agent_name} likely to say next? Respond in'
' the format `{agent_name} says: "..."` For example, '
'Cristina says: "Hello! Mighty fine weather today, right?" '
'or Ichabod says: "I wonder if the alfalfa is ready to harvest.\n'
Expand Down

0 comments on commit 4b4f2f3

Please sign in to comment.