Home / File/ __init__.py — langchain Source File

__init__.py — langchain Source File

Architecture documentation for __init__.py, a python file in the langchain codebase. 1 imports, 0 dependents.

File python 1 imports

Entity Profile

Dependency Diagram

graph LR
  de940754_6592_b7c9_1f1c_d4aa83dcd660["__init__.py"]
  ffbb5555_bdc4_8cc0_3d6d_348e198d7a93["langchain_classic.evaluation.comparison.eval_chain"]
  de940754_6592_b7c9_1f1c_d4aa83dcd660 --> ffbb5555_bdc4_8cc0_3d6d_348e198d7a93
  style de940754_6592_b7c9_1f1c_d4aa83dcd660 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

r"""Comparison evaluators.

This module contains evaluators for comparing the output of two models,
be they LLMs, Chains, or otherwise. This can be used for scoring
preferences, measuring similarity / semantic equivalence between outputs,
or any other comparison task.

Example:
    >>> from langchain_openai import ChatOpenAI
    >>> from langchain_classic.evaluation.comparison import PairwiseStringEvalChain
    >>> llm = ChatOpenAI(temperature=0)
    >>> chain = PairwiseStringEvalChain.from_llm(llm=llm)
    >>> result = chain.evaluate_string_pairs(
    ...     input = "What is the chemical formula for water?",
    ...     prediction = "H2O",
    ...     prediction_b = (
    ...        "The chemical formula for water is H2O, which means"
    ...        " there are two hydrogen atoms and one oxygen atom."
    ...     reference = "The chemical formula for water is H2O.",
    ... )
    >>> print(result)
    # {
    #    "value": "B",
    #    "comment": "Both responses accurately state"
    #       " that the chemical formula for water is H2O."
    #       " However, Response B provides additional information"
    # .     " by explaining what the formula means.\n[[B]]"
    # }
"""

from langchain_classic.evaluation.comparison.eval_chain import (
    LabeledPairwiseStringEvalChain,
    PairwiseStringEvalChain,
)

__all__ = ["LabeledPairwiseStringEvalChain", "PairwiseStringEvalChain"]

Dependencies

  • langchain_classic.evaluation.comparison.eval_chain

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.comparison.eval_chain.
Where is __init__.py in the architecture?
__init__.py is located at libs/langchain/langchain_classic/evaluation/comparison/__init__.py (directory: libs/langchain/langchain_classic/evaluation/comparison).

Analyze Your Own Codebase

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

Try Supermodel Free