def __init__(
      self,
      model: language_model.LanguageModel,
      entity_names: Sequence[str],
      prompt: str,
      components: Sequence[str] = (),
      pre_act_label: str = '\nEntity locations',
  ):
    """Initializes the component.

    Args:
      model: The language model to use.
      entity_names: Names of entities to track locations for.
      prompt: description of all locations to be specifically represented in the
        world. This is used to prompt the model to generate concrete variables
        representing the locations and their properties (e.g. their topology). 
      components: Keys of components to condition entity locations on.
      pre_act_label: Prefix to add to the output of the component when called
        in `pre_act`.
    """
    self._pre_act_label = pre_act_label
    self._model = model
    self._entity_names = entity_names
    self._prompt = prompt
    self._components = components

    self._locations = {}
    self._entity_locations = {name: '' for name in entity_names}
    self._latest_action_spec = None

    chain_of_thought = interactive_document.InteractiveDocument(self._model)
    chain_of_thought.statement(self._prompt)
    locations_str = chain_of_thought.open_question(
        question=(
            'Given the context above, what locations are important to write '
            'down now so that they can be used later? Respond with a '
            'comma-separated list of locations using the format: '
            '"location 1|properties of location 1,'
            'location 2|properties of location 2,'
            'location 3|properties of location 3,...".'
        ),
        max_tokens=1000,
        terminators=(),
    )
    locations_and_properties = locations_str.split(',')
    for location_and_property_str in locations_and_properties:
      location_and_property = location_and_property_str.strip().split('|')
      if len(location_and_property) == 2:
        location, properties = location_and_property
        self._locations[location.strip()] = properties.strip()
Initializes the component.

    Args:
      model: The language model to use.
      entity_names: Names of entities to track locations for.
      prompt: description of all locations to be specifically represented in the
        world. This is used to prompt the model to generate concrete variables
        representing the locations and their properties (e.g. their topology). 
      components: Keys of components to condition entity locations on.
      pre_act_label: Prefix to add to the output of the component when called
        in `pre_act`.
    
concordia/components/game_master/world_state.py