langchain-experimental: 0.3.4#

agents#

Functions

agents.agent_toolkits.csv.base.create_csv_agent(...)

Create pandas dataframe agent by loading csv to a dataframe.

agents.agent_toolkits.pandas.base.create_pandas_dataframe_agent(llm, df)

Construct a Pandas agent from an LLM and dataframe(s).

agents.agent_toolkits.python.base.create_python_agent(...)

Construct a python agent from an LLM and tool.

agents.agent_toolkits.spark.base.create_spark_dataframe_agent(llm, df)

Construct a Spark agent from an LLM and dataframe.

agents.agent_toolkits.xorbits.base.create_xorbits_agent(...)

Construct a xorbits agent from an LLM and dataframe.

autonomous_agents#

Classes

autonomous_agents.autogpt.agent.AutoGPT(...)

Agent for interacting with AutoGPT.

autonomous_agents.autogpt.memory.AutoGPTMemory

Memory for AutoGPT.

autonomous_agents.autogpt.output_parser.AutoGPTAction(...)

Action returned by AutoGPTOutputParser.

autonomous_agents.autogpt.output_parser.AutoGPTOutputParser

Output parser for AutoGPT.

autonomous_agents.autogpt.output_parser.BaseAutoGPTOutputParser

Base Output parser for AutoGPT.

autonomous_agents.autogpt.prompt.AutoGPTPrompt

Prompt for AutoGPT.

autonomous_agents.autogpt.prompt_generator.PromptGenerator()

Generator of custom prompt strings.

autonomous_agents.baby_agi.baby_agi.BabyAGI

Controller model for the BabyAGI agent.

autonomous_agents.baby_agi.task_creation.TaskCreationChain

Chain generating tasks.

autonomous_agents.baby_agi.task_execution.TaskExecutionChain

Chain to execute tasks.

autonomous_agents.baby_agi.task_prioritization.TaskPrioritizationChain

Chain to prioritize tasks.

autonomous_agents.hugginggpt.hugginggpt.HuggingGPT(...)

Agent for interacting with HuggingGPT.

autonomous_agents.hugginggpt.repsonse_generator.ResponseGenerationChain

Chain to execute tasks.

autonomous_agents.hugginggpt.repsonse_generator.ResponseGenerator(...)

Generates a response based on the input.

autonomous_agents.hugginggpt.task_executor.Task(...)

Task to be executed.

autonomous_agents.hugginggpt.task_executor.TaskExecutor(plan)

Load tools and execute tasks.

autonomous_agents.hugginggpt.task_planner.BasePlanner

Base class for a planner.

autonomous_agents.hugginggpt.task_planner.Plan(steps)

A plan to execute.

autonomous_agents.hugginggpt.task_planner.PlanningOutputParser

Parses the output of the planning stage.

autonomous_agents.hugginggpt.task_planner.Step(...)

A step in the plan.

autonomous_agents.hugginggpt.task_planner.TaskPlaningChain

Chain to execute tasks.

autonomous_agents.hugginggpt.task_planner.TaskPlanner

Planner for tasks.

Functions

chat_models#

Classes

comprehend_moderation#

Classes

comprehend_moderation.amazon_comprehend_moderation.AmazonComprehendModerationChain

Moderation Chain, based on Amazon Comprehend service.

comprehend_moderation.base_moderation.BaseModeration(client)

Base class for moderation.

comprehend_moderation.base_moderation_callbacks.BaseModerationCallbackHandler()

Base class for moderation callback handlers.

comprehend_moderation.base_moderation_config.BaseModerationConfig

Base configuration settings for moderation.

comprehend_moderation.base_moderation_config.ModerationPiiConfig

Configuration for PII moderation filter.

comprehend_moderation.base_moderation_config.ModerationPromptSafetyConfig

Configuration for Prompt Safety moderation filter.

comprehend_moderation.base_moderation_config.ModerationToxicityConfig

Configuration for Toxicity moderation filter.

comprehend_moderation.base_moderation_exceptions.ModerationPiiError([...])

Exception raised if PII entities are detected.

comprehend_moderation.base_moderation_exceptions.ModerationPromptSafetyError([...])

Exception raised if Unsafe prompts are detected.

comprehend_moderation.base_moderation_exceptions.ModerationToxicityError([...])

Exception raised if Toxic entities are detected.

comprehend_moderation.pii.ComprehendPII(client)

Class to handle Personally Identifiable Information (PII) moderation.

comprehend_moderation.prompt_safety.ComprehendPromptSafety(client)

Class to handle prompt safety moderation.

