Use native request execution and credential masking
This commit is contained in:
@@ -4,58 +4,11 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
ck "gitea.maximumdirect.net/eric/ConfigKit"
|
||||
"gitea.maximumdirect.net/eric/audita/v3/internal/core/config"
|
||||
"gitea.maximumdirect.net/eric/audita/v3/internal/core/redaction"
|
||||
ck "go.maximumdirect.net/configkit"
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
type selectedProfileView struct {
|
||||
ID string `yaml:"id"`
|
||||
Backend string `yaml:"backend"`
|
||||
Model string `yaml:"model"`
|
||||
Temperature float64 `yaml:"temperature"`
|
||||
MaxTokens int `yaml:"max_tokens"`
|
||||
TopP float64 `yaml:"top_p"`
|
||||
TimeoutSeconds int `yaml:"timeout_seconds"`
|
||||
ServiceTier string `yaml:"service_tier,omitempty"`
|
||||
ReasoningEffort string `yaml:"reasoning_effort,omitempty"`
|
||||
}
|
||||
|
||||
// SelectedProfilesYAML exposes selected controls without endpoint, credential,
|
||||
// or arbitrary extra provider parameters.
|
||||
func (r *Runtime) SelectedProfilesYAML() ([]byte, error) {
|
||||
if r == nil {
|
||||
return nil, fmt.Errorf("LLM runtime is unavailable")
|
||||
}
|
||||
view := func(role string) (selectedProfileView, error) {
|
||||
profile, ok := r.Profiles[role]
|
||||
if !ok {
|
||||
return selectedProfileView{}, fmt.Errorf("%s profile is unavailable", role)
|
||||
}
|
||||
target := profile.EffectiveModelParams
|
||||
return selectedProfileView{ID: profile.ProfileID, Backend: target.BackendID, Model: target.Model,
|
||||
Temperature: target.Temperature, MaxTokens: target.MaxTokens, TopP: target.TopP,
|
||||
TimeoutSeconds: target.TimeoutSeconds, ServiceTier: target.ServiceTier, ReasoningEffort: target.ReasoningEffort}, nil
|
||||
}
|
||||
proposal, err := view("proposal")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
validation, err := view("validation")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
raw, err := yaml.Marshal(struct {
|
||||
Proposal selectedProfileView `yaml:"proposal"`
|
||||
Validation selectedProfileView `yaml:"validation"`
|
||||
}{proposal, validation})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return redaction.New(ConfiguredSecrets(&r.Config)).YAML(raw)
|
||||
}
|
||||
|
||||
type derivationView struct {
|
||||
Operation ck.ChangeKind `yaml:"operation"`
|
||||
Reason string `yaml:"reason"`
|
||||
|
||||
Reference in New Issue
Block a user