Home / Class/ RunEvalConfig Class — langchain Architecture

RunEvalConfig Class — langchain Architecture

Architecture documentation for the RunEvalConfig class in config.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  660299c8_978f_055e_c167_5636f232f62a["RunEvalConfig"]
  5528a09f_3682_a8b0_958b_cd9a898b6e3c["SingleKeyEvalConfig"]
  660299c8_978f_055e_c167_5636f232f62a -->|extends| 5528a09f_3682_a8b0_958b_cd9a898b6e3c
  3f727cf4_38d7_5e57_1492_800220e6e9f9["EvalConfig"]
  660299c8_978f_055e_c167_5636f232f62a -->|extends| 3f727cf4_38d7_5e57_1492_800220e6e9f9
  47293a9b_cea7_3396_d2ae_5ae17921131c["ScoreString"]
  660299c8_978f_055e_c167_5636f232f62a -->|extends| 47293a9b_cea7_3396_d2ae_5ae17921131c
  ba7f9415_541a_d99f_0400_a688a10212b0["config.py"]
  660299c8_978f_055e_c167_5636f232f62a -->|defined in| ba7f9415_541a_d99f_0400_a688a10212b0

Relationship Graph

Source Code

libs/langchain/langchain_classic/smith/evaluation/config.py lines 84–273

class RunEvalConfig(BaseModel):
    """Configuration for a run evaluation."""

    evaluators: list[SINGLE_EVAL_CONFIG_TYPE | CUSTOM_EVALUATOR_TYPE] = Field(
        default_factory=list
    )
    """Configurations for which evaluators to apply to the dataset run.
    Each can be the string of an
    `EvaluatorType <langchain.evaluation.schema.EvaluatorType>`, such
    as `EvaluatorType.QA`, the evaluator type string ("qa"), or a configuration for a
    given evaluator
    (e.g.,
    `RunEvalConfig.QA <langchain.smith.evaluation.config.RunEvalConfig.QA>`)."""
    custom_evaluators: list[CUSTOM_EVALUATOR_TYPE] | None = None
    """Custom evaluators to apply to the dataset run."""
    batch_evaluators: list[BATCH_EVALUATOR_LIKE] | None = None
    """Evaluators that run on an aggregate/batch level.

    These generate one or more metrics that are assigned to the full test run.
    As a result, they are not associated with individual traces.
    """

    reference_key: str | None = None
    """The key in the dataset run to use as the reference string.
    If not provided, we will attempt to infer automatically."""
    prediction_key: str | None = None
    """The key from the traced run's outputs dictionary to use to
    represent the prediction. If not provided, it will be inferred
    automatically."""
    input_key: str | None = None
    """The key from the traced run's inputs dictionary to use to represent the
    input. If not provided, it will be inferred automatically."""
    eval_llm: BaseLanguageModel | None = None
    """The language model to pass to any evaluators that require one."""

    model_config = ConfigDict(
        arbitrary_types_allowed=True,
    )

    class Criteria(SingleKeyEvalConfig):
        """Configuration for a reference-free criteria evaluator.

        Attributes:
            criteria: The criteria to evaluate.
            llm: The language model to use for the evaluation chain.
        """

        criteria: CRITERIA_TYPE | None = None
        llm: BaseLanguageModel | None = None
        evaluator_type: EvaluatorType = EvaluatorType.CRITERIA

    class LabeledCriteria(SingleKeyEvalConfig):
        """Configuration for a labeled (with references) criteria evaluator.

        Attributes:
            criteria: The criteria to evaluate.
            llm: The language model to use for the evaluation chain.
        """

        criteria: CRITERIA_TYPE | None = None
        llm: BaseLanguageModel | None = None
        evaluator_type: EvaluatorType = EvaluatorType.LABELED_CRITERIA

    class EmbeddingDistance(SingleKeyEvalConfig):
        """Configuration for an embedding distance evaluator.

        Attributes:
            embeddings: The embeddings to use for computing the distance.
            distance_metric: The distance metric to use for computing the distance.
        """

        evaluator_type: EvaluatorType = EvaluatorType.EMBEDDING_DISTANCE
        embeddings: Embeddings | None = None
        distance_metric: EmbeddingDistanceEnum | None = None

        model_config = ConfigDict(
            arbitrary_types_allowed=True,
        )

    class StringDistance(SingleKeyEvalConfig):
        """Configuration for a string distance evaluator.

Frequently Asked Questions

What is the RunEvalConfig class?
RunEvalConfig is a class in the langchain codebase, defined in libs/langchain/langchain_classic/smith/evaluation/config.py.
Where is RunEvalConfig defined?
RunEvalConfig is defined in libs/langchain/langchain_classic/smith/evaluation/config.py at line 84.
What does RunEvalConfig extend?
RunEvalConfig extends SingleKeyEvalConfig, EvalConfig, ScoreString.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free