comprehend_moderation.toxicity.ComprehendToxicity(client)

Class to handle toxicity moderation.

cpal#

Classes

cpal.base.CPALChain

Causal program-aided language (CPAL) chain implementation.

cpal.base.CausalChain

Translate the causal narrative into a stack of operations.

cpal.base.InterventionChain

Set the hypothetical conditions for the causal model.

cpal.base.NarrativeChain

Decompose the narrative into its story elements.

cpal.base.QueryChain

Query the outcome table using SQL.

cpal.constants.Constant(value[, names, ...])

Enum for constants used in the CPAL.

cpal.models.CausalModel

Casual data.

cpal.models.EntityModel

Entity in the story.

cpal.models.EntitySettingModel

Entity initial conditions.

cpal.models.InterventionModel

Intervention data of the story aka initial conditions.

cpal.models.NarrativeModel

Narrative input as three story elements.

cpal.models.QueryModel

Query data of the story.

cpal.models.ResultModel

Result of the story query.

cpal.models.StoryModel

Story data.

cpal.models.SystemSettingModel

System initial conditions.

data_anonymizer#

Classes

data_anonymizer.base.AnonymizerBase()

Base abstract class for anonymizers.

data_anonymizer.base.ReversibleAnonymizerBase()

Base abstract class for reversible anonymizers.

data_anonymizer.deanonymizer_mapping.DeanonymizerMapping(...)

Deanonymizer mapping.

data_anonymizer.presidio.PresidioAnonymizer([...])

Anonymizer using Microsoft Presidio.

data_anonymizer.presidio.PresidioAnonymizerBase([...])

Base Anonymizer using Microsoft Presidio.

data_anonymizer.presidio.PresidioReversibleAnonymizer([...])

Reversible Anonymizer using Microsoft Presidio.

Functions

data_anonymizer.deanonymizer_mapping.create_anonymizer_mapping(...)

Create or update the mapping used to anonymize and/or

data_anonymizer.deanonymizer_mapping.format_duplicated_operator(...)

Format the operator name with the count.

data_anonymizer.deanonymizer_matching_strategies.case_insensitive_matching_strategy(...)

Case insensitive matching strategy for deanonymization.

data_anonymizer.deanonymizer_matching_strategies.combined_exact_fuzzy_matching_strategy(...)

Combined exact and fuzzy matching strategy for deanonymization.

data_anonymizer.deanonymizer_matching_strategies.exact_matching_strategy(...)

Exact matching strategy for deanonymization.

data_anonymizer.deanonymizer_matching_strategies.fuzzy_matching_strategy(...)

Fuzzy matching strategy for deanonymization.

data_anonymizer.deanonymizer_matching_strategies.ngram_fuzzy_matching_strategy(...)

N-gram fuzzy matching strategy for deanonymization.

data_anonymizer.faker_presidio_mapping.get_pseudoanonymizer_mapping([seed])

Get a mapping of entities to pseudo anonymize them.

fallacy_removal#

Classes

fallacy_removal.base.FallacyChain

Chain for applying logical fallacy evaluations.

fallacy_removal.models.LogicalFallacy

Logical fallacy.

generative_agents#

Classes

generative_agents.generative_agent.GenerativeAgent

Agent as a character with memory and innate characteristics.

generative_agents.memory.GenerativeAgentMemory

Memory for the generative agent.

graph_transformers#

Classes

graph_transformers.diffbot.DiffbotGraphTransformer([...])

Transform documents into graph documents using Diffbot NLP API.

graph_transformers.diffbot.NodesList()

List of nodes with associated properties.

graph_transformers.diffbot.SimplifiedSchema()

Simplified schema mapping.

graph_transformers.diffbot.TypeOption(value)

graph_transformers.gliner.GlinerGraphTransformer(...)

A transformer class for converting documents into graph structures using the GLiNER and GLiREL models.

graph_transformers.llm.LLMGraphTransformer(llm)

Transform documents into graph-based documents using a LLM.

graph_transformers.llm.UnstructuredRelation

Create a new model by parsing and validating input data from keyword arguments.

graph_transformers.relik.RelikGraphTransformer([...])

A transformer class for converting documents into graph structures using the Relik library and models.

Functions

graph_transformers.diffbot.format_property_key(s)

Formats a string to be used as a property key.

graph_transformers.llm.create_simple_model([...])

Create a simple graph model with optional constraints on node and relationship types.

graph_transformers.llm.create_unstructured_prompt([...])

graph_transformers.llm.format_property_key(s)

graph_transformers.llm.get_default_prompt([...])

graph_transformers.llm.map_to_base_node(node)

