fix: Add remove tool from Agent API (#1714)

This commit is contained in:
Charles Packer
2024-09-05 11:06:31 -07:00
committed by GitHub
parent 35ebaef721
commit f7fdf7cc8f
2 changed files with 1 additions and 22 deletions

View File

@@ -24,7 +24,7 @@ def setup_user_tools_index_router(server: SyncServer, interface: QueuingInterfac
"""
# Clear the interface
interface.clear()
server.delete_tool(id)
server.delete_tool(tool_id)
@router.get("/tools/{tool_id}", tags=["tools"], response_model=Tool)
async def get_tool(

View File

@@ -780,27 +780,6 @@ class SyncServer(Server):
# TODO: probably reload the agent somehow?
return memgpt_agent.agent_state
def delete_agent(
self,
user_id: str,
agent_id: str,
):
# TODO: delete agent data
if self.ms.get_user(user_id=user_id) is None:
raise ValueError(f"User user_id={user_id} does not exist")
if self.ms.get_agent(agent_id=agent_id, user_id=user_id) is None:
raise ValueError(f"Agent agent_id={agent_id} does not exist")
# TODO: delete related tables (recall/archival memory)
# TODO: Make sure the user owns the agent
# TODO: consider clean up any blocks associated with this agent
# and no other agents (e.g. not templates, but not used as shared blocks either)
agent = self.ms.get_agent(agent_id=agent_id, user_id=user_id)
if agent is not None:
self.ms.delete_agent(agent_id=agent_id)
def _agent_state_to_config(self, agent_state: AgentState) -> dict:
"""Convert AgentState to a dict for a JSON response"""
assert agent_state is not None