mirror of
https://github.com/Ed1s0nZ/CyberStrikeAI.git
synced 2026-11-23 04:41:41 +01:00
test(ai): cover idempotent effective context budget
This commit is contained in:
1 parent
0d97169d07
commit
77711616b2
1 file changed
+22
@@ -290,6 +290,28 @@ func TestEffectiveEinoMiddlewareForChannelAutoUnchanged(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithEffectiveContextBudgetIsIdempotent(t *testing.T) {
|
||||
t.Parallel()
|
||||
cfg := &Config{
|
||||
OpenAI: OpenAIConfig{ContextWindow: 131072, ContextProfile: "local", MaxTotalTokens: 120000},
|
||||
MultiAgent: MultiAgentConfig{
|
||||
EinoMiddleware: MultiAgentEinoMiddlewareConfig{
|
||||
SummarizationTriggerRatio: 0.9,
|
||||
SummarizationOutputReserveTokens: 40960,
|
||||
ToolSearchAlwaysVisibleTools: []string{"read_file", "webshell_exec"},
|
||||
},
|
||||
},
|
||||
}
|
||||
once := cfg.WithEffectiveContextBudget()
|
||||
twice := once.WithEffectiveContextBudget()
|
||||
if !reflect.DeepEqual(once.OpenAI, twice.OpenAI) {
|
||||
t.Fatalf("OpenAI not idempotent: %#v vs %#v", once.OpenAI, twice.OpenAI)
|
||||
}
|
||||
if !reflect.DeepEqual(once.MultiAgent.EinoMiddleware, twice.MultiAgent.EinoMiddleware) {
|
||||
t.Fatalf("middleware not idempotent: %#v vs %#v", once.MultiAgent.EinoMiddleware, twice.MultiAgent.EinoMiddleware)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithEffectiveContextBudgetDoesNotMutateSource(t *testing.T) {
|
||||
t.Parallel()
|
||||
cfg := &Config{
|
||||
|
||||
Reference in new issue
Block a user