Skip to content

Commit

Permalink
Minor imporvments to plan component:
Browse files Browse the repository at this point in the history
- Rephrased the query to be more aligned with instruction tuned models.
- added in-context example to improve and unify output
- no longer printing the goal, since it is a component supplied externally, if the user wants to add it to the agents' context they can do it explicitly.

PiperOrigin-RevId: 590924533
Change-Id: Ib00ac12f04fae04feebd8761a6edb0e4f41e8a93
  • Loading branch information
vezhnick authored and copybara-github committed Dec 14, 2023
1 parent 925c473 commit c5e6260
Showing 1 changed file with 13 additions and 18 deletions.
31 changes: 13 additions & 18 deletions concordia/components/agent/plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,13 @@ def update(self):
)
memories = '\n'.join(memories)

components = '\n'.join(
[
f"{self._agent_name}'s "
+ (construct.name() + ':\n' + construct.state())
for construct in self._components
]
components = '\n'.join([
f"{self._agent_name}'s {construct.name()}:\n{construct.state()}"
for construct in self._components
])

in_context_example = (
'Please format the plan like in this example: [21:00 - 22:00] watch TV'
)

prompt = interactive_document.InteractiveDocument(self._model)
Expand All @@ -116,30 +117,24 @@ def update(self):
prompt.statement(f'Current plan: {self._current_plan}')
prompt.statement(f'Current situation: {observation}')
should_replan = prompt.yes_no_question(
(
f'Given the above, should {self._agent_name} change their current '
+ 'plan?'
)
f'Given the above, should {self._agent_name} change their current '
'plan? '
)

if should_replan or not self._state:
goal_mention = '.'
if self._goal_component:
goal_mention = ', keep in mind the goal.'
self._current_plan = prompt.open_question(
f"What is {self._agent_name}'s plan for {self._timescale}? Please,"
f"Write {self._agent_name}'s plan for {self._timescale}? Please,"
f' provide a {self._time_adverb} schedule'
+ goal_mention,
+ goal_mention + in_context_example,
max_characters=1200,
max_tokens=1200,
terminators=(),
)
if self._goal_component:
self._state = (
f'The goal: {self._goal_component.state()}\n{self._current_plan}'
)
else:
self._state = self._current_plan

self._state = self._current_plan

if self._verbose:
self._log('\n' + prompt.view().text() + '\n')

0 comments on commit c5e6260

Please sign in to comment.