Map the SimpleNode to the base Node.

graph_transformers.llm.map_to_base_relationship(rel)

Map the SimpleRelationship to the base Relationship.

graph_transformers.llm.optional_enum_field([...])

Utility function to conditionally create a field with an enum constraint.

graph_transformers.llm.validate_and_get_relationship_type(...)

llm_bash#

Classes

llm_bash.base.LLMBashChain

Chain that interprets a prompt and executes bash operations.

llm_bash.bash.BashProcess([strip_newlines, ...])

Wrapper for starting subprocesses.

llm_bash.prompt.BashOutputParser

Parser for bash output.

llm_symbolic_math#

Classes

llm_symbolic_math.base.LLMSymbolicMathChain

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

llms#

Classes

llms.anthropic_functions.TagParser()

Parser for the tool tags.

llms.jsonformer_decoder.JsonFormer

Jsonformer wrapped LLM using HuggingFace Pipeline API.

llms.llamaapi.ChatLlamaAPI

Chat model using the Llama API.

llms.lmformatenforcer_decoder.LMFormatEnforcer

LMFormatEnforcer wrapped LLM using HuggingFace Pipeline API.

llms.rellm_decoder.RELLM

RELLM wrapped LLM using HuggingFace Pipeline API.

Functions

llms.jsonformer_decoder.import_jsonformer()

Lazily import of the jsonformer package.

llms.lmformatenforcer_decoder.import_lmformatenforcer()

Lazily import of the lmformatenforcer package.

llms.ollama_functions.convert_to_ollama_tool(tool)

Convert a tool to an Ollama tool.

llms.ollama_functions.parse_response(message)

Extract function_call from AIMessage.

llms.rellm_decoder.import_rellm()

Lazily import of the rellm package.

Deprecated classes

open_clip#

Classes

open_clip.open_clip.OpenCLIPEmbeddings

OpenCLIP Embeddings model.

pal_chain#

Classes

pal_chain.base.PALChain

Chain that implements Program-Aided Language Models (PAL).

pal_chain.base.PALValidation([...])

Validation for PAL generated code.

plan_and_execute#

Classes

Functions

prompt_injection_identifier#

Classes

prompt_injection_identifier.hugging_face_identifier.HuggingFaceInjectionIdentifier

Tool that uses HuggingFace Prompt Injection model to detect prompt injection attacks.

prompt_injection_identifier.hugging_face_identifier.PromptInjectionException([...])

Exception raised when prompt injection attack is detected.

recommenders#

Classes

recommenders.amazon_personalize.AmazonPersonalize([...])

Amazon Personalize Runtime wrapper for executing real-time operations.

recommenders.amazon_personalize_chain.AmazonPersonalizeChain

Chain for retrieving recommendations from Amazon Personalize,

retrievers#

Classes

retrievers.vector_sql_database.VectorSQLDatabaseChainRetriever

Retriever that uses Vector SQL Database.

rl_chain#

Classes

rl_chain.base.AutoSelectionScorer

Auto selection scorer.

rl_chain.base.Embedder(*args, **kwargs)

Abstract class to represent an embedder.

rl_chain.base.Event(inputs[, selected])

Abstract class to represent an event.

rl_chain.base.Policy(**kwargs)

Abstract class to represent a policy.

rl_chain.base.RLChain

Chain that leverages the Vowpal Wabbit (VW) model as a learned policy for reinforcement learning.

rl_chain.base.RLChain[PickBestEvent]

Chain that leverages the Vowpal Wabbit (VW) model as a learned policy for reinforcement learning.

rl_chain.base.Selected()

Abstract class to represent the selected item.

rl_chain.base.SelectionScorer

Abstract class to grade the chosen selection or the response of the llm.

rl_chain.base.VwPolicy(model_repo, vw_cmd, ...)

Vowpal Wabbit policy.

rl_chain.metrics.MetricsTrackerAverage(step)

Metrics Tracker Average.

rl_chain.metrics.MetricsTrackerRollingWindow(...)

Metrics Tracker Rolling Window.

rl_chain.model_repository.ModelRepository(folder)

Model Repository.

rl_chain.pick_best_chain.PickBest

Chain that leverages the Vowpal Wabbit (VW) model for reinforcement learning with a context, with the goal of modifying the prompt before the LLM call.

rl_chain.pick_best_chain.PickBestEvent(...)

Event class for PickBest chain.

rl_chain.pick_best_chain.PickBestFeatureEmbedder(...)

Embed the BasedOn and ToSelectFrom inputs into a format that can be used by the learning policy.

