From 15659c57a0336ea9dff974b69f831ec5dddb5efc Mon Sep 17 00:00:00 2001 From: Dmitry Paramonov Date: Fri, 20 Dec 2024 12:37:19 +0300 Subject: [PATCH] chore: Move queries to another folder --- .../{models => queries}/tools/__init__.py | 0 .../{models => queries}/tools/create_tools.py | 21 +++++++++---------- .../{models => queries}/tools/delete_tool.py | 0 .../{models => queries}/tools/get_tool.py | 0 .../tools/get_tool_args_from_metadata.py | 0 .../{models => queries}/tools/list_tools.py | 0 .../{models => queries}/tools/patch_tool.py | 0 .../{models => queries}/tools/update_tool.py | 0 8 files changed, 10 insertions(+), 11 deletions(-) rename agents-api/agents_api/{models => queries}/tools/__init__.py (100%) rename agents-api/agents_api/{models => queries}/tools/create_tools.py (89%) rename agents-api/agents_api/{models => queries}/tools/delete_tool.py (100%) rename agents-api/agents_api/{models => queries}/tools/get_tool.py (100%) rename agents-api/agents_api/{models => queries}/tools/get_tool_args_from_metadata.py (100%) rename agents-api/agents_api/{models => queries}/tools/list_tools.py (100%) rename agents-api/agents_api/{models => queries}/tools/patch_tool.py (100%) rename agents-api/agents_api/{models => queries}/tools/update_tool.py (100%) diff --git a/agents-api/agents_api/models/tools/__init__.py b/agents-api/agents_api/queries/tools/__init__.py similarity index 100% rename from agents-api/agents_api/models/tools/__init__.py rename to agents-api/agents_api/queries/tools/__init__.py diff --git a/agents-api/agents_api/models/tools/create_tools.py b/agents-api/agents_api/queries/tools/create_tools.py similarity index 89% rename from agents-api/agents_api/models/tools/create_tools.py rename to agents-api/agents_api/queries/tools/create_tools.py index 578a1268d..0d2e0984c 100644 --- a/agents-api/agents_api/models/tools/create_tools.py +++ b/agents-api/agents_api/queries/tools/create_tools.py @@ -1,18 +1,18 @@ """This module contains functions for creating tools in the CozoDB database.""" +import sqlvalidator from typing import Any, TypeVar from uuid import UUID from beartype import beartype from fastapi import HTTPException -from pycozo.client import QueryException from pydantic import ValidationError from uuid_extensions import uuid7 from ...autogen.openapi_model import CreateToolRequest, Tool from ...metrics.counters import increase_counter from ..utils import ( - cozo_query, + pg_query, partialclass, rewrap_exceptions, verify_developer_id_query, @@ -24,14 +24,13 @@ T = TypeVar("T") -@rewrap_exceptions( - { - QueryException: partialclass(HTTPException, status_code=400), - ValidationError: partialclass(HTTPException, status_code=400), - TypeError: partialclass(HTTPException, status_code=400), - AssertionError: partialclass(HTTPException, status_code=400), - } -) +# @rewrap_exceptions( +# { +# ValidationError: partialclass(HTTPException, status_code=400), +# TypeError: partialclass(HTTPException, status_code=400), +# AssertionError: partialclass(HTTPException, status_code=400), +# } +# ) @wrap_in_class( Tool, transform=lambda d: { @@ -41,7 +40,7 @@ }, _kind="inserted", ) -@cozo_query +@pg_query @increase_counter("create_tools") @beartype def create_tools( diff --git a/agents-api/agents_api/models/tools/delete_tool.py b/agents-api/agents_api/queries/tools/delete_tool.py similarity index 100% rename from agents-api/agents_api/models/tools/delete_tool.py rename to agents-api/agents_api/queries/tools/delete_tool.py diff --git a/agents-api/agents_api/models/tools/get_tool.py b/agents-api/agents_api/queries/tools/get_tool.py similarity index 100% rename from agents-api/agents_api/models/tools/get_tool.py rename to agents-api/agents_api/queries/tools/get_tool.py diff --git a/agents-api/agents_api/models/tools/get_tool_args_from_metadata.py b/agents-api/agents_api/queries/tools/get_tool_args_from_metadata.py similarity index 100% rename from agents-api/agents_api/models/tools/get_tool_args_from_metadata.py rename to agents-api/agents_api/queries/tools/get_tool_args_from_metadata.py diff --git a/agents-api/agents_api/models/tools/list_tools.py b/agents-api/agents_api/queries/tools/list_tools.py similarity index 100% rename from agents-api/agents_api/models/tools/list_tools.py rename to agents-api/agents_api/queries/tools/list_tools.py diff --git a/agents-api/agents_api/models/tools/patch_tool.py b/agents-api/agents_api/queries/tools/patch_tool.py similarity index 100% rename from agents-api/agents_api/models/tools/patch_tool.py rename to agents-api/agents_api/queries/tools/patch_tool.py diff --git a/agents-api/agents_api/models/tools/update_tool.py b/agents-api/agents_api/queries/tools/update_tool.py similarity index 100% rename from agents-api/agents_api/models/tools/update_tool.py rename to agents-api/agents_api/queries/tools/update_tool.py