runnables
#
LangChain Runnable and the LangChain Expression Language (LCEL).
The LangChain Expression Language (LCEL) offers a declarative method to build production-grade programs that harness the power of LLMs.
Programs created using LCEL and LangChain Runnables inherently support synchronous, asynchronous, batch, and streaming operations.
Support for async allows servers hosting LCEL based programs to scale better for higher concurrent loads.
Batch operations allow for processing multiple inputs in parallel.
Streaming of intermediate outputs, as they’re being generated, allows for creating more responsive UX.
This module contains schema and implementation of LangChain Runnables primitives.
Classes
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. |
Functions
Decorate a function to make it a Runnable. |
|
Coerce a Runnable-like object into a Runnable. |
|
Async call function that may optionally accept a run_manager and/or config. |
|
Call function that may optionally accept a run_manager and/or config. |
|
|
Ensure that a config is a dict with all keys present. |
|
Get an async callback manager for a config. |
Get a callback manager for a config. |
|
|
Get a list of configs from a single config or a list of configs. |
Get an executor for a config. |
|
|
Merge multiple configs into one. |
|
Patch a config with new values. |
Run a function in an executor. |
|
Make a ConfigurableFieldSpec for a ConfigurableFieldSingleOption or ConfigurableFieldMultiOption. |
|
Prefix the id of a ConfigurableFieldSpec. |
|
|
Check if a string is a valid UUID. |
|
Convert the data of a node to a JSON-serializable format. |
|
Convert the data of a node to a string. |
|
Build a DAG and draw it in ASCII. |
|
Draws a Mermaid graph using the provided graph data. |
Draws a Mermaid graph as PNG using provided syntax. |
|
Async identity function. |
|
Identity function. |
|
|
Asynchronously add a sequence of addable objects together. |
|
Check if a callable accepts a config argument. |
|
Check if a callable accepts a context argument. |
|
Check if a callable accepts a run_manager argument. |
|
Add a sequence of addable objects together. |
|
Run a coroutine with a semaphore. |
Gather coroutines with a limit on the number of concurrent coroutines. |
|
Get the keys of the first argument of a function if it is a dict. |
|
Get the source code of a lambda function. |
|
Get the unique config specs from a sequence of config specs. |
|
Indent all lines of text after the first line. |
|
Check if a function is async. |
|
Check if a function is an async generator. |