Orchestrator + Tooling rework #4

Merged
JohnCosta27 merged 17 commits from feat/orchestrator into main 2025-04-09 17:00:53 +01:00
14 changed files with 921 additions and 949 deletions
Showing only changes of commit 1a9b707533 - Show all commits

View File

@ -103,6 +103,8 @@ func (agent OrchestratorAgent) Orchestrate(userId uuid.UUID, imageId uuid.UUID,
ToolChoice: &toolChoice, ToolChoice: &toolChoice,
Tools: &tools, Tools: &tools,
EndToolCall: "defaultAgent",
Chat: &client.Chat{ Chat: &client.Chat{
Messages: make([]client.ChatMessage, 0), Messages: make([]client.ChatMessage, 0),
}, },
@ -123,7 +125,7 @@ func (agent OrchestratorAgent) Orchestrate(userId uuid.UUID, imageId uuid.UUID,
UserId: userId, 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) { 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? // 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. // 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{ return Status{
Ok: true, 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) { 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{ return Status{
Ok: true, Ok: true,