From 11c5c8921b3380096e5a4f2db7ed29ba37672879 Mon Sep 17 00:00:00 2001 From: John Costa Date: Wed, 9 Apr 2025 15:23:51 +0100 Subject: [PATCH] feat(orchestrator): async processing and ending the loop3 --- backend/agents/orchestrator.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/agents/orchestrator.go b/backend/agents/orchestrator.go index a7577a7..430699c 100644 --- a/backend/agents/orchestrator.go +++ b/backend/agents/orchestrator.go @@ -103,6 +103,8 @@ func (agent OrchestratorAgent) Orchestrate(userId uuid.UUID, imageId uuid.UUID, ToolChoice: &toolChoice, Tools: &tools, + EndToolCall: "defaultAgent", + Chat: &client.Chat{ Messages: make([]client.ChatMessage, 0), }, @@ -123,7 +125,7 @@ func (agent OrchestratorAgent) Orchestrate(userId uuid.UUID, imageId uuid.UUID, UserId: userId, } - return agent.client.Process(toolHandlerInfo, &request) + return agent.client.ToolLoop(toolHandlerInfo, &request) } func NewOrchestratorAgent(eventLocationAgent EventLocationAgent, noteAgent NoteAgent, imageName string, imageData []byte) (OrchestratorAgent, error) { @@ -136,7 +138,7 @@ func NewOrchestratorAgent(eventLocationAgent EventLocationAgent, noteAgent NoteA // We need a way to keep track of this async? // Probably just a DB, because we don't want to wait. The orchistrator shouldnt wait for this stuff to finish. - eventLocationAgent.GetLocations(info.UserId, info.ImageId, imageName, imageData) + go eventLocationAgent.GetLocations(info.UserId, info.ImageId, imageName, imageData) return Status{ Ok: true, @@ -144,7 +146,7 @@ func NewOrchestratorAgent(eventLocationAgent EventLocationAgent, noteAgent NoteA }) agent.ToolHandler.AddTool("noteAgent", func(info client.ToolHandlerInfo, args string, call client.ToolCall) (any, error) { - noteAgent.GetNotes(info.UserId, info.ImageId, imageName, imageData) + go noteAgent.GetNotes(info.UserId, info.ImageId, imageName, imageData) return Status{ Ok: true,