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-classicchainsopenai_functions
    Module●Since v1.0

    openai_functions

    Functions

    function
    create_citation_fuzzy_match_runnable

    Create a citation fuzzy match Runnable.

    Example usage:

    from langchain_classic.chains import create_citation_fuzzy_match_runnable
    from langchain_openai import ChatOpenAI
    
    model = ChatOpenAI(model="gpt-4o-mini")
    
    context = "Alice has blue eyes. Bob has brown eyes. Charlie has green eyes."
    question = "What color are Bob's eyes?"
    
    chain = create_citation_fuzzy_match_runnable(model)
    chain.invoke({"question": question, "context": context})
    function
    get_openai_output_parser

    Get the appropriate function output parser given the user functions.

    deprecatedfunction
    create_openai_fn_chain

    [Legacy] Create an LLM chain that uses OpenAI functions.

    deprecatedfunction
    create_structured_output_chain

    [Legacy] Create an LLMChain that uses an OpenAI function to get a structured output.

    deprecatedfunction
    create_citation_fuzzy_match_chain

    Create a citation fuzzy match chain.

    deprecatedfunction
    create_extraction_chain

    Creates a chain that extracts information from a passage.

    deprecatedfunction
    create_extraction_chain_pydantic

    Creates a chain that extracts information from a passage using Pydantic schema.

    deprecatedfunction
    create_qa_with_sources_chain

    Create a question answering chain that returns an answer with sources.

    deprecatedfunction
    create_qa_with_structure_chain

    Create a question answering chain with structure.

    Create a question answering chain that returns an answer with sources based on schema.

    deprecatedfunction
    create_tagging_chain

    Create tagging chain from schema.

    Create a chain that extracts information from a passage based on a schema.

    This function is deprecated. Please use with_structured_output instead. See example usage below:

    from typing_extensions import Annotated, TypedDict
    from langchain_anthropic import ChatAnthropic
    
    class Joke(TypedDict):
        """Tagged joke."""
    
        setup: Annotated[str, ..., "The setup of the joke"]
        punchline: Annotated[str, ..., "The punchline of the joke"]
    
    # Or any other chat model that supports tools.
    # Please reference to the documentation of structured_output
    # to see an up to date list of which models support
    # with_structured_output.
    model = ChatAnthropic(model="claude-3-haiku-20240307", temperature=0)
    structured_model = model.with_structured_output(Joke)
    structured_model.invoke(
        "Why did the cat cross the road? To get to the other "
        "side... and then lay down in the middle of it!"
    )

    Read more here: https://docs.langchain.com/oss/python/langchain/models#structured-outputs

    deprecatedfunction
    create_tagging_chain_pydantic

    Create tagging chain from Pydantic schema.

    Create a chain that extracts information from a passage based on a Pydantic schema.

    This function is deprecated. Please use with_structured_output instead. See example usage below:

    from pydantic import BaseModel, Field
    from langchain_anthropic import ChatAnthropic
    
    class Joke(BaseModel):
        setup: str = Field(description="The setup of the joke")
        punchline: str = Field(description="The punchline to the joke")
    
    # Or any other chat model that supports tools.
    # Please reference to the documentation of structured_output
    # to see an up to date list of which models support
    # with_structured_output.
    model = ChatAnthropic(model="claude-opus-4-1-20250805", temperature=0)
    structured_model = model.with_structured_output(Joke)
    structured_model.invoke(
        "Why did the cat cross the road? To get to the other "
        "side... and then lay down in the middle of it!"
    )

    Read more here: https://docs.langchain.com/oss/python/langchain/models#structured-outputs

    deprecatedfunction
    create_openai_fn_runnable

    Create a runnable sequence that uses OpenAI functions.

    deprecatedfunction
    create_structured_output_runnable

    Create a runnable for extracting structured outputs.

    Modules

    module
    utils
    module
    qa_with_structure
    module
    tagging
    module
    openapi
    module
    citation_fuzzy_match
    module
    extraction
    module
    base

    Methods for creating chains that use OpenAI function-calling APIs.

    View source on GitHub