Skip to content

Commit

Permalink
allow formative memories to include specific memories as part of the …
Browse files Browse the repository at this point in the history
…player config

PiperOrigin-RevId: 587716912
Change-Id: Ia013dd77fe7d1bda5a633e4b465079de67d04318
  • Loading branch information
jzleibo authored and copybara-github committed Dec 4, 2023
1 parent e045684 commit 1bf3281
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions concordia/associative_memory/formative_memories.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class AgentConfig:
traits: any traits to use while generating formative memories. For example,
big five.
context: agent formative memories will be generated with this context
specific_memories: inject these specific memories. Split memories at newline
characters. Can be left blank if not used.
goal: defines agents goal. Can be left blank if not used.
date_of_birth: the date of birth for the agent.
formative_ages: ages at which the formative episodes will be created
Expand All @@ -54,6 +56,7 @@ class AgentConfig:
gender: str
traits: str
context: str = ''
specific_memories: str = ''
goal: str = ''
date_of_birth: datetime.datetime = DEFAULT_DOB
formative_ages: Iterable[int] = DEFAULT_FORMATIVE_AGES
Expand Down Expand Up @@ -152,6 +155,12 @@ def make_memories(
if item:
mem.add(item, importance=1.0)

if agent_config.specific_memories:
specific_memories = agent_config.specific_memories.split('\n')
for item in specific_memories:
if item:
mem.add(item, importance=1.0)

return mem

def add_memories(
Expand Down

0 comments on commit 1bf3281

Please sign in to comment.