rl_chain.pick_best_chain.PickBestRandomPolicy(...)

Random policy for PickBest chain.

rl_chain.pick_best_chain.PickBestSelected([...])

Selected class for PickBest chain.

rl_chain.vw_logger.VwLogger(path)

Vowpal Wabbit custom logger.

Functions

rl_chain.base.BasedOn(anything)

Wrap a value to indicate that it should be based on.

rl_chain.base.Embed(anything[, keep])

Wrap a value to indicate that it should be embedded.

rl_chain.base.EmbedAndKeep(anything)

Wrap a value to indicate that it should be embedded and kept.

rl_chain.base.ToSelectFrom(anything)

Wrap a value to indicate that it should be selected from.

rl_chain.base.get_based_on_and_to_select_from(inputs)

Get the BasedOn and ToSelectFrom from the inputs.

rl_chain.base.parse_lines(parser, input_str)

Parse the input string into a list of examples.

rl_chain.base.prepare_inputs_for_autoembed(inputs)

Prepare the inputs for auto embedding.

rl_chain.helpers.embed(to_embed, model[, ...])

Embed the actions or context using the SentenceTransformer model (or a model that has an encode function).

rl_chain.helpers.embed_dict_type(item, model)

Embed a dictionary item.

rl_chain.helpers.embed_list_type(item, model)

Embed a list item.

rl_chain.helpers.embed_string_type(item, model)

Embed a string or an _Embed object.

rl_chain.helpers.is_stringtype_instance(item)

Check if an item is a string.

rl_chain.helpers.stringify_embedding(embedding)

Convert an embedding to a string.

smart_llm#

Classes

smart_llm.base.SmartLLMChain

Chain for applying self-critique using the SmartGPT workflow.

sql#

Classes

sql.base.SQLDatabaseChain

Chain for interacting with SQL Database.

sql.base.SQLDatabaseSequentialChain

Chain for querying SQL database that is a sequential chain.

sql.vector_sql.VectorSQLDatabaseChain

Chain for interacting with Vector SQL Database.

sql.vector_sql.VectorSQLOutputParser

Output Parser for Vector SQL.

sql.vector_sql.VectorSQLRetrieveAllOutputParser

Parser based on VectorSQLOutputParser.

Functions

sql.vector_sql.get_result_from_sqldb(db, cmd)

Get result from SQL Database.

tabular_synthetic_data#

Classes

tabular_synthetic_data.base.SyntheticDataGenerator

Generate synthetic data using the given LLM and few-shot template.

Functions

tabular_synthetic_data.openai.create_openai_data_generator(...)

Create an instance of SyntheticDataGenerator tailored for OpenAI models.

text_splitter#

Classes

text_splitter.SemanticChunker(embeddings[, ...])

Split the text based on semantic similarity.

Functions

text_splitter.calculate_cosine_distances(...)

Calculate cosine distances between sentences.

text_splitter.combine_sentences(sentences[, ...])

Combine sentences based on buffer size.

tools#

Classes

tools.python.tool.PythonAstREPLTool

Tool for running python code in a REPL.

tools.python.tool.PythonInputs

Python inputs.

tools.python.tool.PythonREPLTool

Tool for running python code in a REPL.

Functions

tools.python.tool.sanitize_input(query)

Sanitize input to the python REPL.

tot#

Classes

tot.base.ToTChain

Chain implementing the Tree of Thought (ToT).

tot.checker.ToTChecker

Tree of Thought (ToT) checker.

tot.controller.ToTController([c])

Tree of Thought (ToT) controller.

tot.memory.ToTDFSMemory([stack])

Memory for the Tree of Thought (ToT) chain.

tot.prompts.CheckerOutputParser

Parse and check the output of the language model.

tot.prompts.JSONListOutputParser

Parse the output of a PROPOSE_PROMPT response.

tot.thought.Thought

A thought in the ToT.

tot.thought.ThoughtValidity(value[, names, ...])

Enum for the validity of a thought.

tot.thought_generation.BaseThoughtGenerationStrategy

Base class for a thought generation strategy.

tot.thought_generation.ProposePromptStrategy

Strategy that is sequentially using a "propose prompt".

tot.thought_generation.SampleCoTStrategy

Sample strategy from a Chain-of-Thought (CoT) prompt.

Functions

tot.prompts.get_cot_prompt()

Get the prompt for the Chain of Thought (CoT) chain.

tot.prompts.get_propose_prompt()

Get the prompt for the PROPOSE_PROMPT chain.

utilities#

Classes

utilities.python.PythonREPL

Simulates a standalone Python REPL.

video_captioning#

Classes