agent build
This commit is contained in:
33
go-api/internal/gateway/routing.go
Normal file
33
go-api/internal/gateway/routing.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package gateway
|
||||
|
||||
import (
|
||||
"github.com/anthropics/anthropic-sdk-go"
|
||||
|
||||
"github.com/krow/krow-backend/go-api/internal/config"
|
||||
)
|
||||
|
||||
// FromConfig builds the gateway's routing table from validated settings.
|
||||
//
|
||||
// The effort per tier is fixed here rather than configured, and that is the
|
||||
// point of the function existing at all: a deployment chooses *which model*
|
||||
// answers a tier, and the platform chooses *how hard it thinks*. If a
|
||||
// deployment could redefine effort, two installations running the same
|
||||
// definition would disagree about what "deep" means while both reporting the
|
||||
// tier as deep — and the tier is written into every trajectory.
|
||||
//
|
||||
// fast → low a lookup, a restatement, a short structured reading
|
||||
// balanced → high the default, and what most turns should cost
|
||||
// deep → xhigh a turn worth several tool calls and real deliberation
|
||||
//
|
||||
// `max` is deliberately not reachable from a spec. It is the setting for when
|
||||
// correctness matters more than cost, which is a judgement an operator makes
|
||||
// about a deployment, not one an agent author makes about a page.
|
||||
func FromConfig(c config.ModelConfig) Config {
|
||||
return Config{
|
||||
APIKey: c.APIKey,
|
||||
Fast: Routing{Model: c.Fast, Effort: anthropic.OutputConfigEffortLow},
|
||||
Balanced: Routing{Model: c.Balanced, Effort: anthropic.OutputConfigEffortHigh},
|
||||
Deep: Routing{Model: c.Deep, Effort: anthropic.OutputConfigEffortXhigh},
|
||||
MaxOutputTokens: int64(c.MaxOutputTokens),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user