Skip to content

Commit

Permalink
Fix offline tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mattzh72 committed Dec 20, 2024
1 parent 4a20ce4 commit ea88617
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions letta/chat_only_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ def generate_offline_memory_agent():
conversation_persona_block_new = Block(
name="chat_agent_persona_new", label="chat_agent_persona_new", value=conversation_persona_block.value, limit=2000
)

recent_convo = "".join([str(message) for message in self.messages[3:]])[-self.recent_convo_limit :]
in_context_messages = self.agent_manager.get_in_context_messages(agent_id=self.agent_state.id, actor=self.user)
recent_convo = "".join([str(message) for message in in_context_messages[3:]])[-self.recent_convo_limit :]
conversation_messages_block = Block(
name="conversation_block", label="conversation_block", value=recent_convo, limit=self.recent_convo_limit
)
Expand Down
4 changes: 3 additions & 1 deletion letta/services/agent_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,9 @@ def rebuild_system_prompt(self, agent_id: str, actor: PydanticUser, force=False,
curr_memory_str = agent_state.memory.compile()
if curr_memory_str in curr_system_message_openai["content"] and not force:
# NOTE: could this cause issues if a block is removed? (substring match would still work)
logger.info(f"Memory hasn't changed, skipping system prompt rebuild")
logger.info(
f"Memory hasn't changed for agent id={agent_id} and actor=({actor.id}, {actor.name}), skipping system prompt rebuild"
)
return agent_state

# If the memory didn't update, we probably don't want to update the timestamp inside
Expand Down

0 comments on commit ea88617

Please sign in to comment.