Tony20100/langchain_full huggingface dataset:
langchain_google_community.gmail.send_message.GmailSendMessage¶
class langchain_google_community.gmail.send_message.GmailSendMessage[source]¶
Bases: GmailBaseTool
Tool that sends a message to Gmail.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param api_resource: Resource [Optional]¶
param args_schema: Type[SendMessageSchema] = <class 'langchain_google_community.gmail.send_message.SendMessageSchema'>¶
Pydantic model class to validate and parse the tool’s input arguments.
param callback_manager: Optional[BaseCallbackManager] = None¶
Deprecated. Please use callbacks instead.
param callbacks: Callbacks = None¶
Callbacks to be called during tool execution.
param description: str = 'Use this tool to send email messages. The input is the message, recipients'¶
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
param handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False¶
Handle the content of the ToolException thrown.
param handle_validation_error: Optional[Union[bool, str, Callable[[ValidationError], str]]] = False¶
Handle the content of the ValidationError thrown.
param metadata: Optional[Dict[str, Any]] = None¶
Optional metadata associated with the tool. Defaults to None
This metadata will be associated with each call to this tool,
and passed as arguments to the handlers defined in callbacks.
You can use these to eg identify a specific instance of a tool with its use case.
param return_direct: bool = False¶
Whether to return the tool’s output directly. Setting this to True means
that after the tool is called, the AgentExecutor will stop looping.
langchain_google_community.gmail.search.GmailSearch¶
class langchain_google_community.gmail.search.GmailSearch[source]¶
Bases: GmailBaseTool
Tool that searches for messages or threads in Gmail.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param api_resource: Resource [Optional]¶
param args_schema: Type[SearchArgsSchema] = <class 'langchain_google_community.gmail.search.SearchArgsSchema'>¶
Pydantic model class to validate and parse the tool’s input arguments.
param callback_manager: Optional[BaseCallbackManager] = None¶
Deprecated. Please use callbacks instead.
param callbacks: Callbacks = None¶
Callbacks to be called during tool execution.
param description: str = 'Use this tool to search for email messages or threads. The input must be a valid Gmail query. The output is a JSON list of the requested resource.'¶
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
param handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False¶
Handle the content of the ToolException thrown.
param handle_validation_error: Optional[Union[bool, str, Callable[[ValidationError], str]]] = False¶
Handle the content of the ValidationError thrown.
param metadata: Optional[Dict[str, Any]] = None¶
Optional metadata associated with the tool. Defaults to None
This metadata will be associated with each call to this tool,
and passed as arguments to the handlers defined in callbacks.
You can use these to eg identify a specific instance of a tool with its use case.
param return_direct: bool = False¶
Whether to return the tool’s output directly. Setting this to True means
langchain_google_community.gmail.get_thread.GmailGetThread¶
class langchain_google_community.gmail.get_thread.GmailGetThread[source]¶
Bases: GmailBaseTool
Tool that gets a thread by ID from Gmail.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param api_resource: Resource [Optional]¶
param args_schema: Type[GetThreadSchema] = <class 'langchain_google_community.gmail.get_thread.GetThreadSchema'>¶
Pydantic model class to validate and parse the tool’s input arguments.
param callback_manager: Optional[BaseCallbackManager] = None¶
Deprecated. Please use callbacks instead.
param callbacks: Callbacks = None¶
Callbacks to be called during tool execution.
param description: str = 'Use this tool to search for email messages. The input must be a valid Gmail query. The output is a JSON list of messages.'¶
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
param handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False¶
Handle the content of the ToolException thrown.
param handle_validation_error: Optional[Union[bool, str, Callable[[ValidationError], str]]] = False¶
Handle the content of the ValidationError thrown.
param metadata: Optional[Dict[str, Any]] = None¶
Optional metadata associated with the tool. Defaults to None
This metadata will be associated with each call to this tool,
and passed as arguments to the handlers defined in callbacks.
You can use these to eg identify a specific instance of a tool with its use case.
param return_direct: bool = False¶
Whether to return the tool’s output directly. Setting this to True means
langchain_google_community.gmail.get_thread.GetThreadSchema¶
class langchain_google_community.gmail.get_thread.GetThreadSchema[source]¶
Bases: BaseModel
Input for GetMessageTool.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param thread_id: str [Required]¶
The thread ID.
classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data.
Default values are respected, but no other validation is performed.
Behaves as if Config.extra = ‘allow’ was set since it adds all passed values
Parameters
_fields_set (Optional[SetStr]) – 
values (Any) – 
Return type
Model
copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶
Duplicate a model, optionally choose which fields to include, exclude and change.
Parameters
include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to include in new model
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to exclude from new model, as with values this takes precedence over include
update (Optional[DictStrAny]) – values to change/add in the new model. Note: the data is not validated before creating
the new model: you should trust this data
deep (bool) – set to True to make a deep copy of the model
self (Model) – 
Returns
new model instance
Return type
Model
langchain_experimental.open_clip.open_clip.OpenCLIPEmbeddings¶
class langchain_experimental.open_clip.open_clip.OpenCLIPEmbeddings[source]¶
Bases: BaseModel, Embeddings
OpenCLIP Embeddings model.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param checkpoint: str = 'laion2b_s32b_b79k'¶
param model: Any = None¶
param model_name: str = 'ViT-H-14'¶
param preprocess: Any = None¶
param tokenizer: Any = None¶
async aembed_documents(texts: List[str]) → List[List[float]]¶
Asynchronous Embed search docs.
Parameters
texts (List[str]) – 
Return type
List[List[float]]
async aembed_query(text: str) → List[float]¶
Asynchronous Embed query text.
Parameters
text (str) – 
Return type
List[float]
classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data.
Default values are respected, but no other validation is performed.
Behaves as if Config.extra = ‘allow’ was set since it adds all passed values
Parameters
_fields_set (Optional[SetStr]) – 
values (Any) – 
Return type
Model
copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶
Duplicate a model, optionally choose which fields to include, exclude and change.
Parameters
Duplicate a model, optionally choose which fields to include, exclude and change.
Parameters
include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to include in new model
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to exclude from new model, as with values this takes precedence over include
update (Optional[DictStrAny]) – values to change/add in the new model. Note: the data is not validated before creating
the new model: you should trust this data
deep (bool) – set to True to make a deep copy of the model
self (Model) – 
Returns
new model instance
Return type
Model
dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) → DictStrAny¶
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
Parameters
include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – 
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – 
by_alias (bool) – 
skip_defaults (Optional[bool]) – 
exclude_unset (bool) – 
exclude_defaults (bool) – 
exclude_none (bool) – 
Return type
DictStrAny
embed_documents(texts: List[str]) → List[List[float]][source]¶
Embed search docs.
Parameters
texts (List[str]) – 
Return type
List[List[float]]
embed_image(uris: List[str]) → List[List[float]][source]¶
Parameters
embed_image(uris: List[str]) → List[List[float]][source]¶
Parameters
uris (List[str]) – 
Return type
List[List[float]]
embed_query(text: str) → List[float][source]¶
Embed query text.
Parameters
text (str) – 
Return type
List[float]
classmethod from_orm(obj: Any) → Model¶
Parameters
obj (Any) – 
Return type
Model
json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) → unicode¶
Generate a JSON representation of the model, include and exclude arguments as per dict().
encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps().
Parameters
include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – 
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – 
by_alias (bool) – 
skip_defaults (Optional[bool]) – 
exclude_unset (bool) – 
exclude_defaults (bool) – 
exclude_none (bool) – 
encoder (Optional[Callable[[Any], Any]]) – 
models_as_dict (bool) – 
dumps_kwargs (Any) – 
Return type
unicode
langchain_ai21.chat.chat_adapter.JambaChatCompletionsAdapter¶
class langchain_ai21.chat.chat_adapter.JambaChatCompletionsAdapter[source]¶
Methods
__init__()
call(client, **params)
convert_messages(messages)
__init__()¶
call(client: Any, **params: Any) → List[BaseMessage][source]¶
Parameters
client (Any) – 
params (Any) – 
Return type
List[BaseMessage]
convert_messages(messages: List[BaseMessage]) → Dict[str, Any][source]¶
Parameters
messages (List[BaseMessage]) – 
Return type
Dict[str, Any]
langchain_ai21.chat.chat_adapter.ChatAdapter¶
class langchain_ai21.chat.chat_adapter.ChatAdapter[source]¶
Provides a common interface for the different Chat models available in AI21.
It converts LangChain messages to AI21 messages.
Calls the appropriate AI21 model API with the converted messages.
Methods
__init__()
call(client, **params)
convert_messages(messages)
__init__()¶
abstract call(client: Any, **params: Any) → List[BaseMessage][source]¶
Parameters
client (Any) – 
params (Any) – 
Return type
List[BaseMessage]
abstract convert_messages(messages: List[BaseMessage]) → Dict[str, Any][source]¶
Parameters
messages (List[BaseMessage]) – 
Return type
Dict[str, Any]
langchain_ai21.chat.chat_adapter.J2ChatAdapter¶
class langchain_ai21.chat.chat_adapter.J2ChatAdapter[source]¶
Methods
__init__()
call(client, **params)
convert_messages(messages)
__init__()¶
call(client: Any, **params: Any) → List[BaseMessage][source]¶
Parameters
client (Any) – 
params (Any) – 
Return type
List[BaseMessage]
convert_messages(messages: List[BaseMessage]) → Dict[str, Any][source]¶
Parameters
messages (List[BaseMessage]) – 
Return type
Dict[str, Any]
langchain_community.chat_loaders.slack.SlackChatLoader¶
class langchain_community.chat_loaders.slack.SlackChatLoader(path: Union[str, Path])[source]¶
Load Slack conversations from a dump zip file.
Initialize the chat loader with the path to the exported Slack dump zip file.
Parameters
path (Union[str, Path]) – Path to the exported Slack dump zip file.
Methods
__init__(path)
Initialize the chat loader with the path to the exported Slack dump zip file.
lazy_load()
Lazy load the chat sessions from the Slack dump file and yield them in the required format.
load()
Eagerly load the chat sessions into memory.
__init__(path: Union[str, Path])[source]¶
Initialize the chat loader with the path to the exported Slack dump zip file.
Parameters
path (Union[str, Path]) – Path to the exported Slack dump zip file.
lazy_load() → Iterator[ChatSession][source]¶
Lazy load the chat sessions from the Slack dump file and yield them
in the required format.
Returns
Iterator of chat sessions containing messages.
Return type
Iterator[ChatSession]
load() → List[ChatSession]¶
Eagerly load the chat sessions into memory.
Return type
List[ChatSession]
Examples using SlackChatLoader¶
Slack
langchain_core.chat_loaders.BaseChatLoader¶
class langchain_core.chat_loaders.BaseChatLoader[source]¶
Base class for chat loaders.
Methods
__init__()
lazy_load()
Lazy load the chat sessions.
load()
Eagerly load the chat sessions into memory.
__init__()¶
abstract lazy_load() → Iterator[ChatSession][source]¶
Lazy load the chat sessions.
Return type
Iterator[ChatSession]
load() → List[ChatSession][source]¶
Eagerly load the chat sessions into memory.
Return type
List[ChatSession]
langchain_community.chat_loaders.langsmith.LangSmithRunChatLoader¶
class langchain_community.chat_loaders.langsmith.LangSmithRunChatLoader(runs: Iterable[Union[str, Run]], client: Optional['Client'] = None)[source]¶
Load chat sessions from a list of LangSmith “llm” runs.
runs¶
The list of LLM run IDs or run objects.
Type
Iterable[Union[str, Run]]
client¶
Instance of LangSmith client for fetching data.
Type
Client
Initialize a new LangSmithRunChatLoader instance.
Parameters
runs (Iterable[Union[str, Run]]) – List of LLM run IDs or run objects.
client (Optional['Client']) – An instance of LangSmith client, if not provided,
a new client instance will be created.
Methods
__init__(runs[, client])
Initialize a new LangSmithRunChatLoader instance.
lazy_load()
Lazy load the chat sessions from the iterable of run IDs.
load()
Eagerly load the chat sessions into memory.
__init__(runs: Iterable[Union[str, Run]], client: Optional['Client'] = None)[source]¶
Initialize a new LangSmithRunChatLoader instance.
Parameters
runs (Iterable[Union[str, Run]]) – List of LLM run IDs or run objects.
client (Optional['Client']) – An instance of LangSmith client, if not provided,
a new client instance will be created.
lazy_load() → Iterator[ChatSession][source]¶
Lazy load the chat sessions from the iterable of run IDs.
This method fetches the runs and converts them to chat sessions on-the-fly,
yielding one session at a time.
Returns
Iterator of chat sessions containing messages.
Return type
Iterator[ChatSession]
load() → List[ChatSession]¶
langchain_community.chat_loaders.langsmith.LangSmithDatasetChatLoader¶
class langchain_community.chat_loaders.langsmith.LangSmithDatasetChatLoader(*, dataset_name: str, client: Optional['Client'] = None)[source]¶
Load chat sessions from a LangSmith dataset with the “chat” data type.
dataset_name¶
The name of the LangSmith dataset.
Type
str
client¶
Instance of LangSmith client for fetching data.
Type
Client
Initialize a new LangSmithChatDatasetLoader instance.
Parameters
dataset_name (str) – The name of the LangSmith dataset.
client (Optional['Client']) – An instance of LangSmith client; if not provided,
a new client instance will be created.
Methods
__init__(*, dataset_name[, client])
Initialize a new LangSmithChatDatasetLoader instance.
lazy_load()
Lazy load the chat sessions from the specified LangSmith dataset.
load()
Eagerly load the chat sessions into memory.
__init__(*, dataset_name: str, client: Optional['Client'] = None)[source]¶
Initialize a new LangSmithChatDatasetLoader instance.
Parameters
dataset_name (str) – The name of the LangSmith dataset.
client (Optional['Client']) – An instance of LangSmith client; if not provided,
a new client instance will be created.
lazy_load() → Iterator[ChatSession][source]¶
Lazy load the chat sessions from the specified LangSmith dataset.
This method fetches the chat data from the dataset and
converts each data point to chat sessions on-the-fly,
yielding one session at a time.
Returns
Iterator of chat sessions containing messages.
Return type
Iterator[ChatSession]
load() → List[ChatSession]¶
Eagerly load the chat sessions into memory.
Return type
List[ChatSession]
langchain_community.chat_loaders.whatsapp.WhatsAppChatLoader¶
class langchain_community.chat_loaders.whatsapp.WhatsAppChatLoader(path: str)[source]¶
Load WhatsApp conversations from a dump zip file or directory.
Initialize the WhatsAppChatLoader.
Parameters
path (str) – Path to the exported WhatsApp chat
zip directory, folder, or file.
To generate the dump, open the chat, click the three dots in the top
right corner, and select “More”. Then select “Export chat” and
choose “Without media”.
Methods
__init__(path)
Initialize the WhatsAppChatLoader.
lazy_load()
Lazy load the messages from the chat file and yield them as chat sessions.
load()
Eagerly load the chat sessions into memory.
__init__(path: str)[source]¶
Initialize the WhatsAppChatLoader.
Parameters
path (str) – Path to the exported WhatsApp chat
zip directory, folder, or file.
To generate the dump, open the chat, click the three dots in the top
right corner, and select “More”. Then select “Export chat” and
choose “Without media”.
lazy_load() → Iterator[ChatSession][source]¶
Lazy load the messages from the chat file and yield
them as chat sessions.
Yields
Iterator[ChatSession] – The loaded chat sessions.
Return type
Iterator[ChatSession]
load() → List[ChatSession]¶
Eagerly load the chat sessions into memory.
Return type
List[ChatSession]
Examples using WhatsAppChatLoader¶
Facebook - Meta
WhatsApp
WhatsApp Chat
langchain_community.chat_loaders.facebook_messenger.FolderFacebookMessengerChatLoader¶
class langchain_community.chat_loaders.facebook_messenger.FolderFacebookMessengerChatLoader(path: Union[str, Path])[source]¶
Load Facebook Messenger chat data from a folder.
Parameters
path (Union[str, Path]) – The path to the directory
containing the chat files.
path¶
The path to the directory containing the chat files.
Type
Path
Methods
__init__(path)
lazy_load()
Lazy loads the chat data from the folder.
load()
Eagerly load the chat sessions into memory.
__init__(path: Union[str, Path]) → None[source]¶
Parameters
path (Union[str, Path]) – 
Return type
None
lazy_load() → Iterator[ChatSession][source]¶
Lazy loads the chat data from the folder.
Yields
ChatSession – A chat session containing the loaded messages.
Return type
Iterator[ChatSession]
load() → List[ChatSession]¶
Eagerly load the chat sessions into memory.
Return type
List[ChatSession]
Examples using FolderFacebookMessengerChatLoader¶
Facebook - Meta
Facebook Messenger
langchain_community.chat_loaders.utils.map_ai_messages¶
langchain_community.chat_loaders.utils.map_ai_messages(chat_sessions: Iterable[ChatSession], sender: str) → Iterator[ChatSession][source]¶
Convert messages from the specified ‘sender’ to AI messages.
This is useful for fine-tuning the AI to adapt to your voice.
Parameters
chat_sessions (Iterable[ChatSession]) – 
sender (str) – 
Return type
Iterator[ChatSession]
Examples using map_ai_messages¶
Discord
Facebook Messenger
GMail
Slack
Telegram
WeChat
WhatsApp
iMessage
langchain_community.chat_loaders.imessage.IMessageChatLoader¶
class langchain_community.chat_loaders.imessage.IMessageChatLoader(path: Optional[Union[str, Path]] = None)[source]¶
Load chat sessions from the iMessage chat.db SQLite file.
It only works on macOS when you have iMessage enabled and have the chat.db file.
The chat.db file is likely located at ~/Library/Messages/chat.db. However, your
terminal may not have permission to access this file. To resolve this, you can
copy the file to a different location, change the permissions of the file, or
grant full disk access for your terminal emulator
in System Settings > Security and Privacy > Full Disk Access.
Initialize the IMessageChatLoader.
Parameters
path (str or Path, optional) – Path to the chat.db SQLite file.
Defaults to None, in which case the default path
~/Library/Messages/chat.db will be used.
Methods
__init__([path])
Initialize the IMessageChatLoader.
lazy_load()
Lazy load the chat sessions from the iMessage chat.db and yield them in the required format.
load()
Eagerly load the chat sessions into memory.
__init__(path: Optional[Union[str, Path]] = None)[source]¶
Initialize the IMessageChatLoader.
Parameters
path (str or Path, optional) – Path to the chat.db SQLite file.
Defaults to None, in which case the default path
~/Library/Messages/chat.db will be used.
lazy_load() → Iterator[ChatSession][source]¶
Lazy load the chat sessions from the iMessage chat.db
and yield them in the required format.
Yields
ChatSession – Loaded chat session.
Return type
Iterator[ChatSession]
load() → List[ChatSession]¶
Eagerly load the chat sessions into memory.
Return type
langchain_community.chat_loaders.gmail.GMailLoader¶
class langchain_community.chat_loaders.gmail.GMailLoader(creds: Any, n: int = 100, raise_error: bool = False)[source]¶
[Deprecated] Load data from GMail.
There are many ways you could want to load data from GMail.
This loader is currently fairly opinionated in how to do so.
The way it does it is it first looks for all messages that you have sent.
It then looks for messages where you are responding to a previous email.
It then fetches that previous email, and creates a training example
of that email, followed by your email.
Note that there are clear limitations here. For example,
all examples created are only looking at the previous email for context.
To use:
Set up a Google Developer Account:Go to the Google Developer Console, create a project,
and enable the Gmail API for that project.
This will give you a credentials.json file that you’ll need later.
Notes
Deprecated since version 0.0.32.
Methods
__init__(creds[, n, raise_error])
lazy_load()
Lazy load the chat sessions.
load()
Eagerly load the chat sessions into memory.
Parameters
creds (Any) – 
n (int) – 
raise_error (bool) – 
__init__(creds: Any, n: int = 100, raise_error: bool = False) → None[source]¶
Parameters
creds (Any) – 
n (int) – 
raise_error (bool) – 
Return type
None
lazy_load() → Iterator[ChatSession][source]¶
Lazy load the chat sessions.
Return type
Iterator[ChatSession]
load() → List[ChatSession]¶
Eagerly load the chat sessions into memory.
langchain_community.chat_loaders.utils.merge_chat_runs¶
langchain_community.chat_loaders.utils.merge_chat_runs(chat_sessions: Iterable[ChatSession]) → Iterator[ChatSession][source]¶
Merge chat runs together.
A chat run is a sequence of messages from the same sender.
Parameters
chat_sessions (Iterable[ChatSession]) – A list of chat sessions.
Returns
A list of chat sessions with merged chat runs.
Return type
Iterator[ChatSession]
Examples using merge_chat_runs¶
Discord
Facebook Messenger
Slack
Telegram
WeChat
WhatsApp
iMessage