langchain_community
0.2.16¶
langchain_community.adapters
¶
Adapters are used to adapt LangChain models to other APIs.
LangChain integrates with many model providers. While LangChain has its own message and model APIs, LangChain has also made it as easy as possible to explore other models by exposing an adapter to adapt LangChain models to the other APIs, as to the OpenAI API.
Classes¶
Chat. |
|
Chat completion. |
|
Chat completion chunk. |
|
Chat completions. |
|
Choice. |
|
Choice chunk. |
|
Completions. |
|
Allows a BaseModel to return its fields by string variable indexing. |
Functions¶
|
Async version of enumerate function. |
Convert a dictionary to a LangChain message. |
|
Convert a LangChain message to a dictionary. |
|
Convert messages to a list of lists of dictionaries for fine-tuning. |
|
|
Convert dictionaries representing OpenAI messages to LangChain format. |
langchain_community.agent_toolkits
¶
Toolkits are sets of tools that can be used to interact with various services and APIs.
Classes¶
Toolkit for interacting with AINetwork Blockchain. |
|
Toolkit for interacting with Amadeus which offers APIs for travel. |
|
Toolkit for Azure AI Services. |
|
|
Toolkit for Azure Cognitive Services. |
|
Toolkit for interacting with an Apache Cassandra database. |
Clickup Toolkit. |
|
Toolkit for CogniSwitch. |
|
Toolkit with a list of Connery Actions as tools. |
|
|
Toolkit for interacting with local files. |
|
Toolkit for interacting with financialdatasets.ai. |
Schema for operations that require a branch name as input. |
|
Schema for operations that require a comment as input. |
|
Schema for operations that require a file path and content as input. |
|
Schema for operations that require a PR title and body as input. |
|
Schema for operations that require a username as input. |
|
Schema for operations that require a file path as input. |
|
Schema for operations that require a directory path as input. |
|
Schema for operations that require an issue number as input. |
|
Schema for operations that require a PR number as input. |
|
GitHub Toolkit. |
|
Schema for operations that do not require any input. |
|
Schema for operations that require a file path as input. |
|
Schema for operations that require a search query as input. |
|
Schema for operations that require a search query as input. |
|
Schema for operations that require a file path and content as input. |
|
GitLab Toolkit. |
|
Toolkit for interacting with Gmail. |
|
Jira Toolkit. |
|
Toolkit for interacting with a JSON spec. |
|
Toolkit for interacting with the Browser Agent. |
|
Nasa Toolkit. |
|
Natural Language API Tool. |
|
Natural Language API Toolkit. |
|
Toolkit for interacting with Office 365. |
|
|
Tool that sends a DELETE request and parses the response. |
Requests GET tool with LLM-instructed extraction of truncated responses. |
|
Requests PATCH tool with LLM-instructed extraction of truncated responses. |
|
Requests POST tool with LLM-instructed extraction of truncated responses. |
|
Requests PUT tool with LLM-instructed extraction of truncated responses. |
|
A reduced OpenAPI spec. |
|
Toolkit for interacting with an OpenAPI API. |
|
Toolkit for making REST requests. |
|
Toolkit for PlayWright browser tools. |
|
Polygon Toolkit. |
|
Toolkit for interacting with Power BI dataset. |
|
Toolkit for interacting with Slack. |
|
Toolkit for interacting with Spark SQL. |
|
SQLDatabaseToolkit for interacting with SQL databases. |
|
Steam Toolkit. |
|
Zapier Toolkit. |
Functions¶
Construct a json agent from an LLM and tools. |
|
Get a list of all possible tool names. |
|
Loads a tool from the HuggingFace Hub. |
|
|
Load tools based on their name. |
|
|
Construct an OpenAPI agent from an LLM and tools. |
|
Construct an OpenAI API planner and controller for a given spec. |
|
Simplify/distill/minify a spec somehow. |
|
Construct a Power BI agent from an LLM and tools. |
|
Construct a Power BI agent from a Chat LLM and tools. |
|
Construct a Spark SQL agent from an LLM and tools. |
|
Construct a SQL agent from an LLM and toolkit or database. |
langchain_community.agents
¶
Classes¶
langchain_community.cache
¶
Warning
Beta Feature!
Cache provides an optional caching layer for LLMs.
Cache is useful for two reasons:
It can save you money by reducing the number of API calls you make to the LLM provider if you’re often requesting the same completion multiple times.
It can speed up your application by reducing the number of API calls you make to the LLM provider.
Cache directly competes with Memory. See documentation for Pros and Cons.
Class hierarchy:
BaseCache --> <name>Cache # Examples: InMemoryCache, RedisCache, GPTCache
Classes¶
|
Cache that uses Redis as a backend. |
|
Cache that uses Cosmos DB Mongo vCore vector-store backend |
|
Cache that uses Cassandra / Astra DB as a backend. |
|
Cache that uses Cassandra as a vector-store backend for semantic (i.e. |
|
SQLite table for full LLM Cache (all generations). |
|
SQLite table for full LLM Cache (all generations). |
|
Cache that uses GPTCache as a backend. |
Cache that stores things in memory. |
|
|
Cache that uses Momento as a backend. |
|
Cache that uses OpenSearch vector store backend |
|
Cache that uses Redis as a backend. |
|
Cache that uses Redis as a vector-store backend. |
|
Cache that uses SQAlchemy as a backend. |
|
Cache that uses SQAlchemy as a backend. |
|
Cache that uses SQLite as a backend. |
|
Cache that uses SingleStore DB as a backend |
|
Cache that uses Upstash Redis as a backend. |
Deprecated classes¶
|
Deprecated since version 0.0.28: Use |
|
Deprecated since version 0.0.28: Use |
langchain_community.callbacks
¶
Callback handlers allow listening to events in LangChain.
Class hierarchy:
BaseCallbackHandler --> <name>CallbackHandler # Example: AimCallbackHandler
Classes¶
Callback Handler that logs to Aim. |
|
Callback handler for the metadata and associated function states for callbacks. |
|
Callback Handler that logs into Argilla. |
|
Callback Handler that logs to Arize. |
|
Callback Handler that logs to Arthur platform. |
|
|
Callback Handler that tracks bedrock anthropic info. |
Callback Handler that logs to ClearML. |
|
Callback Handler that logs to Comet. |
|
|
Callback Handler that logs into deepeval. |
Callback Handler that records transcripts to the Context service. |
|
Initialize Fiddler callback handler. |
|
Callback handler that is used within a Flyte task. |
|
Asynchronous callback for manually validating values. |
|
Callback for manually validating values. |
|
Exception to raise when a person manually review and rejects a value. |
|
Callback Handler that logs to Infino. |
|
|
Label Studio callback handler. |
Label Studio mode enumerator. |
|
|
Callback Handler for LLMonitor`. |
Context manager for LLMonitor user context. |
|
Callback Handler that logs metrics and artifacts to mlflow server. |
|
|
Callback Handler that logs metrics and artifacts to mlflow server. |
Callback Handler that tracks OpenAI info. |
|
|
Callback handler for promptlayer. |
Callback Handler that logs prompt artifacts and metrics to SageMaker Experiments. |
|
Child record as a NamedTuple. |
|
Enumerator of the child type. |
|
Streamlit expander that can be renamed and dynamically expanded/collapsed. |
|
|
A thought in the LLM's thought stream. |
|
Generates markdown labels for LLMThought containers. |
|
Enumerator of the LLMThought state. |
|
Callback handler that writes to a Streamlit app. |
|
Tool record as a NamedTuple. |
|
Comet Tracer. |
Arguments for the WandbTracer. |
|
Callback Handler that logs to Weights and Biases. |
|
Callback handler for Trubrics. |
|
|
Upstash Ratelimit Error |
|
Callback to handle rate limiting based on the number of requests or the number of tokens in the input. |
Callback Handler that logs evaluation results to uptrain and the console. |
|
The UpTrain data schema for tracking evaluation results. |
|
Handle the metadata and associated function states for callbacks. |
|
Callback Handler that logs to Weights and Biases. |
|
Callback Handler for logging to WhyLabs. |
Functions¶
Import the aim python package and raise an error if it is not installed. |
|
Import the clearml python package and raise an error if it is not installed. |
|
Import comet_ml and raise an error if it is not installed. |
|
Import the getcontext package. |
|
Import the fiddler python package and raise an error if it is not installed. |
|
Analyze text using textstat and spacy. |
|
Import flytekit and flytekitplugins-deck-standard. |
|
Calculate num tokens for OpenAI with tiktoken package. |
|
Import the infino client. |
|
Import tiktoken for counting tokens for OpenAI models. |
|
|
Get default Label Studio configs for the given mode. |
Builds an LLMonitor UserContextManager |
|
Get the Bedrock anthropic callback handler in a context manager. |
|
Get the OpenAI callback handler in a context manager. |
|
Get the WandbTracer in a context manager. |
|
Analyze text using textstat and spacy. |
|
|
Construct an html element from a prompt and a generation. |
Get the text complexity metrics from textstat. |
|
Import the mlflow python package and raise an error if it is not installed. |
|
Get the metrics to log to MLFlow. |
|
Get the cost in USD for a given model and number of tokens. |
|
Standardize the model name to a format that can be used in the OpenAI API. |
|
|
Save dict to local file path. |
Import comet_llm api and raise an error if it is not installed. |
|
Builds a nested dictionary from a list of runs. :param runs: The list of runs to build the tree from. :return: The nested dictionary representing the langchain Run in a tree structure compatible with WBTraceTree. |
|
Utility to flatten a nest run object into a list of runs. |
|
Utility to modify the serialized field of a list of runs dictionaries. removes any keys that match the exact_keys and any keys that contain any of the partial_keys. recursively moves the dictionaries under the kwargs key to the top level. changes the "id" field to a string "_kind" field that tells WBTraceTree how to visualize the run. promotes the "serialized" field to the top level. :param runs: The list of runs to modify. :param exact_keys: A tuple of keys to remove from the serialized field. :param partial_keys: A tuple of partial keys to remove from the serialized field. :return: The modified list of runs. |
|
Utility to truncate a list of runs dictionaries to only keep the specified |
|
Import the uptrain package. |
|
|
Flatten a nested dictionary into a flat dictionary. |
Hash a string using sha1. |
|
Import the pandas python package and raise an error if it is not installed. |
|
Import the spacy python package and raise an error if it is not installed. |
|
Import the textstat python package and raise an error if it is not installed. |
|
|
Load json file to a string. |
Analyze text using textstat and spacy. |
|
|
Construct an html element from a prompt and a generation. |
Import the wandb python package and raise an error if it is not installed. |
|
Load json file to a dictionary. |
|
Import the langkit python package and raise an error if it is not installed. |
langchain_community.chains
¶
Chains module for langchain_community
This module contains the community chains.
Classes¶
Chain for question-answering against a graph by generating AQL statements. |
|
Chain for question-answering against a graph. |
|
Chain for question-answering against a graph by generating Cypher statements. |
|
Used to correct relationship direction in generated Cypher statements. |
|
Create new instance of Schema(left_node, relation, right_node) |
|
Chain for question-answering against a graph by generating Cypher statements. |
|
Chain for question-answering against a graph by generating gremlin statements. |
|
Chain for question-answering against a graph by generating gremlin statements. |
|
Question-answering against a graph by generating Cypher statements for Kùzu. |
|
Chain for question-answering against a graph by generating nGQL statements. |
|
Chain for question-answering against a Neptune graph by generating openCypher statements. |
|
Chain for question-answering against a Neptune graph by generating SPARQL statements. |
|
Question-answering against Ontotext GraphDB |
|
Question-answering against an RDF or OWL graph by generating SPARQL statements. |
|
Chain that requests a URL and then uses an LLM to parse results. |
|
Chain interacts with an OpenAPI endpoint using natural language. |
|
Get the request parser. |
|
Parse the request and error tags. |
|
Get the response parser. |
|
Parse the response and error tags. |
|
Retrieval Chain with Identity & Semantic Enforcement for question-answering against a vector database. |
|
Create a new model by parsing and validating input data from keyword arguments. |
|
Class for an authorization context. |
|
Create a new model by parsing and validating input data from keyword arguments. |
|
Input for PebbloRetrievalQA chain. |
|
Create a new model by parsing and validating input data from keyword arguments. |
|
Langchain framework details |
|
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. |
|
OS, language details |
|
Class for a semantic context. |
|
Class for a semantic entity filter. |
|
Class for a semantic topic filter. |
|
Create a new model by parsing and validating input data from keyword arguments. |
|
Wrapper for Pebblo Retrieval API. |
|
Routes available for the Pebblo API as enumerator. |
Functions¶
|
Convert a Python function to an Ernie function-calling API compatible dict. |
Convert a raw function/class to an Ernie function. |
|
[Legacy] Create an LLM chain that uses Ernie functions. |
|
Create a runnable sequence that uses Ernie functions. |
|
|
[Legacy] Create an LLMChain that uses an Ernie function to get a structured output. |
|
Create a runnable that uses an Ernie function to get a structured output. |
Get the appropriate function output parser given the user functions. |
|
Filter the schema based on included or excluded types |
|
Extract Cypher code from a text. |
|
Extract Cypher code from a text. |
|
Extract Gremlin code from a text. |
|
Extract Cypher code from a text. |
|
|
Remove a prefix from a text. |
Extract Cypher code from text using Regex. |
|
Trim the query to only include Cypher keywords. |
|
Decides whether to use the simple prompt |
|
Extract SPARQL code from a text. |
|
|
Clear the identity and semantic enforcement filters in the retriever search_kwargs. |
|
Set identity and semantic enforcement filters in the retriever. |
Fetch local runtime ip address. |
|
Fetch the current Framework and Runtime details. |
langchain_community.chat_loaders
¶
Chat Loaders load chat messages from common communications platforms.
Load chat messages from various communications platforms such as Facebook Messenger, Telegram, and WhatsApp. The loaded chat messages can be used for fine-tuning models.
Class hierarchy:
BaseChatLoader --> <name>ChatLoader # Examples: WhatsAppChatLoader, IMessageChatLoader
Main helpers:
ChatSession
Classes¶
|
Load Facebook Messenger chat data from a folder. |
|
Load Facebook Messenger chat data from a single file. |
Load chat sessions from the iMessage chat.db SQLite file. |
|
Load chat sessions from a LangSmith dataset with the "chat" data type. |
|
Load chat sessions from a list of LangSmith "llm" runs. |
|
Load Slack conversations from a dump zip file. |
|
Load telegram conversations to LangChain chat messages. |
|
Load WhatsApp conversations from a dump zip file or directory. |
Functions¶
|
Convert nanoseconds since 2001 to a datetime object. |
Convert messages from the specified 'sender' to AI messages. |
|
Convert messages from the specified 'sender' to AI messages. |
|
|
Merge chat runs together. |
Merge chat runs together in a chat session. |
Deprecated classes¶
|
Deprecated since version 0.0.32: Use |
langchain_community.chat_message_histories
¶
Chat message history stores a history of the message interactions in a chat.
Class hierarchy:
BaseChatMessageHistory --> <name>ChatMessageHistory # Examples: FileChatMessageHistory, PostgresChatMessageHistory
Main helpers:
AIMessage, HumanMessage, BaseMessage
Classes¶
|
Chat message history that is backed by Cassandra. |
|
Chat message history backed by Azure CosmosDB. |
|
Chat message history that stores history in AWS DynamoDB. |
Chat message history that stores history in a local file. |
|
|
Chat message history backed by Google Firestore. |
Consume start position for Kafka consumer to get chat history messages. |
|
Chat message history stored in Kafka. |
|
|
Chat message history cache that uses Momento as a backend. |
Chat message history stored in a Neo4j database. |
|
Chat message history stored in a Redis database. |
|
|
Uses Rockset to store chat messages. |
|
Chat message history stored in a SingleStoreDB database. |
Convert BaseMessage to the SQLAlchemy model. |
|
The default message converter for SQLChatMessageHistory. |
|
Chat message history stored in an SQL database. |
|
|
Chat message history that stores messages in Streamlit session state. |
Represents a chat message history stored in a TiDB database. |
|
|
Chat message history stored in an Upstash Redis database. |
Chat message history stored in a Xata database. |
|
Scope for the document search. |
|
Enumerator of the types of search to perform. |
|
Chat message history that uses Zep as a backend. |
|
|
Chat message history that uses Zep Cloud as a backend. |
Functions¶
Create topic if it doesn't exist, and return the number of partitions. |
|
Create a message model for a given table name. |
|
|
Condense Zep memory into a human message. |
|
Get the Zep role type from the role string. |
Deprecated classes¶
|
Deprecated since version 0.0.25: Use |
|
Deprecated since version 0.0.27: Use |
|
Deprecated since version 0.0.25: Use |
|
Deprecated since version 0.0.31: This class is deprecated and will be removed in a future version. You can swap to using the PostgresChatMessageHistory implementation in langchain_postgres. Please do not submit further PRs to this class.See <https://github.com/langchain-ai/langchain-postgres> Use |
langchain_community.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¶
Anyscale Chat large language models. |
|
Azure ML Online Endpoint chat models. |
|
|
Chat Content formatter for models with OpenAI like API scheme. |
Deprecated: Kept for backwards compatibility |
|
Content formatter for LLaMA. |
|
Content formatter for Mistral. |
|
Baichuan chat model integration. |
|
Baidu Qianfan chat model integration. |
|
Adapter class to prepare the inputs from Langchain to prompt format that Chat model expects. |
|
ChatCoze chat models API by coze.com |
|
Dappier chat large language models. |
|
Databricks chat models API. |
|
A chat model that uses the DeepInfra API. |
|
Exception raised when the DeepInfra API returns an error. |
|
EdenAI chat large language models. |
|
EverlyAI Chat large language models. |
|
Fake ChatModel for testing purposes. |
|
Fake ChatModel for testing purposes. |
|
Friendli LLM for chat. |
|
GigaChat large language models API. |
|
Google PaLM Chat models API. |
|
Error with the Google PaLM API. |
|
GPTRouter by Writesonic Inc. |
|
Error with the GPTRouter APIs |
|
GPTRouter model. |
|
ChatModel which returns user input as the response. |
|
Tencent Hunyuan chat models API by Tencent. |
|
Javelin AI Gateway chat models API. |
|
Parameters for the Javelin AI Gateway LLM. |
|
Jina AI Chat models API. |
|
Kinetica LLM Chat Model API. |
|
Fetch and return data from the Kinetica LLM. |
|
Response containing SQL and the fetched data. |
|
Kinetica utility functions. |
|
ChatKonko Chat large language models API. |
|
Chat model that uses the LiteLLM API. |
|
Error with the LiteLLM I/O library |
|
LiteLLM Router as LangChain Model. |
|
Chat with LLMs via llama-api-server |
|
llama.cpp model. |
|
MariTalk Chat models API. |
|
Initialize RequestException with request and response objects. |
|
MiniMax chat model integration. |
|
MLflow chat models API. |
|
MLflow AI Gateway chat models API. |
|
Parameters for the MLflow AI Gateway LLM. |
|
MLX chat models. |
|
Moonshot large language models. |
|
ChatOCIGenAI chat model integration. |
|
OctoAI Chat large language models. |
|
Ollama locally runs large language models. |
|
Alibaba Cloud PAI-EAS LLM Service chat model API. |
|
Perplexity AI Chat models API. |
|
PremAI Chat models. |
|
Error with the PremAI API. |
|
PromptLayer and OpenAI Chat large language models API. |
|
Snowflake Cortex based Chat model |
|
Error with Snowpark client. |
|
IFlyTek Spark chat model integration. |
|
Nebula chat large language model - https://docs.symbl.ai/docs/nebula-llm |
|
Alibaba Tongyi Qwen chat model integration. |
|
Volc Engine Maas hosts a plethora of models. |
|
YandexGPT large language models. |
|
Yi chat models API. |
|
Yuan2.0 Chat models API. |
|
ZhipuAI chat model integration. |
Functions¶
|
Format a list of messages into a full prompt for the Anthropic model |
Async context manager for connecting to an SSE stream. |
|
|
Convert a message to a dictionary that can be passed to the API. |
Convert a list of messages to a prompt for mistral. |
|
Get the request for the Cohere chat API. |
|
|
Get the role of the message. |
Use tenacity to retry the async completion call. |
|
Use tenacity to retry the completion call for streaming. |
|
Use tenacity to retry the completion call. |
|
Define conditional decorator. |
|
Convert a dict response to a message. |
|
|
Get a request of the Friendli chat API. |
|
Get role of the message. |
Use tenacity to retry the async completion call. |
|
|
Use tenacity to retry the completion call. |
Use tenacity to retry the async completion call. |
|
Use tenacity to retry the completion call. |
|
Return the body for the model router input. |
|
Use tenacity to retry the async completion call. |
|
Use tenacity to retry the async completion call. |
|
Get llm output from usage and params. |
|
Convert a list of messages to a prompt for llama. |
|
Async context manager for connecting to an SSE stream. |
|
Context manager for connecting to an SSE stream. |
|
Use tenacity to retry the async completion call. |
|
|
Using tenacity for retry in completion call |
Create a retry decorator for PremAI API errors. |
|
Convert a dict to a message. |
|
Convert a message chunk to a message. |
|
Convert a message to a dict. |
|
Convert a dict to a message. |
|
Use tenacity to retry the async completion call. |
|
Use tenacity to retry the completion call. |
|
|
|
Use tenacity to retry the async completion call. |
|
|
Async context manager for connecting to an SSE stream. |
|
Context manager for connecting to an SSE stream. |
Deprecated classes¶
Deprecated since version 0.0.28: Use |
|
Deprecated since version 0.0.10: Use |
|
Deprecated since version 0.0.34: Use |
|
Deprecated since version 0.0.30: Use |
|
Deprecated since version 0.0.13: Use |
|
Deprecated since version 0.0.26: Use |
|
Deprecated since version 0.0.37: Use |
|
Deprecated since version 0.0.10: Use |
|
Deprecated since version 0.0.34: Use |
|
Deprecated since version 0.0.12: Use |
langchain_community.cross_encoders
¶
- Cross encoders are wrappers around cross encoder models from different APIs and
services.
Cross encoder models can be LLMs or not.
Class hierarchy:
BaseCrossEncoder --> <name>CrossEncoder # Examples: SagemakerEndpointCrossEncoder
Classes¶
Fake cross encoder model. |
|
HuggingFace cross encoder models. |
|
|
Content handler for CrossEncoder class. |
|
SageMaker Inference CrossEncoder endpoint. |
langchain_community.docstore
¶
Docstores are classes to store and load Documents.
The Docstore is a simplified version of the Document Loader.
Class hierarchy:
Docstore --> <name> # Examples: InMemoryDocstore, Wikipedia
Main helpers:
Document, AddableMixin
Classes¶
|
Docstore via arbitrary lookup function. |
Mixin class that supports adding texts. |
|
Interface to access to place that stores documents. |
|
|
Simple in memory docstore in the form of a dict. |
Wikipedia API. |
langchain_community.document_compressors
¶
Classes¶
Document compressor that uses DashScope Rerank API. |
|
Document compressor using Flashrank interface. |
|
Document compressor that uses Jina Rerank API. |
|
Compress using LLMLingua Project. |
|
OpenVINO rerank models. |
|
Request for reranking. |
|
An enumeration. |
|
Document compressor using Flashrank interface. |
|
Document compressor that uses Volcengine Rerank API. |
langchain_community.document_loaders
¶
Document Loaders are classes to load Documents.
Document Loaders are usually used to load a lot of Documents in a single run.
Class hierarchy:
BaseLoader --> <name>Loader # Examples: TextLoader, UnstructuredFileLoader
Main helpers:
Document, <name>TextSplitter
Classes¶
|
Load acreom vault from a directory. |
Load with an Airbyte source connector implemented using the CDK. |
|
Load from Gong using an Airbyte source connector. |
|
Load from Hubspot using an Airbyte source connector. |
|
Load from Salesforce using an Airbyte source connector. |
|
Load from Shopify using an Airbyte source connector. |
|
Load from Stripe using an Airbyte source connector. |
|
Load from Typeform using an Airbyte source connector. |
|
Load from Zendesk Support using an Airbyte source connector. |
|
Load local Airbyte json files. |
|
Load the Airtable tables. |
|
Load datasets from Apify web scraping, crawling, and data extraction platform. |
|
Load records from an ArcGIS FeatureLayer. |
|
|
Load a query result from Arxiv. |
Load AssemblyAI audio transcripts. |
|
|
Load AssemblyAI audio transcripts. |
Transcript format to use for the document loader. |
|
Load HTML asynchronously. |
|
|
Load documents from AWS Athena. |
Load AZLyrics webpages. |
|
Load from Azure AI Data. |
|
|
Load from Azure Blob Storage container. |
|
Load from Azure Blob Storage files. |
|
Load from Baidu BOS directory. |
|
Load from Baidu Cloud BOS file. |
Base class for all loaders that uses O365 Package |
|
|
Load a bibtex file. |
Load fetching transcripts from BiliBili videos. |
|
Load a Blackboard course. |
|
|
Load blobs from cloud URL or file:. |
|
Load blobs in the local file system. |
|
Load YouTube urls as audio file(s). |
Load elements from a blockchain smart contract. |
|
Enumerator of the supported blockchains. |
|
Load with Brave Search engine. |
|
Load pre-rendered web pages using a headless browser hosted on Browserbase. |
|
Load webpages with Browserless /content endpoint. |
|
Document Loader for Apache Cassandra. |
|
|
Load conversations from exported ChatGPT data. |
Microsoft Compiled HTML Help (CHM) Parser. |
|
Load CHM files using Unstructured. |
|
Scrape HTML pages from URLs using a headless instance of the Chromium. |
|
|
Load College Confidential webpages. |
Load and pars Documents concurrently. |
|
Load Confluence pages. |
|
Enumerator of the content formats of Confluence page. |
|
|
Load CoNLL-U files. |
Load documents from Couchbase. |
|
|
Load a CSV file into a list of Documents. |
Load CSV files using Unstructured. |
|
Load Cube semantic layer metadata. |
|
Load Datadog logs. |
|
Initialize with dataframe object. |
|
Load Pandas DataFrame. |
|
Load files using dedoc API. The file loader automatically detects the file type (even with the wrong extension). By default, the loader makes a call to the locally hosted dedoc API. More information about dedoc API can be found in dedoc documentation: https://dedoc.readthedocs.io/en/latest/dedoc_api_usage/api.html. |
|
Base Loader that uses dedoc (https://dedoc.readthedocs.io). |
|
DedocFileLoader document loader integration to load files using dedoc. |
|
Load Diffbot json file. |
|
Load from a directory. |
|
Load Discord chat logs. |
|
|
Load a PDF with Azure Document Intelligence. |
Load from Docusaurus Documentation. |
|
Load files from Dropbox. |
|
Load from DuckDB. |
|
Loads Outlook Message files using extract_msg. |
|
Load email files using Unstructured. |
|
Load EPub files using Unstructured. |
|
Load transactions from Ethereum mainnet. |
|
Load from EverNote. |
|
Load Microsoft Excel files using Unstructured. |
|
Load Facebook Chat messages directory dump. |
|
|
Load from FaunaDB. |
Load Figma file. |
|
FireCrawlLoader document loader integration |
|
Generic Document Loader. |
|
Load geopandas Dataframe. |
|
|
Load Git repository files. |
|
Load GitBook data. |
Load GitHub repository Issues. |
|
Load issues of a GitHub repository. |
|
Load GitHub File |
|
Load table schemas from AWS Glue. |
|
Load from Gutenberg.org. |
|
File encoding as the NamedTuple. |
|
|
Load Hacker News data. |
Load HTML files using Unstructured. |
|
|
__ModuleName__ document loader integration |
|
Load from Hugging Face Hub datasets. |
|
Load model information from Hugging Face Hub, including README content. |
|
Load iFixit repair guides, device wikis and answers. |
Load PNG and JPG files using Unstructured. |
|
Load image captions. |
|
Load IMSDb webpages. |
|
|
Load from IUGU. |
Load notes from Joplin. |
|
Load a JSON file using a jq schema. |
|
Load from Kinetica API. |
|
Client for lakeFS. |
|
|
Load from lakeFS. |
Load from lakeFS as unstructured data. |
|
Load from LarkSuite (FeiShu). |
|
Load from LarkSuite (FeiShu) wiki. |
|
Load Documents using LLMSherpa. |
|
Load Markdown files using Unstructured. |
|
Load the Mastodon 'toots'. |
|
Load from Alibaba Cloud MaxCompute table. |
|
Load MediaWiki dump from an XML file. |
|
Merge documents from a list of loaders |
|
|
Parse MHTML files with BeautifulSoup. |
Load elements from a blockchain smart contract. |
|
Load from Modern Treasury. |
|
Load MongoDB documents. |
|
|
Load news articles from URLs using Unstructured. |
Load Jupyter notebook (.ipynb) files. |
|
Load Notion directory dump. |
|
Load from Notion DB. |
|
|
Load from any file type using Nuclia Understanding API. |
Load from Huawei OBS directory. |
|
Load from the Huawei OBS file. |
|
Load Obsidian files from directory. |
|
Load OpenOffice ODT files using Unstructured. |
|
Load from Microsoft OneDrive. |
|
Load a file from Microsoft OneDrive. |
|
Load pages from OneNote notebooks. |
|
Load from Open City. |
|
|
Load from oracle adb |
Read documents using OracleDocLoader :param conn: Oracle Connection, :param params: Loader parameters. |
|
Read a file |
|
Splitting text using Oracle chunker. |
|
Parse Oracle doc metadata... |
|
Load Org-Mode files using Unstructured. |
|
Transcribe and parse audio files with faster-whisper. |
|
Transcribe and parse audio files. |
|
|
Transcribe and parse audio files with OpenAI Whisper model. |
Transcribe and parse audio files. |
|
|
Loads a PDF with Azure Document Intelligence (formerly Forms Recognizer). |
Dataclass to store Document AI parsing results. |
|
Parser that uses mime-types to parse a blob. |
|
Load article PDF files using Grobid. |
|
Exception raised when the Grobid server is unavailable. |
|
Parse HTML files using Beautiful Soup. |
|
Code segmenter for C. |
|
|
Code segmenter for COBOL. |
|
Abstract class for the code segmenter. |
Code segmenter for C++. |
|
|
Code segmenter for C#. |
|
Code segmenter for Elixir. |
Code segmenter for Go. |
|
Code segmenter for Java. |
|
|
Code segmenter for JavaScript. |
|
Code segmenter for Kotlin. |
|
Parse using the respective programming language syntax. |
Code segmenter for Lua. |
|
Code segmenter for Perl. |
|
Code segmenter for PHP. |
|
|
Code segmenter for Python. |
Code segmenter for Ruby. |
|
Code segmenter for Rust. |
|
|
Code segmenter for Scala. |
|
Abstract class for `CodeSegmenter`s that use the tree-sitter library. |
|
Code segmenter for TypeScript. |
Parse the Microsoft Word documents from a blob. |
|
Send PDF files to Amazon Textract and parse them. |
|
|
Loads a PDF with Azure Document Intelligence (formerly Form Recognizer) and chunks at character level. |
Parse PDF using PDFMiner. |
|
Parse PDF with PDFPlumber. |
|
Parse PDF using PyMuPDF. |
|
Load PDF using pypdf |
|
Parse PDF with PyPDFium2. |
|
Parser for text blobs. |
|
Parser for vsdx files. |
|
Load PDF files from a local file system, HTTP or S3. |
|
|
Base Loader class for PDF files. |
|
DedocPDFLoader document loader integration to load PDF files using dedoc. The file loader can automatically detect the correctness of a textual layer in the PDF document. Note that __init__ method supports parameters that differ from ones of DedocBaseLoader. |
Load a PDF with Azure Document Intelligence |
|
|
Load PDF files using Mathpix service. |
|
Load online PDF. |
|
Load PDF files using PDFMiner. |
Load PDF files as HTML content using PDFMiner. |
|
|
Load PDF files using pdfplumber. |
alias of |
|
|
Load PDF files using PyMuPDF. |
Load a directory with PDF files using pypdf and chunks at character level. |
|
|
PyPDFLoader document loader integration |
|
Load PDF using pypdfium2 and chunks at character level. |
Load PDF files using Unstructured. |
|
Pebblo Safe Loader class is a wrapper around document loaders enabling the data to be scrutinized. |
|
|
Load Polars DataFrame. |
|
Load Microsoft PowerPoint files using Unstructured. |
Load from Psychic.dev. |
|
Load from the PubMed biomedical library. |
|
|
Load PySpark DataFrames. |
|
Load Python files, respecting any non-default encoding if specified. |
|
Load Quip pages. |
Load ReadTheDocs documentation directory. |
|
|
Recursively load all child links from a root URL. |
Load Reddit posts. |
|
Load Roam files from a directory. |
|
Column not found error. |
|
Load from a Rockset database. |
|
|
Load content from RSpace notebooks, folders, documents or PDF Gallery files. |
|
Load news articles from RSS feeds using Unstructured. |
Load RST files using Unstructured. |
|
Load RTF files using Unstructured. |
|
Load from Amazon AWS S3 directory. |
|
|
Load from Amazon AWS S3 file. |
Turn a url to llm accessible markdown with Scrapfly.io. |
|
Turn an url to LLM accessible markdown with ScrapingAnt. |
|
Load from SharePoint. |
|
|
Load a sitemap and its URLs. |
Load from a Slack directory dump. |
|
Load from Snowflake API. |
|
Load web pages as Documents using Spider AI. |
|
Load from Spreedly API. |
|
Load documents by querying database tables supported by SQLAlchemy. |
|
|
Load .srt (subtitle) files. |
|
Load from Stripe API. |
Load SurrealDB documents. |
|
Load Telegram chat json directory dump. |
|
Load from Telegram chat dump. |
|
alias of |
|
|
Load from Tencent Cloud COS directory. |
Load from Tencent Cloud COS file. |
|
|
Load from TensorFlow Dataset. |
|
Load text file. |
|
Load documents from TiDB. |
Load HTML using 2markdown API. |
|
|
Load TOML files. |
|
Load cards from a Trello board. |
Load TSV files using Unstructured. |
|
Load Twitter tweets. |
|
Base Loader that uses Unstructured. |
|
Load files from remote URLs using Unstructured. |
|
Abstract base class for all evaluators. |
|
Load HTML pages with Playwright and parse with Unstructured. |
|
|
Evaluate the page HTML content using the unstructured library. |
Load HTML pages with Selenium and parse with Unstructured. |
|
|
Initialize with file path. |
Load weather data with Open Weather Map API. |
|
WebBaseLoader document loader integration |
|
Load WhatsApp messages text file. |
|
Load from Wikipedia. |
|
Load DOCX file using docx2txt and chunks at character level. |
|
|
Load Microsoft Word file using Unstructured. |
Load XML file using Unstructured. |
|
Load Xorbits DataFrame. |
|
Generic Google API Client. |
|
Load all Videos from a YouTube Channel. |
|
Output formats of transcripts from YoutubeLoader. |
|
|
Load YouTube video transcripts. |
|
Load documents from Yuque. |
Functions¶
Fetch the mime types for the specified file types. |
|
Combine message information in a readable format ready to be used. |
|
Combine message information in a readable format ready to be used. |
|
Try to detect the file encoding. |
|
Combine cells information in a readable format ready to be used. |
|
Recursively remove newlines, no matter the data structure they are stored in. |
|
|
Extract text from images with RapidOCR. |
Get a parser by parser name. |
|
Default joiner for content columns. |
|
Combine message information in a readable format ready to be used. |
|
Convert a string or list of strings to a list of Documents with metadata. |
|
Retrieve a list of elements from the Unstructured API. |
|
|
Check if the installed Unstructured version exceeds the minimum version for the feature in question. |
|
Raise an error if the Unstructured version does not exceed the specified minimum. |
Combine message information in a readable format ready to be used. |
Deprecated classes¶
Deprecated since version 0.0.29: Use |
|
Deprecated since version 0.0.32: Use |
|
Deprecated since version 0.0.24: Use |
|
Deprecated since version 0.0.32: Use |
|
Deprecated since version 0.0.32: Use |
|
|
Deprecated since version 0.0.32: Use |
Deprecated since version 0.0.32: Use |
|
Deprecated since version 0.0.32: Use |
|
|
Deprecated since version 0.2.8: Use |
|
Deprecated since version 0.2.8: Use |
|
Deprecated since version 0.2.8: Use |
Deprecated since version 0.2.8: Use |
langchain_community.document_transformers
¶
Document Transformers are classes to transform Documents.
Document Transformers usually used to transform a lot of Documents in a single run.
Class hierarchy:
BaseDocumentTransformer --> <name> # Examples: DoctranQATransformer, DoctranTextTranslator
Main helpers:
Document
Classes¶
|
Transform HTML content by extracting specific tags and removing unwanted ones. |
|
Extract properties from text documents using doctran. |
|
Extract QA from text documents using doctran. |
|
Translate text documents using doctran. |
|
Perform K-means clustering on document vectors. |
|
Filter that drops redundant documents by comparing their embeddings. |
Replace occurrences of a particular search pattern with a replacement string |
|
|
Reorder long context. |
|
Converts HTML documents to Markdown format with customizable options for handling links, images, other tags and heading styles using the markdownify library. |
|
Nuclia Text Transformer. |
Extract metadata tags from document contents using OpenAI functions. |
Functions¶
|
Get all navigable strings from a BeautifulSoup element. |
|
Convert a list of documents to a list of documents with state. |
|
Create a DocumentTransformer that uses an OpenAI function chain to automatically |
Deprecated classes¶
|
Deprecated since version 0.0.32: Use |
langchain_community.embeddings
¶
Embedding models are wrappers around embedding models from different APIs and services.
Embedding models can be LLMs or not.
Class hierarchy:
Embeddings --> <name>Embeddings # Examples: OpenAIEmbeddings, HuggingFaceEmbeddings
Classes¶
|
Aleph Alpha's asymmetric semantic embedding. |
Symmetric version of the Aleph Alpha's semantic embeddings. |
|
Anyscale Embeddings API. |
|
Ascend NPU accelerate Embedding model |
|
Embedding documents and queries with Awa DB. |
|
Baichuan Text Embedding models. |
|
Baidu Qianfan Embeddings embedding models. |
|
Bookend AI sentence_transformers embedding models. |
|
Clarifai embedding models. |
|
|
Cloudflare Workers AI embedding model. |
Clova's embedding service. |
|
DashScope embedding models. |
|
Databricks embeddings. |
|
Deep Infra's embedding inference service. |
|
EdenAI embedding. |
|
Embaas's embedding service. |
|
Payload for the Embaas embeddings API. |
|
Fake embedding model that always returns the same embedding vector for the same text. |
|
Fake embedding model. |
|
Qdrant FastEmbedding models. |
|
GigaChat Embeddings models. |
|
Google's PaLM Embeddings APIs. |
|
GPT4All embedding models. |
|
Gradient.ai Embedding models. |
|
|
Deprecated, TinyAsyncGradientEmbeddingClient was removed. |
HuggingFace sentence_transformers embedding models. |
|
Embed texts using the HuggingFace API. |
|
Wrapper around sentence_transformers embedding models. |
|
Self-hosted embedding models for infinity package. |
|
|
Helper tool to embed Infinity. |
Optimized Infinity embedding models. |
|
Wrapper around the BGE embedding model with IPEX-LLM optimizations on Intel CPUs and GPUs. |
|
Leverage Itrex runtime to unlock the performance of compressed NLP models. |
|
Javelin AI Gateway embeddings. |
|
Jina embedding models. |
|
JohnSnowLabs embedding models |
|
LASER Language-Agnostic SEntence Representations. |
|
llama.cpp embedding models. |
|
Llamafile lets you distribute and run large language models with a single file. |
|
LLMRails embedding models. |
|
LocalAI embedding models. |
|
MiniMax embedding model integration. |
|
Cohere embedding LLMs in MLflow. |
|
Embedding LLMs in MLflow. |
|
MLflow AI Gateway embeddings. |
|
ModelScopeHub embedding models. |
|
MosaicML embedding service. |
|
NLP Cloud embedding models. |
|
OCI authentication types as enumerator. |
|
OCI embedding models. |
|
OctoAI Compute Service embedding models. |
|
Ollama locally runs large language models. |
|
OpenVNO BGE embedding models. |
|
OpenVINO embedding models. |
|
Quantized bi-encoders embedding models. |
|
Get Embeddings |
|
OVHcloud AI Endpoints Embeddings. |
|
Prem's Embedding APIs |
|
Content handler for LLM class. |
|
Custom Sagemaker Inference Endpoints. |
|
SambaNova embedding models. |
|
Custom embedding models on self-hosted remote hardware. |
|
|
HuggingFace embedding models on self-hosted remote hardware. |
|
HuggingFace InstructEmbedding models on self-hosted remote hardware. |
Embeddings by spaCy models. |
|
Exception raised for errors in the header assembly. |
|
SparkLLM embedding model integration. |
|
|
URL class for parsing the URL. |
TensorflowHub embedding models. |
|
text2vec embedding models. |
|
|
A client to handle synchronous and asynchronous requests to the TextEmbed API. |
A class to handle embedding requests to the TextEmbed API. |
|
Device to use for inference, cuda or cpu. |
|
Exception raised when no consumer group is provided on initialization of TitanTakeoffEmbed or in embed request. |
|
Configuration for the reader to be deployed in Takeoff. |
|
Custom exception for interfacing with Takeoff Embedding class. |
|
Interface with Takeoff Inference API for embedding models. |
|
Volcengine Embeddings embedding models. |
|
Xinference embedding models. |
|
YandexGPT Embeddings models. |
|
ZhipuAI embedding model integration. |
Functions¶
Use tenacity to retry the embedding call. |
|
Use tenacity to retry the completion call. |
|
|
Get the bytes string of a file. |
Check if a URL is a local file. |
|
Use tenacity to retry the embedding call. |
|
Use tenacity to retry the embedding call. |
|
Use tenacity to retry the completion call. |
|
|
Check if an endpoint is live by sending a GET request to the specified URL. |
Use tenacity to retry the embedding call. |
|
Use tenacity to retry the embedding call. |
|
Create a retry decorator for PremAIEmbeddings. |
|
|
Using tenacity for retry in embedding calls |
|
Load the embedding model. |
Use tenacity to retry the completion call. |
|
Use tenacity to retry the embedding call. |
Deprecated classes¶
Deprecated since version 0.0.9: Use |
|
Deprecated since version 0.2.11: Use |
|
Deprecated since version 0.0.30: Use |
|
Deprecated since version 0.1.11: Use |
|
Deprecated since version 0.0.13: Use |
|
Deprecated since version 0.2.2: Use |
|
Deprecated since version 0.2.2: Use |
|
Deprecated since version 0.0.37: Directly instantiating a NeMoEmbeddings from langchain-community is deprecated. Please use langchain-nvidia-ai-endpoints NVIDIAEmbeddings interface. |
|
Deprecated since version 0.0.9: Use |
|
Deprecated since version 0.0.34: Use |
|
Deprecated since version 0.0.12: Use |
|
Deprecated since version 0.0.29: Use |
langchain_community.example_selectors
¶
Example selector implements logic for selecting examples to include them in prompts. This allows us to select examples that are most relevant to the input.
There could be multiple strategies for selecting examples. For example, one could select examples based on the similarity of the input to the examples. Another strategy could be to select examples based on the diversity of the examples.
Classes¶
Select and order examples based on ngram overlap score (sentence_bleu score from NLTK package). |
Functions¶
Compute ngram overlap score of source and example as sentence_bleu score from NLTK package. |
langchain_community.graph_vectorstores
¶
Graph Vector Store
Sometimes embedding models don’t capture all the important relationships between documents. Graph Vector Stores are an extension to both vector stores and retrievers that allow documents to be explicitly connected to each other.
Graph vector store retrievers use both vector similarity and links to find documents related to an unstructured query.
Graphs allow linking between documents. Each document identifies tags that link to and from it. For example, a paragraph of text may be linked to URLs based on the anchor tags in it’s content and linked from the URL(s) it is published at.
Link extractors can be used to extract links from documents.
Example:
graph_vector_store = CassandraGraphVectorStore()
link_extractor = HtmlLinkExtractor()
links = link_extractor.extract_one(HtmlInput(document.page_content, "http://mysite"))
add_links(document, links)
graph_vector_store.add_document(document)
Get started¶
We chunk the State of the Union text and split it into documents.
from langchain_community.document_loaders import TextLoader
from langchain_text_splitters import CharacterTextSplitter
raw_documents = TextLoader("state_of_the_union.txt").load()
text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)
documents = text_splitter.split_documents(raw_documents)
Links can be added to documents manually but it’s easier to use a
LinkExtractor
.
Several common link extractors are available and you can build your own.
For this guide, we’ll use the
KeybertLinkExtractor
which uses the KeyBERT model to tag documents with keywords and uses these keywords to
create links between documents.
from langchain_community.graph_vectorstores.extractors import KeybertLinkExtractor
from langchain_community.graph_vectorstores.links import add_links
extractor = KeybertLinkExtractor()
for doc in documents:
add_links(doc, extractor.extract_one(doc))
Create the graph vector store and add documents¶
We’ll use an Apache Cassandra or Astra DB database as an example.
We create a CassandraGraphVectorStore
from the documents and an OpenAIEmbeddings
model.
import cassio
from langchain_community.graph_vectorstores import CassandraGraphVectorStore
from langchain_openai import OpenAIEmbeddings
# Initialize cassio and the Cassandra session from the environment variables
cassio.init(auto=True)
store = CassandraGraphVectorStore.from_documents(
embedding=OpenAIEmbeddings(),
documents=documents,
)
Similarity search¶
If we don’t traverse the graph, a graph vector store behaves like a regular vector
store.
So all methods available in a vector store are also available in a graph vector store.
The similarity_search()
method returns documents similar to a query without considering
the links between documents.
docs = store.similarity_search(
"What did the president say about Ketanji Brown Jackson?"
)
Traversal search¶
The traversal_search()
method returns documents similar to a query considering the links
between documents. It first does a similarity search and then traverses the graph to
find linked documents.
docs = list(
store.traversal_search("What did the president say about Ketanji Brown Jackson?")
)
Async methods¶
The graph vector store has async versions of the methods prefixed with a
.
docs = [
doc
async for doc in store.atraversal_search(
"What did the president say about Ketanji Brown Jackson?"
)
]
Graph vector store retriever¶
The graph vector store can be converted to a retriever.
It is similar to the vector store retriever but it also has traversal search methods
such as traversal
and mmr_traversal
.
retriever = store.as_retriever(search_type="mmr_traversal")
docs = retriever.invoke("What did the president say about Ketanji Brown Jackson?")
Classes¶
langchain_community.graphs
¶
Graphs provide a natural language interface to graph databases.
Classes¶
|
Apache AGE wrapper for graph operations. |
|
Exception for the AGE queries. |
ArangoDB wrapper for graph operations. |
|
|
FalkorDB wrapper for graph operations. |
Represents a graph document consisting of nodes and relationships. |
|
Represents a node in a graph with associated properties. |
|
Represents a directed relationship between two nodes in a graph. |
|
Abstract class for graph operations. |
|
|
Gremlin wrapper for graph operations. |
|
HugeGraph wrapper for graph operations. |
Functionality to create graph index. |
|
|
Kùzu wrapper for graph operations. |
|
Memgraph wrapper for graph operations. |
|
NebulaGraph wrapper for graph operations. |
|
Neo4j database wrapper for various graph operations. |
Abstract base class for Neptune. |
|
Neptune Analytics wrapper for graph operations. |
|
|
Neptune wrapper for graph operations. |
Exception for the Neptune queries. |
|
Neptune wrapper for RDF graph operations. |
|
Knowledge triple in the graph. |
|
Networkx wrapper for entity graph operations. |
|
Ontotext GraphDB https://graphdb.ontotext.com/ wrapper for graph operations. |
|
|
RDFlib wrapper for graph operations. |
TigerGraph wrapper for graph operations. |
Functions¶
Get the Arango DB client from credentials. |
|
Clean string values for schema. |
|
Sanitize the input dictionary or list. |
|
|
Extract entities from entity string. |
Parse knowledge triples from the knowledge string. |
langchain_community.indexes
¶
Index is used to avoid writing duplicated content into the vectostore and to avoid over-writing content if it’s unchanged.
Indexes also :
Create knowledge graphs from data.
Support indexing workflows from LangChain data loaders to vectorstores.
Importantly, Index keeps on working even if the content being written is derived via a set of transformations from some source content (e.g., indexing children documents that were derived from parent documents by chunking.)
Classes¶
|
Abstract base class for a record manager. |
langchain_community.llms
¶
LLM classes provide access to the large language model (LLM) APIs and services.
Class hierarchy:
BaseLanguageModel --> BaseLLM --> LLM --> <name> # Examples: AI21, HuggingFaceHub, OpenAI
Main helpers:
LLMResult, PromptValue,
CallbackManagerForLLMRun, AsyncCallbackManagerForLLMRun,
CallbackManager, AsyncCallbackManager,
AIMessage, BaseMessage
Classes¶
AI21 large language models. |
|
Parameters for AI21 penalty data. |
|
Aleph Alpha large language models. |
|
Amazon API Gateway to access LLM models hosted on AWS. |
|
Adapter to prepare the inputs from Langchain to a format that LLM model expects. |
|
Anyscale large language models. |
|
Aphrodite language model. |
|
Arcee's Domain Adapted Language Models (DALMs). |
|
Aviary hosted models. |
|
|
Aviary backend. |
Azure ML Online Endpoint models. |
|
Azure ML endpoints API types. |
|
AzureML Managed Endpoint client. |
|
Azure ML Online Endpoint models. |
|
Transform request and response of AzureML endpoint to match with required schema. |
|
Content formatter for models that use the OpenAI like API scheme. |
|
Content handler for the Dolly-v2-12b model |
|
Content handler for GPT2 |
|
Content handler for LLMs from the HuggingFace catalog. |
|
Deprecated: Kept for backwards compatibility |
|
Deprecated: Kept for backwards compatibility |
|
Baichuan large language models. |
|
Baidu Qianfan completion model integration. |
|
Banana large language models. |
|
Baseten model |
|
Beam API for gpt2 large language model. |
|
Base class for Bedrock models. |
|
Adapter class to prepare the inputs from Langchain to a format that LLM model expects. |
|
Wrapper around the BigdlLLM model |
|
NIBittensor LLMs |
|
CerebriumAI large language models. |
|
ChatGLM LLM service. |
|
ChatGLM3 LLM service. |
|
Clarifai large language models. |
|
Cloudflare Workers AI service. |
|
C Transformers LLM models. |
|
CTranslate2 language model. |
|
Databricks serving endpoint or a cluster driver proxy app for LLM. |
|
DeepInfra models. |
|
Neural Magic DeepSparse LLM interface. |
|
EdenAI models. |
|
ExllamaV2 API. |
|
Fake LLM for testing purposes. |
|
Fake streaming list LLM for testing purposes. |
|
ForefrontAI large language models. |
|
Base class of Friendli. |
|
Friendli LLM. |
|
GigaChat large language models API. |
|
GooseAI large language models. |
|
GPT4All language models. |
|
Gradient.ai LLM Endpoints. |
|
Train result. |
|
User input as the response. |
|
IpexLLM model. |
|
Javelin AI Gateway LLMs. |
|
Parameters for the Javelin AI Gateway LLM. |
|
Kobold API language model. |
|
Konko AI models. |
|
Layerup Security LLM service. |
|
llama.cpp model. |
|
Llamafile lets you distribute and run large language models with a single file. |
|
HazyResearch's Manifest library. |
|
Minimax large language models. |
|
Common parameters for Minimax large language models. |
|
MLflow LLM service. |
|
MLflow AI Gateway LLMs. |
|
Parameters for the MLflow AI Gateway LLM. |
|
MLX Pipeline API. |
|
Modal large language models. |
|
Moonshot large language models. |
|
Common parameters for Moonshot LLMs. |
|
MosaicML LLM service. |
|
NLPCloud large language models. |
|
|
Base class for LLM deployed on OCI Data Science Model Deployment. |
|
OCI Data Science Model Deployment TGI Endpoint. |
|
VLLM deployed on OCI Data Science Model Deployment |
OCI authentication types as enumerator. |
|
OCI large language models. |
|
Base class for OCI GenAI models |
|
OctoAI LLM Endpoints - OpenAI compatible. |
|
Ollama locally runs large language models. |
|
Raised when the Ollama endpoint is not found. |
|
LLM that uses OpaquePrompts to sanitize prompts. |
|
Base OpenAI large language model class. |
|
Parameters for identifying a model as a typed dict. |
|
OpenLLM, supporting both in-process model instance and remote OpenLLM servers. |
|
OpenLM models. |
|
Langchain LLM class to help to access eass llm service. |
|
Petals Bloom models. |
|
PipelineAI large language models. |
|
Use your Predibase models with Langchain. |
|
Prediction Guard large language models. |
|
PromptLayer OpenAI large language models. |
|
PromptLayer OpenAI large language models. |
|
Replicate models. |
|
RWKV language models. |
|
Handler class to transform input from LLM to a format that SageMaker endpoint expects. |
|
Content handler for LLM class. |
|
Parse the byte stream input. |
|
Sagemaker Inference Endpoint models. |
|
|
SambaNova Systems Interface for SambaStudio model endpoints. |
|
SambaNova Systems Interface for Sambaverse endpoint. |
SambaStudio large language models. |
|
Sambaverse large language models. |
|
Model inference on self-hosted remote hardware. |
|
HuggingFace Pipeline API to run on self-hosted remote hardware. |
|
Solar large language models. |
|
Common configuration for Solar LLMs. |
|
iFlyTek Spark completion model integration. |
|
StochasticAI large language models. |
|
Nebula Service models. |
|
Text generation models from WebUI. |
|
|
The device to use for inference, cuda or cpu |
Configuration for the reader to be deployed in Titan Takeoff API. |
|
Titan Takeoff API LLMs. |
|
Tongyi completion model integration. |
|
VLLM language model. |
|
vLLM OpenAI-compatible API client |
|
Base class for VolcEngineMaas models. |
|
volc engine maas hosts a plethora of models. |
|
Weight only quantized model. |
|
Writer large language models. |
|
Xinference large-scale model inference service. |
|
Yandex large language models. |
|
Yi large language models. |
|
Wrapper around You.com's conversational Smart and Research APIs. |
|
Yuan2.0 language models. |
Functions¶
|
Create the LLMResult from the choices and prompts. |
|
Update token usage. |
|
Get completions from Aviary models. |
List available models |
|
|
Use tenacity to retry the completion call. |
|
Use tenacity to retry the completion call. |
Get the default Databricks personal access token. |
|
Get the default Databricks workspace hostname. |
|
Get the notebook REPL context if running inside a Databricks notebook. |
|
|
Use tenacity to retry the completion call. |
Use tenacity to retry the completion call. |
|
Use tenacity to retry the completion call for streaming. |
|
|
Use tenacity to retry the completion call. |
Use tenacity to retry the completion call. |
|
Conditionally apply a decorator. |
|
|
Use tenacity to retry the completion call. |
Remove trailing slash and /api from url if present. |
|
|
Default guardrail violation handler. |
|
Load LLM from a file. |
|
Load LLM from Config Dict. |
|
Use tenacity to retry the async completion call. |
|
Use tenacity to retry the completion call. |
|
Update token usage. |
Use tenacity to retry the completion call. |
|
|
Generate text from the model. |
Generate elements from an async iterable, and a boolean indicating if it is the last element. |
|
|
Async version of stream_generate_with_retry. |
Check the response from the completion call. |
|
Generate elements from an iterable, and a boolean indicating if it is the last element. |
|
|
Use tenacity to retry the completion call. |
|
Use tenacity to retry the completion call. |
|
Cut off the text as soon as any stop words occur. |
|
Use tenacity to retry the completion call. |
|
Use tenacity to retry the completion call. |
|
Return True if the model name is a Codey model. |
|
Return True if the model name is a Gemini model. |
|
Use tenacity to retry the async completion call. |
|
Use tenacity to retry the completion call. |
Deprecated classes¶
Deprecated since version 0.0.28: Use |
|
Deprecated since version 0.0.34: Use |
|
Deprecated since version 0.0.30: Use |
|
Deprecated since version 0.1.14: Use |
|
Deprecated since version 0.0.26: Use |
|
Deprecated since version 0.0.12: Use |
|
Deprecated since version 0.0.37: Use |
|
Deprecated since version 0.0.21: Use |
|
Deprecated since version 0.0.37: Use |
|
|
Deprecated since version 0.0.21: Use |
Deprecated since version 0.0.10: Use |
|
Deprecated since version 0.0.10: Use |
|
Deprecated since version 0.0.1: Use |
|
Deprecated since version 0.0.12: Use |
|
Deprecated since version 0.0.12: Use |
|
Deprecated since version 0.0.12: Use |
|
Deprecated since version 0.0.18: Use |
langchain_community.memory
¶
Classes¶
Knowledge graph conversation memory. |
|
Chat message memory backed by Motorhead service. |
|
Persist your chain history to the Zep MemoryStore. |
langchain_community.output_parsers
¶
OutputParser classes parse the output of an LLM call.
Class hierarchy:
BaseLLMOutputParser --> BaseOutputParser --> <name>OutputParser # GuardrailsOutputParser
Main helpers:
Serializable, Generation, PromptValue
Classes¶
Parse an output as the element of the Json object. |
|
Parse an output as the Json object. |
|
Parse an output that is one of sets of values. |
|
|
Parse an output as an attribute of a pydantic object. |
|
Parse an output as a pydantic object. |
Parse the output of an LLM call using Guardrails. |
langchain_community.query_constructors
¶
Classes¶
Translate AstraDB internal query language elements to valid filters. |
|
Translate Chroma internal query language elements to valid filters. |
|
Logic for converting internal query language elements to valid filters. |
|
|
Translate Databricks vector search internal query language elements to valid filters. |
Translate DeepLake internal query language elements to valid filters. |
|
Translate DingoDB internal query language elements to valid filters. |
|
Translate Elasticsearch internal query language elements to valid filters. |
|
Translate internal query language elements to valid filters params for HANA vectorstore. |
|
Translate Milvus internal query language elements to valid filters. |
|
Translate Mongo internal query language elements to valid filters. |
|
Translate MyScale internal query language elements to valid filters. |
|
Translate Neo4j internal query language elements to valid filters. |
|
Translate OpenSearch internal query domain-specific language elements to valid filters. |
|
Translate PGVector internal query language elements to valid filters. |
|
Translate Pinecone internal query language elements to valid filters. |
|
Translate Qdrant internal query language elements to valid filters. |
|
Visitor for translating structured queries to Redis filter expressions. |
|
Translate Langchain filters to Supabase PostgREST filters. |
|
|
Translate StructuredQuery to Tencent VectorDB query. |
|
Translate the internal query language elements to valid filters. |
Translate Vectara internal query language elements to valid filters. |
|
Translate Weaviate internal query language elements to valid filters. |
Functions¶
Check if a string can be cast to a float. |
|
Convert a value to a string and add double quotes if it is a string. |
|
Convert a value to a string and add single quotes if it is a string. |
langchain_community.retrievers
¶
Retriever class returns Documents given a text query.
It is more general than a vector store. A retriever does not need to be able to store documents, only to return (or retrieve) it. Vector stores can be used as the backbone of a retriever, but there are other types of retrievers as well.
Class hierarchy:
BaseRetriever --> <name>Retriever # Examples: ArxivRetriever, MergerRetriever
Main helpers:
Document, Serializable, Callbacks,
CallbackManagerForRetrieverRun, AsyncCallbackManagerForRetrieverRun
Classes¶
Arcee Domain Adapted Language Models (DALMs) retriever. |
|
Arxiv retriever. |
|
AskNews retriever. |
|
Azure AI Search service retriever. |
|
Azure Cognitive Search service retriever. |
|
Amazon Bedrock Knowledge Bases retriever. |
|
Configuration for retrieval. |
|
Configuration for vector search. |
|
BM25 retriever without Elasticsearch. |
|
A retriever class for Breebs. |
|
Chaindesk API retriever. |
|
ChatGPT plugin retriever. |
|
Databerry API retriever. |
|
DocArray Document Indices retriever. |
|
Enumerator of the types of search to perform. |
|
Dria retriever using the DriaAPIWrapper. |
|
Elasticsearch retriever that uses BM25. |
|
Embedchain retriever. |
|
|
Google Vertex Search API retriever alias for backwards compatibility. |
Retriever for Kay.ai datasets. |
|
Additional result attribute. |
|
Value of an additional result attribute. |
|
Amazon Kendra Index retriever. |
|
Document attribute. |
|
Value of a document attribute. |
|
Information that highlights the keywords in the excerpt. |
|
Amazon Kendra Query API search result. |
|
Query API result item. |
|
Base class of a result item. |
|
Amazon Kendra Retrieve API search result. |
|
Retrieve API result item. |
|
Text with highlights. |
|
KNN retriever. |
|
LlamaIndex graph data structure retriever. |
|
LlamaIndex retriever. |
|
Metal API retriever. |
|
Milvus API retriever. |
|
`NanoPQ retriever. |
|
Retriever for Outline API. |
|
|
Pinecone Hybrid Search retriever. |
PubMed API retriever. |
|
Rememberizer retriever. |
|
LangChain API retriever. |
|
SVM retriever. |
|
Search depth as enumerator. |
|
Tavily Search API retriever. |
|
TF-IDF retriever. |
|
Document retriever that uses ThirdAI's NeuralDB. |
|
Vespa retriever. |
|
|
Weaviate hybrid search retriever. |
Output parser for a list of numbered questions. |
|
Search queries to research for the user's goal. |
|
Google Search API retriever. |
|
Wikipedia API retriever. |
|
You.com Search API retriever. |
|
|
Which documents to search. |
|
Enumerator of the types of search to perform. |
Zep MemoryStore Retriever. |
|
Zep Cloud MemoryStore Retriever. |
|
Zilliz API retriever. |
Functions¶
|
Clean an excerpt from Kendra. |
Combine a ResultItem title and excerpt into a single string. |
|
|
Create an index of embeddings for a list of contexts. |
|
Deprecated MilvusRetreiver. |
|
Create an index of embeddings for a list of contexts. |
Create an index from a list of contexts. |
|
Hash a text using SHA256. |
|
|
Create an index of embeddings for a list of contexts. |
|
Deprecated ZillizRetreiver. |
Deprecated classes¶
Deprecated since version 0.0.30: Use |
|
|
Deprecated since version 0.0.32: Use |
|
Deprecated since version 0.0.33: Use |
|
Deprecated since version 0.0.33: Use |
|
Deprecated since version 0.2.16: Use |
langchain_community.storage
¶
Storage is an implementation of key-value store.
Storage module provides implementations of various key-value stores that conform to a simple key-value interface.
The primary goal of these storages is to support caching.
Class hierarchy:
BaseStore --> <name>Store # Examples: MongoDBStore, RedisStore
Classes¶
|
Base class for the DataStax AstraDB data store. |
|
A ByteStore implementation using Cassandra as the backend. |
|
BaseStore implementation using MongoDB as the underlying store. |
|
BaseStore implementation using MongoDB as the underlying store. |
|
BaseStore implementation using Redis as the underlying store. |
|
Table used to save values. |
|
BaseStore interface that works on an SQL database. |
BaseStore implementation using Upstash Redis as the underlying store to store raw bytes. |
Functions¶
|
Deprecated classes¶
|
Deprecated since version 0.0.22: Use |
|
Deprecated since version 0.0.22: Use |
|
Deprecated since version 0.0.1: Use |
langchain_community.tools
¶
Tools are classes that an Agent uses to interact with the world.
Each tool has a description. Agent uses the description to choose the right tool for the job.
Class hierarchy:
ToolMetaclass --> BaseTool --> <name>Tool # Examples: AIPluginTool, BaseGraphQLTool
<name> # Examples: BraveSearch, HumanInputRun
Main helpers:
CallbackManagerForToolRun, AsyncCallbackManagerForToolRun
Classes¶
Tool for app operations. |
|
Type of app operation as enumerator. |
|
Schema for app operations. |
|
Base class for the AINetwork tools. |
|
Type of operation as enumerator. |
|
Tool for owner operations. |
|
Schema for owner operations. |
|
Tool for owner operations. |
|
Schema for owner operations. |
|
Tool for transfer operations. |
|
Schema for transfer operations. |
|
Tool for value operations. |
|
Schema for value operations. |
|
Base Tool for Amadeus. |
|
Tool for finding the closest airport to a particular location. |
|
Schema for the AmadeusClosestAirport tool. |
|
Tool for searching for a single flight between two airports. |
|
Schema for the AmadeusFlightSearch tool. |
|
Input for the Arxiv tool. |
|
Tool that searches the Arxiv API. |
|
Tool that searches the AskNews API. |
|
Input for the AskNews Search tool. |
|
|
HuggingFace Text-to-Speech Model Inference. |
|
Tool that queries the Azure AI Services Document Intelligence API. |
|
Tool that queries the Azure AI Services Image Analysis API. |
|
Tool that queries the Azure AI Services Speech to Text API. |
|
Tool that queries the Azure AI Services Text Analytics for Health API. |
|
Tool that queries the Azure AI Services Text to Speech API. |
|
Tool that queries the Azure Cognitive Services Form Recognizer API. |
|
Tool that queries the Azure Cognitive Services Image Analysis API. |
|
Tool that queries the Azure Cognitive Services Speech2Text API. |
|
Tool that queries the Azure Cognitive Services Text2Speech API. |
|
Tool that queries the Azure Cognitive Services Text Analytics for Health API. |
Tool for evaluating python code in a sandbox environment. |
|
Arguments for the BearlyInterpreterTool. |
|
Information about a file to be uploaded. |
|
Bing Search tool. |
|
Tool that queries the Bing search API. |
|
Tool that queries the BraveSearch. |
|
Base tool for interacting with an Apache Cassandra database. |
|
|
Tool for getting the schema of a keyspace in an Apache Cassandra database. |
|
Tool for getting data from a table in an Apache Cassandra database. |
Tool for querying an Apache Cassandra database with provided CQL. |
|
Tool that queries the Clickup API. |
|
Tool that uses the Cogniswitch service to answer questions. |
|
Tool that uses the Cogniswitch services to store data from file. |
|
Tool that uses the Cogniswitch services to store data from a URL. |
|
Tool that uses the Cogniswitch services to get the |
|
Connery Action model. |
|
Connery Action parameter model. |
|
Connery Action parameter validation model. |
|
Service for interacting with the Connery Runner API. |
|
Connery Action tool. |
|
Create a new model by parsing and validating input data from keyword arguments. |
|
Tool that queries the DataForSeo Google Search API and get back json. |
|
Tool that queries the DataForSeo Google search API. |
|
Tool that queries using the Dataherald SDK. |
|
Create a new model by parsing and validating input data from keyword arguments. |
|
Input for the DuckDuckGo search tool. |
|
Tool that queries the DuckDuckGo search API and gets back json string. |
|
DuckDuckGo tool. |
|
Tool for running python code in a sandboxed environment for data analysis. |
|
Arguments for the E2BDataAnalysisTool. |
|
Description of the uploaded path with its remote path. |
|
Traverse an AST and output source code for the abstract syntax; original formatting is disregarded. |
|
Tool that queries the Eden AI Speech To Text API. |
|
Create a new model by parsing and validating input data from keyword arguments. |
|
Tool that queries the Eden AI Text to speech API. |
|
Create a new model by parsing and validating input data from keyword arguments. |
|
the base tool for all the EdenAI Tools . |
|
Tool that queries the Eden AI Explicit image detection. |
|
Create a new model by parsing and validating input data from keyword arguments. |
|
|
Tool that queries the Eden AI Object detection API. |
Create a new model by parsing and validating input data from keyword arguments. |
|
Tool that queries the Eden AI Identity parsing API. |
|
Create a new model by parsing and validating input data from keyword arguments. |
|
Tool that queries the Eden AI Invoice parsing API. |
|
Create a new model by parsing and validating input data from keyword arguments. |
|
Tool that queries the Eden AI Explicit text detection. |
|
Create a new model by parsing and validating input data from keyword arguments. |
|
Models available for Eleven Labs Text2Speech. |
|
Models available for Eleven Labs Text2Speech. |
|
Tool that queries the Eleven Labs Text2Speech API. |
|
Tool that copies a file. |
|
Input for CopyFileTool. |
|
Tool that deletes a file. |
|
Input for DeleteFileTool. |
|
Input for FileSearchTool. |
|
Tool that searches for files in a subdirectory that match a regex pattern. |
|
Input for ListDirectoryTool. |
|
Tool that lists files and directories in a specified folder. |
|
Input for MoveFileTool. |
|
Tool that moves a file. |
|
Input for ReadFileTool. |
|
Tool that reads a file. |
|
Mixin for file system tools. |
|
Error for paths outside the root directory. |
|
Input for WriteFileTool. |
|
Tool that writes a file to disk. |
|
Tool that gets balance sheets for a given ticker over a given period. |
|
Input for BalanceSheets. |
|
|
Tool that gets cash flow statements for a given ticker over a given period. |
|
Input for CashFlowStatements. |
Tool that gets income statements for a given ticker over a given period. |
|
|
Input for IncomeStatements. |
Tool for interacting with the GitHub API. |
|
Tool for interacting with the GitLab API. |
|
Base class for Gmail tools. |
|
Input for CreateDraftTool. |
|
Tool that creates a draft email for Gmail. |
|
Tool that gets a message by ID from Gmail. |
|
Input for GetMessageTool. |
|
Input for GetMessageTool. |
|
Tool that gets a thread by ID from Gmail. |
|
Tool that searches for messages or threads in Gmail. |
|
|
Enumerator of Resources to search. |
Input for SearchGmailTool. |
|
Tool that sends a message to Gmail. |
|
Input for SendMessageTool. |
|
Tool that adds the capability to query using the Golden API and get back JSON. |
|
Tool that queries the Google Finance API. |
|
Tool that queries the Google Jobs API. |
|
Tool that queries the Google Lens API. |
|
Input for GooglePlacesTool. |
|
Tool that queries the Google search API. |
|
Tool that queries the Serper.dev Google Search API and get back json. |
|
Tool that queries the Serper.dev Google search API. |
|
Tool that queries the Google trends API. |
|
Base tool for querying a GraphQL API. |
|
Tool that asks user for input. |
|
IFTTT Webhook. |
|
Input for the Jina search tool. |
|
Tool that queries the JinaSearch. |
|
Tool that queries the Atlassian Jira API. |
|
Tool for getting a value in a JSON spec. |
|
Tool for listing keys in a JSON spec. |
|
Base class for JSON spec. |
|
Tool that trains a language model. |
|
|
Protocol for trainable language models. |
Tool that searches the Merriam-Webster API. |
|
Initialize the tool. |
|
Input for UpdateSessionTool. |
|
Tool that closes an existing Multion Browser Window with provided fields. |
|
Input for CreateSessionTool. |
|
Tool that creates a new Multion Browser Window with provided fields. |
|
Tool that updates an existing Multion Browser Window with provided fields. |
|
Input for UpdateSessionTool. |
|
Tool that queries the Atlassian Jira API. |
|
Input for Nuclia Understanding API. |
|
Tool to process files with the Nuclia Understanding API. |
|
Base class for the Office 365 tools. |
|
|
Input for SendMessageTool. |
Tool for creating a draft email in Office 365. |
|
Search calendar events in Office 365. |
|
Input for SearchEmails Tool. |
|
Search email messages in Office 365. |
|
Input for SearchEmails Tool. |
|
Tool for sending calendar events in Office 365. |
|
Input for CreateEvent Tool. |
|
Send an email in Office 365. |
|
Input for SendMessageTool. |
|
|
Tool that generates an image using OpenAI DALLE. |
A model for a single API operation. |
|
A model for a property in the query, path, header, or cookie params. |
|
Base model for an API property. |
|
The location of the property. |
|
A model for a request body. |
|
A model for a request body property. |
|
Tool that queries the OpenWeatherMap API. |
|
Tool that queries the Passio Nutrition AI API. |
|
Inputs to the Passio Nutrition AI tool. |
|
Base class for browser tools. |
|
Tool for clicking on an element with the given CSS selector. |
|
Input for ClickTool. |
|
Tool for getting the URL of the current webpage. |
|
Extract all hyperlinks on the page. |
|
|
Input for ExtractHyperlinksTool. |
Tool for extracting all the text on the current webpage. |
|
Tool for getting elements in the current web page matching a CSS selector. |
|
Input for GetElementsTool. |
|
Tool for navigating a browser to a URL. |
|
Input for NavigateToolInput. |
|
Navigate back to the previous page in the browser history. |
|
AI Plugin Definition. |
|
Tool for getting the OpenAPI spec for an AI Plugin. |
|
Schema for AIPluginTool. |
|
API Configuration. |
|
Tool that gets aggregate bars (stock prices) over a given date range for a given ticker from Polygon. |
|
Input for PolygonAggregates. |
|
Inputs for Polygon's Financials API |
|
Tool that gets the financials of a ticker from Polygon |
|
Inputs for Polygon's Last Quote API |
|
Tool that gets the last quote of a ticker from Polygon |
|
Inputs for Polygon's Ticker News API |
|
Tool that gets the latest news for a given ticker from Polygon |
|
Tool for getting metadata about a PowerBI Dataset. |
|
Tool for getting tables names. |
|
Tool for querying a Power BI Dataset. |
|
Tool that searches the PubMed API. |
|
Tool that queries for posts on a subreddit. |
|
Input for Reddit search. |
|
Base class for requests tools. |
|
Tool for making a DELETE request to an API endpoint. |
|
Tool for making a GET request to an API endpoint. |
|
Tool for making a PATCH request to an API endpoint. |
|
Tool for making a POST request to an API endpoint. |
|
Tool for making a PUT request to an API endpoint. |
|
A tool implementation to execute JavaScript via Riza's Code Interpreter API. |
|
Create a new model by parsing and validating input data from keyword arguments. |
|
Riza Code tool. |
|
Create a new model by parsing and validating input data from keyword arguments. |
|
Input for SceneXplain. |
|
Tool that explains images. |
|
Tool that queries the SearchApi.io search API and returns JSON. |
|
Tool that queries the SearchApi.io search API. |
|
Input for the SearxSearch tool. |
|
Tool that queries a Searx instance and gets back json. |
|
Tool that queries a Searx instance. |
|
Tool that searches the semanticscholar API. |
|
Input for the SemanticScholar tool. |
|
Commands for the Bash Shell tool. |
|
Tool to run shell commands. |
|
Base class for Slack tools. |
|
Tool that gets Slack channel information. |
|
Tool that gets Slack messages. |
|
Input schema for SlackGetMessages. |
|
Input for ScheduleMessageTool. |
|
Tool for scheduling a message in Slack. |
|
Input for SendMessageTool. |
|
Tool for sending a message in Slack. |
|
Input for CopyFileTool. |
|
Tool that adds the capability to sleep. |
|
Base tool for interacting with Spark SQL. |
|
Tool for getting metadata about a Spark SQL. |
|
Tool for getting tables names. |
|
Use an LLM to check if a query is correct. |
|
Tool for querying a Spark SQL. |
|
Base tool for interacting with a SQL database. |
|
Tool for getting metadata about a SQL database. |
|
Tool for getting tables names. |
|
Use an LLM to check if a query is correct. |
|
Tool for querying a SQL database. |
|
Tool that uses StackExchange |
|
Tool that searches the Steam Web API. |
|
Supported Image Models for generation. |
|
|
Tool used to generate images from a text-prompt. |
Tool that queries the Tavily Search API and gets back an answer. |
|
Input for the Tavily tool. |
|
Tool that queries the Tavily Search API and gets back json. |
|
Base class for tools that use a VectorStore. |
|
Tool for the VectorDBQA chain. |
|
Tool for the VectorDBQAWithSources chain. |
|
Tool that searches the Wikidata API. |
|
Input for the WikipediaQuery tool. |
|
Tool that searches the Wikipedia API. |
|
Tool that queries using the Wolfram Alpha SDK. |
|
Input for the YahooFinanceNews tool. |
|
Tool that searches financial news on Yahoo Finance. |
|
Input schema for the you.com tool. |
|
Tool that searches the you.com API. |
|
Tool that queries YouTube. |
|
Returns a list of all exposed (enabled) actions associated with current user (associated with the set api_key). |
|
Executes an action that is identified by action_id, must be exposed |
|
|
An enumeration. |
An enumeration. |
|
Create a new model by parsing and validating input data from keyword arguments. |
|
Initialize the tool. |
Functions¶
|
Authenticate using the AIN Blockchain |
Authenticate using the Amadeus API |
|
Detect if the file is local or remote. |
|
Download audio from url to local. |
|
|
Detect if the file is local or remote. |
|
Download audio from url to local. |
Convert a file to base64. |
|
|
Get the first n lines of a file. |
|
Strip markdown code from a string. |
Deprecated. |
|
Add print statement to the last line if it's missing. |
|
Call f on each item in seq, calling inter() in between. |
|
Parse a file and pretty-print it to output. |
|
|
Resolve a relative path, raising an error if not within the root directory. |
Check if path is relative to root. |
|
Build a Gmail service. |
|
Clean email body. |
|
Get credentials. |
|
Import google libraries. |
|
Import googleapiclient.discovery.build function. |
|
Import InstalledAppFlow class. |
|
Tool for asking the user for input. |
|
Authenticate using the Microsoft Graph API |
|
Clean body of a message or event. |
|
Lazy import playwright browsers. |
|
Asynchronously get the current page of the browser. |
|
|
Create an async playwright browser. |
|
Create a playwright browser. |
Get the current page of the browser. |
|
Run an async coroutine. |
|
Convert the yaml or json serialized spec to a dict. |
|
Authenticate using the Slack API. |
|
|
Upload a block to a signed URL and return the public URL. |
Deprecated classes¶
Deprecated since version 0.0.33: Use |
|
Deprecated since version 0.0.33: Use |
|
Deprecated since version 0.0.33: Use |
|
Deprecated since version 0.0.33: Use |
|
Deprecated since version 0.0.15: Use |
langchain_community.utilities
¶
Utilities are the integrations with third-part systems and packages.
Other LangChain classes use Utilities to interact with third-part systems and packages.
Classes¶
Wrapper for AlphaVantage API for Currency Exchange Rate. |
|
Wrapper around Apify. |
|
Arcee document. |
|
Adapter for Arcee documents |
|
Source of an Arcee document. |
|
|
Routes available for the Arcee API as enumerator. |
|
Wrapper for Arcee API. |
Filters available for a DALM retrieval and generation. |
|
Filter types available for a DALM retrieval as enumerator. |
|
Wrapper around ArxivAPI. |
|
Wrapper for AskNews API. |
|
|
Setup mode for AstraDBEnvironment as enumerator. |
Wrapper for AWS Lambda SDK. |
|
Wrapper around bibtexparser. |
|
Wrapper for Bing Web Search API. |
|
Wrapper around the Brave search engine. |
|
An enumeration. |
|
Apache Cassandra® database wrapper. |
|
Exception raised for errors in the database schema. |
|
Create a new model by parsing and validating input data from keyword arguments. |
|
|
Component class for a list. |
Wrapper for Clickup API. |
|
Base class for all components. |
|
|
Component class for a member. |
|
Component class for a space. |
|
Class for a task. |
|
Component class for a team. |
Wrapper for OpenAI's DALL-E Image Generator. |
|
Wrapper around the DataForSeo API. |
|
Wrapper for Dataherald. |
|
|
Wrapper around Dria API. |
Wrapper for DuckDuckGo Search API. |
|
Wrapper for financial datasets API. |
|
Wrapper for GitHub API. |
|
Wrapper for GitLab API. |
|
Wrapper for Golden. |
|
Wrapper for SerpApi's Google Finance API |
|
Wrapper for SerpApi's Google Scholar API |
|
Wrapper for SerpApi's Google Lens API |
|
Wrapper for Google Scholar API |
|
Wrapper around the Serper.dev Google Search API. |
|
Wrapper for SerpApi's Google Scholar API |
|
Wrapper around GraphQL API. |
|
Wrapper for Infobip API for messaging. |
|
Wrapper around the Jina search engine. |
|
Wrapper for Jira API. |
|
Interface for querying Alibaba Cloud MaxCompute tables. |
|
Wrapper for Merriam-Webster. |
|
Wrapper for Metaphor Search API. |
|
Create a new model by parsing and validating input data from keyword arguments. |
|
Wrapper for NASA API. |
|
alias of |
|
|
A message containing streaming audio. |
alias of |
|
alias of |
|
alias of |
|
A runnable that performs Automatic Speech Recognition (ASR) using NVIDIA Riva. |
|
An enum of the possible choices for Riva audio encoding. |
|
Configuration for the authentication to a Riva service connection. |
|
A collection of common Riva settings. |
|
A runnable that performs Text-to-Speech (TTS) with NVIDIA Riva. |
|
An empty Sentinel type. |
|
|
Enumerator of the HTTP verbs. |
OpenAPI Model that removes mis-formatted parts of the spec. |
|
Wrapper for OpenWeatherMap API using PyOWM. |
|
|
Get Summary :param conn: Oracle Connection, :param params: Summary parameters, :param proxy: Proxy |
Wrapper around OutlineAPI. |
|
Manage the token for the NutritionAI API. |
|
Mixin to prevent storing on disk. |
|
Wrapper for the Passio Nutrition AI API. |
|
Pebblo AI application. |
|
Pebblo document. |
|
Pebblo Framework instance. |
|
Pebblo Indexed Document. |
|
Wrapper for Pebblo Loader API. |
|
|
Routes available for the Pebblo API as enumerator. |
Pebblo Runtime. |
|
Wrapper for Polygon API. |
|
Portkey configuration. |
|
Create PowerBI engine from dataset ID and credential or token. |
|
Wrapper around PubMed API. |
|
Wrapper for Reddit API |
|
|
Escape punctuation within an input string. |
Wrapper for Rememberizer APIs. |
|
Lightweight wrapper around requests library. |
|
Lightweight wrapper around requests library, with async support. |
|
Wrapper around requests to handle auth and async. |
|
alias of |
|
Lightweight wrapper around requests library, with async support. |
|
Wrapper for SceneXplain API. |
|
Wrapper around SearchApi API. |
|
Dict like wrapper around search api results. |
|
Wrapper for Searx API. |
|
Wrapper around semanticscholar.org API. |
|
Context manager to hide prints. |
|
Wrapper around SerpAPI. |
|
|
SparkSQL is a utility class for interacting with Spark SQL. |
|
SQLAlchemy wrapper around a database. |
Wrapper for Stack Exchange API. |
|
Wrapper for Steam API. |
|
Wrapper for Tavily Search API. |
|
Access to the TensorFlow Datasets. |
|
Messaging Client using Twilio. |
|
Wrapper around the Wikidata API. |
|
Wrapper around WikipediaAPI. |
|
Wrapper for Wolfram Alpha. |
|
Output from you.com API. |
|
Output of parsing one snippet. |
|
A single hit from you.com, which may contain multiple snippets |
|
Metadata on a single hit from you.com |
|
Wrapper for you.com Search and News API. |
|
Wrapper for Zapier NLA. |
Functions¶
Get the number of tokens in a string of text. |
|
Get the token ids for a string of text. |
|
|
Execute a CQL query asynchronously. |
Wrap a Cassandra response future in an asyncio future. |
|
|
Extract elements from a dictionary. |
|
Fetch data from a URL. |
|
Fetch the first id from a dictionary. |
|
Fetch the folder id. |
|
Fetch the list id. |
|
Fetch the space id. |
|
Fetch the team id. |
|
Parse a JSON string and return the parsed object. |
Parse a dictionary by creating a component and then turning it back into a dictionary. |
|
Restore the original sensitive data from the sanitized text. |
|
Sanitize input string or dict of strings by replacing sensitive data with placeholders. |
|
Check if a HTTP response is retryable. |
|
Calculate the content size in bytes: - Encode the string to bytes using a specific encoding (e.g., UTF-8) - Get the length of the encoded bytes. |
|
Generate batches of documents based on page_content size. |
|
Fetch owner of local file path. |
|
Return an absolute local path for a local file/directory, for a network related path, return as is. |
|
Fetch local runtime ip address. |
|
Return an absolute source path of source of loader based on the keys present in Document. |
|
|
Return loader type among, file, dir or in-memory. |
Fetch the current Framework and Runtime details. |
|
|
Fetch size of source path. |
Add single quotes around table names that contain spaces. |
|
|
Convert a JSON object to a markdown table. |
Check if the correct Redis modules are installed. |
|
|
Get a redis client from the connection url given. |
|
Truncate a string to a certain number of words, based on the max string length. |
Create a retry decorator for Vertex / Palm LLMs. |
|
|
Return a custom user agent header. |
|
Init Vertex AI. |
Load an image from Google Cloud Storage. |
|
Raise ImportError related to Vertex SDK being not available. |
Deprecated classes¶
Deprecated since version 0.0.33: Use |
|
Deprecated since version 0.0.33: Use |
langchain_community.utils
¶
Utility functions for LangChain.
Classes¶
Representation of a callable function to the Ernie API. |
|
Representation of a callable function to the Ernie API. |
Functions¶
|
Convert a Pydantic model to a function description for the Ernie API. |
Convert a Pydantic model to a function description for the Ernie API. |
|
|
Return a custom user agent header. |
Row-wise cosine similarity between two equal-width matrices. |
|
|
Row-wise cosine similarity with optional top-k and score threshold filtering. |
Return whether OpenAI API is v1 or more. |
|
Get user agent from environment variable. |
langchain_community.vectorstores
¶
Vector store stores embedded data and performs vector search.
One of the most common ways to store and search over unstructured data is to embed it and store the resulting embedding vectors, and then query the store and retrieve the data that are ‘most similar’ to the embedded query.
Class hierarchy:
VectorStore --> <name> # Examples: Annoy, FAISS, Milvus
BaseRetriever --> VectorStoreRetriever --> <name>Retriever # Example: VespaRetriever
Main helpers:
Embeddings, Document
Classes¶
|
Aerospike vector store. |
|
Alibaba Cloud OpenSearch vector store. |
|
Alibaba Cloud Opensearch` client configuration. |
|
AnalyticDB (distributed PostgreSQL) vector store. |
|
Annoy vector store. |
|
Apache Doris vector store. |
Apache Doris client configuration. |
|
|
Create a vectorstore backed by ApertureDB |
|
Atlas vector store. |
|
AwaDB vector store. |
Azure Cosmos DB for MongoDB vCore vector store. |
|
Cosmos DB Similarity Type as enumerator. |
|
|
Cosmos DB Vector Search Type as enumerator. |
|
Azure Cosmos DB for NoSQL vector store. |
|
Azure Cognitive Search vector store. |
Retriever that uses Azure Cognitive Search. |
|
|
|
Baidu Elasticsearch vector store. |
|
Baidu VectorDB as a vector store. |
|
Baidu VectorDB Connection params. |
|
|
Baidu VectorDB table params. |
|
Apache Cassandra(R) for vector-store workloads. |
|
Clarifai AI vector store. |
|
ClickHouse vector store integration. |
ClickHouse client configuration. |
|
DashVector vector store. |
|
|
Databricks Vector Search vector store. |
Activeloop Deep Lake vector store. |
|
|
Dingo vector store. |
Base class for DocArray based vector stores. |
|
HnswLib storage using DocArray package. |
|
In-memory DocArray storage for exact search. |
|
DocumentDB Similarity Type as enumerator. |
|
Amazon DocumentDB (with MongoDB compatibility) vector store. |
|
|
DuckDB vector store. |
ecloud Elasticsearch vector store. |
|
Base class for Elasticsearch retrieval strategies. |
|
|
Wrapper around Epsilla vector database. |
|
FAISS vector store integration. |
|
SAP HANA Cloud Vector Engine |
|
Hippo vector store. |
|
Hologres API vector store. |
|
Helper class for Infinispan REST interface. |
Infinispan VectorStore interface. |
|
|
Jaguar API vector store. |
|
KDB.AI vector store. |
Some default dimensions for known embeddings. |
|
Enumerator of the Distance strategies. |
|
|
Kinetica vector store. |
Kinetica client configuration. |
|
|
LanceDB vector store. |
Base class for the Lantern embedding store. |
|
Enumerator of the Distance strategies. |
|
|
Postgres with the lantern extension as a vector store. |
Result from a query. |
|
Implementation of Vector Store using LLMRails. |
|
Retriever for LLMRails. |
|
ManticoreSearch Engine vector store. |
|
Create a new model by parsing and validating input data from keyword arguments. |
|
|
Marqo vector store. |
|
Meilisearch vector store. |
Momento Vector Index (MVI) vector store. |
|
|
MyScale vector store. |
MyScale client configuration. |
|
MyScale vector store without metadata column |
|
Enumerator of the index types. |
|
|
Neo4j vector index. |
Enumerator of the Distance strategies. |
|
|
NucliaDB vector store. |
|
Amazon OpenSearch Vector Engine vector store. |
|
OracleVS vector store. |
VectorStore connecting to Pathway Vector Store. |
|
|
Base model for all SQL stores. |
Collection store. |
|
|
Embedding store. |
|
Postgres with the pg_embedding extension as a vector store. |
Result from a query. |
|
|
VectorStore backed by pgvecto_rs. |
|
Base model for the SQL stores. |
Enumerator of the Distance strategies. |
|
Qdrant related exceptions. |
|
|
Redis vector database. |
Retriever for Redis VectorStore. |
|
Collection of RedisFilterFields. |
|
Logical expression of RedisFilterFields. |
|
Base class for RedisFilterFields. |
|
RedisFilterOperator enumerator is used to create RedisFilterExpressions. |
|
RedisFilterField representing a numeric field in a Redis index. |
|
RedisFilterField representing a tag in a Redis index. |
|
RedisFilterField representing a text field in a Redis index. |
|
Schema for flat vector fields in Redis. |
|
Schema for HNSW vector fields in Redis. |
|
Schema for numeric fields in Redis. |
|
Distance metrics for Redis vector fields. |
|
Base class for Redis fields. |
|
Schema for Redis index. |
|
Base class for Redis vector fields. |
|
Schema for tag fields in Redis. |
|
Schema for text fields in Redis. |
|
|
Relyt (distributed PostgreSQL) vector store. |
|
Rockset vector store. |
|
ScaNN vector store. |
|
SemaDB vector store. |
SingleStore DB vector store. |
|
|
Base class for serializing data. |
|
Serialize data in Binary JSON using the bson python package. |
|
Serialize data in JSON using the json package from python standard library. |
Serialize data in Apache Parquet format using the pyarrow package. |
|
Simple in-memory vector store based on the scikit-learn library NearestNeighbors. |
|
Exception raised by SKLearnVectorStore. |
|
|
SQLite with VSS extension as a vector database. |
|
StarRocks vector store. |
StarRocks client configuration. |
|
Supabase Postgres vector store. |
|
SurrealDB as Vector Store. |
|
|
Tair vector store. |
Tencent vector DB Connection params. |
|
Tencent vector DB Index params. |
|
MetaData Field for Tencent vector DB. |
|
Tencent VectorDB as a vector store. |
|
Vectorstore that uses ThirdAI's NeuralDB Enterprise Python Client for NeuralDBs. |
|
Vectorstore that uses ThirdAI's NeuralDB. |
|
TiDB Vector Store. |
|
|
Tigris vector store. |
|
TileDB vector store. |
Timescale Postgres vector store |
|
|
Typesense vector store. |
Upstash Vector vector store |
|
|
USearch vector store. |
Enumerator of the Distance strategies for calculating distances between vectors. |
|
|
Vald vector database. |
|
Intel Lab's VDMS for vector-store workloads. |
|
Initialize vearch vector store flag 1 for cluster,0 for standalone |
|
Configuration for Maximal Marginal Relevance (MMR) search. |
Configuration for Reranker. |
|
Configuration for summary generation. |
|
|
Vectara API vector store. |
|
Configuration for Vectara query. |
|
Vectara RAG runnable. |
Vectara Retriever class. |
|
|
Vespa vector store. |
|
vikingdb as a vector store |
|
vikingdb connection config |
|
VLite is a simple and fast vector database for semantic search. |
|
Weaviate vector store. |
|
Xata vector store. |
|
Yellowbrick as a vector database. |
|
Configuration for a Zep Collection. |
|
Zep vector store. |
Zep vector store. |
|
|
Zilliz vector store. |
Functions¶
|
Create metadata from fields. |
Import annoy if available, otherwise raise error. |
|
|
Check if a string contains multiple substrings. |
Import faiss if available, otherwise raise error. |
|
Import lancedb package. |
|
Converts a dict filter to a LanceDB filter string. |
|
Get the embedding store class. |
|
|
Check if a string contains multiple substrings. |
Check if the values are not None or empty string |
|
Transform the input data into the desired format. |
|
Combine multiple queries with an operator. |
|
Construct a metadata filter. |
|
Convert a dictionary to a YAML-like string without using external libraries. |
|
Remove Lucene special characters |
|
Sort first element to match the index_name if exists |
|
|
Create an index on the vector store. |
Drop an index if it exists. |
|
Drop a table and purge it from the database. |
|
Decorator to call the synchronous method of the class if the async method is not implemented. |
|
Check if Redis index exists. |
|
Decorator to check for misuse of equality operators. |
|
Read in the index schema from a dict or yaml file. |
|
Import scann if available, otherwise raise error. |
|
Normalize vectors to unit length. |
|
Print a debug message if DEBUG is True. |
|
Get a named result from a query. |
|
|
Check if a string has multiple substrings. |
Translate LangChain filter to Tencent VectorDB filter. |
|
Import tiledb-vector-search if available, otherwise raise error. |
|
Get the URI of the documents array. |
|
|
Get the URI of the documents array from group. |
Get the URI of the vector index. |
|
Get the URI of the vector index. |
|
Import usearch if available, otherwise raise error. |
|
Filter out metadata types that are not supported for a vector store. |
|
Calculate maximal marginal relevance. |
|
|
VDMS client for the VDMS server. |
|
Convert embedding to bytes. |
Deprecated classes¶
|
Deprecated since version 0.0.21: Use |
|
Deprecated since version 0.0.33: Use |
|
Deprecated since version 0.2.9: Use |
Deprecated since version 0.2.4: Use |
|
Deprecated since version 0.0.1: Use |
|
Deprecated since version 0.0.27: Use |
|
Deprecated since version 0.0.27: Use |
|
Deprecated since version 0.0.27: Use |
|
Deprecated since version 0.0.27: Use |
|
Deprecated since version 0.0.27: Use |
|
Deprecated since version 0.0.12: Use |
|
|
Deprecated since version 0.2.0: Use |
Deprecated since version 0.0.25: Use |
|
|
Deprecated since version 0.0.31: This class is pending deprecation and may be removed in a future version. You can swap to using the PGVector implementation in langchain_postgres. Please read the guidelines in the doc-string of this class to follow prior to migrating as there are some differences between the implementations. See <https://github.com/langchain-ai/langchain-postgres> for details aboutthe new implementation. Use |
|
Deprecated since version 0.0.18: Use |
|
Deprecated since version 0.0.37: Use |