Tony20100/langchain_full huggingface dataset:
langchain_postgres 0.0.6¶
langchain_postgres.chat_message_histories¶
Client for persisting chat message history in a Postgres database.
This client provides support for both sync and async via psycopg 3.
Classes¶
chat_message_histories.PostgresChatMessageHistory(...)
Client for persisting chat message history in a Postgres database,
langchain_postgres.vectorstores¶
Classes¶
vectorstores.DistanceStrategy(value)
Enumerator of the Distance strategies.
vectorstores.PGVector(embeddings, *[, ...])
Vectorstore implementation using Postgres as the backend.
langchain_ai21 0.1.6¶
langchain_ai21.ai21_base¶
Classes¶
ai21_base.AI21Base
Create a new model by parsing and validating input data from keyword arguments.
langchain_ai21.chat¶
Classes¶
chat.chat_adapter.ChatAdapter()
Provides a common interface for the different Chat models available in AI21.
chat.chat_adapter.J2ChatAdapter()
chat.chat_adapter.JambaChatCompletionsAdapter()
Functions¶
chat.chat_factory.create_chat_adapter(model)
langchain_ai21.chat_models¶
Classes¶
chat_models.ChatAI21
ChatAI21 chat model.
langchain_ai21.contextual_answers¶
Classes¶
contextual_answers.AI21ContextualAnswers
Create a new model by parsing and validating input data from keyword arguments.
contextual_answers.ContextualAnswerInput
langchain_ai21.embeddings¶
Classes¶
embeddings.AI21Embeddings
AI21 Embeddings embedding model.
langchain_ai21.llms¶
Classes¶
llms.AI21LLM
AI21LLM large language models.
langchain_ai21.semantic_text_splitter¶
Classes¶
semantic_text_splitter.AI21SemanticTextSplitter([...])
Splitting text into coherent and readable units, based on distinct topics and lines
langchain_exa 0.1.0¶
langchain_exa.retrievers¶
Classes¶
retrievers.ExaSearchRetriever
Exa Search retriever.
langchain_exa.tools¶
Tool for the Exa Search API.
Classes¶
tools.ExaFindSimilarResults
Tool that queries the Metaphor Search API and gets back json.
tools.ExaSearchResults
Tool that queries the Metaphor Search API and gets back json.
langchain_text_splitters 0.2.1¶
langchain_text_splitters.base¶
Classes¶
base.Language(value)
Enum of the programming languages.
base.TextSplitter(chunk_size, chunk_overlap, ...)
Interface for splitting text into chunks.
base.TokenTextSplitter([encoding_name, ...])
Splitting text to tokens using model tokenizer.
base.Tokenizer(chunk_overlap, ...)
Tokenizer data class.
Functions¶
base.split_text_on_tokens(*, text, tokenizer)
Split incoming text and return chunks using tokenizer.
langchain_text_splitters.character¶
Classes¶
character.CharacterTextSplitter([separator, ...])
Splitting text that looks at characters.
character.RecursiveCharacterTextSplitter([...])
Splitting text by recursively look at characters.
langchain_text_splitters.html¶
Classes¶
html.ElementType
Element type as typed dict.
html.HTMLHeaderTextSplitter(headers_to_split_on)
Splitting HTML files based on specified headers.
html.HTMLSectionSplitter(headers_to_split_on)
Splitting HTML files based on specified tag and font sizes.
langchain_text_splitters.json¶
Classes¶
json.RecursiveJsonSplitter([max_chunk_size, ...])
langchain_text_splitters.konlpy¶
Classes¶
konlpy.KonlpyTextSplitter([separator])
Splitting text using Konlpy package.
langchain_text_splitters.latex¶
Classes¶
latex.LatexTextSplitter(**kwargs)
Attempts to split the text along Latex-formatted layout elements.
langchain_text_splitters.markdown¶
Classes¶
markdown.HeaderType
Header type as typed dict.
markdown.LineType
Line type as typed dict.
markdown.MarkdownHeaderTextSplitter(...[, ...])
Line type as typed dict.
markdown.MarkdownHeaderTextSplitter(...[, ...])
Splitting markdown files based on specified headers.
markdown.MarkdownTextSplitter(**kwargs)
Attempts to split the text along Markdown-formatted headings.
langchain_text_splitters.nltk¶
Classes¶
nltk.NLTKTextSplitter([separator, language])
Splitting text using NLTK package.
langchain_text_splitters.python¶
Classes¶
python.PythonCodeTextSplitter(**kwargs)
Attempts to split the text along Python syntax.
langchain_text_splitters.sentence_transformers¶
Classes¶
sentence_transformers.SentenceTransformersTokenTextSplitter([...])
Splitting text to tokens using sentence model tokenizer.
langchain_text_splitters.spacy¶
Classes¶
spacy.SpacyTextSplitter([separator, ...])
Splitting text using Spacy package.
langchain_fireworks 0.1.3¶
langchain_fireworks.chat_models¶
Fireworks chat wrapper.
Classes¶
chat_models.ChatFireworks
Fireworks Chat large language models API.
langchain_fireworks.embeddings¶
Classes¶
embeddings.FireworksEmbeddings
FireworksEmbeddings embedding model.
langchain_fireworks.llms¶
Wrapper around Fireworks AI’s Completion API.
Classes¶
llms.Fireworks
LLM models from Fireworks.
langchain_cohere 0.1.6¶
langchain_cohere.chat_models¶
Classes¶
chat_models.ChatCohere
Implements the BaseChatModel (and BaseLanguageModel) interface with Cohere's large language models.
Functions¶
chat_models.get_cohere_chat_request(messages, *)
Get the request for the Cohere chat API.
chat_models.get_role(message)
Get the role of the message.
langchain_cohere.cohere_agent¶
Functions¶
cohere_agent.create_cohere_tools_agent(llm, ...)
langchain_cohere.common¶
Classes¶
common.CohereCitation(start, end, text, ...)
Cohere has fine-grained citations that specify the exact part of text.
langchain_cohere.embeddings¶
Classes¶
embeddings.CohereEmbeddings
Implements the Embeddings interface with Cohere's text representation language models.
langchain_cohere.llms¶
Classes¶
llms.BaseCohere
Base class for Cohere models.
llms.Cohere
Cohere large language models.
Functions¶
llms.acompletion_with_retry(llm, **kwargs)
Use tenacity to retry the completion call.
llms.completion_with_retry(llm, **kwargs)
Use tenacity to retry the completion call.
llms.enforce_stop_tokens(text, stop)
Cut off the text as soon as any stop words occur.
langchain_cohere.rag_retrievers¶
Classes¶
rag_retrievers.CohereRagRetriever
Cohere Chat API with RAG.
langchain_cohere.react_multi_hop¶
Classes¶
react_multi_hop.parsing.CohereToolsReactAgentOutputParser
Parses a message into agent actions/finish.
Parses a message into agent actions/finish.
Functions¶
react_multi_hop.agent.create_cohere_react_agent(...)
Create an agent that enables multiple tools to be used in sequence to complete a task.
react_multi_hop.parsing.parse_actions(generation)
Parse action selections from model output.
react_multi_hop.parsing.parse_answer_with_prefixes(...)
parses string into key-value pairs,
react_multi_hop.parsing.parse_citations(...)
Parses a grounded_generation (from parse_actions) and documents (from convert_to_documents) into a (generation, CohereCitation list) tuple.
react_multi_hop.parsing.parse_jsonified_tool_use_generation(...)
Parses model-generated jsonified actions.
react_multi_hop.prompt.convert_to_documents(...)
Converts observations into a 'document' dict
react_multi_hop.prompt.create_directly_answer_tool()
directly_answer is a special tool that's always presented to the model as an available tool.
react_multi_hop.prompt.multi_hop_prompt(...)
The returned function produces a BasePromptTemplate suitable for multi-hop.
react_multi_hop.prompt.render_intermediate_steps(...)
Renders an agent's intermediate steps into prompt content.
react_multi_hop.prompt.render_messages(messages)
Renders one or more BaseMessage implementations into prompt content.
react_multi_hop.prompt.render_observations(...)
Renders the 'output' part of an Agent's intermediate step into prompt content.
react_multi_hop.prompt.render_role(message)
Renders the role of a message into prompt content.
react_multi_hop.prompt.render_structured_preamble([...])
Renders the structured preamble part of the prompt content.
react_multi_hop.prompt.render_tool(tool)
Renders a tool into prompt content
react_multi_hop.prompt.render_tool_args(tool)
Renders the 'Args' section of a tool's prompt content.
react_multi_hop.prompt.render_tool_signature(tool)
langchain_aws 0.1.6¶
langchain_aws.chat_models¶
Classes¶
chat_models.bedrock.BedrockChat
[Deprecated]
chat_models.bedrock.ChatBedrock
A chat model that uses the Bedrock API.
chat_models.bedrock.ChatPromptAdapter()
Adapter class to prepare the inputs from Langchain to prompt format that Chat model expects.
Functions¶
chat_models.bedrock.convert_messages_to_prompt_anthropic(...)
Format a list of messages into a full prompt for the Anthropic model
chat_models.bedrock.convert_messages_to_prompt_llama(...)
Convert a list of messages to a prompt for llama.
chat_models.bedrock.convert_messages_to_prompt_llama3(...)
Convert a list of messages to a prompt for llama.
chat_models.bedrock.convert_messages_to_prompt_mistral(...)
Convert a list of messages to a prompt for mistral.
langchain_aws.embeddings¶
Classes¶
embeddings.bedrock.BedrockEmbeddings
Bedrock embedding models.
langchain_aws.function_calling¶
Methods for creating function specs in the style of Bedrock Functions
for supported model providers
Classes¶
function_calling.AnthropicTool
function_calling.FunctionDescription
Representation of a callable function to send to an LLM.
function_calling.ToolDescription
Representation of a callable function to the OpenAI API.
Functions¶
function_calling.convert_to_anthropic_tool(tool)
function_calling.get_system_message(tools)
langchain_aws.graphs¶
Classes¶
graphs.neptune_graph.BaseNeptuneGraph()
graphs.neptune_graph.NeptuneAnalyticsGraph(...)
Neptune Analytics wrapper for graph operations.
graphs.neptune_graph.NeptuneGraph(host[, ...])
Neptune wrapper for graph operations.
graphs.neptune_graph.NeptuneQueryException(...)
Exception for the Neptune queries.
graphs.neptune_graph.NeptuneQueryException(...)
Exception for the Neptune queries.
graphs.neptune_rdf_graph.NeptuneRdfGraph(host)
Neptune wrapper for RDF graph operations.
langchain_aws.llms¶
Classes¶
llms.bedrock.Bedrock
[Deprecated]
llms.bedrock.BedrockBase
Base class for Bedrock models.
llms.bedrock.BedrockLLM
Bedrock models.
llms.bedrock.LLMInputOutputAdapter()
Adapter class to prepare the inputs from Langchain to a format that LLM model expects.
llms.sagemaker_endpoint.ContentHandlerBase()
A handler class to transform input from LLM to a format that SageMaker endpoint expects.
llms.sagemaker_endpoint.LLMContentHandler()
Content handler for LLM class.
llms.sagemaker_endpoint.LineIterator(stream)
A helper class for parsing the byte stream input.
llms.sagemaker_endpoint.SagemakerEndpoint
Sagemaker Inference Endpoint models.
Functions¶
llms.sagemaker_endpoint.enforce_stop_tokens(...)
Cut off the text as soon as any stop words occur.
langchain_aws.retrievers¶
Classes¶
retrievers.bedrock.AmazonKnowledgeBasesRetriever
Amazon Bedrock Knowledge Bases retrieval.
retrievers.bedrock.RetrievalConfig
Configuration for retrieval.
retrievers.bedrock.VectorSearchConfig
Configuration for vector search.
retrievers.kendra.AdditionalResultAttribute
Additional result attribute.
retrievers.kendra.AdditionalResultAttributeValue
Value of an additional result attribute.
retrievers.kendra.AmazonKendraRetriever
Amazon Kendra Index retriever.
retrievers.kendra.DocumentAttribute
Document attribute.
retrievers.kendra.DocumentAttributeValue
Value of a document attribute.
Document attribute.
retrievers.kendra.DocumentAttributeValue
Value of a document attribute.
retrievers.kendra.Highlight
Information that highlights the keywords in the excerpt.
retrievers.kendra.QueryResult
Amazon Kendra Query API search result.
retrievers.kendra.QueryResultItem
Query API result item.
retrievers.kendra.ResultItem
Base class of a result item.
retrievers.kendra.RetrieveResult
Amazon Kendra Retrieve API search result.
retrievers.kendra.RetrieveResultItem
Retrieve API result item.
retrievers.kendra.TextWithHighLights
Text with highlights.
Functions¶
retrievers.kendra.clean_excerpt(excerpt)
Clean an excerpt from Kendra.
retrievers.kendra.combined_text(item)
Combine a ResultItem title and excerpt into a single string.
langchain_aws.utils¶
Functions¶
utils.enforce_stop_tokens(text, stop)
Cut off the text as soon as any stop words occur.
utils.get_num_tokens_anthropic(text)
Get the number of tokens in a string of text.
utils.get_token_ids_anthropic(text)
Get the token ids for a string of text.
langchain_experimental 0.0.60¶
langchain_experimental.agents¶
Agent is a class that uses an LLM to choose
a sequence of actions to take.
In Chains, a sequence of actions is hardcoded. In Agents,
a language model is used as a reasoning engine to determine which actions
to take and in which order.
Agents select and use Tools and Toolkits for actions.
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.
langchain_experimental.autonomous_agents¶
Autonomous agents in the Langchain experimental package include
[AutoGPT](https://github.com/Significant-Gravitas/AutoGPT),
[BabyAGI](https://github.com/yoheinakajima/babyagi),
and [HuggingGPT](https://arxiv.org/abs/2303.17580) agents that
interact with language models autonomously.
These agents have specific functionalities like memory management,
task creation, execution chains, and response generation.
They differ from ordinary agents by their autonomous decision-making capabilities,
memory handling, and specialized functionalities for tasks and response.
Classes¶
autonomous_agents.autogpt.agent.AutoGPT(...)
Agent for interacting with 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
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¶
autonomous_agents.autogpt.output_parser.preprocess_json_input(...)
Preprocesses a string to be parsed as json.
autonomous_agents.autogpt.prompt_generator.get_prompt(tools)
Generates a prompt string.
autonomous_agents.hugginggpt.repsonse_generator.load_response_generator(llm)
Load the ResponseGenerator.
autonomous_agents.hugginggpt.task_planner.load_chat_planner(llm)
Load the chat planner.
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¶
chat_models.llm_wrapper.ChatWrapper
Wrapper for chat LLMs.
chat_models.llm_wrapper.Llama2Chat
Wrapper for Llama-2-chat model.
chat_models.llm_wrapper.Mixtral
See https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1#instruction-format
chat_models.llm_wrapper.Orca
Wrapper for Orca-style models.
chat_models.llm_wrapper.Vicuna
Wrapper for Orca-style models.
chat_models.llm_wrapper.Vicuna
Wrapper for Vicuna-style models.
langchain_experimental.comprehend_moderation¶
Comprehend Moderation is used to detect and handle Personally Identifiable Information (PII),
toxicity, and prompt safety in text.
The Langchain experimental package includes the AmazonComprehendModerationChain class
for the comprehend moderation tasks. It is based on Amazon Comprehend service.
This class can be configured with specific moderation settings like PII labels, redaction,
toxicity thresholds, and prompt safety thresholds.
See more at https://aws.amazon.com/comprehend/
Amazon Comprehend service is used by several other classes:
- ComprehendToxicity class is used to check the toxicity of text prompts using
AWS Comprehend service and take actions based on the configuration
ComprehendPromptSafety class is used to validate the safety of given prompt
text, raising an error if unsafe content is detected based on the specified threshold
ComprehendPII class is designed to handle
Personally Identifiable Information (PII) moderation tasks,
detecting and managing PII entities in text inputs
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.
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.
langchain_experimental.cpal¶
Causal program-aided language (CPAL) is a concept implemented in LangChain as
a chain for causal modeling and narrative decomposition.
CPAL improves upon the program-aided language (PAL) by incorporating
causal structure to prevent hallucination in language models,
particularly when dealing with complex narratives and math
problems with nested dependencies.
CPAL involves translating causal narratives into a stack of operations,
setting hypothetical conditions for causal models, and decomposing
narratives into story elements.
It allows for the creation of causal chains that define the relationships
between different elements in a narrative, enabling the modeling and analysis
of causal relationships within a given context.
Classes¶
cpal.base.CPALChain
of causal relationships within a given context.
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)
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.
langchain_experimental.data_anonymizer¶
Data anonymizer contains both Anonymizers and Deanonymizers.
It uses the [Microsoft Presidio](https://microsoft.github.io/presidio/) library.
Anonymizers are used to replace a Personally Identifiable Information (PII)
entity text with some other
value by applying a certain operator (e.g. replace, mask, redact, encrypt).
Deanonymizers are used to revert the anonymization operation
(e.g. to decrypt an encrypted text).
Classes¶
data_anonymizer.base.AnonymizerBase()
Base abstract class for anonymizers.
data_anonymizer.base.ReversibleAnonymizerBase()
Base abstract class for reversible anonymizers.
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.
langchain_experimental.fallacy_removal¶
Fallacy Removal Chain runs a self-review of logical fallacies
as determined by paper
[Robust and Explainable Identification of Logical Fallacies in Natural