def get_shared_memories_and_context(
    model: language_model.LanguageModel,
    contestant_names: Sequence[str],
    rng: random.Random,
) -> tuple[Sequence[str], str, str]:
  """Return the shared memories and context for all agents and game master."""
  show_title_and_description, show_title = get_random_show_with_description(rng)
  all_contestants_string = _get_all_contestant_names_string(contestant_names)

  shared_memories = [
      (
          f'{all_contestants_string} are contestants on a reality show: '
          f'{show_title}. There are no other contestants besides '
          f'{all_contestants_string}.'
      ),
      show_title_and_description,
      GENERAL_BACKGROUND,
  ]

  # 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. It '
      'is OK to omit details that seem less important:\n'
      + '\n'.join(shared_memories)
      + '\n'
      + 'Summary:'
  )
  return shared_memories, shared_context, show_title
Return the shared memories and context for all agents and game master.
examples/deprecated/modular/environment/reality_show.py