Skip to content

Commit

Permalink
shorten tokens
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 588770633
Change-Id: Id15b4e0c345cd5c65d1e866e46d51c563d74dda7
  • Loading branch information
vezhnick authored and copybara-github committed Dec 7, 2023
1 parent 393c48c commit a96b8de
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 19 deletions.
8 changes: 4 additions & 4 deletions concordia/associative_memory/formative_memories.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ def make_backstory(
question += f'Take into account the following context: {context}'
result = prompt.open_question(
question,
max_characters=8000,
max_tokens=8000,
max_characters=4000,
max_tokens=4000,
terminators=[],
)
result = re.sub(r'\.\s', '.\n', result)
Expand Down Expand Up @@ -204,8 +204,8 @@ def add_memories(

episode = prompt.open_question(
question,
max_characters=8000,
max_tokens=8000,
max_characters=4000,
max_tokens=4000,
terminators=[],
)
memory.add(
Expand Down
4 changes: 2 additions & 2 deletions concordia/components/agent/reflection.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def update(self) -> None:
f' answer about {self._agent_name}?'
),
]),
max_characters=5000,
max_characters=4000,
max_tokens=5000,
terminators=(),
)
Expand All @@ -105,7 +105,7 @@ def update(self) -> None:
' statements?'
),
]),
max_characters=5000,
max_characters=4000,
max_tokens=5000,
terminators=(),
)
Expand Down
4 changes: 2 additions & 2 deletions examples/cyberball/cyberball.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@
" f'Sequence of events:\\n{detailed_story}'+\n",
" '\\nNarratively summarize the above temporally ordered ' +\n",
" 'sequence of events. Write it as a news report. Summary:\\n',\n",
" max_characters=8000, max_tokens=8000, terminators=())\n",
" max_characters=4000, max_tokens=4000, terminators=())\n",
"print(episode_summary)"
]
},
Expand All @@ -788,7 +788,7 @@
" f'Sequence of events that happened to {name}:\\n{detailed_story}'\n",
" '\\nWrite a short story that summarises these events.\\n'\n",
" ,\n",
" max_characters=8000, max_tokens=8000, terminators=())\n",
" max_characters=4000, max_tokens=4000, terminators=())\n",
"\n",
" all_player_mem = player._memory.retrieve_recent(k=1000, add_time=True)\n",
" all_player_mem = ['Summary:', summary, 'Memories:'] + all_player_mem\n",
Expand Down
4 changes: 2 additions & 2 deletions examples/magic_beans_for_sale.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@
" f'Sequence of events:\\n{detailed_story}'+\n",
" '\\nNarratively summarize the above temporally ordered ' +\n",
" 'sequence of events. Write it as a news report. Summary:\\n',\n",
" max_characters=8000, max_tokens=8000, terminators=())\n",
" max_characters=4000, max_tokens=4000, terminators=())\n",
"print(episode_summary)"
]
},
Expand All @@ -746,7 +746,7 @@
" f'Sequence of events that happened to {name}:\\n{detailed_story}'\n",
" '\\nWrite a short story that summarises these events.\\n'\n",
" ,\n",
" max_characters=8000, max_tokens=8000, terminators=())\n",
" max_characters=4000, max_tokens=4000, terminators=())\n",
"\n",
" all_player_mem = player._memory.retrieve_recent(k=1000, add_time=True)\n",
" all_player_mem = ['Summary:', summary, 'Memories:'] + all_player_mem\n",
Expand Down
4 changes: 2 additions & 2 deletions examples/phone/calendar.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@
" f'Sequence of events:\\n{detailed_story}'+\n",
" '\\nNarratively summarize the above temporally ordered ' +\n",
" 'sequence of events. Write it as a news report. Summary:\\n',\n",
" max_characters=8000, max_tokens=8000, terminators=())\n",
" max_characters=4000, max_tokens=4000, terminators=())\n",
"print(episode_summary)"
]
},
Expand All @@ -559,7 +559,7 @@
" f'Sequence of events that happened to {name}:\\n{detailed_story}'\n",
" '\\nWrite a short story that summarises these events.\\n'\n",
" ,\n",
" max_characters=8000, max_tokens=8000, terminators=())\n",
" max_characters=4000, max_tokens=4000, terminators=())\n",
"\n",
" all_player_mem = player._memory.retrieve_recent(k=1000, add_time=True)\n",
" all_player_mem = ['Summary:', summary, 'Memories:'] + all_player_mem\n",
Expand Down
6 changes: 3 additions & 3 deletions examples/three_key_questions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
"outputs": [],
"source": [
"#@title Importance models\n",
"importance_model = importance_function.AgentImportanceModel(model)\n",
"importance_model = importance_function.ConstantImportanceModel(model)\n",
"importance_model_gm = importance_function.ConstantImportanceModel()\n"
]
},
Expand Down Expand Up @@ -671,7 +671,7 @@
" f'Sequence of events:\\n{detailed_story}'+\n",
" '\\nNarratively summarize the above temporally ordered ' +\n",
" 'sequence of events. Write it as a news report. Summary:\\n',\n",
" max_characters=8000, max_tokens=8000, terminators=())\n",
" max_characters=4000, max_tokens=4000, terminators=())\n",
"print(episode_summary)"
]
},
Expand All @@ -695,7 +695,7 @@
" f'Sequence of events that happened to {name}:\\n{detailed_story}'\n",
" '\\nWrite a short story that summarises these events.\\n'\n",
" ,\n",
" max_characters=8000, max_tokens=8000, terminators=())\n",
" max_characters=4000, max_tokens=4000, terminators=())\n",
"\n",
" all_player_mem = player._memory.retrieve_recent(k=1000, add_time=True)\n",
" all_player_mem = ['Summary:', summary, 'Memories:'] + all_player_mem\n",
Expand Down
4 changes: 2 additions & 2 deletions examples/village/day_in_riverbend.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@
" f'Sequence of events:\\n{detailed_story}'+\n",
" '\\nNarratively summarize the above temporally ordered ' +\n",
" 'sequence of events. Write it as a news report. Summary:\\n',\n",
" max_characters=8000, max_tokens=8000, terminators=())\n",
" max_characters=4000, max_tokens=4000, terminators=())\n",
"print(episode_summary)"
]
},
Expand All @@ -717,7 +717,7 @@
" f'Sequence of events that happened to {name}:\\n{detailed_story}'\n",
" '\\nWrite a short story that summarises these events.\\n'\n",
" ,\n",
" max_characters=8000, max_tokens=8000, terminators=())\n",
" max_characters=4000, max_tokens=4000, terminators=())\n",
"\n",
" all_player_mem = player._memory.retrieve_recent(k=1000, add_time=True)\n",
" all_player_mem = ['Summary:', summary, 'Memories:'] + all_player_mem\n",
Expand Down
4 changes: 2 additions & 2 deletions examples/village/riverbend_elections.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@
" f'Sequence of events:\\n{detailed_story}'+\n",
" '\\nNarratively summarize the above temporally ordered ' +\n",
" 'sequence of events. Write it as a news report. Summary:\\n',\n",
" max_characters=8000, max_tokens=8000, terminators=())\n",
" max_characters=4000, max_tokens=4000, terminators=())\n",
"print(episode_summary)"
]
},
Expand All @@ -797,7 +797,7 @@
" f'Sequence of events that happened to {name}:\\n{detailed_story}'\n",
" '\\nWrite a short story that summarises these events.\\n'\n",
" ,\n",
" max_characters=8000, max_tokens=8000, terminators=())\n",
" max_characters=4000, max_tokens=4000, terminators=())\n",
"\n",
" all_player_mem = player._memory.retrieve_recent(k=1000, add_time=True)\n",
" all_player_mem = ['Summary:', summary, 'Memories:'] + all_player_mem\n",
Expand Down

0 comments on commit a96b8de

Please sign in to comment.