feat(orchestrator): removing the end tool call
fix
This commit is contained in:
@ -1,7 +1,6 @@
|
|||||||
package agents
|
package agents
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"screenmark/screenmark/agents/client"
|
"screenmark/screenmark/agents/client"
|
||||||
|
|
||||||
"github.com/charmbracelet/log"
|
"github.com/charmbracelet/log"
|
||||||
@ -32,7 +31,7 @@ const orchestratorPrompt = `
|
|||||||
|
|
||||||
3. **Final Tool Choice:**
|
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 *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):**
|
**Available Agents (Tools):**
|
||||||
|
|
||||||
@ -40,12 +39,11 @@ const orchestratorPrompt = `
|
|||||||
* **contactAgent**: Use when the image contains some person or contact.
|
* **contactAgent**: Use when the image contains some person or contact.
|
||||||
* **locationAgent**: Use when the image contains some place, location or address.
|
* **locationAgent**: Use when the image contains some place, location or address.
|
||||||
* **eventAgent**: Use when the image contains some event.
|
* **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:**
|
**Execution Rules:**
|
||||||
|
|
||||||
* Call all applicable agents (noteAgent, contactAgent, locationAgent, eventAgent) simultaneously (in parallel).
|
* 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.
|
**Output:** Specify the tool call(s) required based on your final choice.
|
||||||
`
|
`
|
||||||
@ -99,18 +97,6 @@ const orchestratorTools = `
|
|||||||
"required": []
|
"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) {
|
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{
|
return Status{
|
||||||
Ok: true,
|
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) {
|
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{
|
return Status{
|
||||||
Ok: true,
|
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) {
|
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{
|
return Status{
|
||||||
Ok: true,
|
Ok: true,
|
||||||
}, nil
|
}, 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
|
return agent
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user