schema.py — langchain Source File
Architecture documentation for schema.py, a python file in the langchain codebase. 10 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR a2c62b27_0460_ffb8_0590_ee64d9a3f350["schema.py"] 2a7f66a7_8738_3d47_375b_70fcaa6ac169["logging"] a2c62b27_0460_ffb8_0590_ee64d9a3f350 --> 2a7f66a7_8738_3d47_375b_70fcaa6ac169 cccbe73e_4644_7211_4d55_e8fb133a8014["abc"] a2c62b27_0460_ffb8_0590_ee64d9a3f350 --> cccbe73e_4644_7211_4d55_e8fb133a8014 cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7["collections.abc"] a2c62b27_0460_ffb8_0590_ee64d9a3f350 --> cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7 b188e880_71c6_b93e_127d_c22666293d37["enum"] a2c62b27_0460_ffb8_0590_ee64d9a3f350 --> b188e880_71c6_b93e_127d_c22666293d37 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3["typing"] a2c62b27_0460_ffb8_0590_ee64d9a3f350 --> 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3 0c635125_6987_b8b3_7ff7_d60249aecde7["warnings"] a2c62b27_0460_ffb8_0590_ee64d9a3f350 --> 0c635125_6987_b8b3_7ff7_d60249aecde7 80d582c5_7cc3_ac96_2742_3dbe1cbd4e2b["langchain_core.agents"] a2c62b27_0460_ffb8_0590_ee64d9a3f350 --> 80d582c5_7cc3_ac96_2742_3dbe1cbd4e2b ba43b74d_3099_7e1c_aac3_cf594720469e["langchain_core.language_models"] a2c62b27_0460_ffb8_0590_ee64d9a3f350 --> ba43b74d_3099_7e1c_aac3_cf594720469e 2971f9da_6393_a3e3_610e_ace3d35ee978["langchain_core.runnables.config"] a2c62b27_0460_ffb8_0590_ee64d9a3f350 --> 2971f9da_6393_a3e3_610e_ace3d35ee978 01158a5b_b299_f45d_92e9_2a7433a1a91a["langchain_classic.chains.base"] a2c62b27_0460_ffb8_0590_ee64d9a3f350 --> 01158a5b_b299_f45d_92e9_2a7433a1a91a style a2c62b27_0460_ffb8_0590_ee64d9a3f350 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"""Interfaces to be implemented by general evaluators."""
from __future__ import annotations
import logging
from abc import ABC, abstractmethod
from collections.abc import Sequence
from enum import Enum
from typing import Any
from warnings import warn
from langchain_core.agents import AgentAction
from langchain_core.language_models import BaseLanguageModel
from langchain_core.runnables.config import run_in_executor
from langchain_classic.chains.base import Chain
logger = logging.getLogger(__name__)
class EvaluatorType(str, Enum):
"""The types of the evaluators."""
QA = "qa"
"""Question answering evaluator, which grades answers to questions
directly using an LLM."""
COT_QA = "cot_qa"
"""Chain of thought question answering evaluator, which grades
answers to questions using
chain of thought 'reasoning'."""
CONTEXT_QA = "context_qa"
"""Question answering evaluator that incorporates 'context' in the response."""
PAIRWISE_STRING = "pairwise_string"
"""The pairwise string evaluator, which predicts the preferred prediction from
between two models."""
SCORE_STRING = "score_string"
"""The scored string evaluator, which gives a score between 1 and 10
to a prediction."""
LABELED_PAIRWISE_STRING = "labeled_pairwise_string"
"""The labeled pairwise string evaluator, which predicts the preferred prediction
from between two models based on a ground truth reference label."""
LABELED_SCORE_STRING = "labeled_score_string"
"""The labeled scored string evaluator, which gives a score between 1 and 10
to a prediction based on a ground truth reference label."""
AGENT_TRAJECTORY = "trajectory"
"""The agent trajectory evaluator, which grades the agent's intermediate steps."""
CRITERIA = "criteria"
"""The criteria evaluator, which evaluates a model based on a
custom set of criteria without any reference labels."""
LABELED_CRITERIA = "labeled_criteria"
"""The labeled criteria evaluator, which evaluates a model based on a
custom set of criteria, with a reference label."""
STRING_DISTANCE = "string_distance"
"""Compare predictions to a reference answer using string edit distances."""
EXACT_MATCH = "exact_match"
"""Compare predictions to a reference answer using exact matching."""
REGEX_MATCH = "regex_match"
"""Compare predictions to a reference answer using regular expressions."""
PAIRWISE_STRING_DISTANCE = "pairwise_string_distance"
"""Compare predictions based on string edit distances."""
// ... (448 more lines)
Domain
Subdomains
Classes
Dependencies
- abc
- collections.abc
- enum
- langchain_classic.chains.base
- langchain_core.agents
- langchain_core.language_models
- langchain_core.runnables.config
- logging
- typing
- warnings
Source
Frequently Asked Questions
What does schema.py do?
schema.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, MessageSchema subdomain.
What does schema.py depend on?
schema.py imports 10 module(s): abc, collections.abc, enum, langchain_classic.chains.base, langchain_core.agents, langchain_core.language_models, langchain_core.runnables.config, logging, and 2 more.
Where is schema.py in the architecture?
schema.py is located at libs/langchain/langchain_classic/evaluation/schema.py (domain: CoreAbstractions, subdomain: MessageSchema, directory: libs/langchain/langchain_classic/evaluation).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free