The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
expose memory key name (#808)
Harrison Chasef46f1d28afed
diff --git a/langchain/chains/conversation/memory.py b/langchain/chains/conversation/memory.pyindex 28f3130ba3..cf174436f4 100644--- a/langchain/chains/conversation/memory.py+++ b/langchain/chains/conversation/memory.py@@ -230,12 +230,12 @@ class ConversationEntityMemory(Memory, BaseModel):llm: BaseLLMentity_extraction_prompt: BasePromptTemplate = ENTITY_EXTRACTION_PROMPTentity_summarization_prompt: BasePromptTemplate = ENTITY_SUMMARIZATION_PROMPT- memory_keys: List[str] = ["entities", "history"] #: :meta private:output_key: Optional[str] = Noneinput_key: Optional[str] = Nonestore: Dict[str, Optional[str]] = {}entity_cache: List[str] = []k: int = 3+ chat_history_key: str = "history"@propertydef memory_variables(self) -> List[str]:@@ -243,7 +243,7 @@ class ConversationEntityMemory(Memory, BaseModel)::meta private:"""- return ["entities", "history"]+ return ["entities", self.chat_history_key]def load_memory_variables(self, inputs: Dict[str, Any]) -> Dict[str, Any]:"""Return history buffer."""@@ -265,7 +265,7 @@ class ConversationEntityMemory(Memory, BaseModel):entity_summaries[entity] = self.store.get(entity, "")self.entity_cache = entitiesreturn {- "history": "\n".join(self.buffer[-self.k :]),+ self.chat_history_key: "\n".join(self.buffer[-self.k :]),"entities": entity_summaries,}