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-classic

    langchain-classic

    Description

    🦜️🔗 LangChain Classic

    PyPI - Version PyPI - License PyPI - Downloads Twitter

    Looking for the JS/TS version? Check out LangChain.js.

    To help you ship LangChain apps to production faster, check out LangSmith. LangSmith is a unified developer platform for building, testing, and monitoring LLM applications.

    Quick Install

    pip install langchain-classic

    🤔 What is this?

    Legacy chains, langchain-community re-exports, indexing API, deprecated functionality, and more.

    In most cases, you should be using the main langchain package.

    📖 Documentation

    For full documentation, see the API reference. For conceptual guides, tutorials, and examples on using LangChain, see the LangChain Docs.

    📕 Releases & Versioning

    See our Releases and Versioning policies.

    💁 Contributing

    As an open-source project in a rapidly developing field, we are extremely open to contributions, whether it be in the form of a new feature, improved infrastructure, or better documentation.

    For detailed information on how to contribute, see the Contributing Guide.

    Classes

    Class

    ModelLaboratory

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

    Class

    HubRunnable

    An instance of a runnable stored in the LangChain Hub.

    Class

    OpenAIFunction

    A function description for ChatOpenAI.

    Class

    OpenAIFunctionsRouter

    A runnable that routes to the selected function.

    Class

    CacheBackedEmbeddings

    Interface for caching results from embedding models.

    Class

    EncoderBackedStore

    Wraps a store with key and value encoders/decoders.

    Class

    LocalFileStore

    BaseStore interface that works on the local file system.

    Class

    ParentDocumentRetriever

    Retrieve small chunks then retrieve their parent documents.

    Class

    SearchType

    Enumerator of the types of search to perform.

    Class

    MultiVectorRetriever

    Retriever that supports multiple embeddings per parent document.

    Class

    TimeWeightedVectorStoreRetriever

    Time Weighted Vector Store Retriever.

    Class

    EnsembleRetriever

    Retriever that ensembles the multiple retrievers.

    Class

    ContextualCompressionRetriever

    Retriever that wraps a base retriever and compresses the results.

    Class

    MergerRetriever

    Retriever that merges the results of multiple retrievers.

    Class

    LineListOutputParser

    Output parser for a list of lines.

    Class

    MultiQueryRetriever

    Given a query, use an LLM to write a set of queries.

    Class

    RePhraseQueryRetriever

    Given a query, use an LLM to re-phrase it.

    Class

    BaseCrossEncoder

    Interface for cross encoder models.

    Class

    NoOutputParser

    Parse outputs that could return a null string of some sort.

    Class

    LLMChainExtractor

    LLM Chain Extractor.

    Class

    CrossEncoderReranker

    Document compressor that uses CrossEncoder for reranking.

    Class

    LLMChainFilter

    Filter that drops documents that aren't relevant to the query.

    Class

    LLMListwiseRerank

    Document compressor that uses Zero-Shot Listwise Document Reranking.

    Class

    EmbeddingsFilter

    Embeddings Filter.

    Class

    DocumentCompressorPipeline

    Document compressor that uses a pipeline of Transformers.

    Class

    SelfQueryRetriever

    Self Query Retriever.

    Class

    RetryOutputParserRetryChainInput

    Retry chain input for RetryOutputParser.

    Class

    RetryWithErrorOutputParserRetryChainInput

    Retry chain input for RetryWithErrorOutputParser.

    Class

    RetryOutputParser

    Wrap a parser and try to fix parsing errors.

    Class

    RetryWithErrorOutputParser

    Wrap a parser and try to fix parsing errors.

    Class

    RegexDictParser

    Parse the output of an LLM call into a Dictionary using a regex.

    Class

    YamlOutputParser

    Parse YAML output using a Pydantic model.

    Class

    ResponseSchema

    Schema for a response from a structured output parser.

    Class

    StructuredOutputParser

    Parse the output of an LLM call to a structured output.

    Class

    RegexParser

    Parse the output of an LLM call using a regex.

    Class

    DatetimeOutputParser

    Parse the output of an LLM call to a datetime.

    Class

    PandasDataFrameOutputParser

    Parse an output using Pandas DataFrame format.

    Class

    CombiningOutputParser

    Combine multiple output parsers into one.

    Class

    EnumOutputParser

    Parse an output that is one of a set of values.

    Class

    OutputFixingParserRetryChainInput

    Input for the retry chain of the OutputFixingParser.

    Class

    OutputFixingParser

    Wrap a parser and try to fix parsing errors.

    Class

    BooleanOutputParser

    Parse the output of an LLM call to a boolean.

    Class

    StringRunMapper

    Extract items to evaluate from the run object.

    Class

    LLMStringRunMapper

    Extract items to evaluate from the run object.

    Class

    ChainStringRunMapper

    Extract items to evaluate from the run object from a chain.

    Class

    ToolStringRunMapper

    Map an input to the tool.

    Class

    StringExampleMapper

    Map an example, or row in the dataset, to the inputs of an evaluation.

    Class

    StringRunEvaluatorChain

    Evaluate Run and optional examples.

    Class

    InputFormatError

    Raised when the input format is invalid.

    Class

    TestResult

    A dictionary of the results of a single test run.

    Class

    EvalError

    Your architecture raised an error.

    Class

    ChatModelInput

    Input for a chat model.

    Class

    EvalConfig

    Configuration for a given run evaluator.

    Class

    SingleKeyEvalConfig

    Configuration for a run evaluator that only requires a single key.

    Class

    RunEvalConfig

    Configuration for a run evaluation.

    Class

    Criteria

    Configuration for a reference-free criteria evaluator.

    Class

    LabeledCriteria

    Configuration for a labeled (with references) criteria evaluator.

    Class

    EmbeddingDistance

    Configuration for an embedding distance evaluator.

    Class

    StringDistance

    Configuration for a string distance evaluator.

    Class

    QA

    Configuration for a QA evaluator.

    Class

    ContextQA

    Configuration for a context-based QA evaluator.

    Class

    CoTQA

    Configuration for a context-based QA evaluator.

    Class

    JsonValidity

    Configuration for a json validity evaluator.

    Class

    JsonEqualityEvaluator

    Configuration for a json equality evaluator.

    Class

    ExactMatch

    Configuration for an exact match string evaluator.

    Class

    RegexMatch

    Configuration for a regex match string evaluator.

    Class

    ScoreString

    Configuration for a score string evaluator.

    Class

    LabeledScoreString

    Configuration for a labeled score string evaluator.

    Class

    ProgressBarCallback

    A simple progress bar for the console.

    Class

    AgentExecutorIterator

    Iterator for AgentExecutor.

    Class

    BaseSingleActionAgent

    Base Single Action Agent class.

    Class

    BaseMultiActionAgent

    Base Multi Action Agent class.

    Class

    AgentOutputParser

    Base class for parsing agent output into agent action/finish.

    Class

    MultiActionAgentOutputParser

    Base class for parsing agent output into agent actions/finish.

    Class

    RunnableAgent

    Agent powered by Runnables.

    Class

    RunnableMultiActionAgent

    Agent powered by Runnables.

    Class

    ExceptionTool

    Tool that just returns the query.

    Class

    AgentExecutor

    Agent that is using tools.

    Class

    AgentScratchPadChatPromptTemplate

    Chat prompt template for the agent scratchpad.

    Class

    InvalidTool

    Tool that is run when invalid tool name is encountered by agent.

    Class

    AgentTokenBufferMemory

    Memory used to save agent output AND intermediate steps.

    Class

    StructuredChatOutputParser

    Output parser for the structured chat agent.

    Class

    StructuredChatOutputParserWithRetries

    Output parser with retries for the structured chat agent.

    Class

    ReActOutputParser

    Output parser for the ReAct agent.

    Class

    ConvoOutputParser

    Output parser for the conversational agent.

    Class

    ReActJsonSingleInputOutputParser

    Parses ReAct-style LLM calls that have a single tool input in json format.

    Class

    OpenAIFunctionsAgentOutputParser

    Parses a message into agent action/finish.

    Class

    OpenAIToolsAgentOutputParser

    Parses a message into agent actions/finish.

    Class

    JSONAgentOutputParser

    Parses tool invocations and final answers in JSON format.

    Class

    XMLAgentOutputParser

    Parses tool invocations and final answers from XML-formatted agent output.

    Class

    ReActSingleInputOutputParser

    Parses ReAct-style LLM calls that have a single tool input.

    Class

    SelfAskOutputParser

    Parses self-ask style LLM calls.

    Class

    ToolAgentAction

    Tool agent action.

    Class

    ToolsAgentOutputParser

    Parses a message into agent actions/finish.

    Class

    ConvoOutputParser

    Output parser for the conversational agent.

    Class

    VectorStoreInfo

    Information about a VectorStore.

    Class

    VectorStoreToolkit

    Toolkit for interacting with a VectorStore.

    Class

    VectorStoreRouterToolkit

    Toolkit for routing between Vector Stores.

    Class

    OpenAIAssistantFinish

    AgentFinish with run and thread metadata.

    Class

    OpenAIAssistantAction

    AgentAction with info needed to submit custom tool output to existing run.

    Class

    OpenAIAssistantRunnable

    Run an OpenAI Assistant.

    Class

    MRKLOutputParser

    MRKL Output parser for the chat agent.

    Class

    ChainConfig

    Configuration for a chain to use in MRKL system.

    Class

    ChatOutputParser

    Output parser for the chat agent.

    Class

    SequentialChain

    Chain where the outputs of one chain feed directly into next.

    Class

    SimpleSequentialChain

    Simple chain where the outputs of one step feed directly into next.

    Class

    TransformChain

    Chain that transforms the chain output.

    Class

    OpenAIModerationChain

    Pass input through a moderation endpoint.

    Class

    BasePromptSelector

    Base class for prompt selectors.

    Class

    ConditionalPromptSelector

    Prompt collection that goes through conditionals.

    Class

    Chain

    Abstract base class for creating structured sequences of calls to components.

    Class

    CombineDocsProtocol

    Interface for the combine_docs method.

    Class

    AsyncCombineDocsProtocol

    Interface for the combine_docs method.

    Class

    BaseCombineDocumentsChain

    Base interface for chains combining documents.

    Class

    APIChain

    Raise an ImportError if APIChain is used without langchain_community.

    Class

    ElasticsearchDatabaseChain

    Chain for interacting with Elasticsearch Database.

    Class

    HypotheticalDocumentEmbedder

    Generate hypothetical document for query, and then embed that.

    Class

    FinishedOutputParser

    Output parser that checks if the output is finished.

    Class

    QuestionGeneratorChain

    Chain that generates questions from uncertain spans.

    Class

    FlareChain

    Flare chain.

    Class

    EmbeddingRouterChain

    Chain that uses embeddings to route between options.

    Class

    MultiRetrievalQAChain

    Multi Retrieval QA Chain.

    Class

    RouterOutputParser

    Parser for output of router chain in the multi-prompt chain.

    Class

    Route

    A route to a destination chain.

    Class

    RouterChain

    Chain that outputs the name of a destination chain and the inputs to it.

    Class

    MultiRouteChain

    Use a single chain to route an input to one of multiple candidate chains.

    Class

    LoadingCallable

    Interface for loading the combine documents chain.

    Class

    RetrievalQAWithSourcesChain

    Question-answering with sources over an index.

    Class

    VectorDBQAWithSourcesChain

    Question-answering with sources over a vector database.

    Class

    ElementInViewPort

    A typed dictionary containing information about elements in the viewport.

    Class

    Crawler

    A crawler for web pages.

    Class

    LoadingCallable

    Interface for loading the combine documents chain.

    Class

    ISO8601Date

    A date in ISO 8601 format (YYYY-MM-DD).

    Class

    ISO8601DateTime

    A datetime in ISO 8601 format (YYYY-MM-DDTHH:MM:SS).

    Class

    QueryTransformer

    Transform a query string into an intermediate representation.

    Class

    AttributeInfo

    Information about a data source attribute.

    Class

    StructuredQueryOutputParser

    Output parser that parses a structured query.

    Class

    LoadingCallable

    Interface for loading the combine documents chain.

    Class

    SQLInput

    Input for a SQL Chain.

    Class

    SQLInputWithTables

    Input for a SQL Chain.

    Class

    InputType

    Input type for ConversationalRetrievalChain.

    Class

    BaseConversationalRetrievalChain

    Chain for chatting with an index.

    Class

    ChatVectorDBChain

    Chain for chatting with a vector database.

    Class

    ConstitutionalPrinciple

    Class for a constitutional principle.

    Class

    AnswerWithSources

    An answer to the question, with sources.

    Class

    SimpleRequestChain

    Chain for making a simple request to an API endpoint.

    Class

    FactWithEvidence

    Class representing a single statement.

    Class

    QuestionAnswer

    A question and its answer as a list of facts.

    Class

    FinalStreamingStdOutCallbackHandler

    Callback handler for streaming in agents.

    Class

    AsyncFinalIteratorCallbackHandler

    Callback handler that returns an async iterator.

    Class

    AsyncIteratorCallbackHandler

    Callback handler that returns an async iterator.

    Class

    LoggingCallbackHandler

    Tracer that logs via the input Logger.

    Class

    SimpleMemory

    Simple Memory.

    Class

    CombinedMemory

    Combining multiple memories' data together.

    Class

    ConversationVectorStoreTokenBufferMemory

    Conversation chat memory with token limit and vectordb backing.

    Class

    ReadOnlySharedMemory

    Memory wrapper that is read-only and cannot be changed.

    Class

    UpsertionRecord

    Table used to keep track of when a key was last updated.

    Class

    SQLRecordManager

    A SQL Alchemy based implementation of the record manager.

    Class

    VectorStoreIndexWrapper

    Wrapper around a VectorStore for easy access.

    Class

    VectorstoreIndexCreator

    Logic for creating indexes.

    Class

    EvaluatorType

    The types of the evaluators.

    Class

    LLMEvalChain

    A base class for evaluators that use an LLM.

    Class

    StringEvaluator

    String evaluator interface.

    Class

    PairwiseStringEvaluator

    Compare the output of two models (or two outputs of the same model).

    Class

    AgentTrajectoryEvaluator

    Interface for evaluating agent trajectories.

    Class

    ExactMatchStringEvaluator

    Compute an exact match between the prediction and the reference.

    Class

    Criteria

    A Criteria to evaluate.

    Class

    CriteriaResultOutputParser

    A parser for the output of the CriteriaEvalChain.

    Class

    CriteriaEvalChain

    LLM Chain for evaluating runs against criteria.

    Class

    LabeledCriteriaEvalChain

    Criteria evaluation chain that requires references.

    Class

    ScoreStringResultOutputParser

    A parser for the output of the ScoreStringEvalChain.

    Class

    ScoreStringEvalChain

    A chain for scoring on a scale of 1-10 the output of a model.

    Class

    LabeledScoreStringEvalChain

    A chain for scoring the output of a model on a scale of 1-10.

    Class

    QAGenerateChain

    LLM Chain for generating examples for question answering.

    Class

    QAEvalChain

    LLM Chain for evaluating question answering.

    Class

    ContextQAEvalChain

    LLM Chain for evaluating QA w/o GT based on context.

    Class

    CotQAEvalChain

    LLM Chain for evaluating QA using chain of thought reasoning.

    Class

    StringDistance

    Distance metric to use.

    Class

    StringDistanceEvalChain

    Compute string distances between the prediction and the reference.

    Class

    PairwiseStringDistanceEvalChain

    Compute string edit distances between two predictions.

    Class

    EmbeddingDistance

    Embedding Distance Metric.

    Class

    EmbeddingDistanceEvalChain

    Embedding distance evaluation chain.

    Class

    PairwiseEmbeddingDistanceEvalChain

    Use embedding distances to score semantic difference between two predictions.

    Class

    TrajectoryEval

    A named tuple containing the score and reasoning for a trajectory.

    Class

    TrajectoryOutputParser

    Trajectory output parser.

    Class

    TrajectoryEvalChain

    A chain for evaluating ReAct style agents.

    Class

    JsonSchemaEvaluator

    An evaluator that validates a JSON prediction against a JSON schema reference.

    Class

    JsonEditDistanceEvaluator

    An evaluator that calculates the edit distance between JSON strings.

    Class

    JsonValidityEvaluator

    Evaluate whether the prediction is valid JSON.

    Class

    JsonEqualityEvaluator

    Json Equality Evaluator.

    Class

    PairwiseStringResultOutputParser

    A parser for the output of the PairwiseStringEvalChain.

    Class

    PairwiseStringEvalChain

    Pairwise String Evaluation Chain.

    Class

    LabeledPairwiseStringEvalChain

    Labeled Pairwise String Evaluation Chain.

    Class

    RegexMatchStringEvaluator

    Compute a regex match between the prediction and the reference.

    Class

    BaseMemory

    deprecated

    Abstract base class for memory in Chains.

    Class

    CohereRerank

    deprecated

    Document compressor that uses Cohere Rerank API.

    Class

    LLMSingleActionAgent

    deprecated

    Base class for single action agents.

    Class

    Agent

    deprecated

    Agent that calls the language model and deciding the action.

    Class

    AgentType

    deprecated

    An enum for agent types.

    Class

    OpenAIFunctionsAgent

    deprecated

    An Agent driven by OpenAIs function powered API.

    Class

    XMLAgent

    deprecated

    Agent that uses XML tags.

    Class

    OpenAIMultiFunctionsAgent

    deprecated

    Agent driven by OpenAIs function powered API.

    Class

    StructuredChatAgent

    deprecated

    Structured Chat Agent.

    Class

    ReActDocstoreAgent

    deprecated

    Agent for the ReAct chain.

    Class

    DocstoreExplorer

    deprecated

    Class to assist with exploration of a document store.

    Class

    ReActTextWorldAgent

    deprecated

    Agent for the ReAct TextWorld chain.

    Class

    ReActChain

    deprecated

    [Deprecated] Chain that implements the ReAct paper.

    Class

    ConversationalAgent

    deprecated

    An agent that holds a conversation in addition to using tools.

    Class

    ConversationalChatAgent

    deprecated

    An agent designed to hold a conversation in addition to using tools.

    Class

    SelfAskWithSearchAgent

    deprecated

    Agent for the self-ask-with-search paper.

    Class

    SelfAskWithSearchChain

    deprecated

    [Deprecated] Chain that does self-ask with search.

    Class

    ZeroShotAgent

    deprecated

    Agent for the MRKL chain.

    Class

    MRKLChain

    deprecated

    Chain that implements the MRKL system.

    Class

    ChatAgent

    deprecated

    Chat Agent.

    Class

    MapReduceChain

    deprecated

    Map-reduce chain.

    Class

    LLMChain

    deprecated

    Chain to run queries against LLMs.

    Class

    MapRerankDocumentsChain

    deprecated

    Combining documents by mapping a chain over them, then reranking results.

    Class

    StuffDocumentsChain

    deprecated

    Chain that combines documents by stuffing into context.

    Class

    ReduceDocumentsChain

    deprecated

    Combine documents by recursively reducing them.

    Class

    RefineDocumentsChain

    deprecated

    Combine documents by doing a first pass and then refining on more documents.

    Class

    MapReduceDocumentsChain

    deprecated

    Combining documents by mapping a chain over them, then combining results.

    Class

    AnalyzeDocumentChain

    deprecated

    Chain that splits documents, then analyzes it in pieces.

    Class

    LLMCheckerChain

    deprecated

    Chain for question-answering with self-verification.

    Class

    MultiPromptChain

    deprecated

    A multi-route chain that uses an LLM router chain to choose amongst prompts.

    Class

    LLMRouterChain

    deprecated

    A router chain that uses an LLM chain to perform routing.

    Class

    QAGenerationChain

    deprecated

    Base class for question-answer generation chains.

    Class

    BaseQAWithSourcesChain

    deprecated

    Question answering chain with sources over documents.

    Class

    QAWithSourcesChain

    deprecated

    Question answering with sources over documents.

    Class

    NatBotChain

    deprecated

    Implement an LLM driven browser.

    Class

    LLMSummarizationCheckerChain

    deprecated

    Chain for question-answering with self-verification.

    Class

    ConversationalRetrievalChain

    deprecated

    Chain for having a conversation based on retrieved documents.

    Class

    ConversationChain

    deprecated

    Chain to have a conversation and load context from memory.

    Class

    ConstitutionalChain

    deprecated

    Chain for applying constitutional principles.

    Class

    LLMMathChain

    deprecated

    Chain that interprets a prompt and executes python code to do math.

    Class

    BaseRetrievalQA

    deprecated

    Base class for question-answering chains.

    Class

    RetrievalQA

    deprecated

    Chain for question-answering against an index.

    Class

    VectorDBQA

    deprecated

    Chain for question-answering against a vector database.

    Class

    ConversationTokenBufferMemory

    deprecated

    Conversation chat memory with token limit.

    Class

    ConversationBufferWindowMemory

    deprecated

    Use to keep track of the last k turns of a conversation.

    Class

    VectorStoreRetrieverMemory

    deprecated

    Vector Store Retriever Memory.

    Class

    SummarizerMixin

    deprecated

    Mixin for summarizer.

    Class

    ConversationSummaryMemory

    deprecated

    Continually summarizes the conversation history.

    Class

    ConversationBufferMemory

    deprecated

    A basic memory implementation that simply stores the conversation history.

    Class

    ConversationStringBufferMemory

    deprecated

    A basic memory implementation that simply stores the conversation history.

    Class

    BaseChatMemory

    deprecated

    Abstract base class for chat memory.

    Class

    BaseEntityStore

    deprecated

    Abstract base class for Entity store.

    Class

    InMemoryEntityStore

    deprecated

    In-memory Entity store.

    Class

    UpstashRedisEntityStore

    deprecated

    Upstash Redis backed Entity store.

    Class

    RedisEntityStore

    deprecated

    Redis-backed Entity store.

    Class

    SQLiteEntityStore

    deprecated

    SQLite-backed Entity store with safe query construction.

    Class

    ConversationEntityMemory

    deprecated

    Entity extractor & summarizer memory.

    Class

    ConversationSummaryBufferMemory

    deprecated

    Buffer with summarizer for storing conversation memory.

    Functions

    Function

    push

    Push an object to the hub and returns the URL it can be viewed at in a browser.

    Function

    pull

    Pull an object from the hub and returns it as a LangChain object.

    Function

    get_runtime_environment

    Get information about the LangChain runtime environment.

    Function

    get_pydantic_major_version

    Get the major version of Pydantic.

    Function

    init_embeddings

    Initialize an embeddings model from a model name and optional provider.

    Function

    create_lc_store

    Create a store for LangChain serializable objects from a bytes store.

    Function

    create_kv_docstore

    Create a store for langchain Document objects from a bytes store.

    Function

    unique_by_key

    Yield unique elements of an iterable based on a key function.

    Function

    default_get_input

    Return the compression chain input.

    Function

    default_get_input

    Return the compression chain input.

    Function

    init_chat_model

    Initialize a chat model from any supported provider using a unified interface.

    Function

    load_output_parser

    Load an output parser.

    Function

    arun_on_dataset

    Run on dataset.

    Function

    run_on_dataset

    Run on dataset.

    Function

    random_name

    Generate a random name.

    Function

    validate_tools_single_input

    Validate tools for single input.

    Function

    create_openai_functions_agent

    Create an agent that uses OpenAI function calling.

    Function

    create_xml_agent

    Create an agent that uses XML to format its logic.

    Function

    create_structured_chat_agent

    Create an agent aimed at supporting tools with multiple inputs.

    Function

    create_react_agent

    Create an agent that uses ReAct prompting.

    Function

    create_json_chat_agent

    Create an agent that uses JSON to format its logic, build for Chat Models.

    Function

    parse_ai_message_to_openai_tool_action

    Parse an AI message potentially containing tool_calls.

    Function

    parse_ai_message_to_tool_action

    Parse an AI message potentially containing tool_calls.

    Function

    create_conversational_retrieval_agent

    A convenience method for creating a conversational retrieval agent.

    Function

    format_log_to_messages

    Construct the scratchpad that lets the agent continue its thought process.

    Function

    format_to_openai_function_messages

    Convert (AgentAction, tool output) tuples into FunctionMessages.

    Function

    format_xml

    Format the intermediate steps as XML.

    Function

    format_log_to_str

    Construct the scratchpad that lets the agent continue its thought process.

    Function

    format_to_tool_messages

    Convert (AgentAction, tool output) tuples into ToolMessage objects.

    Function

    create_tool_calling_agent

    Create an agent that uses tools.

    Function

    create_self_ask_with_search_agent

    Create an agent that uses self-ask with search prompting.

    Function

    create_openai_tools_agent

    Create an agent that uses OpenAI tools.

    Function

    load_llm

    Import error for load_llm.

    Function

    load_llm_from_config

    Import error for load_llm_from_config.

    Function

    create_history_aware_retriever

    Create a chain that takes conversation history and returns documents.

    Function

    create_retrieval_chain

    Create retrieval chain that retrieves documents and then passes them on.

    Function

    generate_example

    Return another example given a list of examples for a prompt.

    Function

    is_llm

    Check if the language model is a LLM.

    Function

    is_chat_model

    Check if the language model is a chat model.

    Function

    create_stuff_documents_chain

    Create a chain for passing a list of Documents to a model.

    Function

    split_list_of_docs

    Split Document objects to subsets that each meet a cumulative len. constraint.

    Function

    collapse_docs

    Execute a collapse function on a set of documents and merge their metadatas.

    Function

    acollapse_docs

    Execute a collapse function on a set of documents and merge their metadatas.

    Function

    v_args

    Dummy decorator for when lark is not installed.

    Function

    get_parser

    Return a parser for the query language.

    Function

    fix_filter_directive

    Fix invalid filter directive.

    Function

    construct_examples

    Construct examples from input-output pairs.

    Function

    get_query_constructor_prompt

    Create query construction prompt.

    Function

    load_query_constructor_runnable

    Load a query constructor runnable chain.

    Function

    load_summarize_chain

    Load summarizing chain.

    Function

    create_sql_query_chain

    Create a chain that generates SQL queries.

    Function

    get_openai_output_parser

    Get the appropriate function output parser given the user functions.

    Function

    get_llm_kwargs

    Return the kwargs for the LLMChain constructor.

    Function

    openapi_spec_to_openai_fn

    OpenAPI spec to OpenAI function JSON Schema.

    Function

    create_citation_fuzzy_match_runnable

    Create a citation fuzzy match Runnable.

    Function

    StreamlitCallbackHandler

    Callback Handler that writes to a Streamlit app.

    Function

    callback

    Function

    create_importer

    Create a function that helps retrieve objects from their new locations.

    Function

    is_interactive_env

    Determine if running within IPython or Jupyter.

    Function

    get_prompt_input_key

    Get the prompt input key.

    Function

    get_type_to_cls_dict

    Function

    load_dataset

    Load a dataset from the LangChainDatasets on HuggingFace.

    Function

    load_evaluator

    Load the requested evaluation chain specified by a string.

    Function

    load_evaluators

    Load evaluators specified by a list of evaluator types.

    Function

    resolve_criteria

    Resolve the criteria to evaluate.

    Function

    resolve_criteria

    Resolve the criteria for the pairwise evaluator.

    Function

    resolve_pairwise_criteria

    Resolve the criteria for the pairwise evaluator.

    Function

    load_agent_from_config

    deprecated

    Load agent from Config Dict.

    Function

    load_agent

    deprecated

    Unified method for loading an agent from LangChainHub or local fs.

    Function

    initialize_agent

    deprecated

    Load an agent executor given tools and LLM.

    Function

    create_vectorstore_agent

    deprecated

    Construct a VectorStore agent from an LLM and tools.

    Function

    create_vectorstore_router_agent

    deprecated

    Construct a VectorStore router agent from an LLM and tools.

    Function

    load_chain_from_config

    deprecated

    Load chain from Config Dict.

    Function

    load_chain

    deprecated

    Unified method for loading a chain from LangChainHub or local fs.

    Function

    load_qa_with_sources_chain

    deprecated

    Load a question answering with sources chain.

    Function

    load_qa_chain

    deprecated

    Load question answering chain.

    Function

    load_query_constructor_chain

    deprecated

    Load a query constructor chain.

    Function

    create_openai_fn_runnable

    deprecated

    Create a runnable sequence that uses OpenAI functions.

    Function

    create_structured_output_runnable

    deprecated

    Create a runnable for extracting structured outputs.

    Function

    create_extraction_chain_pydantic

    deprecated

    Creates a chain that extracts information from a passage.

    Function

    create_qa_with_structure_chain

    deprecated

    Create a question answering chain with structure.

    Function

    create_qa_with_sources_chain

    deprecated

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

    Function

    create_tagging_chain

    deprecated

    Create tagging chain from schema.

    Function

    create_tagging_chain_pydantic

    deprecated

    Create tagging chain from Pydantic schema.

    Function

    get_openapi_chain

    deprecated

    Create a chain for querying an API from a OpenAPI spec.

    Function

    create_citation_fuzzy_match_chain

    deprecated

    Create a citation fuzzy match chain.

    Function

    create_extraction_chain

    deprecated

    Creates a chain that extracts information from a passage.

    Function

    create_extraction_chain_pydantic

    deprecated

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

    Function

    create_openai_fn_chain

    deprecated

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

    Function

    create_structured_output_chain

    deprecated

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

    Modules

    Module

    langchain_classic

    Main entrypoint into package.

    Module

    hub

    Interface with the LangChain Hub.

    Module

    model_laboratory

    Experiment with different models.

    Module

    formatting

    DEPRECATED: Kept for backwards compatibility.

    Module

    requests

    DEPRECATED: Kept for backwards compatibility.

    Module

    base_memory

    Memory maintains Chain state, incorporating context from past runs.

    Module

    serpapi

    For backwards compatibility.

    Module

    env

    Module

    sql_database

    Keep here for backwards compatibility.

    Module

    text_splitter

    Kept for backwards compatibility.

    Module

    python

    For backwards compatibility.

    Module

    example_generator

    Keep here for backwards compatibility.

    Module

    cache

    Module

    globals

    Global values and configuration that apply to all of LangChain.

    Module

    input

    DEPRECATED: Kept for backwards compatibility.

    Module

    base_language

    Deprecated module for BaseLanguageModel class, kept for backwards compatibility.

    Module

    document_loaders

    Document Loaders are classes to load Documents.

    Module

    obs_file

    Module

    notebook

    Module

    s3_directory

    Module

    airbyte_json

    Module

    sitemap

    Module

    tensorflow_datasets

    Module

    azure_blob_storage_container

    Module

    org_mode

    Module

    hugging_face_dataset

    Module

    roam

    Module

    dataframe

    Module

    dropbox

    Module

    onenote

    Module

    telegram

    Module

    ifixit

    Module

    word_document

    Module

    obs_directory

    Module

    snowflake_loader

    Module

    bigquery

    Module

    rtf

    Module

    gcs_file

    Module

    pdf

    Module

    open_city_data

    Module

    xorbits

    Module

    lakefs

    Module

    onedrive

    Module

    baiducloud_bos_file

    Module

    epub

    Module

    chatgpt

    Module

    browserless

    Module

    chromium

    Module

    async_html

    Module

    conllu

    Module

    url

    Module

    image_captions

    Module

    notion

    Module

    iugu

    Module

    azure_ai_data

    Module

    fauna

    Module

    googledrive

    Module

    mongodb

    Module

    web_base

    Module

    gcs_directory

    Module

    directory

    Module

    arcgis_loader

    Module

    quip

    Module

    concurrent

    Module

    assemblyai

    Module

    toml

    Module

    airtable

    Module

    college_confidential

    Module

    google_speech_to_text

    Module

    azure_blob_storage_file

    Module

    polars_dataframe

    Module

    geodataframe

    Module

    generic

    Module

    arxiv

    Module

    bibtex

    Module

    youtube

    Module

    rss

    Module

    cube_semantic

    Module

    larksuite

    Module

    joplin

    Module

    max_compute

    Module

    twitter

    Module

    datadog_logs

    Module

    couchbase

    Module

    spreedly

    Module

    imsdb

    Module

    figma

    Module

    base_o365

    Module

    confluence

    Module

    airbyte

    Module

    readthedocs

    Module

    slack_directory

    Module

    azlyrics

    Module

    obsidian

    Module

    evernote

    Module

    python

    Module

    hn

    Module

    markdown

    Module

    weather

    Module

    helpers

    Module

    sharepoint

    Module

    nuclia

    Module

    powerpoint

    Module

    srt

    Module

    diffbot

    Module

    tencent_cos_directory

    Module

    pyspark_dataframe

    Module

    rocksetdb

    Module

    duckdb_loader

    Module

    apify_dataset

    Module

    gitbook

    Module

    csv_loader

    Module

    blackboard

    Module

    gutenberg

    Module

    acreom

    Module

    stripe

    Module

    xml

    Module

    merge

    Module

    baiducloud_bos_directory

    Module

    facebook_chat

    Module

    html_bs

    Module

    tsv

    Module

    s3_file

    Module

    image

    Module

    json_loader

    Module

    url_playwright

    Module

    tomarkdown

    Module

    blockchain

    Module

    docusaurus

    Module

    onedrive_file

    Module

    mediawikidump

    Module

    rst

    Module

    mastodon

    Module

    recursive_url_loader

    Module

    text

    Module

    mhtml

    Module

    git

    Module

    wikipedia

    Module

    odt

    Module

    news

    Module

    reddit

    Module

    url_selenium

    Module

    trello

    Module

    modern_treasury

    Module

    pubmed

    Module

    unstructured

    Module

    etherscan

    Module

    html

    Module

    whatsapp_chat

    Module

    email

    Module

    rspace

    Module

    brave_search

    Module

    notiondb

    Module

    tencent_cos_file

    Module

    discord

    Module

    psychic

    Module

    github

    Module

    bilibili

    Module

    docugami

    Module

    excel

    Module

    base

    Module

    blob_loaders

    Module

    youtube_audio

    Module

    file_system

    Module

    schema

    Module

    parsers

    Module

    msword

    Module

    pdf

    Module

    audio

    Module

    generic

    Module

    docai

    Module

    txt

    Module

    grobid

    Module

    registry

    Module

    language

    Module

    language_parser

    Module

    python

    Module

    cobol

    Module

    code_segmenter

    Module

    javascript

    Module

    html

    Module

    bs4

    Module

    schema

    Schemas are the LangChain Base Classes and Interfaces.

    Module

    embeddings

    Module

    document

    Module

    storage

    Module

    agent

    Module

    vectorstore

    Module

    memory

    Module

    chat

    Module

    retriever

    Module

    output

    Module

    output_parser

    Module

    prompt

    Module

    messages

    Module

    exceptions

    Module

    cache

    Module

    chat_history

    Module

    language_model

    Module

    prompt_template

    Module

    runnable

    LangChain Runnable and the LangChain Expression Language (LCEL).

    Module

    retry

    Module

    passthrough

    Module

    configurable

    Module

    utils

    Module

    branch

    Module

    fallbacks

    Module

    history

    Module

    router

    Module

    config

    Module

    base

    Module

    callbacks

    Module

    streaming_stdout

    Module

    stdout

    Module

    manager

    Module

    base

    Module

    tracers

    Module

    root_listeners

    Module

    run_collector

    Module

    evaluation

    Module

    stdout

    Module

    langchain

    Module

    schemas

    Module

    log_stream

    Module

    base

    Module

    utils

    Utility functions for LangChain.

    Module

    formatting

    Module

    utils

    Module

    openai

    Module

    env

    Module

    json_schema

    Module

    aiter

    Module

    math

    Module

    openai_functions

    Module

    strings

    Module

    pydantic

    Module

    ernie_functions

    Module

    input

    Module

    iter

    Module

    html

    Module

    runnables

    LangChain Runnable and the LangChain Expression Language (LCEL).

    Module

    hub

    Module

    openai_functions

    Module

    embeddings

    Embedding models.

    Module

    localai

    Module

    javelin_ai_gateway

    Module

    sentence_transformer

    Module

    fake

    Module

    cohere

    Module

    sagemaker_endpoint

    Module

    elasticsearch

    Module

    google_palm

    Module

    embaas

    Module

    minimax

    Module

    johnsnowlabs

    Module

    openai

    Module

    mlflow_gateway

    Module

    edenai

    Module

    nlpcloud

    Module

    mosaicml

    Module

    tensorflow_hub

    Module

    mlflow

    Module

    spacy_embeddings

    Module

    huggingface

    Module

    llamacpp

    Module

    ernie

    Module

    octoai_embeddings

    Module

    awa

    Module

    modelscope_hub

    Module

    vertexai

    Module

    ollama

    Module

    jina

    Module

    self_hosted_hugging_face

    Module

    bedrock

    Module

    self_hosted

    Module

    voyageai

    Module

    bookend

    Module

    huggingface_hub

    Module

    databricks

    Module

    cache

    Module contains code for a cache backed embedder.

    Module

    llm_rails

    Module

    cloudflare_workersai

    Module

    gpt4all

    Module

    gradient_ai

    Module

    dashscope

    Module

    fastembed

    Module

    xinference

    Module

    baidu_qianfan_endpoint

    Module

    infinity

    Module

    deepinfra

    Module

    azure_openai

    Module

    aleph_alpha

    Module

    clarifai

    Module

    base

    Module

    storage

    Implementations of key-value stores and storage helpers.

    Module

    in_memory

    In memory store that is not thread safe and has no eviction policy.

    Module

    upstash_redis

    Module

    encoder_backed

    Module

    exceptions

    Module

    file_system

    Module

    redis

    Module

    retrievers

    Retriever class returns Documents given a text query.

    Module

    parent_document_retriever

    Module

    you

    Module

    zep

    Module

    multi_vector

    Module

    pinecone_hybrid_search

    Module

    google_vertex_ai_search

    Module

    pupmed

    Module

    elastic_search_bm25

    Module

    google_cloud_documentai_warehouse

    Module

    zilliz

    Module

    time_weighted_retriever

    Module

    docarray

    Module

    web_research

    Module

    tavily_search_api

    Module

    arxiv

    Module

    cohere_rag_retriever

    Module

    kendra

    Module

    weaviate_hybrid_search

    Module

    embedchain

    Module

    metal

    Module

    bedrock

    Module

    ensemble

    Ensemble Retriever.

    Module

    bm25

    Module

    knn

    Module

    contextual_compression

    Module

    merger_retriever

    Module

    vespa_retriever

    Module

    llama_index

    Module

    azure_ai_search

    Module

    tfidf

    Module

    databerry

    Module

    outline

    Module

    milvus

    Module

    chatgpt_plugin_retriever

    Module

    wikipedia

    Module

    pubmed

    Module

    multi_query

    Module

    arcee

    Module

    remote_retriever

    Module

    re_phraser

    Module

    svm

    Module

    chaindesk

    Module

    kay

    Module

    document_compressors

    Module

    flashrank_rerank

    Module

    cross_encoder

    Module

    chain_extract

    DocumentFilter that uses an LLM chain to extract the relevant parts of documents.

    Module

    cohere_rerank

    Module

    cross_encoder_rerank

    Module

    chain_filter

    Filter that uses an LLM to drop documents that aren't relevant to the query.

    Module

    listwise_rerank

    Filter that uses an LLM to rerank documents listwise and select top-k.

    Module

    embeddings_filter

    Module

    chain_extract_prompt

    Module

    chain_filter_prompt

    Module

    base

    Module

    self_query

    Module

    databricks_vector_search

    Module

    mongodb_atlas

    Module

    elasticsearch

    Module

    dashvector

    Module

    chroma

    Module

    qdrant

    Module

    supabase

    Module

    pinecone

    Module

    weaviate

    Module

    vectara

    Module

    dingo

    Module

    myscale

    Module

    pgvector

    Module

    timescalevector

    Module

    opensearch

    Module

    redis

    Module

    milvus

    Module

    tencentvectordb

    Module

    deeplake

    Module

    astradb

    Module

    base

    Retriever that generates and executes structured queries over its own data source.

    Module

    load

    Serialization and deserialization.

    Module

    load

    Module

    dump

    Module

    serializable

    Module

    chat_loaders

    Chat Loaders load chat messages from common communications platforms.

    Module

    telegram

    Module

    utils

    Module

    langsmith

    Module

    imessage

    Module

    slack

    Module

    whatsapp

    Module

    facebook_messenger

    Module

    base

    Module

    gmail

    Module

    chat_models

    Chat Models are a variation on language models.

    Module

    gigachat

    Module

    javelin_ai_gateway

    Module

    fake

    Module

    cohere

    Module

    litellm

    Module

    meta

    Module

    google_palm

    Module

    hunyuan

    Module

    mlflow_ai_gateway

    Module

    azureml_endpoint

    Module

    minimax

    Module

    openai

    Module

    pai_eas_endpoint

    Module

    baichuan

    Module

    mlflow

    Module

    anyscale

    Module

    ernie

    Module

    everlyai

    Module

    human

    Module

    fireworks

    Module

    vertexai

    Module

    ollama

    Module

    volcengine_maas

    Module

    bedrock

    Module

    databricks

    Module

    konko

    Module

    tongyi

    Module

    yandex

    Module

    jinachat

    Module

    anthropic

    Module

    baidu_qianfan_endpoint

    Module

    azure_openai

    Module

    promptlayer_openai

    Module

    base

    Module

    output_parsers

    OutputParser classes parse the output of an LLM call.

    Module

    retry

    Module

    list

    Module

    loading

    Module

    regex_dict

    Module

    rail_parser

    Module

    prompts

    Module

    yaml

    Module

    structured

    Module

    regex

    Module

    format_instructions

    Module

    datetime

    Module

    openai_functions

    Module

    pydantic

    Module

    openai_tools

    Module

    ernie_functions

    Module

    json

    Module

    pandas_dataframe

    Module

    xml

    Module

    combining

    Module

    enum

    Module

    fix

    Module

    boolean

    Module

    tools

    Tools are classes that an Agent uses to interact with the world.

    Module

    convert_to_openai

    Module

    plugin

    Module

    retriever

    Module

    render

    Different methods for rendering Tools to be passed to LLMs.

    Module

    ifttt

    Module

    yahoo_finance_news

    Module

    base

    Module

    jira

    Jira Tool.

    Module

    tool

    This module provides dynamic access to deprecated Jira tools.

    Module

    nuclia

    Module

    tool

    Module

    file_management

    File Management Tools.

    Module

    move

    Module

    copy

    Module

    delete

    Module

    list_dir

    Module

    write

    Module

    read

    Module

    file_search

    Module

    zapier

    Zapier Tool.

    Module

    tool

    This module provides dynamic access to deprecated Zapier tools in LangChain.

    Module

    brave_search

    Module

    tool

    Module

    openweathermap

    OpenWeatherMap API toolkit.

    Module

    tool

    Module

    python

    Module

    reddit_search

    Module

    tool

    Module

    steam

    Steam API toolkit.

    Module

    tool

    Module

    gitlab

    GitLab Tool.

    Module

    tool

    Module

    youtube

    Module

    search

    Module

    spark_sql

    Tools for interacting with Spark SQL.

    Module

    tool

    Module

    google_scholar

    Google Scholar API Toolkit.

    Module

    tool

    Module

    graphql

    Tools for interacting with a GraphQL API.

    Module

    tool

    Module

    stackexchange

    StackExchange API toolkit.

    Module

    tool

    Module

    google_cloud

    Google Cloud Tools.

    Module

    texttospeech

    Module

    merriam_webster

    Merriam-Webster API toolkit.

    Module

    tool

    Module

    powerbi

    Tools for interacting with a PowerBI dataset.

    Module

    tool

    Module

    slack

    Slack tools.

    Module

    get_channel

    Module

    get_message

    Module

    schedule_message

    Module

    send_message

    Module

    base

    Module

    human

    Tool for asking for human input.

    Module

    tool

    Module

    azure_cognitive_services

    Azure Cognitive Services Tools.

    Module

    form_recognizer

    Module

    image_analysis

    Module

    text2speech

    Module

    text_analytics_health

    Module

    speech2text

    Module

    ainetwork

    Module

    transfer

    Module

    owner

    Module

    value

    Module

    rule

    Module

    app

    Module

    base

    Module

    playwright

    Browser tools and toolkit.

    Module

    navigate

    Module

    extract_text

    Module

    navigate_back

    Module

    get_elements

    Module

    extract_hyperlinks

    Module

    click

    Module

    current_page

    Module

    base

    Module

    openapi

    Module

    utils

    Module

    openapi_utils

    Utility functions for parsing an OpenAPI spec. Kept for backwards compat.

    Module

    api_models

    Module

    pubmed

    PubMed API toolkit.

    Module

    tool

    Module

    google_search

    Google Search API Toolkit.

    Module

    tool

    Module

    google_serper

    Module

    tool

    Module

    clickup

    Module

    tool

    Module

    requests

    Tools for making requests to an API endpoint.

    Module

    tool

    Module

    vectorstore

    Simple tool wrapper around VectorDBQA chain.

    Module

    tool

    Module

    scenexplain

    SceneXplain API toolkit.

    Module

    tool

    Module

    github

    GitHub Tool.

    Module

    tool

    Module

    searchapi

    Module

    tool

    Module

    amadeus

    Amadeus tools.

    Module

    flight_search

    Module

    closest_airport

    Module

    base

    Module

    google_places

    Google Places API Toolkit.

    Module

    tool

    Module

    sql_database

    Tools for interacting with a SQL database.

    Module

    tool

    Module

    prompt

    For backwards compatibility.

    Module

    office365

    O365 tools.

    Module

    events_search

    Module

    send_event

    Module

    create_draft_message

    Module

    send_message

    Module

    messages_search

    Module

    base

    Module

    e2b_data_analysis

    Module

    tool

    Module

    shell

    Shell tool.

    Module

    tool

    Module

    json

    Tools for interacting with a JSON file.

    Module

    tool

    This module provides dynamic access to deprecated JSON tools in LangChain.

    Module

    gmail

    Gmail tools.

    Module

    create_draft

    Module

    get_thread

    Module

    get_message

    Module

    send_message

    Module

    search

    Module

    base

    Module

    edenai

    Edenai Tools.

    Module

    image_explicitcontent

    Module

    ocr_identityparser

    Module

    ocr_invoiceparser

    Module

    text_moderation

    Module

    audio_speech_to_text

    Module

    edenai_base_tool

    Module

    image_objectdetection

    Module

    audio_text_to_speech

    Module

    google_trends

    Google Trends API Toolkit.

    Module

    tool

    Module

    searx_search

    Module

    tool

    Module

    wikipedia

    Wikipedia API toolkit.

    Module

    tool

    Module

    eleven_labs

    Eleven Labs Services Tools.

    Module

    text2speech

    Module

    models

    Module

    golden_query

    Golden API toolkit.

    Module

    tool

    Module

    google_finance

    Google Finance API Toolkit.

    Module

    tool

    Module

    google_lens

    Google Lens API Toolkit.

    Module

    tool

    Module

    bing_search

    Bing Search API toolkit.

    Module

    tool

    Module

    dataforseo_api_search

    DataForSeo API Toolkit.

    Module

    tool

    Module

    nasa

    Module

    tool

    Module

    multion

    MutliOn Client API tools.

    Module

    update_session

    Module

    create_session

    Module

    close_session

    Module

    arxiv

    Arxiv API toolkit.

    Module

    tool

    Module

    tavily_search

    Tavily Search API toolkit.

    Module

    tool

    Module

    sleep

    Sleep tool.

    Module

    tool

    Module

    google_jobs

    Google Jobs API Toolkit.

    Module

    tool

    Module

    memorize

    Unsupervised learning based memorization.

    Module

    tool

    Module

    metaphor_search

    Metaphor Search API toolkit.

    Module

    tool

    Module

    steamship_image_generation

    Tool to generate an image.

    Module

    tool

    Module

    bearly

    Module

    tool

    Module

    wolfram_alpha

    Wolfram Alpha API toolkit.

    Module

    tool

    Module

    interaction

    Tools for interacting with the user.

    Module

    tool

    Module

    ddg_search

    DuckDuckGo Search API toolkit.

    Module

    tool

    Module

    utilities

    Utilities are the integrations with third-part systems and packages.

    Module

    searx_search

    Module

    tensorflow_datasets

    Module

    dalle_image_generator

    Module

    awslambda

    Module

    google_serper

    Module

    duckduckgo_search

    Module

    alpha_vantage

    Module

    clickup

    Module

    google_places_api

    Module

    reddit_search

    Module

    google_trends

    Module

    asyncio

    Shims for asyncio features that may be missing from older python versions.

    Module

    nasa

    Module

    portkey

    Module

    tavily_search

    Module

    requests

    Module

    gitlab

    Module

    zapier

    Module

    merriam_webster

    Module

    serpapi

    Module

    arxiv

    Module

    opaqueprompts

    Module

    bibtex

    Module

    twilio

    Module

    jira

    Module

    powerbi

    Module

    google_jobs

    Module

    graphql

    Module

    bing_search

    Module

    max_compute

    Module

    steam

    Module

    sql_database

    Module

    openweathermap

    Module

    vertexai

    Module

    python

    For backwards compatibility.

    Module

    searchapi

    Module

    openapi

    Module

    stackexchange

    Module

    google_search

    Module

    spark_sql

    Module

    apify

    Module

    scenexplain

    Module

    wolfram_alpha

    Module

    google_scholar

    Module

    golden_query

    Module

    google_lens

    Module

    metaphor_search

    Module

    outline

    Module

    redis

    Module

    wikipedia

    Module

    anthropic

    Module

    google_finance

    Module

    pubmed

    Module

    arcee

    Module

    brave_search

    Module

    dataforseo_api_search

    Module

    github

    Module

    graphs

    Graphs provide a natural language interface to graph databases.

    Module

    nebula_graph

    Module

    neo4j_graph

    Module

    graph_document

    Module

    graph_store

    Module

    neptune_graph

    Module

    networkx_graph

    Module

    hugegraph

    Module

    kuzu_graph

    Module

    falkordb_graph

    Module

    memgraph_graph

    Module

    arangodb_graph

    Module

    rdf_graph

    Module

    smith

    LangSmith utilities.

    Module

    evaluation

    LangSmith evaluation utilities.

    Module

    string_run_evaluator

    Run evaluator wrapper for string evaluators.

    Module

    runner_utils

    Utilities for running language models or Chains over datasets.

    Module

    name_generation

    Module

    config

    Configuration for run evaluators.

    Module

    progress

    A simple progress bar for the console.

    Module

    agents

    Agent is a class that uses an LLM to choose a sequence of actions to take.

    Module

    load_tools

    Module

    agent_iterator

    Module

    loading

    Functionality for loading agents.

    Module

    agent

    Chain that takes in an input and produces an action and action input.

    Module

    utils

    Module

    agent_types

    Module definitions of agent types together with corresponding agents.

    Module

    types

    Module

    initialize

    Load agent.

    Module

    schema

    Module

    tools

    Interface for tools.

    Module

    openai_functions_agent

    Module

    agent_token_buffer_memory

    Memory used to save agent output AND intermediate steps.

    Module

    base

    Module implements an agent that uses OpenAI's APIs function enabled API.

    Module

    xml

    Module

    prompt

    Module

    base

    Module

    openai_functions_multi_agent

    Module

    base

    Module implements an agent that uses OpenAI's APIs function enabled API.

    Module

    structured_chat

    Module

    output_parser

    Module

    prompt

    Module

    base

    Module

    react

    Implements the ReAct paper from https://arxiv.org/pdf/2210.03629.pdf.

    Module

    agent

    Module

    wiki_prompt

    Module

    output_parser

    Module

    textworld_prompt

    Module

    base

    Chain that implements the ReAct paper from https://arxiv.org/pdf/2210.03629.pdf.

    Module

    conversational

    An agent designed to hold a conversation in addition to using tools.

    Module

    output_parser

    Module

    prompt

    Module

    base

    An agent designed to hold a conversation in addition to using tools.

    Module

    json_chat

    Module

    prompt

    Module

    base

    Module

    output_parsers

    Parsing utils to go from string to AgentAction or Agent Finish.

    Module

    react_json_single_input

    Module

    openai_functions

    Module

    openai_tools

    Module

    json

    Module

    xml

    Module

    react_single_input

    Module

    self_ask

    Module

    tools

    Module

    conversational_chat

    An agent designed to hold a conversation in addition to using tools.

    Module

    output_parser

    Module

    prompt

    Module

    base

    An agent designed to hold a conversation in addition to using tools.

    Module

    agent_toolkits

    Agent toolkits contain integrations with various resources and services.

    Module

    azure_cognitive_services

    Module

    base

    Module

    jira

    Jira Toolkit.

    Module

    toolkit

    Module

    file_management

    Local file management toolkit.

    Module

    toolkit

    Module

    zapier

    Zapier Toolkit.

    Module

    toolkit

    Module

    python

    Module

    steam

    Steam Toolkit.

    Module

    toolkit

    Module

    gitlab

    GitLab Toolkit.

    Module

    toolkit

    Module

    spark_sql

    Spark SQL agent.

    Module

    prompt

    Module

    toolkit

    Module

    base

    Module

    spark

    Module

    csv

    Module

    powerbi

    Power BI agent.

    Module

    chat_base

    Module

    prompt

    Module

    toolkit

    Module

    base

    Module

    slack

    Slack toolkit.

    Module

    toolkit

    Module

    sql

    SQL agent.

    Module

    prompt

    Module

    toolkit

    Module

    base

    Module

    ainetwork

    AINetwork toolkit.

    Module

    toolkit

    Module

    playwright

    Playwright browser toolkit.

    Module

    toolkit

    Module

    openapi

    OpenAPI spec agent.

    Module

    planner

    Module

    prompt

    Module

    spec

    Module

    planner_prompt

    Module

    toolkit

    Module

    base

    Module

    clickup

    Module

    toolkit

    Module

    vectorstore

    Agent toolkit for interacting with vector stores.

    Module

    prompt

    Module

    toolkit

    Toolkit for interacting with a vector store.

    Module

    base

    VectorStore agent.

    Module

    github

    GitHub Toolkit.

    Module

    toolkit

    Module

    amadeus

    Module

    toolkit

    Module

    office365

    Office365 toolkit.

    Module

    toolkit

    Module

    conversational_retrieval

    Module

    tool

    Module

    openai_functions

    Module

    pandas

    Module

    json

    Json agent.

    Module

    prompt

    Module

    toolkit

    Module

    base

    Module

    gmail

    Gmail toolkit.

    Module

    toolkit

    Module

    xorbits

    Module

    nla

    Module

    tool

    Module

    toolkit

    Module

    nasa

    NASA Toolkit.

    Module

    toolkit

    Module

    multion

    MultiOn Toolkit.

    Module

    toolkit

    Module

    openai_assistant

    Module

    base

    Module

    format_scratchpad

    Logic for formatting intermediate steps into an agent scratchpad.

    Module

    log_to_messages

    Module

    openai_functions

    Module

    openai_tools

    Module

    xml

    Module

    log

    Module

    tools

    Module

    tool_calling_agent

    Module

    base

    Module

    self_ask_with_search

    Chain that does self ask with search.

    Module

    output_parser

    Module

    prompt

    Module

    base

    Chain that does self-ask with search.

    Module

    mrkl

    Attempt to implement MRKL systems as described in arxiv.org/pdf/2205.00445.pdf.

    Module

    output_parser

    Module

    prompt

    Module

    base

    Attempt to implement MRKL systems as described in arxiv.org/pdf/2205.00445.pdf.

    Module

    openai_tools

    Module

    base

    Module

    chat

    Module

    output_parser

    Module

    prompt

    Module

    base

    Module

    docstore

    Docstores are classes to store and load Documents.

    Module

    in_memory

    Module

    document

    Module

    arbitrary_fn

    Module

    wikipedia

    Module

    base

    Module

    document_transformers

    Document Transformers are classes to transform Documents.

    Module

    beautiful_soup_transformer

    Module

    nuclia_text_transform

    Module

    google_translate

    Module

    html2text

    Module

    long_context_reorder

    Module

    openai_functions

    Module

    doctran_text_extract

    Module

    doctran_text_translate

    Module

    doctran_text_qa

    Module

    embeddings_redundant_filter

    Module

    prompts

    Prompt is the input to the model.

    Module

    loading

    Module

    chat

    Module

    prompt

    Module

    few_shot_with_templates

    Module

    few_shot

    Module

    base

    Module

    example_selector

    Logic for selecting examples to include in prompts.

    Module

    length_based

    Module

    ngram_overlap

    Module

    semantic_similarity

    Module

    base

    Module

    chains

    Chains are easily reusable components linked together.

    Module

    loading

    Functionality for loading chains.

    Module

    mapreduce

    Map-reduce chain.

    Module

    sequential

    Chain pipeline where the outputs of one step feed directly into next.

    Module

    history_aware_retriever

    Module

    retrieval

    Module

    transform

    Chain that runs an arbitrary python function.

    Module

    llm

    Chain that just formats a prompt and calls an LLM.

    Module

    example_generator

    Module

    llm_requests

    Module

    moderation

    Pass input through a moderation endpoint.

    Module

    prompt_selector

    Module

    base

    Base interface that all chains should implement.

    Module

    combine_documents

    Different ways to combine documents.

    Module

    map_rerank

    Combining documents by mapping a chain over them first, then reranking results.

    Module

    stuff

    Chain that combines documents by stuffing into context.

    Module

    reduce

    Combine many documents together by recursively reducing them.

    Module

    refine

    Combine documents by doing a first pass and then refining on more documents.

    Module

    map_reduce

    Combining documents by mapping a chain over them first, then combining results.

    Module

    base

    Base interface for chains combining documents.

    Module

    api

    Chain that makes API calls and summarizes the responses to answer a question.

    Module

    open_meteo_docs

    Module

    podcast_docs

    Module

    prompt

    Module

    news_docs

    Module

    tmdb_docs

    Module

    base

    Chain that makes API calls and summarizes the responses to answer a question.

    Module

    openapi

    Module

    prompts

    Module

    response_chain

    Module

    requests_chain

    Module

    chain

    Module

    llm_checker

    Chain that tries to verify assumptions before answering a question.

    Module

    prompt

    Module

    base

    Chain for question-answering with self-verification.

    Module

    elasticsearch_database

    Module

    prompts

    Module

    base

    Chain for interacting with Elasticsearch Database.

    Module

    hyde

    Hypothetical Document Embeddings.

    Module

    prompts

    Module

    base

    Hypothetical Document Embeddings.

    Module

    flare

    Adapted from https://github.com/jzbjyb/FLARE.

    Module

    prompts

    Module

    base

    Module

    router

    Module

    multi_prompt_prompt

    Prompt for the router chain in the multi-prompt chain.

    Module

    embedding_router

    Module

    multi_prompt

    Use a single chain to route an input to one of multiple llm chains.

    Module

    multi_retrieval_prompt

    Prompt for the router chain in the multi-retrieval qa chain.

    Module

    multi_retrieval_qa

    Use a single chain to route an input to one of multiple retrieval qa chains.

    Module

    llm_router

    Base classes for LLM-powered router chains.

    Module

    base

    Base classes for chain routing.

    Module

    chat_vector_db

    Module

    prompts

    Module

    qa_generation

    Module

    prompt

    Module

    base

    Module

    qa_with_sources

    Load question answering with sources chains.

    Module

    loading

    Load question answering with sources chains.

    Module

    retrieval

    Question-answering with sources over an index.

    Module

    stuff_prompt

    Module

    map_reduce_prompt

    Module

    refine_prompts

    Module

    vector_db

    Question-answering with sources over a vector database.

    Module

    base

    Question answering with sources over documents.

    Module

    llm_bash

    Module

    natbot

    Implement a GPT-3 driven browser.

    Module

    crawler

    Module

    prompt

    Module

    base

    Implement an LLM driven browser.

    Module

    question_answering

    Module

    map_rerank_prompt

    Module

    chain

    Load question answering chains.

    Module

    stuff_prompt

    Module

    map_reduce_prompt

    Module

    refine_prompts

    Module

    query_constructor

    Module

    prompt

    Module

    ir

    Internal representation of a structured query language.

    Module

    parser

    Module

    schema

    Module

    base

    LLM Chain for turning a user text query into a structured query.

    Module

    summarize

    Module

    chain

    Load summarizing chains.

    Module

    stuff_prompt

    Module

    map_reduce_prompt

    Module

    refine_prompts

    Module

    sql_database

    Chain for interacting with SQL Database.

    Module

    prompt

    Module

    query

    Module

    llm_summarization_checker

    Summarization checker chain for verifying accuracy of text generation.

    Module

    base

    Chain for summarization with self-verification.

    Module

    conversational_retrieval

    Chain for chatting with a vector database.

    Module

    prompts

    Module

    base

    Chain for chatting with a vector database.

    Module

    structured_output

    Module

    base

    Module

    graph_qa

    Module

    ontotext_graphdb

    Module

    kuzu

    Module

    cypher

    Module

    cypher_utils

    Module

    prompts

    Module

    hugegraph

    Module

    gremlin

    Module

    neptune_sparql

    Module

    nebulagraph

    Module

    sparql

    Module

    falkordb

    Module

    neptune_cypher

    Module

    arangodb

    Module

    base

    Module

    conversation

    Chain that carries on a conversation from a prompt plus history.

    Module

    memory

    Memory modules for conversation prompts.

    Module

    prompt

    Module

    base

    Chain that carries on a conversation and calls an LLM.

    Module

    constitutional_ai

    Constitutional AI.

    Module

    principles

    Constitutional principles.

    Module

    prompts

    Module

    models

    Models for the Constitutional AI chain.

    Module

    base

    Chain for applying constitutional principles to the outputs of another chain.

    Module

    llm_math

    Chain that interprets a prompt and executes python code to do math.

    Module

    prompt

    Module

    base

    Chain that interprets a prompt and executes python code to do math.

    Module

    llm_symbolic_math

    Module

    retrieval_qa

    Chain for question-answering against a vector database.

    Module

    prompt

    Module

    base

    Chain for question-answering against a vector database.

    Module

    openai_tools

    Module

    extraction

    Module

    openai_functions

    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.

    Module

    ernie_functions

    Module

    base

    Module

    callbacks

    Callback handlers allow listening to events in LangChain.

    Module

    promptlayer_callback

    Module

    streaming_stdout

    Callback Handler streams to stdout on new llm token.

    Module

    labelstudio_callback

    Module

    flyte_callback

    Module

    context_callback

    Module

    utils

    Module

    mlflow_callback

    Module

    streaming_stdout_final_only

    Callback Handler streams to stdout on new llm token.

    Module

    openai_info

    Module

    file

    Module

    clearml_callback

    Module

    sagemaker_callback

    Module

    arize_callback

    Module

    human

    Module

    comet_ml_callback

    Module

    aim_callback

    Module

    arthur_callback

    Module

    llmonitor_callback

    Module

    infino_callback

    Module

    stdout

    Module

    argilla_callback

    Module

    confident_callback

    Module

    streaming_aiter_final_only

    Module

    manager

    Module

    streaming_aiter

    Module

    trubrics_callback

    Module

    wandb_callback

    Module

    whylabs_callback

    Module

    base

    Base callback handler that can be used to handle callbacks in langchain.

    Module

    streamlit

    Module

    streamlit_callback_handler

    Module

    mutable_expander

    Module

    tracers

    Tracers that record execution of LangChain runs.

    Module

    root_listeners

    Module

    comet

    Module

    run_collector

    Module

    wandb

    Module

    evaluation

    A tracer that runs evaluators over completed runs.

    Module

    stdout

    Module

    langchain

    A Tracer implementation that records to LangChain endpoint.

    Module

    schemas

    Module

    logging

    Module

    log_stream

    Module

    base

    Base interfaces for tracing runs.

    Module

    vectorstores

    Vector store stores embedded data and performs vector search.

    Module

    databricks_vector_search

    Module

    vald

    Module

    tair

    Module

    mongodb_atlas

    Module

    pgvecto_rs

    Module

    elastic_vector_search

    Module

    momento_vector_index

    Module

    elasticsearch

    Module

    lancedb

    Module

    bageldb

    Module

    baiducloud_vector_search

    Module

    zep

    Module

    nucliadb

    Module

    cassandra

    Module

    clickhouse

    Module

    annoy

    Module

    utils

    Module

    dashvector

    Module

    tiledb

    Module

    awadb

    Module

    chroma

    Module

    qdrant

    Module

    hippo

    Module

    atlas

    Module

    supabase

    Module

    zilliz

    Module

    xata

    Module

    starrocks

    Module

    azure_cosmos_db

    Module

    opensearch_vector_search

    Module

    alibabacloud_opensearch

    Module

    matching_engine

    Module

    vearch

    Module

    meilisearch

    Module

    pinecone

    Module

    faiss

    Module

    scann

    Module

    typesense

    Module

    weaviate

    Module

    vectara

    Module

    semadb

    Module

    epsilla

    Module

    hologres

    Module

    dingo

    Module

    myscale

    Module

    analyticdb

    Module

    sklearn

    Module

    yellowbrick

    Module

    pgvector

    Module

    azuresearch

    Module

    rocksetdb

    Module

    pgembedding

    Module

    llm_rails

    Module

    marqo

    Module

    timescalevector

    Module

    singlestoredb

    Module

    vespa

    Module

    milvus

    Module

    tencentvectordb

    Module

    deeplake

    Module

    neo4j_vector

    Module

    astradb

    Module

    sqlitevss

    Module

    usearch

    Module

    clarifai

    Module

    base

    Module

    redis

    Module

    filters

    Module

    schema

    Module

    base

    Module

    docarray

    Module

    hnsw

    Module

    in_memory

    Module

    base

    Module

    deprecation

    Module

    module_import

    Module

    interactive_env

    Module

    path

    Module

    memory

    Memory maintains Chain state, incorporating context from past runs.

    Module

    token_buffer

    Module

    zep_memory

    Module

    motorhead_memory

    Module

    simple

    Module

    buffer_window

    Module

    utils

    Module

    vectorstore

    Class for a VectorStore-backed memory object.

    Module

    summary

    Module

    buffer

    Module

    prompt

    Module

    chat_memory

    Module

    combined

    Module

    vectorstore_token_buffer_memory

    Class for a conversation memory buffer with older messages stored in a vectorstore .

    Module

    entity

    Deprecated as of LangChain v0.3.4 and will be removed in LangChain v1.0.0.

    Module

    readonly

    Module

    summary_buffer

    Module

    kg

    Module

    chat_message_histories

    Module

    in_memory

    Module

    firestore

    Module

    momento

    Module

    elasticsearch

    Module

    zep

    Module

    cassandra

    Module

    mongodb

    Module

    file

    Module

    xata

    Module

    streamlit

    Module

    upstash_redis

    Module

    neo4j

    Module

    sql

    Module

    rocksetdb

    Module

    singlestoredb

    Module

    redis

    Module

    dynamodb

    Module

    astradb

    Module

    postgres

    Module

    cosmos_db

    Module

    adapters

    Module

    openai

    Module

    indexes

    Indexes.

    Module

    graph

    Graphs provide a natural language interface to graph databases.

    Module

    vectorstore

    Vectorstore stubs for the indexing api.

    Module

    prompts

    Relevant prompts for constructing indexes.

    Module

    entity_summarization

    Module

    knowledge_triplet_extraction

    Module

    entity_extraction

    Module

    llms

    LLMs.

    Module

    gigachat

    Module

    javelin_ai_gateway

    Module

    writer

    Module

    ai21

    Module

    fake

    Module

    bananadev

    Module

    manifest

    Module

    cohere

    Module

    titan_takeoff

    Module

    loading

    Module

    sagemaker_endpoint

    Module

    google_palm

    Module

    predibase

    Module

    mlflow_ai_gateway

    Module

    symblai_nebula

    Module

    utils

    Module

    azureml_endpoint

    Module

    minimax

    Module

    titan_takeoff_pro

    Module

    openai

    Module

    pai_eas_endpoint

    Module

    edenai

    Module

    nlpcloud

    Module

    mosaicml

    Module

    gooseai

    Module

    replicate

    Module

    mlflow

    Module

    opaqueprompts

    Module

    llamacpp

    Module

    anyscale

    Module

    human

    Module

    petals

    Module

    aviary

    Module

    huggingface_text_gen_inference

    Module

    fireworks

    Module

    forefrontai

    Module

    koboldai

    Module

    vertexai

    Module

    modal

    Module

    bittensor

    Module

    ollama

    Module

    predictionguard

    Module

    huggingface_endpoint

    Module

    volcengine_maas

    Module

    deepsparse

    Module

    self_hosted_hugging_face

    Module

    bedrock

    Module

    baseten

    Module

    self_hosted

    Module

    huggingface_hub

    Module

    databricks

    Module

    ctranslate2

    Module

    pipelineai

    Module

    tongyi

    Module

    cloudflare_workersai

    Module

    textgen

    Module

    yandex

    Module

    gpt4all

    Module

    gradient_ai

    Module

    stochasticai

    Module

    octoai_endpoint

    Module

    rwkv

    Module

    cerebriumai

    Module

    openlm

    Module

    huggingface_pipeline

    Module

    watsonxllm

    Module

    together

    Module

    amazon_api_gateway

    Module

    anthropic

    Module

    xinference

    Module

    baidu_qianfan_endpoint

    Module

    vllm

    Module

    beam

    Module

    deepinfra

    Module

    openllm

    Module

    chatglm

    Module

    arcee

    Module

    ctransformers

    Module

    aleph_alpha

    Module

    clarifai

    Module

    promptlayer_openai

    Module

    base

    This module provides backward-compatible exports of core language model classes.

    Module

    evaluation

    Evaluation chains for grading LLM and Chain outputs.

    Module

    loading

    Loading datasets and evaluators.

    Module

    schema

    Interfaces to be implemented by general evaluators.

    Module

    exact_match

    Module

    base

    Module

    criteria

    Criteria or rubric based evaluators.

    Module

    prompt

    Module

    eval_chain

    Module

    scoring

    Scoring evaluators.

    Module

    prompt

    Prompts for scoring the outputs of a models for a given question.

    Module

    eval_chain

    Base classes for scoring the output of a model on a scale of 1-10.

    Module

    qa

    Chains and utils related to evaluating question answering functionality.

    Module

    eval_prompt

    Module

    generate_prompt

    Module

    generate_chain

    LLM Chain for generating examples for question answering.

    Module

    eval_chain

    LLM Chains for evaluating question answering.

    Module

    string_distance

    String distance evaluators.

    Module

    base

    String distance evaluators based on the RapidFuzz library.

    Module

    embedding_distance

    Evaluators that measure embedding distances.

    Module

    base

    A chain for comparing the output of two models using embeddings.

    Module

    agents

    Chains for evaluating ReAct style agents.

    Module

    trajectory_eval_prompt

    Prompt for trajectory evaluation chain.

    Module

    trajectory_eval_chain

    A chain for evaluating ReAct style agents.

    Module

    parsing

    Module

    json_schema

    Module

    json_distance

    Module

    base

    Evaluators for parsing strings.

    Module

    comparison

    Comparison evaluators.

    Module

    prompt

    Prompts for comparing the outputs of two models for a given question.

    Module

    eval_chain

    Base classes for comparing the output of two models.

    Module

    regex_match

    Module

    base

    Types

    Type

    MODEL_OR_CHAIN_FACTORY

    Type

    MCF

    Type

    CUSTOM_EVALUATOR_TYPE

    Type

    SINGLE_EVAL_CONFIG_TYPE

    Type

    RunnableAgentType

    Type

    AGENT_TYPE

    Type

    OutputType

    Type

    CHAT_TURN_TYPE

    Type

    CRITERIA_TYPE