Merge PR #1404
This commit is contained in:
commit
adb33b5cfc
2 changed files with 35 additions and 5 deletions
|
|
@ -1431,12 +1431,13 @@ func (al *AgentLoop) selectCandidates(
|
||||||
|
|
||||||
logger.InfoCF("agent", "Model routing: light model selected",
|
logger.InfoCF("agent", "Model routing: light model selected",
|
||||||
map[string]any{
|
map[string]any{
|
||||||
"agent_id": agent.ID,
|
"agent_id": agent.ID,
|
||||||
"light_model": agent.Router.LightModel(),
|
"light_model": agent.Router.LightModel(),
|
||||||
"score": score,
|
"resolved_light_model": agent.LightCandidates[0].Model,
|
||||||
"threshold": agent.Router.Threshold(),
|
"score": score,
|
||||||
|
"threshold": agent.Router.Threshold(),
|
||||||
})
|
})
|
||||||
return agent.LightCandidates, agent.Router.LightModel()
|
return agent.LightCandidates, agent.LightCandidates[0].Model
|
||||||
}
|
}
|
||||||
|
|
||||||
// maybeSummarize triggers summarization if the session history exceeds thresholds.
|
// maybeSummarize triggers summarization if the session history exceeds thresholds.
|
||||||
|
|
|
||||||
|
|
@ -575,6 +575,35 @@ func TestProcessMessage_SwitchModelShowModelConsistency(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestSelectCandidates_UsesResolvedLightModelID(t *testing.T) {
|
||||||
|
al := &AgentLoop{}
|
||||||
|
agent := &AgentInstance{
|
||||||
|
ID: "main",
|
||||||
|
Model: "heavy-alias",
|
||||||
|
Router: routing.New(routing.RouterConfig{
|
||||||
|
LightModel: "light-alias",
|
||||||
|
Threshold: 1.0,
|
||||||
|
}),
|
||||||
|
Candidates: []providers.FallbackCandidate{
|
||||||
|
{Provider: "openai", Model: "gpt-4o"},
|
||||||
|
},
|
||||||
|
LightCandidates: []providers.FallbackCandidate{
|
||||||
|
{Provider: "openai", Model: "qwen2.5:3b"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
candidates, model := al.selectCandidates(agent, "hi", nil)
|
||||||
|
if len(candidates) != 1 {
|
||||||
|
t.Fatalf("len(candidates) = %d, want 1", len(candidates))
|
||||||
|
}
|
||||||
|
if candidates[0].Model != "qwen2.5:3b" {
|
||||||
|
t.Fatalf("candidate model = %q, want %q", candidates[0].Model, "qwen2.5:3b")
|
||||||
|
}
|
||||||
|
if model != "qwen2.5:3b" {
|
||||||
|
t.Fatalf("model = %q, want %q", model, "qwen2.5:3b")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TestToolResult_SilentToolDoesNotSendUserMessage verifies silent tools don't trigger outbound
|
// TestToolResult_SilentToolDoesNotSendUserMessage verifies silent tools don't trigger outbound
|
||||||
func TestToolResult_SilentToolDoesNotSendUserMessage(t *testing.T) {
|
func TestToolResult_SilentToolDoesNotSendUserMessage(t *testing.T) {
|
||||||
tmpDir, err := os.MkdirTemp("", "agent-test-*")
|
tmpDir, err := os.MkdirTemp("", "agent-test-*")
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue