chains
#
Chains are easily reusable components linked together.
Chains encode a sequence of calls to components like models, document retrievers, other Chains, etc., and provide a simple interface to this sequence.
The Chain interface makes it easy to create apps that are:
Stateful: add Memory to any Chain to give it state,
Observable: pass Callbacks to a Chain to execute additional functionality, like logging, outside the main sequence of component calls,
Composable: combine Chains with other components, including other Chains.
Class hierarchy:
Chain --> <name>Chain # Examples: LLMChain, MapReduceChain, RouterChain
Classes
Abstract base class for creating structured sequences of calls to components. |
|
Base interface for chains combining documents. |
|
|
Interface for the combine_docs method. |
Interface for the combine_docs method. |
|
Class for a constitutional principle. |
|
|
Chain for chatting with an index. |
Chain for chatting with a vector database. |
|
Input type for ConversationalRetrievalChain. |
|
|
Chain for interacting with Elasticsearch Database. |
Chain that combines a retriever, a question generator, and a response generator. |
|
Chain that generates questions from uncertain spans. |
|
Output parser that checks if the output is finished. |
|
Generate hypothetical document for query, and then embed that. |
|
Pass input through a moderation endpoint. |
|
A crawler for web pages. |
|
A typed dictionary containing information about elements in the viewport. |
|
|
Class representing a single statement. |
A question and its answer as a list of facts each one should have a source. |
|
Chain for making a simple request to an API endpoint. |
|
An answer to the question, with sources. |
|
Base class for prompt selectors. |
|
Prompt collection that goes through conditionals. |
|
Interface for loading the combine documents chain. |
|
|
Question-answering with sources over an index. |
Question-answering with sources over a vector database. |
|
Output parser that parses a structured query. |
|
A date in ISO 8601 format (YYYY-MM-DD). |
|
A datetime in ISO 8601 format (YYYY-MM-DDTHH:MM:SS). |
|
Information about a data source attribute. |
|
Interface for loading the combine documents chain. |
|
Use a single chain to route an input to one of multiple candidate chains. |
|
|
Create new instance of Route(destination, next_inputs) |
Chain that outputs the name of a destination chain and the inputs to it. |
|
Chain that uses embeddings to route between options. |
|
Parser for output of router chain in the multi-prompt chain. |
|
A multi-route chain that uses an LLM router chain to choose amongst retrieval qa chains. |
|
Chain where the outputs of one chain feed directly into next. |
|
Simple chain where the outputs of one step feed directly into next. |
|
Input for a SQL Chain. |
|
Input for a SQL Chain. |
|
Interface for loading the combine documents chain. |
|
Chain that transforms the chain output. |
Functions
Execute a collapse function on a set of documents and merge their metadatas. |
|
Execute a collapse function on a set of documents and merge their metadatas. |
|
Split Documents into subsets that each meet a cumulative length constraint. |
|
|
Create a chain for passing a list of Documents to a model. |
Return another example given a list of examples for a prompt. |
|
|
Create a chain that takes conversation history and returns documents. |
|
Create a citation fuzzy match Runnable. |
|
Convert a valid OpenAPI spec to the JSON Schema format expected for OpenAI |
Return the kwargs for the LLMChain constructor. |
|
Check if the language model is a chat model. |
|
Check if the language model is a LLM. |
|
Construct examples from input-output pairs. |
|
Fix invalid filter directive. |
|
|
Create query construction prompt. |
|
Load a query constructor runnable chain. |
Return a parser for the query language. |
|
Dummy decorator for when lark is not installed. |
|
Create retrieval chain that retrieves documents and then passes them on. |
|
Create a chain that generates SQL queries. |
|
Get the appropriate function output parser given the user functions. |
|
Load summarizing chain. |
Deprecated classes
|
|
|
|
Deprecated functions