chore: Clean up upserting base tools (#2274)

This commit is contained in:
Matthew Zhou
2024-12-18 14:33:29 -08:00
committed by GitHub
parent 8644f2016a
commit b1ce8b4e8a
10 changed files with 113 additions and 228 deletions

View File

@@ -1,5 +1,5 @@
from letta.functions.functions import parse_source_code
from letta.schemas.tool import Tool
from tqdm import tqdm
from letta.schemas.user import User
from letta.services.organization_manager import OrganizationManager
from letta.services.tool_manager import ToolManager
@@ -10,33 +10,8 @@ def deprecated_tool():
orgs = OrganizationManager().list_organizations(cursor=None, limit=5000)
for org in orgs:
for org in tqdm(orgs):
if org.name != "default":
fake_user = User(id="user-00000000-0000-4000-8000-000000000000", name="fake", organization_id=org.id)
ToolManager().add_base_tools(actor=fake_user)
source_code = parse_source_code(deprecated_tool)
source_type = "python"
description = "deprecated"
tags = ["deprecated"]
ToolManager().create_or_update_tool(
Tool(
name="core_memory_append",
source_code=source_code,
source_type=source_type,
description=description,
),
actor=fake_user,
)
ToolManager().create_or_update_tool(
Tool(
name="core_memory_replace",
source_code=source_code,
source_type=source_type,
description=description,
),
actor=fake_user,
)
ToolManager().upsert_base_tools(actor=fake_user)