id
stringlengths
14
16
text
stringlengths
13
2.7k
source
stringlengths
57
178
93c753639227-1
clear() → None[source]¶ Clear memory contents. 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 = ...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.summary_buffer.ConversationSummaryBufferMemory.html
93c753639227-2
Get the namespace of the langchain object. For example, if the class is langchain.llms.openai.OpenAI, then the namespace is [“langchain”, “llms”, “openai”] classmethod is_lc_serializable() → bool¶ Is this class serializable? json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.summary_buffer.ConversationSummaryBufferMemory.html
93c753639227-3
predict_new_summary(messages: List[BaseMessage], existing_summary: str) → str¶ prune() → None[source]¶ Prune buffer if it exceeds max token limit save_context(inputs: Dict[str, Any], outputs: Dict[str, str]) → None[source]¶ Save context from this conversation to buffer. classmethod schema(by_alias: bool = True, ref_tem...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.summary_buffer.ConversationSummaryBufferMemory.html
b3a201120362-0
langchain.memory.chat_message_histories.file.FileChatMessageHistory¶ class langchain.memory.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 Retri...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.file.FileChatMessageHistory.html
191011689acb-0
langchain.memory.chat_message_histories.xata.XataChatMessageHistory¶ class langchain.memory.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 Xata da...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.xata.XataChatMessageHistory.html
56086ef9d707-0
langchain.memory.entity.RedisEntityStore¶ class langchain.memory.entity.RedisEntityStore[source]¶ Bases: BaseEntityStore Redis-backed Entity store. Entities get a TTL of 1 day by default, and that TTL is extended by 3 days every time the entity is read back. Create a new model by parsing and validating input data from ...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.entity.RedisEntityStore.html
56086ef9d707-1
deep – set to True to make a deep copy of the model Returns new model instance delete(key: str) → None[source]¶ Delete entity value from store. dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.entity.RedisEntityStore.html
56086ef9d707-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...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.entity.RedisEntityStore.html
26c918adaf87-0
langchain.memory.entity.ConversationEntityMemory¶ class langchain.memory.entity.ConversationEntityMemory[source]¶ Bases: BaseChatMemory Entity extractor & summarizer memory. Extracts named entities from the recent chat history and generates summaries. With a swappable entity store, persisting entities across conversati...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.entity.ConversationEntityMemory.html
26c918adaf87-1
param entity_extraction_prompt: langchain.schema.prompt_template.BasePromptTemplate = PromptTemplate(input_variables=['history', 'input'], template='You are an AI assistant reading the transcript of a conversation between an AI and a human. Extract all of the proper nouns from the last line of conversation. As a guidel...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.entity.ConversationEntityMemory.html
26c918adaf87-2
trying to improve Langchain\'s interfaces, the UX, its integrations with various products the user might want ... a lot of stuff. I\'m working with Person #2.\nOutput: Langchain, Person #2\nEND OF EXAMPLE\n\nConversation history (for reference only):\n{history}\nLast line of conversation (for extraction):\nHuman: {inpu...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.entity.ConversationEntityMemory.html
26c918adaf87-3
param entity_store: langchain.memory.entity.BaseEntityStore [Optional]¶ param entity_summarization_prompt: langchain.schema.prompt_template.BasePromptTemplate = PromptTemplate(input_variables=['entity', 'history', 'input', 'summary'], template='You are an AI assistant helping a human keep track of facts about relevant ...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.entity.ConversationEntityMemory.html
26c918adaf87-4
Behaves as if Config.extra = ‘allow’ was set since it adds all passed values 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...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.entity.ConversationEntityMemory.html
26c918adaf87-5
classmethod is_lc_serializable() → bool¶ Is this class serializable? 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_defa...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.entity.ConversationEntityMemory.html
26c918adaf87-6
save_context(inputs: Dict[str, Any], outputs: Dict[str, str]) → None[source]¶ Save context from this conversation history to the entity store. Generates a summary for each entity in the entity cache by prompting the model, and saves these summaries to the entity store. classmethod schema(by_alias: bool = True, ref_temp...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.entity.ConversationEntityMemory.html
8bb69abe30b1-0
langchain.memory.entity.UpstashRedisEntityStore¶ class langchain.memory.entity.UpstashRedisEntityStore[source]¶ Bases: BaseEntityStore Upstash Redis backed Entity store. Entities get a TTL of 1 day by default, and that TTL is extended by 3 days every time the entity is read back. Create a new model by parsing and valid...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.entity.UpstashRedisEntityStore.html
8bb69abe30b1-1
delete(key: str) → None[source]¶ Delete entity value from store. 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...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.entity.UpstashRedisEntityStore.html
8bb69abe30b1-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...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.entity.UpstashRedisEntityStore.html
263c5abb87f4-0
langchain.memory.kg.ConversationKGMemory¶ class langchain.memory.kg.ConversationKGMemory[source]¶ Bases: BaseChatMemory Knowledge graph conversation memory. Integrates with external knowledge graph to store and retrieve information about knowledge triples in the conversation. Create a new model by parsing and validatin...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.kg.ConversationKGMemory.html
263c5abb87f4-1
param entity_extraction_prompt: langchain.schema.prompt_template.BasePromptTemplate = PromptTemplate(input_variables=['history', 'input'], template='You are an AI assistant reading the transcript of a conversation between an AI and a human. Extract all of the proper nouns from the last line of conversation. As a guidel...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.kg.ConversationKGMemory.html
263c5abb87f4-2
trying to improve Langchain\'s interfaces, the UX, its integrations with various products the user might want ... a lot of stuff. I\'m working with Person #2.\nOutput: Langchain, Person #2\nEND OF EXAMPLE\n\nConversation history (for reference only):\n{history}\nLast line of conversation (for extraction):\nHuman: {inpu...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.kg.ConversationKGMemory.html
263c5abb87f4-3
param human_prefix: str = 'Human'¶ param input_key: Optional[str] = None¶ param k: int = 2¶ param kg: langchain.graphs.networkx_graph.NetworkxEntityGraph [Optional]¶
lang/api.python.langchain.com/en/latest/memory/langchain.memory.kg.ConversationKGMemory.html
263c5abb87f4-4
param knowledge_extraction_prompt: langchain.schema.prompt_template.BasePromptTemplate = PromptTemplate(input_variables=['history', 'input'], template="You are a networked intelligence helping a human track knowledge triples about all relevant people, things, concepts, etc. and integrating them with your knowledge stor...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.kg.ConversationKGMemory.html
263c5abb87f4-5
mathematician, and scientist who lived in the 17th century.\nPerson #1: The Descartes I'm referring to is a standup comedian and interior designer from Montreal.\nAI: Oh yes, He is a comedian and an interior designer. He has been in the industry for 30 years. His favorite food is baked bean pie.\nLast line of conversat...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.kg.ConversationKGMemory.html
263c5abb87f4-6
param llm: langchain.schema.language_model.BaseLanguageModel [Required]¶ param output_key: Optional[str] = None¶ param return_messages: bool = False¶ param summary_message_cls: Type[langchain.schema.messages.BaseMessage] = <class 'langchain.schema.messages.SystemMessage'>¶ Number of previous utterances to include in th...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.kg.ConversationKGMemory.html
263c5abb87f4-7
deep – set to True to make a deep copy of the model Returns new model instance 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, ex...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.kg.ConversationKGMemory.html
263c5abb87f4-8
classmethod lc_id() → List[str]¶ A unique identifier for this class for serialization purposes. The unique identifier is a list of strings that describes the path to the object. load_memory_variables(inputs: Dict[str, Any]) → Dict[str, Any][source]¶ Return history buffer. classmethod parse_file(path: Union[str, Path], ...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.kg.ConversationKGMemory.html
263c5abb87f4-9
Examples using ConversationKGMemory¶ Conversation Knowledge Graph
lang/api.python.langchain.com/en/latest/memory/langchain.memory.kg.ConversationKGMemory.html
a3040ff311db-0
langchain.memory.chat_message_histories.sql.create_message_model¶ langchain.memory.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 model. Ret...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.sql.create_message_model.html
50b4d0afae28-0
langchain.memory.simple.SimpleMemory¶ class langchain.memory.simple.SimpleMemory[source]¶ Bases: BaseMemory Simple memory for storing context or other information that shouldn’t ever change between prompts. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the inp...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.simple.SimpleMemory.html
50b4d0afae28-1
deep – set to True to make a deep copy of the model Returns new model instance 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, ex...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.simple.SimpleMemory.html
50b4d0afae28-2
The unique identifier is a list of strings that describes the path to the object. load_memory_variables(inputs: Dict[str, Any]) → Dict[str, str][source]¶ Return key-value pairs given the text input to the chain. classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', ...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.simple.SimpleMemory.html
50b4d0afae28-3
property memory_variables: List[str]¶ The string keys this memory class will add to chain inputs.
lang/api.python.langchain.com/en/latest/memory/langchain.memory.simple.SimpleMemory.html
dcaebc956620-0
langchain.memory.summary.ConversationSummaryMemory¶ class langchain.memory.summary.ConversationSummaryMemory[source]¶ Bases: BaseChatMemory, SummarizerMixin Conversation summarizer to chat memory. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data ca...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.summary.ConversationSummaryMemory.html
dcaebc956620-1
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 copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclu...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.summary.ConversationSummaryMemory.html
dcaebc956620-2
Get the namespace of the langchain object. For example, if the class is langchain.llms.openai.OpenAI, then the namespace is [“langchain”, “llms”, “openai”] classmethod is_lc_serializable() → bool¶ Is this class serializable? json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.summary.ConversationSummaryMemory.html
dcaebc956620-3
predict_new_summary(messages: List[BaseMessage], existing_summary: str) → str¶ save_context(inputs: Dict[str, Any], outputs: Dict[str, str]) → None[source]¶ Save context from this conversation to buffer. classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.summary.ConversationSummaryMemory.html
56a0230f443a-0
langchain.memory.combined.CombinedMemory¶ class langchain.memory.combined.CombinedMemory[source]¶ Bases: BaseMemory Combining multiple memories’ data together. 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....
lang/api.python.langchain.com/en/latest/memory/langchain.memory.combined.CombinedMemory.html
56a0230f443a-1
deep – set to True to make a deep copy of the model Returns new model instance 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, ex...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.combined.CombinedMemory.html
56a0230f443a-2
The unique identifier is a list of strings that describes the path to the object. load_memory_variables(inputs: Dict[str, Any]) → Dict[str, str][source]¶ Load all vars from sub-memories. classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, a...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.combined.CombinedMemory.html
56a0230f443a-3
property memory_variables: List[str]¶ All the memory variables that this instance provides. Examples using CombinedMemory¶ Zep Multiple Memory classes
lang/api.python.langchain.com/en/latest/memory/langchain.memory.combined.CombinedMemory.html
40c4a6cd41a4-0
langchain.memory.buffer.ConversationStringBufferMemory¶ class langchain.memory.buffer.ConversationStringBufferMemory[source]¶ Bases: BaseMemory Buffer for storing conversation memory. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data cannot be parse...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.buffer.ConversationStringBufferMemory.html
40c4a6cd41a4-1
deep – set to True to make a deep copy of the model Returns new model instance 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, ex...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.buffer.ConversationStringBufferMemory.html
40c4a6cd41a4-2
The unique identifier is a list of strings that describes the path to the object. load_memory_variables(inputs: Dict[str, Any]) → Dict[str, str][source]¶ Return history buffer. classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickl...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.buffer.ConversationStringBufferMemory.html
c3d25425ca21-0
langchain.memory.chat_message_histories.in_memory.ChatMessageHistory¶ class langchain.memory.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 and val...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.in_memory.ChatMessageHistory.html
c3d25425ca21-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...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.in_memory.ChatMessageHistory.html
c3d25425ca21-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...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.in_memory.ChatMessageHistory.html
a71e242b31cf-0
langchain.memory.chat_message_histories.upstash_redis.UpstashRedisChatMessageHistory¶ class langchain.memory.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 history s...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.upstash_redis.UpstashRedisChatMessageHistory.html
185194f3a878-0
langchain.memory.utils.get_prompt_input_key¶ langchain.memory.utils.get_prompt_input_key(inputs: Dict[str, Any], memory_variables: List[str]) → str[source]¶ Get the prompt input key. Parameters inputs – Dict[str, Any] memory_variables – List[str] Returns A prompt input key.
lang/api.python.langchain.com/en/latest/memory/langchain.memory.utils.get_prompt_input_key.html
2137820817f9-0
langchain.memory.entity.BaseEntityStore¶ class langchain.memory.entity.BaseEntityStore[source]¶ Bases: BaseModel, ABC Abstract base class for Entity store. 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. abs...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.entity.BaseEntityStore.html
2137820817f9-1
abstract delete(key: str) → None[source]¶ Delete entity value from store. 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...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.entity.BaseEntityStore.html
2137820817f9-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...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.entity.BaseEntityStore.html
f3fc0ffa1d98-0
langchain.memory.entity.SQLiteEntityStore¶ class langchain.memory.entity.SQLiteEntityStore[source]¶ Bases: BaseEntityStore SQLite-backed Entity store 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 ses...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.entity.SQLiteEntityStore.html
f3fc0ffa1d98-1
delete(key: str) → None[source]¶ Delete entity value from store. 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...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.entity.SQLiteEntityStore.html
f3fc0ffa1d98-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...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.entity.SQLiteEntityStore.html
13914ff4e577-0
langchain.memory.chat_message_histories.cassandra.CassandraChatMessageHistory¶ class langchain.memory.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 that st...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.cassandra.CassandraChatMessageHistory.html
13914ff4e577-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
lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.cassandra.CassandraChatMessageHistory.html
b0ddb716458f-0
langchain.memory.vectorstore.VectorStoreRetrieverMemory¶ class langchain.memory.vectorstore.VectorStoreRetrieverMemory[source]¶ Bases: BaseMemory VectorStoreRetriever-backed memory. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data cannot be parsed ...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.vectorstore.VectorStoreRetrieverMemory.html
b0ddb716458f-1
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 copy of the model Returns new model instance dict(*, i...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.vectorstore.VectorStoreRetrieverMemory.html
b0ddb716458f-2
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(). classmethod lc_id() → List[str]¶ A unique identifier for this class for serialization purposes. The unique identifier is a ...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.vectorstore.VectorStoreRetrieverMemory.html
b0ddb716458f-3
These attributes must be accepted by the constructor. property lc_secrets: Dict[str, str]¶ A map of constructor argument names to secret ids. For example,{“openai_api_key”: “OPENAI_API_KEY”} property memory_variables: List[str]¶ The list of keys emitted from the load_memory_variables method. Examples using VectorStoreR...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.vectorstore.VectorStoreRetrieverMemory.html
be7214fb8f60-0
langchain.memory.zep_memory.ZepMemory¶ class langchain.memory.zep_memory.ZepMemory[source]¶ Bases: ConversationBufferMemory Persist your chain history to the Zep MemoryStore. The number of messages returned by Zep and when the Zep server summarizes chat histories is configurable. See the Zep documentation for more deta...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.zep_memory.ZepMemory.html
be7214fb8f60-1
“http://localhost:8000”. api_key (Optional[str], optional) – Your Zep API key. Defaults to None. output_key (Optional[str], optional) – The key to use for the output message. Defaults to None. input_key (Optional[str], optional) – The key to use for the input message. Defaults to None. return_messages (bool, optional) ...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.zep_memory.ZepMemory.html
be7214fb8f60-2
Behaves as if Config.extra = ‘allow’ was set since it adds all passed values 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...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.zep_memory.ZepMemory.html
be7214fb8f60-3
classmethod is_lc_serializable() → bool¶ Is this class serializable? 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_defa...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.zep_memory.ZepMemory.html
be7214fb8f60-4
outputs (Dict[str, str]) – The outputs from the chain. metadata (Optional[Dict[str, Any]], optional) – Any metadata to save with the context. Defaults to None Returns None classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias: bool =...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.zep_memory.ZepMemory.html
5c23c5f74ab4-0
langchain.memory.chat_memory.BaseChatMemory¶ class langchain.memory.chat_memory.BaseChatMemory[source]¶ Bases: BaseMemory, ABC Abstract base class for chat memory. 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 mo...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_memory.BaseChatMemory.html
5c23c5f74ab4-1
deep – set to True to make a deep copy of the model Returns new model instance 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, ex...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_memory.BaseChatMemory.html
5c23c5f74ab4-2
The unique identifier is a list of strings that describes the path to the object. abstract load_memory_variables(inputs: Dict[str, Any]) → Dict[str, Any]¶ Return key-value pairs given the text input to the chain. classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8',...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_memory.BaseChatMemory.html
5c23c5f74ab4-3
abstract property memory_variables: List[str]¶ The string keys this memory class will add to chain inputs.
lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_memory.BaseChatMemory.html
b26b86fb3e4d-0
langchain.memory.chat_message_histories.rocksetdb.RocksetChatMessageHistory¶ class langchain.memory.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: ~typi...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.rocksetdb.RocksetChatMessageHistory.html
b26b86fb3e4d-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...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.rocksetdb.RocksetChatMessageHistory.html
b26b86fb3e4d-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...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.rocksetdb.RocksetChatMessageHistory.html
4cc58e6d702e-0
langchain.memory.chat_message_histories.singlestoredb.SingleStoreDBChatMessageHistory¶ class langchain.memory.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 = 'mess...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.singlestoredb.SingleStoreDBChatMessageHistory.html
4cc58e6d702e-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...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.singlestoredb.SingleStoreDBChatMessageHistory.html
4cc58e6d702e-2
Examples Basic Usage: from langchain.memory.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.memory.chat_message_histories import...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.singlestoredb.SingleStoreDBChatMessageHistory.html
4cc58e6d702e-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...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.singlestoredb.SingleStoreDBChatMessageHistory.html
4cc58e6d702e-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...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.singlestoredb.SingleStoreDBChatMessageHistory.html
4cc58e6d702e-5
message_history = SingleStoreDBChatMessageHistory( session_id="my-session", host="https://user:password@127.0.0.1:3306/database" ) Advanced Usage: from langchain.memory.chat_message_histories import ( SingleStoreDBChatMessageHistory ) message_history = SingleStoreDBChatMessageHistory( session_id="my-ses...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.singlestoredb.SingleStoreDBChatMessageHistory.html
939ac6a7ef2c-0
langchain.memory.summary.SummarizerMixin¶ class langchain.memory.summary.SummarizerMixin[source]¶ Bases: BaseModel Mixin for summarizer. 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 ai_prefix: str =...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.summary.SummarizerMixin.html
939ac6a7ef2c-1
Behaves as if Config.extra = ‘allow’ was set since it adds all passed values 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...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.summary.SummarizerMixin.html
939ac6a7ef2c-2
classmethod from_orm(obj: Any) → 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_n...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.summary.SummarizerMixin.html
e24e755eb19b-0
langchain.memory.chat_message_histories.streamlit.StreamlitChatMessageHistory¶ class langchain.memory.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 Streamlit ...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.streamlit.StreamlitChatMessageHistory.html
e102554b6154-0
langchain.memory.chat_message_histories.redis.RedisChatMessageHistory¶ class langchain.memory.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 databa...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.redis.RedisChatMessageHistory.html
b88a18861d6f-0
langchain.memory.chat_message_histories.mongodb.MongoDBChatMessageHistory¶ class langchain.memory.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 histo...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.mongodb.MongoDBChatMessageHistory.html
42ff9277969c-0
langchain.memory.chat_message_histories.sql.BaseMessageConverter¶ class langchain.memory.chat_message_histories.sql.BaseMessageConverter[source]¶ The class responsible for converting BaseMessage to your SQLAlchemy model. Methods __init__() from_sql_model(sql_message) Convert a SQLAlchemy model to a BaseMessage instance...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.sql.BaseMessageConverter.html
243cff31644a-0
langchain.memory.chat_message_histories.dynamodb.DynamoDBChatMessageHistory¶ class langchain.memory.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_session: O...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.dynamodb.DynamoDBChatMessageHistory.html
243cff31644a-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,...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.dynamodb.DynamoDBChatMessageHistory.html
505e6217552b-0
langchain.memory.chat_message_histories.neo4j.Neo4jChatMessageHistory¶ class langchain.memory.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 = 'Session',...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.neo4j.Neo4jChatMessageHistory.html
4958b71a0edd-0
langchain.memory.buffer.ConversationBufferMemory¶ class langchain.memory.buffer.ConversationBufferMemory[source]¶ Bases: BaseChatMemory Buffer for storing conversation memory. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data cannot be parsed to for...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.buffer.ConversationBufferMemory.html
4958b71a0edd-1
deep – set to True to make a deep copy of the model Returns new model instance 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, ex...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.buffer.ConversationBufferMemory.html
4958b71a0edd-2
The unique identifier is a list of strings that describes the path to the object. load_memory_variables(inputs: Dict[str, Any]) → Dict[str, Any][source]¶ Return history buffer. classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickl...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.buffer.ConversationBufferMemory.html
4958b71a0edd-3
These attributes must be accepted by the constructor. property lc_secrets: Dict[str, str]¶ A map of constructor argument names to secret ids. For example,{“openai_api_key”: “OPENAI_API_KEY”} Examples using ConversationBufferMemory¶ Gradio SceneXplain Xata chat memory Streamlit Chat Message History Dynamodb Chat Message...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.buffer.ConversationBufferMemory.html
814ef8553629-0
langchain.memory.chat_message_histories.elasticsearch.ElasticsearchChatMessageHistory¶ class langchain.memory.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] = Non...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.elasticsearch.ElasticsearchChatMessageHistory.html
814ef8553629-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]...
lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.elasticsearch.ElasticsearchChatMessageHistory.html
087854c5a7d5-0
langchain.schema.runnable.utils.IsLocalDict¶ class langchain.schema.runnable.utils.IsLocalDict(name: str, keys: Set[str])[source]¶ Check if a name is a local dict. Methods __init__(name, keys) generic_visit(node) Called if no explicit visitor function exists for a node. visit(node) Visit a node. visit_Call(node) visit_...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.utils.IsLocalDict.html
b34114f8a8eb-0
langchain.schema.runnable.utils.get_function_first_arg_dict_keys¶ langchain.schema.runnable.utils.get_function_first_arg_dict_keys(func: Callable) → Optional[List[str]][source]¶ Get the keys of the first argument of a function if it is a dict.
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.utils.get_function_first_arg_dict_keys.html
70af02203692-0
langchain.schema.runnable.utils.gated_coro¶ async langchain.schema.runnable.utils.gated_coro(semaphore: Semaphore, coro: Coroutine) → Any[source]¶ Run a coroutine with a semaphore. :param semaphore: The semaphore to use. :param coro: The coroutine to run. Returns The result of the coroutine.
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.utils.gated_coro.html
b124fe321890-0
langchain.schema.runnable.utils.indent_lines_after_first¶ langchain.schema.runnable.utils.indent_lines_after_first(text: str, prefix: str) → str[source]¶ Indent all lines of text after the first line. Parameters text – The text to indent prefix – Used to determine the number of spaces to indent Returns The indented tex...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.utils.indent_lines_after_first.html
9646e64f2988-0
langchain.schema.runnable.base.RunnableEachBase¶ class langchain.schema.runnable.base.RunnableEachBase[source]¶ Bases: RunnableSerializable[List[Input], List[Output]] A runnable that delegates calls to another runnable with each element of the input sequence. Use only if creating a new RunnableEach subclass with differ...
lang/api.python.langchain.com/en/latest/schema.runnable/langchain.schema.runnable.base.RunnableEachBase.html