From 181da1f09de0fb2ee25e7990d877d04a02b10508 Mon Sep 17 00:00:00 2001 From: John Costa Date: Thu, 17 Apr 2025 13:00:33 +0100 Subject: [PATCH] feat(orchestrator): removing the end tool call fix --- backend/agents/orchestrator.go | 32 +++++--------------------------- 1 file changed, 5 insertions(+), 27 deletions(-) diff --git a/backend/agents/orchestrator.go b/backend/agents/orchestrator.go index 5cf353d..bcde097 100644 --- a/backend/agents/orchestrator.go +++ b/backend/agents/orchestrator.go @@ -1,7 +1,6 @@ package agents import ( - "errors" "screenmark/screenmark/agents/client" "github.com/charmbracelet/log" @@ -32,7 +31,7 @@ const orchestratorPrompt = ` 3. **Final Tool Choice:** * If *at least one* of noteAgent, contactAgent, locationAgent, or eventAgent was selected in Step 2, prepare to call *all* selected agents in parallel. - * If *none* of those four agents were selected after your analysis, you MUST call the noAction agent. + * If *none* of those four agents were selected after your analysis, you must stop. **Available Agents (Tools):** @@ -40,12 +39,11 @@ const orchestratorPrompt = ` * **contactAgent**: Use when the image contains some person or contact. * **locationAgent**: Use when the image contains some place, location or address. * **eventAgent**: Use when the image contains some event. -* **noAction**: Use *only* when you are sure none of the other agents (noteAgent, contactAgent, locationAgent, eventAgent) are applicable to the image. **Execution Rules:** * Call all applicable agents (noteAgent, contactAgent, locationAgent, eventAgent) simultaneously (in parallel). -* If and only if none of the other agents apply, call noAction. Do not call noAction if any other agent is being called. +* If and only if none of the other agents apply, stop. **Output:** Specify the tool call(s) required based on your final choice. ` @@ -99,18 +97,6 @@ const orchestratorTools = ` "required": [] } } - }, - { - "type": "function", - "function": { - "name": "noAction", - "description": "Select this option *only* when a thorough analysis of the image indicates that none of the other specialized agents (noteAgent, contactAgent, locationAgent, eventAgent) are relevant or needed for processing the image content.", - "parameters": { - "type": "object", - "properties": {}, - "required": [] - } - } } ]` @@ -133,7 +119,7 @@ func NewOrchestratorAgent(log *log.Logger, noteAgent NoteAgent, contactAgent cli }) agent.ToolHandler.AddTool("noteAgent", func(info client.ToolHandlerInfo, args string, call client.ToolCall) (any, error) { - // go noteAgent.GetNotes(info.UserId, info.ImageId, imageName, imageData) + go noteAgent.GetNotes(info.UserId, info.ImageId, imageName, imageData) return Status{ Ok: true, @@ -149,7 +135,7 @@ func NewOrchestratorAgent(log *log.Logger, noteAgent NoteAgent, contactAgent cli }) agent.ToolHandler.AddTool("locationAgent", func(info client.ToolHandlerInfo, args string, call client.ToolCall) (any, error) { - // go locationAgent.RunAgent(info.UserId, info.ImageId, imageName, imageData) + go locationAgent.RunAgent(info.UserId, info.ImageId, imageName, imageData) return Status{ Ok: true, @@ -157,20 +143,12 @@ func NewOrchestratorAgent(log *log.Logger, noteAgent NoteAgent, contactAgent cli }) agent.ToolHandler.AddTool("eventAgent", func(info client.ToolHandlerInfo, args string, call client.ToolCall) (any, error) { - // go eventAgent.RunAgent(info.UserId, info.ImageId, imageName, imageData) + go eventAgent.RunAgent(info.UserId, info.ImageId, imageName, imageData) return Status{ Ok: true, }, nil }) - agent.ToolHandler.AddTool("noAction", func(info client.ToolHandlerInfo, args string, call client.ToolCall) (any, error) { - // To nothing - - return Status{ - Ok: true, - }, errors.New("Finished! Kinda bad return type but...") - }) - return agent }