Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mattzh72 committed Dec 3, 2024
1 parent 5aa35ed commit 9502b13
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions letta/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -1728,15 +1728,15 @@ def link_block_to_agent_memory(self, user_id: str, agent_id: str, block_id: str)
self.blocks_agents_manager.add_block_to_agent(agent_id, block_id, block_label=block.label)

# get agent memory
memory = self.load_agent(agent_id=agent_id).agent_state.memory
memory = self.get_agent(agent_id=agent_id).memory
return memory

def unlink_block_from_agent_memory(self, user_id: str, agent_id: str, block_label: str, delete_if_no_ref: bool = True) -> Memory:
"""Unlink a block from an agent's memory. If the block is not linked to any agent, delete it."""
self.blocks_agents_manager.remove_block_with_label_from_agent(agent_id=agent_id, block_label=block_label)

# get agent memory
memory = self.load_agent(agent_id=agent_id).agent_state.memory
memory = self.get_agent(agent_id=agent_id).memory
return memory

def update_agent_memory_limit(self, user_id: str, agent_id: str, block_label: str, limit: int) -> Memory:
Expand All @@ -1746,7 +1746,7 @@ def update_agent_memory_limit(self, user_id: str, agent_id: str, block_label: st
block_id=block.id, block_update=BlockUpdate(limit=limit), actor=self.user_manager.get_user_by_id(user_id=user_id)
)
# get agent memory
memory = self.load_agent(agent_id=agent_id).agent_state.memory
memory = self.get_agent(agent_id=agent_id).memory
return memory

def upate_block(self, user_id: str, block_id: str, block_update: BlockUpdate) -> Block:
Expand Down
6 changes: 4 additions & 2 deletions tests/helpers/endpoints_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,10 @@ def check_agent_recall_chat_memory(filename: str) -> LettaResponse:
cleanup(client=client, agent_uuid=agent_uuid)

human_name = "BananaBoy"
agent_state = setup_agent(client, filename, memory_human_str=f"The human's name is {human_name}. That is all I know about them so far.")
response = client.user_message(agent_id=agent_state.id, message="Repeat my name back to me. It should be in your core memory.")
agent_state = setup_agent(client, filename, memory_human_str=f"My name is {human_name}.")
response = client.user_message(
agent_id=agent_state.id, message="Repeat my name back to me. You should search in your human memory block."
)

# Basic checks
assert_sanity_checks(response)
Expand Down

0 comments on commit 9502b13

Please sign in to comment.