From cd6f5402e61bc675789bad20776d5a48a22a50c4 Mon Sep 17 00:00:00 2001 From: whiterabbit1983 Date: Thu, 2 May 2024 21:12:33 +0300 Subject: [PATCH] Agent creation fixes (#309) * fix: Convert preset to string * fix: Fallback to an empty list if there are not instructions --- agents-api/agents_api/models/agent/create_agent.py | 3 +++ agents-api/agents_api/routers/agents/routers.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/agents-api/agents_api/models/agent/create_agent.py b/agents-api/agents_api/models/agent/create_agent.py index d065cee77..860c9f268 100644 --- a/agents-api/agents_api/models/agent/create_agent.py +++ b/agents-api/agents_api/models/agent/create_agent.py @@ -39,6 +39,9 @@ def create_agent_query( pd.DataFrame: A DataFrame containing the results of the query execution. """ + preset = default_settings["preset"] + default_settings["preset"] = getattr(preset, "value", preset) + settings_cols, settings_vals = cozo_process_mutate_data( { **default_settings, diff --git a/agents-api/agents_api/routers/agents/routers.py b/agents-api/agents_api/routers/agents/routers.py index f8071d026..3ae11df97 100644 --- a/agents-api/agents_api/routers/agents/routers.py +++ b/agents-api/agents_api/routers/agents/routers.py @@ -227,7 +227,7 @@ async def create_agent( developer_id=x_developer_id, name=request.name, about=request.about, - instructions=request.instructions, + instructions=request.instructions or [], model=request.model, default_settings=( request.default_settings or AgentDefaultSettings()