LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • MCP Adapters
    • Overview
    • Agents
    • Callbacks
    • Chains
    • Chat models
    • Embeddings
    • Evaluation
    • Globals
    • Hub
    • Memory
    • Output parsers
    • Retrievers
    • Runnables
    • LangSmith
    • Storage
    Standard Tests
    Text Splitters
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    MCP Adapters
    OverviewAgentsCallbacksChainsChat modelsEmbeddingsEvaluationGlobalsHubMemoryOutput parsersRetrieversRunnablesLangSmithStorage
    Standard Tests
    Text Splitters
    Language
    Theme
    Pythonlangchain-classicmodel_laboratoryModelLaboratory
    Class●Since v1.0

    ModelLaboratory

    A utility to experiment with and compare the performance of different models.

    Copy
    ModelLaboratory(
      self,
      chains: Sequence[Chain],
      names: list[str] | None = None
    )

    Used in Docs

    • Manifest integration

    Parameters

    NameTypeDescription
    chains*Sequence[Chain]

    A sequence of chains to experiment with. Each chain must have exactly one input and one output variable.

    nameslist[str] | None
    Default:None

    Optional list of names corresponding to each chain. If provided, its length must match the number of chains.

    Constructors

    constructor
    __init__
    NameType
    chainsSequence[Chain]
    nameslist[str] | None

    Attributes

    attribute
    chains: chains
    attribute
    chain_colors
    attribute
    names: names

    Methods

    method
    from_llms

    Initialize the ModelLaboratory with LLMs and an optional prompt.

    method
    compare

    Compare model outputs on an input text.

    If a prompt was provided with starting the laboratory, then this text will be fed into the prompt. If no prompt was provided, then the input text is the entire prompt.

    View source on GitHub