Skip to content

Commit

Permalink
Fix tool output endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Frank committed Nov 13, 2024
1 parent 0a2fbd3 commit e4a3cec
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions swarm_copy/app/routers/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,16 @@ async def get_tool_returns(
select(Messages)
.where(
Messages.thread_id == thread_id,
Messages.entity == Entity.AI_TOOL,
Messages.entity == Entity.TOOL,
)
.order_by(Messages.order)
)
tool_messages = messages_result.scalars().all()

tool_output = []
for msg in tool_messages:
if json.loads(msg.content).get("tool_call_id") == tool_call_id:
tool_output.append(json.loads(msg.content))
msg_content = json.loads(msg.content)
if msg_content.get("tool_call_id") == tool_call_id:
tool_output.append(msg_content)

return tool_output

0 comments on commit e4a3cec

Please sign in to comment.