id
stringlengths
14
15
text
stringlengths
13
2.7k
source
stringlengths
60
181
9593773c14ab-0
langchain_community.chat_message_histories.singlestoredb.SingleStoreDBChatMessageHistory¶ class langchain_community.chat_message_histories.singlestoredb.SingleStoreDBChatMessageHistory(session_id: str, *, table_name: str = 'message_store', id_field: str = 'id', session_id_field: str = 'session_id', message_field: str =...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.singlestoredb.SingleStoreDBChatMessageHistory.html
9593773c14ab-1
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_py...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.singlestoredb.SingleStoreDBChatMessageHistory.html
9593773c14ab-2
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 ...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.singlestoredb.SingleStoreDBChatMessageHistory.html
9593773c14ab-3
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 c...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.singlestoredb.SingleStoreDBChatMessageHistory.html
9593773c14ab-4
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) – Specifi...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.singlestoredb.SingleStoreDBChatMessageHistory.html
9593773c14ab-5
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-...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.singlestoredb.SingleStoreDBChatMessageHistory.html
8ef98c3002a9-0
langchain_community.chat_message_histories.sql.SQLChatMessageHistory¶ class langchain_community.chat_message_histories.sql.SQLChatMessageHistory(session_id: str, connection_string: str, table_name: str = 'message_store', session_id_field_name: str = 'session_id', custom_message_converter: Optional[BaseMessageConverter]...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.sql.SQLChatMessageHistory.html
94c6a817e99e-0
langchain_community.chat_message_histories.postgres.PostgresChatMessageHistory¶ class langchain_community.chat_message_histories.postgres.PostgresChatMessageHistory(session_id: str, connection_string: str = 'postgresql://postgres:mypassword@localhost/chat_history', table_name: str = 'message_store')[source]¶ Chat messa...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.postgres.PostgresChatMessageHistory.html
81bfcb516fd9-0
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]...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.elasticsearch.ElasticsearchChatMessageHistory.html
81bfcb516fd9-1
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)[source]...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.elasticsearch.ElasticsearchChatMessageHistory.html
7041ad8d2a39-0
langchain_community.chat_message_histories.redis.RedisChatMessageHistory¶ class langchain_community.chat_message_histories.redis.RedisChatMessageHistory(session_id: str, url: str = 'redis://localhost:6379/0', key_prefix: str = 'message_store:', ttl: Optional[int] = None)[source]¶ Chat message history stored in a Redis ...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.redis.RedisChatMessageHistory.html
9dbf2c53f208-0
langchain_community.chat_message_histories.upstash_redis.UpstashRedisChatMessageHistory¶ class langchain_community.chat_message_histories.upstash_redis.UpstashRedisChatMessageHistory(session_id: str, url: str = '', token: str = '', key_prefix: str = 'message_store:', ttl: Optional[int] = None)[source]¶ Chat message his...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.upstash_redis.UpstashRedisChatMessageHistory.html
839dd50bbac7-0
langchain_community.chat_message_histories.neo4j.Neo4jChatMessageHistory¶ class langchain_community.chat_message_histories.neo4j.Neo4jChatMessageHistory(session_id: Union[str, int], url: Optional[str] = None, username: Optional[str] = None, password: Optional[str] = None, database: str = 'neo4j', node_label: str = 'Ses...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.neo4j.Neo4jChatMessageHistory.html
c984c8e0d5a2-0
langchain_community.chat_message_histories.momento.MomentoChatMessageHistory¶ class langchain_community.chat_message_histories.momento.MomentoChatMessageHistory(session_id: str, cache_client: momento.CacheClient, cache_name: str, *, key_prefix: str = 'message_store:', ttl: Optional[timedelta] = None, ensure_cache_exist...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.momento.MomentoChatMessageHistory.html
c984c8e0d5a2-1
add_message(message) Store a message in the cache. add_user_message(message) Convenience method for adding a human message string to the store. clear() Remove the session's messages from the cache. from_client_params(session_id, cache_name, ...) Construct cache from CacheClient parameters. __init__(session_id: str, cac...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.momento.MomentoChatMessageHistory.html
c984c8e0d5a2-2
Store a message in the cache. Parameters message (BaseMessage) – The message object to store. Raises SdkException – Momento service or network error. Exception – Unexpected response. add_user_message(message: str) → None¶ Convenience method for adding a human message string to the store. Parameters message – The string...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.momento.MomentoChatMessageHistory.html
a772b8de618f-0
langchain_community.chat_message_histories.rocksetdb.RocksetChatMessageHistory¶ class langchain_community.chat_message_histories.rocksetdb.RocksetChatMessageHistory(session_id: str, client: ~typing.Any, collection: str, workspace: str = 'commons', messages_key: str = 'messages', sync: bool = False, message_uuid_method:...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.rocksetdb.RocksetChatMessageHistory.html
a772b8de618f-1
If set, all messages will have an id field within the additional_kwargs property. If this param is not set and sync is False, message IDs will not be created. If this param is not set and sync is True, the uuid.uuid4 method will be used to create message IDs. Attributes ADD_TIMEOUT_MS CREATE_TIMEOUT_MS SLEEP_INTERVAL_M...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.rocksetdb.RocksetChatMessageHistory.html
a772b8de618f-2
to False. NOTE: setting this to True will slow down performance. message_uuid_method (-) – The method that generates message IDs. If set, all messages will have an id field within the additional_kwargs property. If this param is not set and sync is False, message IDs will not be created. If this param is not set and sy...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.rocksetdb.RocksetChatMessageHistory.html
84c6d3ccdb9a-0
langchain_community.chat_message_histories.in_memory.ChatMessageHistory¶ class langchain_community.chat_message_histories.in_memory.ChatMessageHistory[source]¶ Bases: BaseChatMessageHistory, BaseModel In memory implementation of chat message history. Stores messages in an in memory list. Create a new model by parsing a...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.in_memory.ChatMessageHistory.html
84c6d3ccdb9a-1
Parameters include – fields to include in new model exclude – fields to exclude from new model, as with values this takes precedence over include update – 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 – set to True to make a deep co...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.in_memory.ChatMessageHistory.html
84c6d3ccdb9a-2
classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmet...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.in_memory.ChatMessageHistory.html
884e0927540c-0
langchain_community.chat_message_histories.cassandra.CassandraChatMessageHistory¶ class langchain_community.chat_message_histories.cassandra.CassandraChatMessageHistory(session_id: str, session: Session, keyspace: str, table_name: str = 'message_store', ttl_seconds: Optional[int] = None)[source]¶ Chat message history t...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.cassandra.CassandraChatMessageHistory.html
884e0927540c-1
message – The string contents of a human message. clear() → None[source]¶ Clear session memory from DB Examples using CassandraChatMessageHistory¶ Cassandra Chat Message History Cassandra
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.cassandra.CassandraChatMessageHistory.html
ba37dff533df-0
langchain_community.chat_message_histories.cosmos_db.CosmosDBChatMessageHistory¶ class langchain_community.chat_message_histories.cosmos_db.CosmosDBChatMessageHistory(cosmos_endpoint: str, cosmos_database: str, cosmos_container: str, session_id: str, user_id: str, credential: Any = None, connection_string: Optional[str...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.cosmos_db.CosmosDBChatMessageHistory.html
ba37dff533df-1
Convenience method for adding a human message string to the store. clear() Clear session memory from this memory and cosmos. load_messages() Retrieve the messages from Cosmos prepare_cosmos() Prepare the CosmosDB client. upsert_messages() Update the cosmosdb item. __init__(cosmos_endpoint: str, cosmos_database: str, co...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.cosmos_db.CosmosDBChatMessageHistory.html
ba37dff533df-2
Convenience method for adding a human message string to the store. Parameters message – The string contents of a human message. clear() → None[source]¶ Clear session memory from this memory and cosmos. load_messages() → None[source]¶ Retrieve the messages from Cosmos prepare_cosmos() → None[source]¶ Prepare the CosmosD...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.cosmos_db.CosmosDBChatMessageHistory.html
b7485b17416e-0
langchain_community.chat_message_histories.astradb.AstraDBChatMessageHistory¶ class langchain_community.chat_message_histories.astradb.AstraDBChatMessageHistory(*, session_id: str, collection_name: str = 'langchain_message_store', token: Optional[str] = None, api_endpoint: Optional[str] = None, astra_db_client: Optiona...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.astradb.AstraDBChatMessageHistory.html
b7485b17416e-1
clear() Clear session memory from DB __init__(*, session_id: str, collection_name: str = 'langchain_message_store', token: Optional[str] = None, api_endpoint: Optional[str] = None, astra_db_client: Optional[LibAstraDB] = None, namespace: Optional[str] = None) → None[source]¶ Create an Astra DB chat message history. add...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.astradb.AstraDBChatMessageHistory.html
fd1141ae3490-0
langchain_community.chat_message_histories.firestore.FirestoreChatMessageHistory¶ class langchain_community.chat_message_histories.firestore.FirestoreChatMessageHistory(collection_name: str, session_id: str, user_id: str, firestore_client: Optional[Client] = None)[source]¶ Chat message history backed by Google Firestor...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.firestore.FirestoreChatMessageHistory.html
fd1141ae3490-1
Add a Message object to the store. Parameters message – A BaseMessage object to store. add_user_message(message: str) → None¶ Convenience method for adding a human message string to the store. Parameters message – The string contents of a human message. clear() → None[source]¶ Clear session memory from this memory and ...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.firestore.FirestoreChatMessageHistory.html
617e68a15dc1-0
langchain_community.chat_message_histories.sql.DefaultMessageConverter¶ class langchain_community.chat_message_histories.sql.DefaultMessageConverter(table_name: str)[source]¶ The default message converter for SQLChatMessageHistory. Methods __init__(table_name) from_sql_model(sql_message) Convert a SQLAlchemy model to a...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.sql.DefaultMessageConverter.html
bf11568d6b98-0
langchain_community.chat_message_histories.file.FileChatMessageHistory¶ class langchain_community.chat_message_histories.file.FileChatMessageHistory(file_path: str)[source]¶ Chat message history that stores history in a local file. Parameters file_path – path of the local file to store the messages. Attributes messages...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.file.FileChatMessageHistory.html
f08bd6d6ffd8-0
langchain_community.chat_message_histories.streamlit.StreamlitChatMessageHistory¶ class langchain_community.chat_message_histories.streamlit.StreamlitChatMessageHistory(key: str = 'langchain_messages')[source]¶ Chat message history that stores messages in Streamlit session state. Parameters key – The key to use in Stre...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.streamlit.StreamlitChatMessageHistory.html
2d678bfefaa7-0
langchain_community.chat_message_histories.xata.XataChatMessageHistory¶ class langchain_community.chat_message_histories.xata.XataChatMessageHistory(session_id: str, db_url: str, api_key: str, branch_name: str = 'main', table_name: str = 'messages', create_table: bool = True)[source]¶ Chat message history stored in a X...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.xata.XataChatMessageHistory.html
2b75df7c5a35-0
langchain_community.chat_message_histories.dynamodb.DynamoDBChatMessageHistory¶ class langchain_community.chat_message_histories.dynamodb.DynamoDBChatMessageHistory(table_name: str, session_id: str, endpoint_url: Optional[str] = None, primary_key_name: str = 'SessionId', key: Optional[Dict[str, str]] = None, boto3_sess...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.dynamodb.DynamoDBChatMessageHistory.html
2b75df7c5a35-1
Append the message to the record in DynamoDB add_user_message(message) Convenience method for adding a human message string to the store. clear() Clear session memory from DynamoDB __init__(table_name: str, session_id: str, endpoint_url: Optional[str] = None, primary_key_name: str = 'SessionId', key: Optional[Dict[str,...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.dynamodb.DynamoDBChatMessageHistory.html
c97694bed863-0
langchain_community.chat_message_histories.sql.create_message_model¶ langchain_community.chat_message_histories.sql.create_message_model(table_name, DynamicBase)[source]¶ Create a message model for a given table name. Parameters table_name – The name of the table to use. DynamicBase – The base class to use for the mode...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.sql.create_message_model.html
0217ad284910-0
langchain_community.chat_message_histories.mongodb.MongoDBChatMessageHistory¶ class langchain_community.chat_message_histories.mongodb.MongoDBChatMessageHistory(connection_string: str, session_id: str, database_name: str = 'chat_history', collection_name: str = 'message_store')[source]¶ Chat message history that stores...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.mongodb.MongoDBChatMessageHistory.html
19628ae06d16-0
langchain_community.chat_message_histories.zep.ZepChatMessageHistory¶ class langchain_community.chat_message_histories.zep.ZepChatMessageHistory(session_id: str, url: str = 'http://localhost:8000', api_key: Optional[str] = None)[source]¶ Chat message history that uses Zep as a backend. Recommended usage: # Set up Zep C...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.zep.ZepChatMessageHistory.html
19628ae06d16-1
Append the message to the Zep memory history add_user_message(message[, metadata]) Convenience method for adding a human message string to the store. clear() Clear session memory from Zep. search(query[, metadata, limit]) Search Zep memory for messages matching the query __init__(session_id: str, url: str = 'http://loc...
https://api.python.langchain.com/en/latest/chat_message_histories/langchain_community.chat_message_histories.zep.ZepChatMessageHistory.html
4b85f854c592-0
langchain_community.cache.FullMd5LLMCache¶ class langchain_community.cache.FullMd5LLMCache(**kwargs)[source]¶ SQLite table for full LLM Cache (all generations). A simple constructor that allows initialization from kwargs. Sets attributes on the constructed instance using the names and values in kwargs. Only keys that a...
https://api.python.langchain.com/en/latest/cache/langchain_community.cache.FullMd5LLMCache.html
6fd7df47418f-0
langchain_community.cache.SQLAlchemyMd5Cache¶ class langchain_community.cache.SQLAlchemyMd5Cache(engine: ~sqlalchemy.engine.base.Engine, cache_schema: ~typing.Type[~langchain_community.cache.FullMd5LLMCache] = <class 'langchain_community.cache.FullMd5LLMCache'>)[source]¶ Cache that uses SQAlchemy as a backend. Initiali...
https://api.python.langchain.com/en/latest/cache/langchain_community.cache.SQLAlchemyMd5Cache.html
84f907bf3e16-0
langchain_community.cache.RedisSemanticCache¶ class langchain_community.cache.RedisSemanticCache(redis_url: str, embedding: Embeddings, score_threshold: float = 0.2)[source]¶ Cache that uses Redis as a vector-store backend. Initialize by passing in the init GPTCache func Parameters redis_url (str) – URL to connect to R...
https://api.python.langchain.com/en/latest/cache/langchain_community.cache.RedisSemanticCache.html
84f907bf3e16-1
set_llm_cache(RedisSemanticCache( redis_url="redis://localhost:6379", embedding=OpenAIEmbeddings() )) clear(**kwargs: Any) → None[source]¶ Clear semantic cache for a given llm_string. lookup(prompt: str, llm_string: str) → Optional[Sequence[Generation]][source]¶ Look up based on prompt and llm_string. update(pr...
https://api.python.langchain.com/en/latest/cache/langchain_community.cache.RedisSemanticCache.html
d1a8db79efdb-0
langchain_community.cache.SQLiteCache¶ class langchain_community.cache.SQLiteCache(database_path: str = '.langchain.db')[source]¶ Cache that uses SQLite as a backend. Initialize by creating the engine and all tables. Methods __init__([database_path]) Initialize by creating the engine and all tables. clear(**kwargs) Cle...
https://api.python.langchain.com/en/latest/cache/langchain_community.cache.SQLiteCache.html
5562ca4a8b8d-0
langchain_community.cache.CassandraSemanticCache¶ class langchain_community.cache.CassandraSemanticCache(session: Optional[CassandraSession], keyspace: Optional[str], embedding: Embeddings, table_name: str = 'langchain_llm_semantic_cache', distance_metric: str = 'dot', score_threshold: float = 0.85, ttl_seconds: Option...
https://api.python.langchain.com/en/latest/cache/langchain_community.cache.CassandraSemanticCache.html
5562ca4a8b8d-1
Methods __init__(session, keyspace, embedding[, ...]) Initialize the cache with all relevant parameters. :param session: an open Cassandra session :type session: cassandra.cluster.Session :param keyspace: the keyspace to use for storing the cache :type keyspace: str :param embedding: Embedding provider for semantic ...
https://api.python.langchain.com/en/latest/cache/langchain_community.cache.CassandraSemanticCache.html
5562ca4a8b8d-2
Initialize the cache with all relevant parameters. :param session: an open Cassandra session :type session: cassandra.cluster.Session :param keyspace: the keyspace to use for storing the cache :type keyspace: str :param embedding: Embedding provider for semantic encoding and search. Parameters table_name (str) – name o...
https://api.python.langchain.com/en/latest/cache/langchain_community.cache.CassandraSemanticCache.html
5562ca4a8b8d-3
Update cache based on prompt and llm_string.
https://api.python.langchain.com/en/latest/cache/langchain_community.cache.CassandraSemanticCache.html
b60712355273-0
langchain_community.cache.GPTCache¶ class langchain_community.cache.GPTCache(init_func: Optional[Union[Callable[[Any, str], None], Callable[[Any], None]]] = None)[source]¶ Cache that uses GPTCache as a backend. Initialize by passing in init function (default: None). Parameters init_func (Optional[Callable[[Any], None]]...
https://api.python.langchain.com/en/latest/cache/langchain_community.cache.GPTCache.html
b60712355273-1
# Initialize GPTCache with a custom init function import gptcache from gptcache.processor.pre import get_prompt from gptcache.manager.factory import get_data_manager from langchain_community.globals import set_llm_cache # Avoid multiple caches using the same file, causing different llm model caches to affect each other...
https://api.python.langchain.com/en/latest/cache/langchain_community.cache.GPTCache.html
e2cc33211987-0
langchain_community.cache.AstraDBSemanticCache¶ class langchain_community.cache.AstraDBSemanticCache(*, collection_name: str = 'langchain_astradb_semantic_cache', token: Optional[str] = None, api_endpoint: Optional[str] = None, astra_db_client: Optional[Any] = None, namespace: Optional[str] = None, embedding: Embedding...
https://api.python.langchain.com/en/latest/cache/langchain_community.cache.AstraDBSemanticCache.html
e2cc33211987-1
similarity_threshold (float, optional) – the minimum similarity for accepting a (semantic-search) match. The default score threshold is tuned to the default metric. Tune it carefully yourself if switching to another distance metric. Methods __init__(*[, collection_name, token, ...]) Initialize the cache with all releva...
https://api.python.langchain.com/en/latest/cache/langchain_community.cache.AstraDBSemanticCache.html
e2cc33211987-2
lookup_with_id(prompt, llm_string) Look up based on prompt and llm_string. lookup_with_id_through_llm(prompt, llm[, stop]) update(prompt, llm_string, return_val) Update cache based on prompt and llm_string. __init__(*, collection_name: str = 'langchain_astradb_semantic_cache', token: Optional[str] = None, api_endpoint:...
https://api.python.langchain.com/en/latest/cache/langchain_community.cache.AstraDBSemanticCache.html
e2cc33211987-3
Tune it carefully yourself if switching to another distance metric. clear(**kwargs: Any) → None[source]¶ Clear the whole semantic cache. delete_by_document_id(document_id: str) → None[source]¶ Given this is a “similarity search” cache, an invalidation pattern that makes sense is first a lookup to get an ID, and then de...
https://api.python.langchain.com/en/latest/cache/langchain_community.cache.AstraDBSemanticCache.html
c2da78afe5ab-0
langchain_community.cache.FullLLMCache¶ class langchain_community.cache.FullLLMCache(**kwargs)[source]¶ SQLite table for full LLM Cache (all generations). A simple constructor that allows initialization from kwargs. Sets attributes on the constructed instance using the names and values in kwargs. Only keys that are pre...
https://api.python.langchain.com/en/latest/cache/langchain_community.cache.FullLLMCache.html
97602c9817ea-0
langchain_community.cache.UpstashRedisCache¶ class langchain_community.cache.UpstashRedisCache(redis_: Any, *, ttl: Optional[int] = None)[source]¶ Cache that uses Upstash Redis as a backend. Initialize an instance of UpstashRedisCache. This method initializes an object with Upstash Redis caching capabilities. It takes ...
https://api.python.langchain.com/en/latest/cache/langchain_community.cache.UpstashRedisCache.html
97602c9817ea-1
This allows the object to communicate with Redis server for caching operations on. ttl (int, optional) – Time-to-live (TTL) for cached items in seconds. If provided, it sets the time duration for how long cached items will remain valid. If not provided, cached items will not have an automatic expiration. clear(**kwargs...
https://api.python.langchain.com/en/latest/cache/langchain_community.cache.UpstashRedisCache.html
adceabe116db-0
langchain_community.cache.SQLAlchemyCache¶ class langchain_community.cache.SQLAlchemyCache(engine: ~sqlalchemy.engine.base.Engine, cache_schema: ~typing.Type[~langchain_community.cache.FullLLMCache] = <class 'langchain_community.cache.FullLLMCache'>)[source]¶ Cache that uses SQAlchemy as a backend. Initialize by creati...
https://api.python.langchain.com/en/latest/cache/langchain_community.cache.SQLAlchemyCache.html
79463b4e3140-0
langchain_community.cache.MomentoCache¶ class langchain_community.cache.MomentoCache(cache_client: momento.CacheClient, cache_name: str, *, ttl: Optional[timedelta] = None, ensure_cache_exists: bool = True)[source]¶ Cache that uses Momento as a backend. See https://gomomento.com/ Instantiate a prompt cache using Moment...
https://api.python.langchain.com/en/latest/cache/langchain_community.cache.MomentoCache.html
79463b4e3140-1
Instantiate a prompt cache using Momento as a backend. Note: to instantiate the cache client passed to MomentoCache, you must have a Momento account. See https://gomomento.com/. Parameters cache_client (CacheClient) – The Momento cache client. cache_name (str) – The name of the cache to use to store the data. ttl (Opti...
https://api.python.langchain.com/en/latest/cache/langchain_community.cache.MomentoCache.html
79463b4e3140-2
Store llm generations in cache. Parameters prompt (str) – The prompt run through the language model. llm_string (str) – The language model string. return_val (RETURN_VAL_TYPE) – A list of language model generations. Raises SdkException – Momento service or network error Exception – Unexpected response Examples using Mo...
https://api.python.langchain.com/en/latest/cache/langchain_community.cache.MomentoCache.html
b4b4fa315f57-0
langchain_community.cache.AstraDBCache¶ class langchain_community.cache.AstraDBCache(*, collection_name: str = 'langchain_astradb_cache', token: Optional[str] = None, api_endpoint: Optional[str] = None, astra_db_client: Optional[Any] = None, namespace: Optional[str] = None)[source]¶ Cache that uses Astra DB as a backen...
https://api.python.langchain.com/en/latest/cache/langchain_community.cache.AstraDBCache.html
b4b4fa315f57-1
lookup(prompt, llm_string) Look up based on prompt and llm_string. update(prompt, llm_string, return_val) Update cache based on prompt and llm_string. __init__(*, collection_name: str = 'langchain_astradb_cache', token: Optional[str] = None, api_endpoint: Optional[str] = None, astra_db_client: Optional[Any] = None, nam...
https://api.python.langchain.com/en/latest/cache/langchain_community.cache.AstraDBCache.html
b4b4fa315f57-2
Look up based on prompt and llm_string. update(prompt: str, llm_string: str, return_val: Sequence[Generation]) → None[source]¶ Update cache based on prompt and llm_string.
https://api.python.langchain.com/en/latest/cache/langchain_community.cache.AstraDBCache.html
a07bd8433488-0
langchain_community.cache.InMemoryCache¶ class langchain_community.cache.InMemoryCache[source]¶ Cache that stores things in memory. Initialize with empty cache. Methods __init__() Initialize with empty cache. clear(**kwargs) Clear cache. lookup(prompt, llm_string) Look up based on prompt and llm_string. update(prompt, ...
https://api.python.langchain.com/en/latest/cache/langchain_community.cache.InMemoryCache.html
1aabe1adfd1f-0
langchain_community.cache.CassandraCache¶ class langchain_community.cache.CassandraCache(session: Optional[CassandraSession] = None, keyspace: Optional[str] = None, table_name: str = 'langchain_llm_cache', ttl_seconds: Optional[int] = None, skip_provisioning: bool = False)[source]¶ Cache that uses Cassandra / Astra DB ...
https://api.python.langchain.com/en/latest/cache/langchain_community.cache.CassandraCache.html
1aabe1adfd1f-1
A wrapper around delete with the LLM being passed. lookup(prompt, llm_string) Look up based on prompt and llm_string. update(prompt, llm_string, return_val) Update cache based on prompt and llm_string. __init__(session: Optional[CassandraSession] = None, keyspace: Optional[str] = None, table_name: str = 'langchain_llm_...
https://api.python.langchain.com/en/latest/cache/langchain_community.cache.CassandraCache.html
0967e2413d48-0
langchain_community.cache.RedisCache¶ class langchain_community.cache.RedisCache(redis_: Any, *, ttl: Optional[int] = None)[source]¶ Cache that uses Redis as a backend. Initialize an instance of RedisCache. This method initializes an object with Redis caching capabilities. It takes a redis_ parameter, which should be a...
https://api.python.langchain.com/en/latest/cache/langchain_community.cache.RedisCache.html
0967e2413d48-1
If provided, it sets the time duration for how long cached items will remain valid. If not provided, cached items will not have an automatic expiration. clear(**kwargs: Any) → None[source]¶ Clear cache. If asynchronous is True, flush asynchronously. lookup(prompt: str, llm_string: str) → Optional[Sequence[Generation]][...
https://api.python.langchain.com/en/latest/cache/langchain_community.cache.RedisCache.html
63297d963079-0
langchain_core.stores.BaseStore¶ class langchain_core.stores.BaseStore[source]¶ Abstract interface for a key-value store. Methods __init__() mdelete(keys) Delete the given keys and their associated values. mget(keys) Get the values associated with the given keys. mset(key_value_pairs) Set the values for the given keys....
https://api.python.langchain.com/en/latest/stores/langchain_core.stores.BaseStore.html
3b8ebf49de08-0
langchain_community.chat_loaders.telegram.TelegramChatLoader¶ class langchain_community.chat_loaders.telegram.TelegramChatLoader(path: Union[str, Path])[source]¶ Load telegram conversations to LangChain chat messages. To export, use the Telegram Desktop app from https://desktop.telegram.org/, select a conversation, cli...
https://api.python.langchain.com/en/latest/chat_loaders/langchain_community.chat_loaders.telegram.TelegramChatLoader.html
d42738ae5739-0
langchain_community.chat_loaders.utils.merge_chat_runs_in_session¶ langchain_community.chat_loaders.utils.merge_chat_runs_in_session(chat_session: ChatSession, delimiter: str = '\n\n') → ChatSession[source]¶ Merge chat runs together in a chat session. A chat run is a sequence of messages from the same sender. Parameter...
https://api.python.langchain.com/en/latest/chat_loaders/langchain_community.chat_loaders.utils.merge_chat_runs_in_session.html
183d98859702-0
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 – A list of chat sessions. R...
https://api.python.langchain.com/en/latest/chat_loaders/langchain_community.chat_loaders.utils.merge_chat_runs.html
3be2e6667202-0
langchain_community.chat_loaders.facebook_messenger.SingleFileFacebookMessengerChatLoader¶ class langchain_community.chat_loaders.facebook_messenger.SingleFileFacebookMessengerChatLoader(path: Union[Path, str])[source]¶ Load Facebook Messenger chat data from a single file. Parameters path (Union[Path, str]) – The path ...
https://api.python.langchain.com/en/latest/chat_loaders/langchain_community.chat_loaders.facebook_messenger.SingleFileFacebookMessengerChatLoader.html
5d71173e28ef-0
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. Th...
https://api.python.langchain.com/en/latest/chat_loaders/langchain_community.chat_loaders.imessage.IMessageChatLoader.html
87e2d41ea7ba-0
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 direct...
https://api.python.langchain.com/en/latest/chat_loaders/langchain_community.chat_loaders.facebook_messenger.FolderFacebookMessengerChatLoader.html
26cbd81f7778-0
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,...
https://api.python.langchain.com/en/latest/chat_loaders/langchain_community.chat_loaders.whatsapp.WhatsAppChatLoader.html
3d65b6761482-0
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. Ex...
https://api.python.langchain.com/en/latest/chat_loaders/langchain_community.chat_loaders.utils.map_ai_messages.html
d0da5a6454b6-0
langchain_community.chat_loaders.gmail.GMailLoader¶ class langchain_community.chat_loaders.gmail.GMailLoader(creds: Any, n: int = 100, raise_error: bool = False)[source]¶ 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 wa...
https://api.python.langchain.com/en/latest/chat_loaders/langchain_community.chat_loaders.gmail.GMailLoader.html
59d895597616-0
langchain_community.chat_loaders.utils.map_ai_messages_in_session¶ langchain_community.chat_loaders.utils.map_ai_messages_in_session(chat_sessions: ChatSession, sender: str) → ChatSession[source]¶ Convert messages from the specified ‘sender’ to AI messages. This is useful for fine-tuning the AI to adapt to your voice.
https://api.python.langchain.com/en/latest/chat_loaders/langchain_community.chat_loaders.utils.map_ai_messages_in_session.html
24b8b18b0634-0
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. Ty...
https://api.python.langchain.com/en/latest/chat_loaders/langchain_community.chat_loaders.langsmith.LangSmithRunChatLoader.html
c2967e232eeb-0
langchain_community.chat_loaders.base.BaseChatLoader¶ class langchain_community.chat_loaders.base.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][s...
https://api.python.langchain.com/en/latest/chat_loaders/langchain_community.chat_loaders.base.BaseChatLoader.html
1a39ee00ff82-0
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 – Path to the exported Slack ...
https://api.python.langchain.com/en/latest/chat_loaders/langchain_community.chat_loaders.slack.SlackChatLoader.html
ea38389ba2ea-0
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 LangSm...
https://api.python.langchain.com/en/latest/chat_loaders/langchain_community.chat_loaders.langsmith.LangSmithDatasetChatLoader.html
8e8258c1fc1f-0
langchain_community.callbacks.whylabs_callback.import_langkit¶ langchain_community.callbacks.whylabs_callback.import_langkit(sentiment: bool = False, toxicity: bool = False, themes: bool = False) → Any[source]¶ Import the langkit python package and raise an error if it is not installed. Parameters sentiment – Whether t...
https://api.python.langchain.com/en/latest/callbacks/langchain_community.callbacks.whylabs_callback.import_langkit.html
8ebd5edc7a5e-0
langchain_core.callbacks.base.RetrieverManagerMixin¶ class langchain_core.callbacks.base.RetrieverManagerMixin[source]¶ Mixin for Retriever callbacks. Methods __init__() on_retriever_end(documents, *, run_id[, ...]) Run when Retriever ends running. on_retriever_error(error, *, run_id[, ...]) Run when Retriever errors. ...
https://api.python.langchain.com/en/latest/callbacks/langchain_core.callbacks.base.RetrieverManagerMixin.html
0acd4cd6f740-0
langchain_core.callbacks.stdout.StdOutCallbackHandler¶ class langchain_core.callbacks.stdout.StdOutCallbackHandler(color: Optional[str] = None)[source]¶ Callback Handler that prints to std out. Initialize callback handler. Attributes ignore_agent Whether to ignore agent callbacks. ignore_chain Whether to ignore chain c...
https://api.python.langchain.com/en/latest/callbacks/langchain_core.callbacks.stdout.StdOutCallbackHandler.html
0acd4cd6f740-1
on_llm_start(serialized, prompts, *, run_id) Run when LLM starts running. on_retriever_end(documents, *, run_id[, ...]) Run when Retriever ends running. on_retriever_error(error, *, run_id[, ...]) Run when Retriever errors. on_retriever_start(serialized, query, *, run_id) Run when Retriever starts running. on_retry(ret...
https://api.python.langchain.com/en/latest/callbacks/langchain_core.callbacks.stdout.StdOutCallbackHandler.html
0acd4cd6f740-2
Run when chain errors. on_chain_start(serialized: Dict[str, Any], inputs: Dict[str, Any], **kwargs: Any) → None[source]¶ Print out that we are entering a chain. on_chat_model_start(serialized: Dict[str, Any], messages: List[List[BaseMessage]], *, run_id: UUID, parent_run_id: Optional[UUID] = None, tags: Optional[List[s...
https://api.python.langchain.com/en/latest/callbacks/langchain_core.callbacks.stdout.StdOutCallbackHandler.html
0acd4cd6f740-3
information. (containing content and other) – on_llm_start(serialized: Dict[str, Any], prompts: List[str], *, run_id: UUID, parent_run_id: Optional[UUID] = None, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, **kwargs: Any) → Any¶ Run when LLM starts running. on_retriever_end(documents: S...
https://api.python.langchain.com/en/latest/callbacks/langchain_core.callbacks.stdout.StdOutCallbackHandler.html
0acd4cd6f740-4
If not the final action, print out observation. on_tool_error(error: BaseException, *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) → Any¶ Run when tool errors. on_tool_start(serialized: Dict[str, Any], input_str: str, *, run_id: UUID, parent_run_id: Optional[UUID] = None, tags: Optional[List[str]...
https://api.python.langchain.com/en/latest/callbacks/langchain_core.callbacks.stdout.StdOutCallbackHandler.html
ad5a69d0d690-0
langchain_community.callbacks.argilla_callback.ArgillaCallbackHandler¶ class langchain_community.callbacks.argilla_callback.ArgillaCallbackHandler(dataset_name: str, workspace_name: Optional[str] = None, api_url: Optional[str] = None, api_key: Optional[str] = None)[source]¶ Callback Handler that logs into Argilla. Para...
https://api.python.langchain.com/en/latest/callbacks/langchain_community.callbacks.argilla_callback.ArgillaCallbackHandler.html
ad5a69d0d690-1
... ) >>> llm = OpenAI( ... temperature=0, ... callbacks=[argilla_callback], ... verbose=True, ... openai_api_key="API_KEY_HERE", ... ) >>> llm.generate([ ... "What is the best NLP-annotation tool out there? (no bias at all)", ... ]) "Argilla, no doubt about it." Initializes the ArgillaCallbackHandl...
https://api.python.langchain.com/en/latest/callbacks/langchain_community.callbacks.argilla_callback.ArgillaCallbackHandler.html
ad5a69d0d690-2
ignore_llm Whether to ignore LLM callbacks. ignore_retriever Whether to ignore retriever callbacks. ignore_retry Whether to ignore retry callbacks. raise_error run_inline Methods __init__(dataset_name[, workspace_name, ...]) Initializes the ArgillaCallbackHandler. on_agent_action(action, **kwargs) Do nothing when agent...
https://api.python.langchain.com/en/latest/callbacks/langchain_community.callbacks.argilla_callback.ArgillaCallbackHandler.html
ad5a69d0d690-3
on_retriever_start(serialized, query, *, run_id) Run when Retriever starts running. on_retry(retry_state, *, run_id[, parent_run_id]) Run on a retry event. on_text(text, **kwargs) Do nothing on_tool_end(output[, observation_prefix, ...]) Do nothing when tool ends. on_tool_error(error, **kwargs) Do nothing when tool out...
https://api.python.langchain.com/en/latest/callbacks/langchain_community.callbacks.argilla_callback.ArgillaCallbackHandler.html
ad5a69d0d690-4
ConnectionError – if the connection to Argilla fails. FileNotFoundError – if the FeedbackDataset retrieval from Argilla fails. on_agent_action(action: AgentAction, **kwargs: Any) → Any[source]¶ Do nothing when agent takes a specific action. on_agent_finish(finish: AgentFinish, **kwargs: Any) → None[source]¶ Do nothing ...
https://api.python.langchain.com/en/latest/callbacks/langchain_community.callbacks.argilla_callback.ArgillaCallbackHandler.html
ad5a69d0d690-5
on_llm_error(error: BaseException, **kwargs: Any) → None[source]¶ Do nothing when LLM outputs an error. on_llm_new_token(token: str, **kwargs: Any) → None[source]¶ Do nothing when a new token is generated. on_llm_start(serialized: Dict[str, Any], prompts: List[str], **kwargs: Any) → None[source]¶ Save the prompts in me...
https://api.python.langchain.com/en/latest/callbacks/langchain_community.callbacks.argilla_callback.ArgillaCallbackHandler.html
ad5a69d0d690-6
Do nothing when tool outputs an error. on_tool_start(serialized: Dict[str, Any], input_str: str, **kwargs: Any) → None[source]¶ Do nothing when tool starts. Examples using ArgillaCallbackHandler¶ Argilla
https://api.python.langchain.com/en/latest/callbacks/langchain_community.callbacks.argilla_callback.ArgillaCallbackHandler.html