def get_shared_memories_and_context(
    model: language_model.LanguageModel,
    sampled_settings: Any,
) -> tuple[Sequence[str], str]:
  """Return the shared memories and context for all agents and game master."""
  shared_memories = sampled_settings.world_elements

  # The shared context will be used for the NPC context. It reflects general
  # knowledge and is possessed by all characters.
  shared_context = model.sample_text(
      'Summarize the following passage in a concise and insightful fashion.\n'
      + f'The year is {sampled_settings.year}. '
      + f'The location is {sampled_settings.location}.\n'
      + '\nContext:\n'
      + '\n'.join(shared_memories)
      + '\n'
      + 'Summary:'
  )
  return shared_memories, shared_context
Return the shared memories and context for all agents and game master.
examples/deprecated/modular/environment/labor_collective_action.py