def __init__(
      self,
      model: language_model.LanguageModel,
      memory: associative_memory.AssociativeMemory,
      item_type_configs: Sequence[ItemTypeConfig],
      players: Sequence[deprecated_agent.BasicAgent | entity_agent.EntityAgent],
      player_initial_endowments: dict[str, dict[str, float]],
      clock_now: Callable[[], datetime.datetime],
      chain_of_thought_prefix: str = _DEFAULT_CHAIN_OF_THOUGHT_PREFIX,
      financial: bool = False,
      never_increase: bool = False,
      name: str = 'Inventory',
      verbose: bool = False,
  ):
    """Initialize a grounded inventory component tracking objects in python.

    Args:
      model: a language model
      memory: an associative memory
      item_type_configs: sequence of item type configurations
      players: sequence of players who have an inventory and will observe it.
      player_initial_endowments: dict mapping player name to a dictionary with
        item types as keys and initial endownments as values.
      clock_now: Function to call to get current time.
      chain_of_thought_prefix: include this string in context before all
        reasoning steps for handling the inventory.
      financial: If set to True then include special questions to handle the
        fact that agents typically say "Alice bought (or sold) X" which is a
        different way of speaking than "Alice exchanged X for Y".
      never_increase: If set to True then this component never increases the
        amount of any item. Events where an item would have been gained lead to
        no change in the inventory and the game master instead invents a reason
        for why the item was not gained.
      name: the name of this component e.g. Possessions, Account, Property, etc
      verbose: whether to print the full update chain of thought or not
    """
    self._model = model
    self._memory = memory
    self._players = players
    self._player_initial_endowments = player_initial_endowments
    self._chain_of_thought_prefix = chain_of_thought_prefix
    self._financial = financial
    self._clock_now = clock_now
    self._never_increase = never_increase
    self._name = name
    self._verbose = verbose

    self._item_types = [config.name for config in item_type_configs]
    self._item_types_dict = {
        config.name: config for config in item_type_configs
    }
    self._player_names = list(player_initial_endowments.keys())
    self._names_to_players = {player.name: player for player in self._players}

    self._inventories = {}
    for player_name, endowment in player_initial_endowments.items():
      self._inventories[player_name] = {
          item_type: endowment.get(item_type, _DEFAULT_QUANTITY)
          for item_type in self._item_types
      }

    self._latest_update_log = None
    self._state = ''
    self._partial_states = {name: '' for name in self._player_names}

    # Determine if each item type is a count noun or a mass noun.
    self._is_count_noun = {}
    self._lock = threading.Lock()

    self._is_count_noun = concurrency.run_tasks({
        item_type: functools.partial(
            helper_functions.is_count_noun, item_type, self._model
        )
        for item_type in self._item_types
    })

    # Set the initial state's string representation.
    self.update()
Initialize a grounded inventory component tracking objects in python.

    Args:
      model: a language model
      memory: an associative memory
      item_type_configs: sequence of item type configurations
      players: sequence of players who have an inventory and will observe it.
      player_initial_endowments: dict mapping player name to a dictionary with
        item types as keys and initial endownments as values.
      clock_now: Function to call to get current time.
      chain_of_thought_prefix: include this string in context before all
        reasoning steps for handling the inventory.
      financial: If set to True then include special questions to handle the
        fact that agents typically say "Alice bought (or sold) X" which is a
        different way of speaking than "Alice exchanged X for Y".
      never_increase: If set to True then this component never increases the
        amount of any item. Events where an item would have been gained lead to
        no change in the inventory and the game master instead invents a reason
        for why the item was not gained.
      name: the name of this component e.g. Possessions, Account, Property, etc
      verbose: whether to print the full update chain of thought or not
    
concordia/components/game_master/deprecated/inventory.py