Skip to content

Commit

Permalink
Improve prompt formatting in basic_entity_agent__main_role
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 655163616
Change-Id: I06df43bab2ac4fe0e8d223c46451325c6c5443e3
  • Loading branch information
jzleibo authored and copybara-github committed Jul 23, 2024
1 parent 100a12f commit 90c4419
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
19 changes: 9 additions & 10 deletions concordia/factory/agent/basic_entity_agent__main_role.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,26 +66,28 @@ def build_agent(
logging_channel=measurements.get_channel('Instructions').on_next,
)

observation_label = '\nObservation'
observation = agent_components.observation.Observation(
clock_now=clock.now,
timeframe=clock.get_step_size(),
pre_act_key='\nObservation',
pre_act_key=observation_label,
logging_channel=measurements.get_channel('Observation').on_next,
)

observation_summary_label = '\nSummary of recent observations'
observation_summary = agent_components.observation.ObservationSummary(
model=model,
clock_now=clock.now,
timeframe_delta_from=datetime.timedelta(hours=4),
timeframe_delta_until=datetime.timedelta(hours=1),
pre_act_key='Summary of recent observations',
pre_act_key=observation_summary_label,
logging_channel=measurements.get_channel('ObservationSummary').on_next,
)
time_display = agent_components.report_function.ReportFunction(
function=clock.current_time_interval_str,
pre_act_key='\nCurrent time',
logging_channel=measurements.get_channel('TimeDisplay').on_next,
)
identity_label = '\nIdentity characteristics'
identity_characteristics = agent_components.identity.IdentityWithoutPreAct(
model=model,
logging_channel=measurements.get_channel('IdentityWithoutPreAct').on_next,
Expand All @@ -94,8 +96,7 @@ def build_agent(
f'\nQuestion: What kind of person is {agent_name}?\nAnswer')
self_perception = agent_components.self_perception.SelfPerception(
model=model,
components={_get_class_name(
identity_characteristics): 'Identity characteristics'},
components={_get_class_name(identity_characteristics): identity_label},
pre_act_key=self_perception_label,
logging_channel=measurements.get_channel('SelfPerception').on_next,
)
Expand All @@ -106,9 +107,8 @@ def build_agent(
agent_components.situation_perception.SituationPerception(
model=model,
components={
_get_class_name(observation): 'Observation',
_get_class_name(observation_summary): (
'Summary of recent observations'),
_get_class_name(observation): observation_label,
_get_class_name(observation_summary): observation_summary_label,
},
clock_now=clock.now,
pre_act_key=situation_perception_label,
Expand All @@ -133,8 +133,7 @@ def build_agent(
relevant_memories = agent_components.all_similar_memories.AllSimilarMemories(
model=model,
components={
_get_class_name(
observation_summary): 'Summary of recent observations',
_get_class_name(observation_summary): observation_summary_label,
_get_class_name(time_display): 'The current date/time is'},
num_memories_to_retrieve=10,
pre_act_key=relevant_memories_label,
Expand Down
2 changes: 0 additions & 2 deletions examples/modular/environment/london_esoteric_market_1870.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,6 @@ def configure_players() -> tuple[list[formative_memories.AgentConfig],
'coins or one laudanum bottle.'),
('Aldous is very agreeable. He will agree to almost any '
'proposal.'),
('Aldous needs cash for opium now. He wants to sell the '
'tabula smaragdina as quickly as possible'),
*supporting_player_knowledge[0]
],
'main_character': False,
Expand Down

0 comments on commit 90c4419

Please sign in to comment.