langchain-core: 0.2.30#
langchain-core
defines the base abstractions for the LangChain ecosystem.
The interfaces for core components like chat models, LLMs, vector stores, retrievers, and more are defined here. The universal invocation protocol (Runnables) along with a syntax for combining components (LangChain Expression Language) are also defined here.
No third-party integrations are defined here. The dependencies are kept purposefully very lightweight.
agents#
Represents a request to execute an action by an agent. |
|
Representation of an action to be executed by an agent. |
|
Final return value of an ActionAgent. |
|
Result of running an AgentAction. |
beta#
Context for a runnable. |
|
|
Context for a runnable with a prefix. |
caches#
Interface for a caching layer for LLMs and Chat models. |
|
|
Cache that stores things in memory. |
callbacks#
Async callback handler for LangChain. |
|
Base callback handler for LangChain. |
|
|
Base callback manager for LangChain. |
Mixin for callback manager. |
|
Mixin for chain callbacks. |
|
Mixin for LLM callbacks. |
|
Mixin for Retriever callbacks. |
|
Mixin for run manager. |
|
Mixin for tool callbacks. |
|
|
Callback Handler that writes to a file. |
|
Async callback manager that handles callbacks from LangChain. |
Async callback manager for the chain group. |
|
Async callback manager for chain run. |
|
Async callback manager for LLM run. |
|
|
Async callback manager for retriever run. |
Async callback manager for tool run. |
|
Async Parent Run Manager. |
|
|
Async Run Manager. |
|
Base class for run manager (a bound callback manager). |
|
Callback manager for LangChain. |
Callback manager for the chain group. |
|
Callback manager for chain run. |
|
Callback manager for LLM run. |
|
Callback manager for retriever run. |
|
Callback manager for tool run. |
|
|
Sync Parent Run Manager. |
|
Sync Run Manager. |
Callback Handler that prints to std out. |
|
Callback handler for streaming. |
chat_history#
Abstract base class for storing chat message history. |
|
In memory implementation of chat message history. |
chat_loaders#
Base class for chat loaders. |
chat_sessions#
Chat Session represents a single conversation, channel, or other group of messages. |
document_loaders#
Abstract interface for blob parsers. |
|
Interface for Document Loader. |
|
Abstract interface for blob loaders implementation. |
documents#
Use to represent media content. |
|
Blob represents raw data by either reference or value. |
|
Class for storing a piece of text and associated metadata. |
|
Base class for document compressors. |
|
Abstract base class for document transformation. |
embeddings#
Interface for embedding models. |
|
Deterministic fake embedding model for unit testing purposes. |
|
Fake embedding model for unit testing purposes. |
example_selectors#
Interface for selecting examples to include in prompts. |
|
Select examples based on length. |
|
|
Select examples based on Max Marginal Relevance. |
|
Select examples based on semantic similarity. |
exceptions#
General LangChain exception. |
|
|
Exception that output parsers should raise to signify a parsing error. |
Base class for exceptions in tracers module. |
globals#
graph_vectorstores#
Retriever class for GraphVectorStore. |
|
Node in the GraphVectorStore. |
|
|
A link to/from a tag of a given tag. |
indexing#
Return a detailed a breakdown of the result of the indexing operation. |
|
A generic response for delete operation. |
|
|
An in-memory record manager for testing purposes. |
|
Abstract base class representing the interface for a record manager. |
A generic response for upsert operations. |
|
language_models#
Abstract base class for interfacing with language models. |
|
Base class for chat models. |
|
LangSmith parameters for tracing. |
|
Simplified implementation for a chat model to inherit from. |
|
Fake LLM for testing purposes. |
|
Fake streaming list LLM for testing purposes. |
|
Fake Chat Model wrapper for testing purposes. |
|
Fake ChatModel for testing purposes. |
|
Fake ChatModel for testing purposes. |
|
Generic fake chat model that can be used to test the chat model interface. |
|
Generic fake chat model that can be used to test the chat model interface. |
|
Base LLM abstract interface. |
|
Simple interface for implementing a custom LLM. |
load#
|
Reviver for JSON objects. |
Base class for serialized objects. |
|
Serializable base class. |
|
Serialized constructor. |
|
Serialized not implemented. |
|
Serialized secret. |
memory#
Abstract base class for memory in Chains. |
messages#
Message from an AI. |
|
Message chunk from an AI. |
|
Usage metadata for a message, such as token counts. |
|
Base abstract message class. |
|
Message chunk, which can be concatenated with other Message chunks. |
|
Message that can be assigned an arbitrary speaker (i.e. |
|
Chat Message chunk. |
|
Message for passing the result of executing a tool back to a model. |
|
Function Message chunk. |
|
Message from a human. |
|
Human Message chunk. |
|
Message for priming AI behavior. |
|
System Message chunk. |
|
Allowance for errors made by LLM. |
|
Represents a request to call a tool. |
|
A chunk of a tool call (e.g., as part of a stream). |
|
Message for passing the result of executing a tool back to a model. |
|
Tool Message chunk. |
output_parsers#
Base class to parse the output of an LLM call. |
|
Abstract base class for parsing the outputs of a model. |
|
Base class to parse the output of an LLM call. |
|
Parse the output of an LLM call to a JSON object. |
|
alias of |
|
Parse the output of an LLM call to a comma-separated list. |
|
Parse the output of an LLM call to a list. |
|
Parse a Markdown list. |
|
Parse a numbered list. |
|
|
Parse an output as the element of the Json object. |
Parse an output as the Json object. |
|
Parse an output that is one of sets of values. |
|
|
Parse an output as an attribute of a pydantic object. |
|
Parse an output as a pydantic object. |
Parse tools from OpenAI response. |
|
Parse tools from OpenAI response. |
|
Parse tools from OpenAI response. |
|
Parse an output using a pydantic model. |
|
OutputParser that parses LLMResult into the top likely string. |
|
|
Base class for an output parser that can handle streaming input. |
Base class for an output parser that can handle streaming input. |
|
Parse an output using xml format. |
outputs#
A single chat generation output. |
|
ChatGeneration chunk, which can be concatenated with other ChatGeneration chunks. |
|
Use to represent the result of a chat model call with a single prompt. |
|
A single text generation output. |
|
Generation chunk, which can be concatenated with other Generation chunks. |
|
A container for results of an LLM call. |
|
Class that contains metadata for a single execution of a Chain or model. |
prompt_values#
Chat prompt value. |
|
Chat prompt value which explicitly lists out the message types it accepts. |
|
Image prompt value. |
|
Image URL. |
|
Base abstract class for inputs to any language model. |
|
String prompt value. |
prompts#
Base class for all prompt templates, returning a prompt. |
|
AI message prompt template. |
|
Base class for chat prompt templates. |
|
Base class for message prompt templates. |
|
Base class for message prompt templates that use a string prompt template. |
|
Chat message prompt template. |
|
Prompt template for chat models. |
|
Human message prompt template. |
|
Prompt template that assumes variable is already list of messages. |
|
System message prompt template. |
|
Chat prompt template that supports few-shot examples. |
|
Prompt template that contains few shot examples. |
|
Prompt template that contains few shot examples. |
|
Image prompt template for a multimodal model. |
|
Prompt template for composing multiple prompt templates together. |
|
Prompt template for a language model. |
|
String prompt that exposes the format method, returning a prompt. |
|
rate_limiters#
|
|
|
retrievers#
Abstract base class for a Document retrieval system. |
|
LangSmith parameters for tracing. |
runnables#
A unit of work that can be invoked, batched, streamed, transformed and composed. |
|
Wrap a Runnable with additional functionality. |
|
Runnable that delegates calls to another Runnable with a set of kwargs. |
|
Runnable that delegates calls to another Runnable with each element of the input sequence. |
|
Runnable that delegates calls to another Runnable with each element of the input sequence. |
|
|
Runnable that runs a generator function. |
|
RunnableLambda converts a python callable into a Runnable. |
alias of |
|
Runnable that runs a mapping of Runnables in parallel, and returns a mapping of their outputs. |
|
Sequence of Runnables, where the output of each is the input of the next. |
|
Runnable that can be serialized to JSON. |
|
Runnable that selects which branch to run based on a condition. |
|
ThreadPoolExecutor that copies the context to the child thread. |
|
Empty dict type. |
|
Configuration for a Runnable. |
|
Serializable Runnable that can be dynamically configured. |
|
Runnable that can be dynamically configured. |
|
Runnable that can be dynamically configured. |
|
|
String enum. |
Runnable that can fallback to other Runnables if it fails. |
|
|
Branch in a graph. |
|
Enum for different curve styles supported by Mermaid |
|
Edge in a graph. |
|
Graph of nodes and edges. |
Dictionary of labels for nodes and edges in a graph. |
|
|
Enum for different draw methods supported by Mermaid |
|
Node in a graph. |
|
Schema for Hexadecimal color codes for different node types. |
|
|
|
Class for drawing in ASCII. |
Class to define vertex box boundaries that will be accounted for during graph building by grandalf. |
|
|
Helper class to draw a state graph into a PNG file. |
Runnable that manages chat message history for another Runnable. |
|
Runnable that assigns key-value pairs to Dict[str, Any] inputs. |
|
Runnable to passthrough inputs unchanged or with additional keys. |
|
Runnable that picks keys from Dict[str, Any] inputs. |
|
Retry a Runnable if it fails. |
|
Router input. |
|
Runnable that routes to a set of Runnables based on Input['key']. |
|
Streaming event. |
|
Custom stream event created by the user. |
|
Data associated with a streaming event. |
|
A standard stream event that follows LangChain convention for event data. |
|
Dictionary that can be added to another dictionary. |
|
|
Field that can be configured by the user. |
Field that can be configured by the user with multiple default values. |
|
Field that can be configured by the user with a default value. |
|
Field that can be configured by the user. |
|
Get the nonlocal variables accessed of a function. |
|
Get the source code of a lambda function. |
|
Check if the first argument of a function is a dict. |
|
|
Check if a name is a local dict. |
Get nonlocal variables accessed. |
|
|
Protocol for objects that support addition. |
stores#
Abstract interface for a key-value store. |
|
In-memory implementation of the BaseStore using a dictionary. |
|
In-memory store for bytes. |
|
In-memory store for any type of data. |
|
Raised when a key is invalid; e.g., uses incorrect characters. |
structured_query#
|
Enumerator of the comparison operators. |
Comparison to a value. |
|
Base class for all expressions. |
|
Filtering expression. |
|
Logical operation over other directives. |
|
|
Enumerator of the operations. |
Structured query. |
|
Defines interface for IR translation using a visitor pattern. |
sys_info#
tools#
Interface LangChain tools must implement. |
|
Base Toolkit representing a collection of related tools. |
|
Annotation for a Tool arg that is not meant to be generated by a model. |
|
Raised when 'args_schema' is missing or has an incorrect type annotation. |
|
Optional exception that tool throws when execution error occurs. |
|
Input to the retriever. |
|
Tool that takes in function or coroutine directly. |
|
Tool that can operate on any number of inputs. |
tracers#
|
Async Base interface for tracers. |
|
Base interface for tracers. |
Tracer that runs a run evaluator whenever a run is persisted. |
|
Information about a run. |
|
Implementation of the SharedTracer that POSTS to the LangChain endpoint. |
|
A single entry in the run log. |
|
Tracer that streams run logs to a stream. |
|
|
Run log. |
Patch to the run log. |
|
State of the run. |
|
Async Tracer that calls listeners on run start, end, and error. |
|
Tracer that calls listeners on run start, end, and error. |
|
Tracer that collects all nested runs in a list. |
|
Run schema for the V2 API in the Tracer. |
|
|
Tracer that prints to the console. |
Tracer that calls a function with a single str parameter. |
utils#
Dummy lock that provides the proper interface but no protection. |
|
|
Create |
|
Async context manager for safely finalizing an asynchronously cleaned-up resource such as an async generator, calling its |
alias of |
|
Formatter that checks for extra keys. |
|
Representation of a callable function to send to an LLM. |
|
Representation of a callable function to the OpenAI API. |
|
Dummy lock that provides the proper interface but no protection. |
|
|
Create |
alias of |
|
Custom exception for Chevron errors. |
vectorstores#
Interface for vector store. |
|
Base Retriever class for VectorStore. |
|
In-memory implementation of VectorStore using a dictionary. |