def __init__(
      self,
      model: language_model.LanguageModel,
      item_type_configs: Sequence[ItemTypeConfig],
      player_initial_endowments: dict[str, dict[str, float]],
      clock_now: Callable[[], datetime.datetime],
      observations_component_name: str = (
          observation_component.DEFAULT_OBSERVATION_COMPONENT_KEY),
      memory_component_name: str = (
          memory_component.DEFAULT_MEMORY_COMPONENT_KEY
      ),
      chain_of_thought_prefix: str = _DEFAULT_CHAIN_OF_THOUGHT_PREFIX,
      financial: bool = False,
      never_increase: bool = False,
      pre_act_label: str = 'Inventory',
      verbose: bool = False,
  ):
    """Initialize a grounded inventory component tracking objects in python.

    Args:
      model: a language model
      item_type_configs: sequence of item type configurations
      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.
      observations_component_name: The name of the component that contains the
        observations.
      memory_component_name: The name of the memory component.
      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.
      pre_act_label: Prefix to add to the output of the component when called
        in `pre_act`.
      verbose: whether to print the full update chain of thought or not
    """
    self._pre_act_label = pre_act_label
    self._model = model
    self._observations_component_name = observations_component_name
    self._memory_component_name = memory_component_name
    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._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
      }

    # 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
    })
Initialize a grounded inventory component tracking objects in python.

    Args:
      model: a language model
      item_type_configs: sequence of item type configurations
      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.
      observations_component_name: The name of the component that contains the
        observations.
      memory_component_name: The name of the memory component.
      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.
      pre_act_label: Prefix to add to the output of the component when called
        in `pre_act`.
      verbose: whether to print the full update chain of thought or not
    
concordia/components/game_master/inventory.py