feat(orchestrator): async processing and ending the loop3
This commit is contained in:
@ -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,
|
||||||
|
Reference in New Issue
Block a user