Toggle Menu
Prev Up Next

# `langchain_community.callbacks.utils`.BaseMetadataCallbackHandler

class langchain_community.callbacks.utils.BaseMetadataCallbackHandler

  Handle the metadata and associated function states for callbacks.

  step

    The current step.

    Type

      int

  starts

    The number of times the start method has been called.

    Type

      int

  ends

    The number of times the end method has been called.

    Type

      int

  errors

    The number of times the error method has been called.

    Type

      int

  text_ctr

    The number of times the text method has been called.

    Type

      int

  ignore_llm_

    Whether to ignore llm callbacks.

    Type

      bool

  ignore_chain_

    Whether to ignore chain callbacks.

    Type

      bool

  ignore_agent_

    Whether to ignore agent callbacks.

    Type

      bool

  ignore_retriever_

    Whether to ignore retriever callbacks.

    Type

      bool

  always_verbose_

    Whether to always be verbose.

    Type

      bool

  chain_starts

    The number of times the chain start method has been called.

    Type

      int

  chain_ends

    The number of times the chain end method has been called.

    Type

      int

  llm_starts

    The number of times the llm start method has been called.

    Type

      int

  llm_ends

    The number of times the llm end method has been called.

    Type

      int

  llm_streams

    The number of times the text method has been called.

    Type

      int

  tool_starts

    The number of times the tool start method has been called.

    Type

      int

  tool_ends

    The number of times the tool end method has been called.

    Type

      int

  agent_ends

    The number of times the agent end method has been called.

    Type

      int

  on_llm_start_records

    A list of records of the on_llm_start method.

    Type

      list

  on_llm_token_records

    A list of records of the on_llm_token method.

    Type

      list

  on_llm_end_records

    A list of records of the on_llm_end method.

    Type

      list

  on_chain_start_records

    A list of records of the on_chain_start method.

    Type

      list

  on_chain_end_records

    A list of records of the on_chain_end method.

    Type

      list

  on_tool_start_records

    A list of records of the on_tool_start method.

    Type

      list

  on_tool_end_records

    A list of records of the on_tool_end method.

    Type

      list

  on_agent_finish_records

    A list of records of the on_agent_end method.

    Type

      list

  Attributes

  `always_verbose` | Whether to call verbose callbacks even if verbose is False.
  `ignore_agent` | Whether to ignore agent callbacks.
  `ignore_chain` | Whether to ignore chain callbacks.
  `ignore_llm` | Whether to ignore LLM callbacks.

  Methods

  `__init__`() |
  `get_custom_callback_meta`() |
  `reset_callback_meta`() | Reset the callback metadata.

  __init__() → None
    Return type

      None

  get_custom_callback_meta() → Dict[str, Any]
    Return type

      Dict[str, Any]

  reset_callback_meta() → None

    Reset the callback metadata.

    Return type

      None