[Improvement] update LLM memory get function (#1162)

Co-authored-by: Deven Patel <deven298@yahoo.com>
This commit is contained in:
Deven Patel
2024-01-12 12:33:07 +05:30
committed by GitHub
parent f582c1fe25
commit c020e65a50
4 changed files with 46 additions and 12 deletions

View File

@@ -667,8 +667,11 @@ class EmbedChain(JSONSerializable):
# Send anonymous telemetry
self.telemetry.capture(event_name="reset", properties=self._telemetry_props)
def get_history(self, num_rounds: int = 10, display_format: bool = True):
return self.llm.memory.get(app_id=self.config.id, num_rounds=num_rounds, display_format=display_format)
def get_history(self, num_rounds: int = 10, display_format: bool = True, session_id: Optional[str] = "default"):
history = self.llm.memory.get(
app_id=self.config.id, session_id=session_id, num_rounds=num_rounds, display_format=display_format
)
return history
def delete_session_chat_history(self, session_id: str = "default"):
self.llm.memory.delete(app_id=self.config.id, session_id=session_id)