Resolve authentication diagnostics by provider

This commit is contained in:
2026-11-22 18:16:13 +00:00
parent adc700f96e
commit ca8cf1b827
10 changed files with 123 additions and 38 deletions

View File

@@ -1,5 +1,7 @@
package llm
import "go.maximumdirect.net/promptkit/internal/domain"
// EffectiveProvider resolves an omitted provider to the generic conventions.
func EffectiveProvider(provider string) string {
if provider == "" {
@@ -18,3 +20,28 @@ func SupportedProvider(provider string) bool {
return false
}
}
// AuthenticationAdapter selects declared diagnostic metadata or provider defaults.
func AuthenticationAdapter(provider string, smoke *domain.BackendSmokeTestConfig) string {
if smoke != nil && smoke.Authentication != nil && smoke.Authentication.Kind != nil {
return *smoke.Authentication.Kind
}
if provider == "openrouter" {
return "openrouter_key"
}
return ""
}
// AuthenticationEndpoint resolves a diagnostic destination without changing configuration.
func AuthenticationEndpoint(adapter, base string, smoke *domain.BackendSmokeTestConfig) (string, error) {
if smoke != nil && smoke.Authentication != nil && smoke.Authentication.Endpoint != nil {
return *smoke.Authentication.Endpoint, nil
}
if adapter == "openrouter_key" {
return OpenRouterKeyEndpoint(base)
}
return base, nil
}
// SupportedAuthenticationAdapter identifies implemented authentication probes.
func SupportedAuthenticationAdapter(adapter string) bool { return adapter == "openrouter_key" }