feat: Add orm for Tools and clean up Tool logic (#1935)

This commit is contained in:
Matthew Zhou
2024-10-25 14:25:40 -07:00
committed by GitHub
parent 150240c7a7
commit d74406af41
37 changed files with 833 additions and 789 deletions

View File

@@ -133,6 +133,7 @@ def run(
# read user id from config
ms = MetadataStore(config)
client = create_client()
server = client.server
# determine agent to use, if not provided
if not yes and not agent:
@@ -217,7 +218,9 @@ def run(
)
# create agent
tools = [ms.get_tool(tool_name, user_id=client.user_id) for tool_name in agent_state.tools]
tools = [
server.tool_manager.get_tool_by_name_and_user_id(tool_name=tool_name, user_id=client.user_id) for tool_name in agent_state.tools
]
letta_agent = Agent(agent_state=agent_state, interface=interface(), tools=tools)
else: # create new agent
@@ -297,7 +300,7 @@ def run(
)
assert isinstance(agent_state.memory, Memory), f"Expected Memory, got {type(agent_state.memory)}"
typer.secho(f"-> 🛠️ {len(agent_state.tools)} tools: {', '.join([t for t in agent_state.tools])}", fg=typer.colors.WHITE)
tools = [ms.get_tool(tool_name, user_id=client.user_id) for tool_name in agent_state.tools]
tools = [server.tool_manager.get_tool_by_name_and_user_id(tool_name, user_id=client.user_id) for tool_name in agent_state.tools]
letta_agent = Agent(
interface=interface(),