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],
      financial: bool = False,
      name: str = 'Inventory',
      verbose: bool = False,
  ):
    """Initialize a grounded inventory component tracking objects in python.

    This component tracks physical objects that agents can possess. Agents can
    only exchange these objects with other named individuals. They cannot create
    or destroy these objects. They cannot trade with unnamed characters (NPCs)
    and they cannot do things like trade money for information.

    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.
      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".
      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._financial = financial
    self._clock_now = clock_now
    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._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._history = []
    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 = {}

    def check_if_count_noun(item_type):
      self._is_count_noun[item_type] = helper_functions.is_count_noun(
          item_type, self._model
      )
      return

    with concurrent.futures.ThreadPoolExecutor(
        max_workers=len(self._item_types)
    ) as executor:
      executor.map(check_if_count_noun, self._item_types)

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

    This component tracks physical objects that agents can possess. Agents can
    only exchange these objects with other named individuals. They cannot create
    or destroy these objects. They cannot trade with unnamed characters (NPCs)
    and they cannot do things like trade money for information.

    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.
      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".
      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/contrib/components/game_master/deprecated/restricted_inventory.py