Change the way, memory is logged.

This commit is contained in:
OK 2024-03-17 12:08:00 +01:00
parent 36190745c9
commit 3bdf9d03c6
3 changed files with 3 additions and 2 deletions

View File

@ -163,6 +163,7 @@ class AIResponder(AIResponderBase):
if self.memory_file.exists(): if self.memory_file.exists():
with open(self.memory_file, 'rb') as fd: with open(self.memory_file, 'rb') as fd:
self.memory = pickle.load(fd) self.memory = pickle.load(fd)
logging.info(f'memmory:\n{self.memory}')
def message(self, message: AIMessage, limit: Optional[int] = None) -> List[Dict[str, Any]]: def message(self, message: AIMessage, limit: Optional[int] = None) -> List[Dict[str, Any]]:
messages = [] messages = []

View File

@ -121,14 +121,14 @@ class OpenAIResponder(AIResponder, LeonardoAIDrawMixIn):
f'The whole memory should not be too long, summarize if required. ' f'The whole memory should not be too long, summarize if required. '
f'Write just new memory data without any comments.'}] f'Write just new memory data without any comments.'}]
try: try:
logging.info(f'send this memory request:\n{pp(messages)}') # logging.info(f'send this memory request:\n{pp(messages)}')
result = await openai_chat(self.client, result = await openai_chat(self.client,
model=self.config['memory-model'], model=self.config['memory-model'],
messages=messages, messages=messages,
temperature=0.6, temperature=0.6,
max_tokens=4096) max_tokens=4096)
new_memory = result.choices[0].message.content new_memory = result.choices[0].message.content
logging.info(f'new memory:\n{pp(new_memory)}') logging.info(f'new memory:\n{new_memory}')
return new_memory return new_memory
except Exception as err: except Exception as err:
logging.warning(f"failed to create new memory: {repr(err)}") logging.warning(f"failed to create new memory: {repr(err)}")

Binary file not shown.