langchain_experimental
API Reference¶
langchain_experimental.agents
¶
Functions¶
Create csv agent by loading to a dataframe and using pandas agent. |
|
|
Construct a pandas agent from an LLM and dataframe. |
Construct a python agent from an LLM and tool. |
|
|
Construct a Spark agent from an LLM and dataframe. |
|
Construct a xorbits agent from an LLM and dataframe. |
langchain_experimental.autonomous_agents
¶
Classes¶
Agent class for interacting with Auto-GPT. |
|
Memory for AutoGPT. |
|
Action returned by AutoGPTOutputParser. |
|
Output parser for AutoGPT. |
|
|
Base Output parser for AutoGPT. |
Prompt for AutoGPT. |
|
|
A class for generating custom prompt strings. |
Controller model for the BabyAGI agent. |
|
Chain generating tasks. |
|
|
Chain to execute tasks. |
|
Chain to prioritize tasks. |
|
Chain to execute tasks. |
|
|
|
Load tools to execute tasks. |
Create a new model by parsing and validating input data from keyword arguments. |
|
|
Create a new model by parsing and validating input data from keyword arguments. |
Chain to execute tasks. |
|
Create a new model by parsing and validating input data from keyword arguments. |
Functions¶
|
Preprocesses a string to be parsed as json. |
|
Generates a prompt string. |
|
|
|
langchain_experimental.chat_models
¶
Chat Models are a variation on language models.
While Chat Models use language models under the hood, the interface they expose is a bit different. Rather than expose a “text in, text out” API, they expose an interface where “chat messages” are the inputs and outputs.
Class hierarchy:
BaseLanguageModel --> BaseChatModel --> <name> # Examples: ChatOpenAI, ChatGooglePalm
Main helpers:
AIMessage, BaseMessage, HumanMessage
Classes¶
Create a new model by parsing and validating input data from keyword arguments. |
|
Create a new model by parsing and validating input data from keyword arguments. |
|
Create a new model by parsing and validating input data from keyword arguments. |
|
Create a new model by parsing and validating input data from keyword arguments. |
langchain_experimental.comprehend_moderation
¶
Classes¶
langchain_experimental.cpal
¶
Classes¶
Causal program-aided language (CPAL) chain implementation. |
|
Translate the causal narrative into a stack of operations. |
|
Set the hypothetical conditions for the causal model. |
|
Decompose the narrative into its story elements |
|
Query the outcome table using SQL. |
|
|
Enum for constants used in the CPAL. |
Create a new model by parsing and validating input data from keyword arguments. |
|
Create a new model by parsing and validating input data from keyword arguments. |
|
Initial conditions for an entity |
|
aka initial conditions |
|
Represent the narrative input as three story elements. |
|
translate a question about the story outcome into a programmatic expression |
|
Create a new model by parsing and validating input data from keyword arguments. |
|
Create a new model by parsing and validating input data from keyword arguments. |
|
Initial global conditions for the system. |
langchain_experimental.data_anonymizer
¶
Data anonymizer package
Classes¶
Base abstract class for anonymizers. It is public and non-virtual because it allows wrapping the behavior for all methods in a base class. |
|
Base abstract class for reversible anonymizers. |
|
|
|
|
|
|
|
|
|
Functions¶
langchain_experimental.fallacy_removal
¶
The Chain runs a self-review of logical fallacies as determined by this paper categorizing and defining logical fallacies https://arxiv.org/pdf/2212.07425.pdf. Modeled after Constitutional AI and in same format, but applying logical fallacies as generalized rules to remove in output
Classes¶
Chain for applying logical fallacy evaluations, modeled after Constitutional AI and in same format, but applying logical fallacies as generalized rules to remove in output |
|
Class for a logical fallacy. |
langchain_experimental.generative_agents
¶
Generative Agents primitives.
Classes¶
An Agent as a character with memory and innate characteristics. |
|
Memory for the generative agent. |
langchain_experimental.graph_transformers
¶
Classes¶
Transforms documents into graph documents using Diffbot's NLP API. |
|
Manages a list of nodes with associated properties. |
|
Provides functionality for working with a simplified schema mapping. |
Functions¶
langchain_experimental.llm_bash
¶
Chain that interprets a prompt and executes bash code to perform bash operations.
Classes¶
Chain that interprets a prompt and executes bash operations. |
|
|
Wrapper class for starting subprocesses. |
Parser for bash output. |
langchain_experimental.llm_symbolic_math
¶
Chain that interprets a prompt and executes python code to do math.
Heavily borrowed from llm_math, wrapper for SymPy
Classes¶
Chain that interprets a prompt and executes python code to do symbolic math. |
langchain_experimental.llms
¶
Experimental LLM wrappers.
Classes¶
Create a new model by parsing and validating input data from keyword arguments. |
|
A heavy-handed solution, but it's fast for prototyping. |
|
Jsonformer wrapped LLM using HuggingFace Pipeline API. |
|
Create a new model by parsing and validating input data from keyword arguments. |
|
LMFormatEnforcer wrapped LLM using HuggingFace Pipeline API. |
|
Create a new model by parsing and validating input data from keyword arguments. |
|
RELLM wrapped LLM using HuggingFace Pipeline API. |
Functions¶
Lazily import jsonformer. |
|
Lazily import lmformatenforcer. |
|
Lazily import rellm. |
langchain_experimental.open_clip
¶
Classes¶
Create a new model by parsing and validating input data from keyword arguments. |
langchain_experimental.pal_chain
¶
Implements Program-Aided Language Models.
As in https://arxiv.org/pdf/2211.10435.pdf.
This is vulnerable to arbitrary code execution: https://github.com/langchain-ai/langchain/issues/5872
Classes¶
Implements Program-Aided Language Models (PAL). |
|
|
Initialize a PALValidation instance. |
langchain_experimental.plan_and_execute
¶
Classes¶
Plan and execute a chain of steps. |
|
Base executor. |
|
Chain executor. |
|
Base planner. |
|
LLM planner. |
|
Planning output parser. |
|
Base step container. |
|
List step container. |
|
Plan. |
|
Plan output parser. |
|
Step. |
|
Step response. |
Functions¶
|
Load an agent executor. |
|
Load a chat planner. |
langchain_experimental.prompt_injection_identifier
¶
HuggingFace Security toolkit.
Classes¶
|
Tool that uses HF model to detect prompt injection attacks. |
Functions¶
langchain_experimental.prompts
¶
Functions¶
|
Unified method for loading a prompt from LangChainHub or local fs. |
langchain_experimental.retrievers
¶
Classes¶
|
Retriever that uses SQLDatabase as Retriever |
langchain_experimental.rl_chain
¶
Classes¶
Create a new model by parsing and validating input data from keyword arguments. |
|
|
|
|
|
|
|
The RLChain class leverages the Vowpal Wabbit (VW) model as a learned policy for reinforcement learning. |
|
Abstract method to grade the chosen selection or the response of the llm |
|
|
|
PickBest is a class designed to leverage the Vowpal Wabbit (VW) model for reinforcement learning with a context, with the goal of modifying the prompt before the LLM call. |
|
Text Embedder class that embeds the BasedOn and ToSelectFrom inputs into a format that can be used by the learning policy |
|
Functions¶
|
|
|
|
|
|
|
|
|
Embeds the actions or context using the SentenceTransformer model (or a model that has an encode function) |
|
Helper function to embed a dictionary item. |
|
|
|
Helper function to embed a string or an _Embed object. |
Helper function to check if an item is a string. |
|
|
|
go over all the inputs and if something is either wrapped in _ToSelectFrom or _BasedOn, and if their inner values are not already _Embed, then wrap them in EmbedAndKeep while retaining their _ToSelectFrom or _BasedOn status |
|
|
langchain_experimental.smart_llm
¶
Generalized implementation of SmartGPT (origin: https://youtu.be/wVzuvf9D9BU)
Classes¶
Generalized implementation of SmartGPT (origin: https://youtu.be/wVzuvf9D9BU) |
langchain_experimental.sql
¶
Chain for interacting with SQL Database.
Classes¶
Chain for interacting with SQL Database. |
|
Chain for querying SQL database that is a sequential chain. |
|
Chain for interacting with Vector SQL Database. |
|
Output Parser for Vector SQL 1. |
|
Based on VectorSQLOutputParser It also modify the SQL to get all columns |
Functions¶
|
langchain_experimental.tabular_synthetic_data
¶
Classes¶
Generates synthetic data using the given LLM and few-shot template. |
Functions¶
|
Create an instance of SyntheticDataGenerator tailored for OpenAI models. |
langchain_experimental.tools
¶
Classes¶
A tool for running python code in a REPL. |
|
Create a new model by parsing and validating input data from keyword arguments. |
|
A tool for running python code in a REPL. |
Functions¶
Sanitize input to the python REPL. |
langchain_experimental.tot
¶
Classes¶
A Chain implementing the Tree of Thought (ToT). |
|
Tree of Thought (ToT) checker. |
|
Tree of Thought (ToT) controller. |
|
|
Memory for the Tree of Thought (ToT) chain. |
Class to parse the output of a PROPOSE_PROMPT response. |
|
Create a new model by parsing and validating input data from keyword arguments. |
|
|
|
Base class for a thought generation strategy. |
|
Propose thoughts sequentially using a "propose prompt". |
|
Sample thoughts from a Chain-of-Thought (CoT) prompt. |
Functions¶
langchain_experimental.utilities
¶
Classes¶
Simulates a standalone Python REPL. |