Skip to content

Commit

Permalink
fix: Set metadata to an empty dict by default
Browse files Browse the repository at this point in the history
  • Loading branch information
whiterabbit1983 committed Apr 17, 2024
1 parent 715c6f7 commit 72160ab
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
6 changes: 4 additions & 2 deletions agents-api/agents_api/activities/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ class ChatML(BaseModel):
token_count: Optional[int] = None


class BaseTask(BaseModel): ...
class BaseTask(BaseModel):
...


class BaseTaskArgs(BaseModel): ...
class BaseTaskArgs(BaseModel):
...


class AddPrinciplesTaskArgs(BaseTaskArgs):
Expand Down
6 changes: 4 additions & 2 deletions agents-api/agents_api/clients/worker/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ class ChatML(BaseModel):
token_count: Optional[int] = None


class BaseTask(BaseModel): ...
class BaseTask(BaseModel):
...


class BaseTaskArgs(BaseModel): ...
class BaseTaskArgs(BaseModel):
...


class MemoryManagementTaskArgs(BaseTaskArgs):
Expand Down
2 changes: 1 addition & 1 deletion agents-api/agents_api/models/agent/patch_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def patch_agent_query(
"""
# Construct the query for updating agent information in the database.
# Agent update query
metadata = update_data.pop("metadata", {})
metadata = update_data.pop("metadata", {}) or {}
agent_update_cols, agent_update_vals = cozo_process_mutate_data(
{
**{k: v for k, v in update_data.items() if v is not None},
Expand Down
2 changes: 1 addition & 1 deletion agents-api/agents_api/models/session/patch_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def patch_session_query(
:assert some
"""

metadata = update_data.pop("metadata", {})
metadata = update_data.pop("metadata", {}) or {}

session_update_cols, session_update_vals = cozo_process_mutate_data(
{k: v for k, v in update_data.items() if v is not None}
Expand Down
2 changes: 1 addition & 1 deletion agents-api/agents_api/models/user/patch_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

def patch_user_query(developer_id: UUID, user_id: UUID, **update_data) -> pd.DataFrame:
# Prepare data for mutation by filtering out None values and adding system-generated fields.
metadata = update_data.pop("metadata", {})
metadata = update_data.pop("metadata", {}) or {}
user_update_cols, user_update_vals = cozo_process_mutate_data(
{
**{k: v for k, v in update_data.items() if v is not None},
Expand Down

0 comments on commit 72160ab

Please sign in to comment.