Tony20100/langchain_full huggingface dataset:
langchain_community.query_constructors.databricks_vector_search.DatabricksVectorSearchTranslator¶
class langchain_community.query_constructors.databricks_vector_search.DatabricksVectorSearchTranslator[source]¶
Translate Databricks vector search internal query language elements to
valid filters.
Attributes
allowed_comparators
allowed_operators
Subset of allowed logical comparators.
Methods
__init__()
visit_comparison(comparison)
Translate a Comparison.
visit_operation(operation)
Translate an Operation.
visit_structured_query(structured_query)
Translate a StructuredQuery.
__init__()¶
visit_comparison(comparison: Comparison) → Dict[source]¶
Translate a Comparison.
Parameters
comparison (Comparison) – 
Return type
Dict
visit_operation(operation: Operation) → Dict[source]¶
Translate an Operation.
Parameters
operation (Operation) – 
Return type
Dict
visit_structured_query(structured_query: StructuredQuery) → Tuple[str, dict][source]¶
Translate a StructuredQuery.
Parameters
structured_query (StructuredQuery) – 
Return type
Tuple[str, dict]
langchain_community.query_constructors.dashvector.DashvectorTranslator¶
class langchain_community.query_constructors.dashvector.DashvectorTranslator[source]¶
Logic for converting internal query language elements to valid filters.
Attributes
allowed_comparators
allowed_operators
map_dict
Methods
__init__()
visit_comparison(comparison)
Translate a Comparison.
visit_operation(operation)
Translate an Operation.
visit_structured_query(structured_query)
Translate a StructuredQuery.
__init__()¶
visit_comparison(comparison: Comparison) → str[source]¶
Translate a Comparison.
Parameters
comparison (Comparison) – 
Return type
str
visit_operation(operation: Operation) → str[source]¶
Translate an Operation.
Parameters
operation (Operation) – 
Return type
str
visit_structured_query(structured_query: StructuredQuery) → Tuple[str, dict][source]¶
Translate a StructuredQuery.
Parameters
structured_query (StructuredQuery) – 
Return type
Tuple[str, dict]
langchain_community.query_constructors.pinecone.PineconeTranslator¶
class langchain_community.query_constructors.pinecone.PineconeTranslator[source]¶
Translate Pinecone internal query language elements to valid filters.
Attributes
allowed_comparators
Subset of allowed logical comparators.
allowed_operators
Subset of allowed logical operators.
Methods
__init__()
visit_comparison(comparison)
Translate a Comparison.
visit_operation(operation)
Translate an Operation.
visit_structured_query(structured_query)
Translate a StructuredQuery.
__init__()¶
visit_comparison(comparison: Comparison) → Dict[source]¶
Translate a Comparison.
Parameters
comparison (Comparison) – 
Return type
Dict
visit_operation(operation: Operation) → Dict[source]¶
Translate an Operation.
Parameters
operation (Operation) – 
Return type
Dict
visit_structured_query(structured_query: StructuredQuery) → Tuple[str, dict][source]¶
Translate a StructuredQuery.
Parameters
structured_query (StructuredQuery) – 
Return type
Tuple[str, dict]
langchain_community.query_constructors.vectara.VectaraTranslator¶
class langchain_community.query_constructors.vectara.VectaraTranslator[source]¶
Translate Vectara internal query language elements to valid filters.
Attributes
allowed_comparators
Subset of allowed logical comparators.
allowed_operators
Subset of allowed logical operators.
Methods
__init__()
visit_comparison(comparison)
Translate a Comparison.
visit_operation(operation)
Translate an Operation.
visit_structured_query(structured_query)
Translate a StructuredQuery.
__init__()¶
visit_comparison(comparison: Comparison) → str[source]¶
Translate a Comparison.
Parameters
comparison (Comparison) – 
Return type
str
visit_operation(operation: Operation) → str[source]¶
Translate an Operation.
Parameters
operation (Operation) – 
Return type
str
visit_structured_query(structured_query: StructuredQuery) → Tuple[str, dict][source]¶
Translate a StructuredQuery.
Parameters
structured_query (StructuredQuery) – 
Return type
Tuple[str, dict]
langchain_community.query_constructors.tencentvectordb.TencentVectorDBTranslator¶
class langchain_community.query_constructors.tencentvectordb.TencentVectorDBTranslator(meta_keys: Optional[Sequence[str]] = None)[source]¶
Translate StructuredQuery to Tencent VectorDB query.
Initialize the translator.
Parameters
meta_keys (Optional[Sequence[str]]) – List of meta keys to be used in the query. Default: [].
Attributes
COMPARATOR_MAP
allowed_comparators
allowed_operators
Methods
__init__([meta_keys])
Initialize the translator.
visit_comparison(comparison)
Visit a comparison node and return the translated query.
visit_operation(operation)
Visit an operation node and return the translated query.
visit_structured_query(structured_query)
Visit a structured query node and return the translated query.
__init__(meta_keys: Optional[Sequence[str]] = None)[source]¶
Initialize the translator.
Parameters
meta_keys (Optional[Sequence[str]]) – List of meta keys to be used in the query. Default: [].
visit_comparison(comparison: Comparison) → str[source]¶
Visit a comparison node and return the translated query.
Parameters
comparison (Comparison) – Comparison node to be visited.
Returns
Translated query.
Return type
str
visit_operation(operation: Operation) → str[source]¶
Visit an operation node and return the translated query.
Parameters
operation (Operation) – Operation node to be visited.
Returns
Translated query.
Return type
str
visit_structured_query(structured_query: StructuredQuery) → Tuple[str, dict][source]¶
Visit a structured query node and return the translated query.
Parameters
structured_query (StructuredQuery) – StructuredQuery node to be visited.
Returns
Translated query and query kwargs.
Return type
Tuple[str, dict]
langchain_elasticsearch.client.create_elasticsearch_client¶
langchain_elasticsearch.client.create_elasticsearch_client(url: Optional[str] = None, cloud_id: Optional[str] = None, api_key: Optional[str] = None, username: Optional[str] = None, password: Optional[str] = None, params: Optional[Dict[str, Any]] = None) → Elasticsearch[source]¶
Parameters
url (Optional[str]) – 
cloud_id (Optional[str]) – 
api_key (Optional[str]) – 
username (Optional[str]) – 
password (Optional[str]) – 
params (Optional[Dict[str, Any]]) – 
Return type
Elasticsearch
langchain_text_splitters.markdown.MarkdownTextSplitter¶
class langchain_text_splitters.markdown.MarkdownTextSplitter(**kwargs: Any)[source]¶
Attempts to split the text along Markdown-formatted headings.
Initialize a MarkdownTextSplitter.
Methods
__init__(**kwargs)
Initialize a MarkdownTextSplitter.
atransform_documents(documents, **kwargs)
Asynchronously transform a list of documents.
create_documents(texts[, metadatas])
Create documents from a list of texts.
from_huggingface_tokenizer(tokenizer, **kwargs)
Text splitter that uses HuggingFace tokenizer to count length.
from_language(language, **kwargs)
from_tiktoken_encoder([encoding_name, ...])
Text splitter that uses tiktoken encoder to count length.
get_separators_for_language(language)
split_documents(documents)
Split documents.
split_text(text)
Split text into multiple components.
transform_documents(documents, **kwargs)
Transform sequence of documents by splitting them.
Parameters
kwargs (Any) – 
__init__(**kwargs: Any) → None[source]¶
Initialize a MarkdownTextSplitter.
Parameters
kwargs (Any) – 
Return type
None
async atransform_documents(documents: Sequence[Document], **kwargs: Any) → Sequence[Document]¶
Asynchronously transform a list of documents.
Parameters
documents (Sequence[Document]) – A sequence of Documents to be transformed.
kwargs (Any) – 
Returns
A list of transformed Documents.
Return type
Sequence[Document]
create_documents(texts: List[str], metadatas: Optional[List[dict]] = None) → List[Document]¶
Create documents from a list of texts.
Parameters
texts (List[str]) –
langchain_text_splitters.markdown.MarkdownHeaderTextSplitter¶
class langchain_text_splitters.markdown.MarkdownHeaderTextSplitter(headers_to_split_on: List[Tuple[str, str]], return_each_line: bool = False, strip_headers: bool = True)[source]¶
Splitting markdown files based on specified headers.
Create a new MarkdownHeaderTextSplitter.
Parameters
headers_to_split_on (List[Tuple[str, str]]) – Headers we want to track
return_each_line (bool) – Return each line w/ associated headers
strip_headers (bool) – Strip split headers from the content of the chunk
Methods
__init__(headers_to_split_on[, ...])
Create a new MarkdownHeaderTextSplitter.
aggregate_lines_to_chunks(lines)
Combine lines with common metadata into chunks :param lines: Line of text / associated header metadata
split_text(text)
Split markdown file :param text: Markdown file
__init__(headers_to_split_on: List[Tuple[str, str]], return_each_line: bool = False, strip_headers: bool = True)[source]¶
Create a new MarkdownHeaderTextSplitter.
Parameters
headers_to_split_on (List[Tuple[str, str]]) – Headers we want to track
return_each_line (bool) – Return each line w/ associated headers
strip_headers (bool) – Strip split headers from the content of the chunk
aggregate_lines_to_chunks(lines: List[LineType]) → List[Document][source]¶
Combine lines with common metadata into chunks
:param lines: Line of text / associated header metadata
Parameters
lines (List[LineType]) – 
Return type
List[Document]
split_text(text: str) → List[Document][source]¶
Split markdown file
:param text: Markdown file
Parameters
text (str) – 
Return type
List[Document]
Examples using MarkdownHeaderTextSplitter¶
langchain_community.chat_message_histories.elasticsearch.ElasticsearchChatMessageHistory¶
class langchain_community.chat_message_histories.elasticsearch.ElasticsearchChatMessageHistory(index: str, session_id: str, *, es_connection: Optional[Elasticsearch] = None, es_url: Optional[str] = None, es_cloud_id: Optional[str] = None, es_user: Optional[str] = None, es_api_key: Optional[str] = None, es_password: Optional[str] = None, esnsure_ascii: Optional[bool] = True)[source]¶
[Deprecated] Chat message history that stores history in Elasticsearch.
Parameters
es_url (Optional[str]) – URL of the Elasticsearch instance to connect to.
es_cloud_id (Optional[str]) – Cloud ID of the Elasticsearch instance to connect to.
es_user (Optional[str]) – Username to use when connecting to Elasticsearch.
es_password (Optional[str]) – Password to use when connecting to Elasticsearch.
es_api_key (Optional[str]) – API key to use when connecting to Elasticsearch.
es_connection (Optional[Elasticsearch]) – Optional pre-existing Elasticsearch connection.
esnsure_ascii (Optional[bool]) – Used to escape ASCII symbols in json.dumps. Defaults to True.
index (str) – Name of the index to use.
session_id (str) – Arbitrary key that is used to store the messages
of a single chat session.
Notes
Deprecated since version 0.0.27: Use Use langchain-elasticsearch package instead.
Attributes
messages
Retrieve the messages from Elasticsearch
Methods
__init__(index, session_id, *[, ...])
aadd_messages(messages)
Add a list of messages.
aclear()
Remove all messages from the store
add_ai_message(message)
Convenience method for adding an AI message string to the store.
add_message(message)
Add a message to the chat session in Elasticsearch
add_message(message)
Add a message to the chat session in Elasticsearch
add_messages(messages)
Add a list of messages.
add_user_message(message)
Convenience method for adding a human message string to the store.
aget_messages()
Async version of getting messages.
clear()
Clear session memory in Elasticsearch
connect_to_elasticsearch(*[, es_url, ...])
get_user_agent()
__init__(index: str, session_id: str, *, es_connection: Optional[Elasticsearch] = None, es_url: Optional[str] = None, es_cloud_id: Optional[str] = None, es_user: Optional[str] = None, es_api_key: Optional[str] = None, es_password: Optional[str] = None, esnsure_ascii: Optional[bool] = True)[source]¶
Parameters
index (str) – 
session_id (str) – 
es_connection (Optional[Elasticsearch]) – 
es_url (Optional[str]) – 
es_cloud_id (Optional[str]) – 
es_user (Optional[str]) – 
es_api_key (Optional[str]) – 
es_password (Optional[str]) – 
esnsure_ascii (Optional[bool]) – 
async aadd_messages(messages: Sequence[BaseMessage]) → None¶
Add a list of messages.
Parameters
messages (Sequence[BaseMessage]) – A list of BaseMessage objects to store.
Return type
None
async aclear() → None¶
Remove all messages from the store
Return type
None
add_ai_message(message: Union[AIMessage, str]) → None¶
Convenience method for adding an AI message string to the store.
Please note that this is a convenience method. Code should favor the bulk
add_messages interface instead to save on round-trips to the underlying
persistence layer.
add_messages interface instead to save on round-trips to the underlying
persistence layer.
This method may be deprecated in a future release.
Parameters
message (Union[AIMessage, str]) – The AI message to add.
Return type
None
add_message(message: BaseMessage) → None[source]¶
Add a message to the chat session in Elasticsearch
Parameters
message (BaseMessage) – 
Return type
None
add_messages(messages: Sequence[BaseMessage]) → None¶
Add a list of messages.
Implementations should over-ride this method to handle bulk addition of messages
in an efficient manner to avoid unnecessary round-trips to the underlying store.
Parameters
messages (Sequence[BaseMessage]) – A list of BaseMessage objects to store.
Return type
None
add_user_message(message: Union[HumanMessage, str]) → None¶
Convenience method for adding a human message string to the store.
Please note that this is a convenience method. Code should favor the
bulk add_messages interface instead to save on round-trips to the underlying
persistence layer.
This method may be deprecated in a future release.
Parameters
message (Union[HumanMessage, str]) – The human message to add
Return type
None
async aget_messages() → List[BaseMessage]¶
Async version of getting messages.
Can over-ride this method to provide an efficient async implementation.
In general, fetching messages may involve IO to the underlying
persistence layer.
Return type
List[BaseMessage]
clear() → None[source]¶
Clear session memory in Elasticsearch
Return type
None
clear() → None[source]¶
Clear session memory in Elasticsearch
Return type
None
static connect_to_elasticsearch(*, es_url: Optional[str] = None, cloud_id: Optional[str] = None, api_key: Optional[str] = None, username: Optional[str] = None, password: Optional[str] = None) → Elasticsearch[source]¶
Parameters
es_url (Optional[str]) – 
cloud_id (Optional[str]) – 
api_key (Optional[str]) – 
username (Optional[str]) – 
password (Optional[str]) – 
Return type
Elasticsearch
static get_user_agent() → str[source]¶
Return type
str
Examples using ElasticsearchChatMessageHistory¶
Elasticsearch
langchain_community.chat_message_histories.zep.SearchType¶
class langchain_community.chat_message_histories.zep.SearchType(value)[source]¶
Enumerator of the types of search to perform.
similarity = 'similarity'¶
Similarity search.
mmr = 'mmr'¶
Maximal Marginal Relevance reranking of similarity search.
Examples using SearchType¶
Docugami
How to retrieve using multiple vectors per document
Zep Open Source
password (str, optional) – Database password.
port (int, optional) – Database port. Defaults to 3306 for non-HTTP
connections, 80 for HTTP connections, and 443 for HTTPS connections.
database (str, optional) – Database name.
the (Additional optional arguments provide further customization over) – 
connection – 
pure_python (bool, optional) – Toggles the connector mode. If True,
operates in pure Python mode.
local_infile (bool, optional) – Allows local file uploads.
charset (str, optional) – Specifies the character set for string values.
ssl_key (str, optional) – Specifies the path of the file containing the SSL
key.
ssl_cert (str, optional) – Specifies the path of the file containing the SSL
certificate.
ssl_ca (str, optional) – Specifies the path of the file containing the SSL
certificate authority.
ssl_cipher (str, optional) – Sets the SSL cipher list.
ssl_disabled (bool, optional) – Disables SSL usage.
ssl_verify_cert (bool, optional) – Verifies the server’s certificate.
Automatically enabled if ssl_ca is specified.
ssl_verify_identity (bool, optional) – Verifies the server’s identity.
conv (dict[int, Callable], optional) – A dictionary of data conversion
functions.
credential_type (str, optional) – Specifies the type of authentication to
use: auth.PASSWORD, auth.JWT, or auth.BROWSER_SSO.
autocommit (bool, optional) – Enables autocommits.
results_type (str, optional) – Determines the structure of the query results:
tuples, namedtuples, dicts.
results_format (str, optional) – Deprecated. This option has been renamed to
results_type.
session_id (str) – 
kwargs (Any) – 
Examples
session_id (str) – 
kwargs (Any) – 
Examples
Basic Usage:
from langchain_community.chat_message_histories import (
    SingleStoreDBChatMessageHistory
)
message_history = SingleStoreDBChatMessageHistory(
    session_id="my-session",
    host="https://user:password@127.0.0.1:3306/database"
)
Advanced Usage:
from langchain_community.chat_message_histories import (
    SingleStoreDBChatMessageHistory
)
message_history = SingleStoreDBChatMessageHistory(
    session_id="my-session",
    host="127.0.0.1",
    port=3306,
    user="user",
    password="password",
    database="db",
    table_name="my_custom_table",
    pool_size=10,
    timeout=60,
)
Using environment variables:
from langchain_community.chat_message_histories import (
    SingleStoreDBChatMessageHistory
)
os.environ['SINGLESTOREDB_URL'] = 'me:p455w0rd@s2-host.com/my_db'
message_history = SingleStoreDBChatMessageHistory("my-session")
Attributes
messages
Retrieve the messages from SingleStoreDB
Methods
__init__(session_id, *[, table_name, ...])
Initialize with necessary components.
aadd_messages(messages)
Add a list of messages.
aclear()
Remove all messages from the store
add_ai_message(message)
Convenience method for adding an AI message string to the store.
add_message(message)
Append the message to the record in SingleStoreDB
add_messages(messages)
Add a list of messages.
add_user_message(message)
Convenience method for adding a human message string to the store.
aget_messages()
Async version of getting messages.
clear()
aget_messages()
Async version of getting messages.
clear()
Clear session memory from SingleStoreDB
__init__(session_id: str, *, table_name: str = 'message_store', id_field: str = 'id', session_id_field: str = 'session_id', message_field: str = 'message', pool_size: int = 5, max_overflow: int = 10, timeout: float = 30, **kwargs: Any)[source]¶
Initialize with necessary components.
Parameters
table_name (str, optional) – Specifies the name of the table in use.
Defaults to “message_store”.
id_field (str, optional) – Specifies the name of the id field in the table.
Defaults to “id”.
session_id_field (str, optional) – Specifies the name of the session_id
field in the table. Defaults to “session_id”.
message_field (str, optional) – Specifies the name of the message field
in the table. Defaults to “message”.
pool (Following arguments pertain to the connection) – 
pool_size (int, optional) – Determines the number of active connections in
the pool. Defaults to 5.
max_overflow (int, optional) – Determines the maximum number of connections
allowed beyond the pool_size. Defaults to 10.
timeout (float, optional) – Specifies the maximum wait time in seconds for
establishing a connection. Defaults to 30.
connection (database) – 
host (str, optional) – Specifies the hostname, IP address, or URL for the
database connection. The default scheme is “mysql”.
user (str, optional) – Database username.
password (str, optional) – Database password.
port (int, optional) – Database port. Defaults to 3306 for non-HTTP
connections, 80 for HTTP connections, and 443 for HTTPS connections.
connections, 80 for HTTP connections, and 443 for HTTPS connections.
database (str, optional) – Database name.
the (Additional optional arguments provide further customization over) – 
connection – 
pure_python (bool, optional) – Toggles the connector mode. If True,
operates in pure Python mode.
local_infile (bool, optional) – Allows local file uploads.
charset (str, optional) – Specifies the character set for string values.
ssl_key (str, optional) – Specifies the path of the file containing the SSL
key.
ssl_cert (str, optional) – Specifies the path of the file containing the SSL
certificate.
ssl_ca (str, optional) – Specifies the path of the file containing the SSL
certificate authority.
ssl_cipher (str, optional) – Sets the SSL cipher list.
ssl_disabled (bool, optional) – Disables SSL usage.
ssl_verify_cert (bool, optional) – Verifies the server’s certificate.
Automatically enabled if ssl_ca is specified.
ssl_verify_identity (bool, optional) – Verifies the server’s identity.
conv (dict[int, Callable], optional) – A dictionary of data conversion
functions.
credential_type (str, optional) – Specifies the type of authentication to
use: auth.PASSWORD, auth.JWT, or auth.BROWSER_SSO.
autocommit (bool, optional) – Enables autocommits.
results_type (str, optional) – Determines the structure of the query results:
tuples, namedtuples, dicts.
results_format (str, optional) – Deprecated. This option has been renamed to
results_type.
session_id (str) – 
kwargs (Any) – 
Examples
Basic Usage:
from langchain_community.chat_message_histories import (
    SingleStoreDBChatMessageHistory
)
SingleStoreDBChatMessageHistory
)
message_history = SingleStoreDBChatMessageHistory(
    session_id="my-session",
    host="https://user:password@127.0.0.1:3306/database"
)
Advanced Usage:
from langchain_community.chat_message_histories import (
    SingleStoreDBChatMessageHistory
)
message_history = SingleStoreDBChatMessageHistory(
    session_id="my-session",
    host="127.0.0.1",
    port=3306,
    user="user",
    password="password",
    database="db",
    table_name="my_custom_table",
    pool_size=10,
    timeout=60,
)
Using environment variables:
from langchain_community.chat_message_histories import (
    SingleStoreDBChatMessageHistory
)
os.environ['SINGLESTOREDB_URL'] = 'me:p455w0rd@s2-host.com/my_db'
message_history = SingleStoreDBChatMessageHistory("my-session")
async aadd_messages(messages: Sequence[BaseMessage]) → None¶
Add a list of messages.
Parameters
messages (Sequence[BaseMessage]) – A list of BaseMessage objects to store.
Return type
None
async aclear() → None¶
Remove all messages from the store
Return type
None
add_ai_message(message: Union[AIMessage, str]) → None¶
Convenience method for adding an AI message string to the store.
Please note that this is a convenience method. Code should favor the bulk
add_messages interface instead to save on round-trips to the underlying
persistence layer.
This method may be deprecated in a future release.
Parameters
message (Union[AIMessage, str]) – The AI message to add.
Return type
None
Return type
None
add_message(message: BaseMessage) → None[source]¶
Append the message to the record in SingleStoreDB
Parameters
message (BaseMessage) – 
Return type
None
add_messages(messages: Sequence[BaseMessage]) → None¶
Add a list of messages.
Implementations should over-ride this method to handle bulk addition of messages
in an efficient manner to avoid unnecessary round-trips to the underlying store.
Parameters
messages (Sequence[BaseMessage]) – A list of BaseMessage objects to store.
Return type
None
add_user_message(message: Union[HumanMessage, str]) → None¶
Convenience method for adding a human message string to the store.
Please note that this is a convenience method. Code should favor the
bulk add_messages interface instead to save on round-trips to the underlying
persistence layer.
This method may be deprecated in a future release.
Parameters
message (Union[HumanMessage, str]) – The human message to add
Return type
None
async aget_messages() → List[BaseMessage]¶
Async version of getting messages.
Can over-ride this method to provide an efficient async implementation.
In general, fetching messages may involve IO to the underlying
persistence layer.
Return type
List[BaseMessage]
clear() → None[source]¶
Clear session memory from SingleStoreDB
Return type
None
Examples using SingleStoreDBChatMessageHistory¶
SingleStoreDB