__init__.py — langchain Source File
Architecture documentation for __init__.py, a python file in the langchain codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR dc9c21e1_1ac2_b238_def6_9f656b111e4c["__init__.py"] 1da1117d_34e9_b42d_751e_42edd84495a2["langchain_classic.evaluation.criteria.eval_chain"] dc9c21e1_1ac2_b238_def6_9f656b111e4c --> 1da1117d_34e9_b42d_751e_42edd84495a2 style dc9c21e1_1ac2_b238_def6_9f656b111e4c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"""Criteria or rubric based evaluators.
These evaluators are useful for evaluating the
output of a language model or chain against
specified criteria or rubric.
Classes
-------
CriteriaEvalChain : Evaluates the output of a language model or
chain against specified criteria.
Examples:
--------
Using a predefined criterion:
>>> from langchain_openai import OpenAI
>>> from langchain_classic.evaluation.criteria import CriteriaEvalChain
>>> model = OpenAI()
>>> criteria = "conciseness"
>>> chain = CriteriaEvalChain.from_llm(llm=model, criteria=criteria)
>>> chain.evaluate_strings(
prediction="The answer is 42.",
reference="42",
input="What is the answer to life, the universe, and everything?",
)
Using a custom criterion:
>>> from langchain_openai import OpenAI
>>> from langchain_classic.evaluation.criteria import LabeledCriteriaEvalChain
>>> model = OpenAI()
>>> criteria = {
"hallucination": (
"Does this submission contain information"
" not present in the input or reference?"
),
}
>>> chain = LabeledCriteriaEvalChain.from_llm(
llm=model,
criteria=criteria,
)
>>> chain.evaluate_strings(
prediction="The answer to life is 42.",
reference="It's commonly known that the answer to life is 42.",
input="Please summarize the following: The answer to life, the universe, and everything is unknowable.",
)
""" # noqa: E501
from langchain_classic.evaluation.criteria.eval_chain import (
Criteria,
CriteriaEvalChain,
LabeledCriteriaEvalChain,
)
__all__ = ["Criteria", "CriteriaEvalChain", "LabeledCriteriaEvalChain"]
Dependencies
- langchain_classic.evaluation.criteria.eval_chain
Source
Frequently Asked Questions
What does __init__.py do?
__init__.py is a source file in the langchain codebase, written in python.
What does __init__.py depend on?
__init__.py imports 1 module(s): langchain_classic.evaluation.criteria.eval_chain.
Where is __init__.py in the architecture?
__init__.py is located at libs/langchain/langchain_classic/evaluation/criteria/__init__.py (directory: libs/langchain/langchain_classic/evaluation/criteria).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free