MCPcopy Create free account
hub / github.com/CL-lau/SQL-GPT / ConversationMemory

Class ConversationMemory

utils/message_content.py:21–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19
20
21class ConversationMemory(BaseChatMemory, ABC):
22 def __init__(self, **kwargs: Any):
23 super().__init__(**kwargs)
24 self.conversations = []
25
26 def addConversation(self, question: str, answer: str):
27 conversation = {"question": question, "answer": answer}
28 self.conversations.append(conversation)
29
30 def addQuestion(self, question: str):
31 conversation = {"question": question}
32 self.conversations.append(conversation)
33
34 def addAnswer(self, answer: str):
35 self.conversations[-1]["answer"] = answer
36
37 def covert(self) -> str:
38 return simplejson.dumps(self.conversations)
39
40
41class RoleManage:

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected