LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
    • Overview
    • Caches
    • Callbacks
    • Documents
    • Document loaders
    • Embeddings
    • Exceptions
    • Language models
    • Serialization
    • Output parsers
    • Prompts
    • Rate limiters
    • Retrievers
    • Runnables
    • Utilities
    • Vector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    OverviewCachesCallbacksDocumentsDocument loadersEmbeddingsExceptionsLanguage modelsSerializationOutput parsersPromptsRate limitersRetrieversRunnablesUtilitiesVector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    Language
    Theme
    Pythonlangchain-coretracersevaluationEvaluatorCallbackHandler
    Class●Since v0.1

    EvaluatorCallbackHandler

    Tracer that runs a run evaluator whenever a run is persisted.

    Copy
    EvaluatorCallbackHandler(
      self,
      evaluators: Sequence[langsmith.RunEvaluator],
      client: langsmith.Client | None = None,
      example_id: UUID | str | None = None,
      skip_unfinished: bool = True,
      project_name: str | None = 'evaluators',
      max_concurrency: int | None = None,
      **kwargs: Any = {}
    )

    Bases

    BaseTracer

    Parameters

    NameTypeDescription
    evaluators*Sequence[langsmith.RunEvaluator]

    The run evaluators to apply to all top level runs.

    clientlangsmith.Client | None
    Default:None

    The LangSmith client instance to use for evaluating the runs.

    If not specified, a new instance will be created.

    example_idUUID | str | None
    Default:None

    The example ID to be associated with the runs.

    skip_unfinishedbool
    Default:True

    Whether to skip unfinished runs.

    project_namestr | None
    Default:'evaluators'

    The LangSmith project name to be organize eval chain runs under.

    max_concurrencyint | None
    Default:None

    The maximum number of concurrent evaluators to run.

    Constructors

    constructor
    __init__
    NameType
    evaluatorsSequence[langsmith.RunEvaluator]
    clientlangsmith.Client | None
    example_idUUID | str | None
    skip_unfinishedbool
    project_namestr | None
    max_concurrencyint | None

    Attributes

    attribute
    name: str
    attribute
    example_id: UUID | None

    The example ID associated with the runs.

    attribute
    client: langsmith.Client

    The LangSmith client instance used for evaluating the runs.

    attribute
    evaluators: Sequence[langsmith.RunEvaluator]

    The sequence of run evaluators to be executed.

    attribute
    executor: ThreadPoolExecutor | None

    The thread pool executor used for running the evaluators.

    attribute
    futures: weakref.WeakSet[Future]

    The set of futures representing the running evaluators.

    attribute
    skip_unfinished: bool

    Whether to skip runs that are not finished or raised an error.

    attribute
    project_name: str | None

    The LangSmith project name to be organize eval chain runs under.

    attribute
    logged_eval_results: dict[tuple[str, str], list[EvaluationResult]]
    attribute
    lock: threading.Lock

    Methods

    method
    wait_for_futures

    Wait for all futures to complete.

    Inherited fromBaseTracer

    Methods

    Mon_chat_model_start
    —

    Start a trace for a chat model run.

    Mon_llm_start
    —

    Start a trace for a (non-chat model) LLM run.

    Mon_llm_new_token
    —

    Run on new output token.

    Mon_retry
    —

    Run on retry.

    Mon_llm_end
    —

    End a trace for a model run.

    Mon_llm_error
    —

    Handle an error for an LLM run.

    Mon_chain_start
    —

    Start a trace for a chain run.

    Mon_chain_end
    —

    End a trace for a chain run.

    Mon_chain_error
    —

    Handle an error for a chain run.

    Mon_tool_start
    —

    Start a trace for a tool run.

    Mon_tool_end
    —

    End a trace for a tool run.

    Mon_tool_error
    —

    Run when tool errors.

    Mon_retriever_start
    —

    Run when Retriever starts running.

    Mon_retriever_error
    —

    Run when Retriever errors.

    Mon_retriever_end
    —

    Run when Retriever ends running.

    Inherited fromBaseCallbackHandler

    Attributes

    Araise_error: bool
    —

    Whether to raise an error if an exception occurs.

    Arun_inline: boolAignore_llm: bool
    —

    Whether to ignore LLM callbacks.

    Aignore_retry: bool
    —

    Whether to ignore retry callbacks.

    Aignore_chain: bool
    —

    Whether to ignore chain callbacks.

    Aignore_agent: bool
    —

    Whether to ignore agent callbacks.

    Aignore_retriever: bool
    —

    Whether to ignore retriever callbacks.

    Aignore_chat_model: bool
    —

    Whether to ignore chat model callbacks.

    Aignore_custom_event: bool
    —

    Ignore custom event.

    Inherited fromLLMManagerMixin

    Methods

    Mon_llm_new_token
    —

    Run on new output token.

    Mon_llm_end
    —

    End a trace for a model run.

    Mon_llm_error
    —

    Handle an error for an LLM run.

    Inherited fromChainManagerMixin

    Methods

    Mon_chain_end
    —

    End a trace for a chain run.

    Mon_chain_error
    —

    Handle an error for a chain run.

    Mon_agent_action
    —

    Run on agent action.

    Mon_agent_finish
    —

    Run on the agent end.

    Inherited fromToolManagerMixin

    Methods

    Mon_tool_end
    —

    End a trace for a tool run.

    Mon_tool_error
    —

    Run when tool errors.

    Inherited fromRetrieverManagerMixin

    Methods

    Mon_retriever_error
    —

    Run when Retriever errors.

    Mon_retriever_end
    —

    Run when Retriever ends running.

    Inherited fromCallbackManagerMixin

    Methods

    Mon_llm_start
    —

    Start a trace for a (non-chat model) LLM run.

    Mon_chat_model_start
    —

    Start a trace for a chat model run.

    Mon_retriever_start
    —

    Run when Retriever starts running.

    Mon_chain_start
    —

    Start a trace for a chain run.

    Mon_tool_start
    —

    Start a trace for a tool run.

    Inherited fromRunManagerMixin

    Methods

    Mon_text
    —

    Run on an arbitrary text.

    Mon_retry
    —

    Run on retry.

    Mon_custom_event
    —

    Generate a custom astream event.

    View source on GitHub