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)[source]¶
Chat message history that stores history in Elasticsearch.
Parameters
es_url – URL of the Elasticsearch instance to connect to.
es_cloud_id – Cloud ID of the Elasticsearch instance to connect to.
es_user – Username to use when connecting to Elasticsearch.
es_password – Password to use when connecting to Elasticsearch.
es_api_key – API key to use when connecting to Elasticsearch.
es_connection – Optional pre-existing Elasticsearch connection.
index – Name of the index to use.
session_id – Arbitrary key that is used to store the messages
of a single chat session.
Attributes
messages
Retrieve the messages from Elasticsearch
Methods
__init__(index, session_id, *[, ...])
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_user_message(message)
Convenience method for adding a human message string to the store.
clear()
Clear session memory in Elasticsearch
connect_to_elasticsearch(*[, es_url, ...])
get_user_agent()