Capture provider policy in backend execution targets
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"go.maximumdirect.net/promptkit/internal/defaults"
|
||||
"go.maximumdirect.net/promptkit/internal/domain"
|
||||
"go.maximumdirect.net/promptkit/internal/jsonvalue"
|
||||
"go.maximumdirect.net/promptkit/internal/llm"
|
||||
profilepkg "go.maximumdirect.net/promptkit/internal/profile"
|
||||
"go.maximumdirect.net/promptkit/internal/settings"
|
||||
)
|
||||
@@ -36,7 +37,7 @@ func (state *loaded) buildExecutionProfiles(config *settings.Settings) error {
|
||||
}
|
||||
|
||||
func captureBackend(id string, config backendConfig) domain.Backend {
|
||||
definition := domain.Backend{ID: id, ExtraParams: config.ExtraParams}
|
||||
definition := domain.Backend{ID: id, Provider: llm.EffectiveProvider(valueOrZero(config.Provider)), ZeroCost: valueOrZero(config.ZeroCost), ExtraParams: config.ExtraParams}
|
||||
if config.SmokeTests != nil {
|
||||
smokeTests := &domain.BackendSmokeTestConfig{DefaultProfile: config.SmokeTests.DefaultProfile}
|
||||
if config.SmokeTests.Reachability != nil {
|
||||
@@ -67,6 +68,7 @@ func captureBackend(id string, config backendConfig) domain.Backend {
|
||||
|
||||
func captureExecutionProfile(id string, config profileConfig, backends map[string]domain.Backend) (domain.ExecutionProfile, error) {
|
||||
target := defaults.ExecutionTargetDefault()
|
||||
target.Provider = llm.EffectiveProvider("")
|
||||
if config.Backend != nil && *config.Backend != "" {
|
||||
// These defaults are capture-owned and immutable. Public and runtime
|
||||
// lookups still detach mutable values; profile overlays copy before merging.
|
||||
@@ -75,6 +77,8 @@ func captureExecutionProfile(id string, config profileConfig, backends map[strin
|
||||
return domain.ExecutionProfile{}, fmt.Errorf("profile %q backend: %w: %q", id, backend.ErrBackendNotFound, *config.Backend)
|
||||
}
|
||||
target.BackendID = selected.ID
|
||||
target.Provider = selected.Provider
|
||||
target.ZeroCost = selected.ZeroCost
|
||||
target.Endpoint = selected.Endpoint
|
||||
target.APIKeyEnv = selected.APIKeyEnv
|
||||
target.ExtraParams = selected.ExtraParams
|
||||
|
||||
Reference in New Issue
Block a user