Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
whiterabbit1983 committed Dec 23, 2024
1 parent 5e94d33 commit 0252a88
Showing 1 changed file with 9 additions and 24 deletions.
33 changes: 9 additions & 24 deletions agents-api/agents_api/queries/tools/get_tool_args_from_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,9 @@
from uuid import UUID

from beartype import beartype
from fastapi import HTTPException
from pycozo.client import QueryException
from pydantic import ValidationError

from ..utils import (
cozo_query,
partialclass,
rewrap_exceptions,
verify_developer_id_query,
verify_developer_owns_resource_query,
pg_query,
wrap_in_class,
)

Expand Down Expand Up @@ -51,10 +44,6 @@ def tool_args_for_task(
"""

queries = [
verify_developer_id_query(developer_id),
verify_developer_owns_resource_query(
developer_id, "tasks", task_id=task_id, parents=[("agents", "agent_id")]
),
get_query,
]

Expand Down Expand Up @@ -95,25 +84,21 @@ def tool_args_for_session(
"""

queries = [
verify_developer_id_query(developer_id),
verify_developer_owns_resource_query(
developer_id, "sessions", session_id=session_id
),
get_query,
]

return (queries, {"agent_id": agent_id, "session_id": session_id})


@rewrap_exceptions(
{
QueryException: partialclass(HTTPException, status_code=400),
ValidationError: partialclass(HTTPException, status_code=400),
TypeError: partialclass(HTTPException, status_code=400),
}
)
# @rewrap_exceptions(
# {
# QueryException: partialclass(HTTPException, status_code=400),
# ValidationError: partialclass(HTTPException, status_code=400),
# TypeError: partialclass(HTTPException, status_code=400),
# }
# )
@wrap_in_class(dict, transform=lambda x: x["values"], one=True)
@cozo_query
@pg_query
@beartype
def get_tool_args_from_metadata(
*,
Expand Down

0 comments on commit 0252a88

Please sign in to comment.