LLMIFY THIS MOFO
CI / Test (push) Successful in 46s

This commit is contained in:
2026-09-01 01:36:17 -04:00
parent dad09d1109
commit 034ee026b1
18 changed files with 318 additions and 41 deletions
+1 -1
View File
@@ -35,7 +35,7 @@ func NewOpenAIAdapter(endpoint *provider.EndpointConfig, apiKey, model, lang str
if endpoint != nil && endpoint.BaseURL != "" {
// use custom endpoint
clientConfig := openai.DefaultConfig(apiKey)
clientConfig.BaseURL = endpoint.BaseURL + "/v1"
clientConfig.BaseURL = strings.TrimRight(endpoint.BaseURL, "/") + "/v1"
client = openai.NewClientWithConfig(clientConfig)
} else {
// default to OpenAI
+19 -2
View File
@@ -31,8 +31,9 @@ type Config struct {
Language string
Model string
Keywords []string
Threads int // CPU threads for local transcription (0 = auto)
Streaming bool // use streaming mode if model supports it
Threads int // CPU threads for local transcription (0 = auto)
Streaming bool // use streaming mode if model supports it
BaseURL string // OpenAI-compatible base URL, without /v1
}
// NewTranscriber creates a new transcriber based on model metadata
@@ -55,6 +56,22 @@ func NewTranscriber(config Config) (Transcriber, error) {
return nil, fmt.Errorf("%s API key required", cases.Title(language.English).String(registryProvider))
}
// llama-swap proxies arbitrary OpenAI-compatible model IDs, so models are
// intentionally configured by the user rather than limited to this registry.
if registryProvider == provider.ProviderLlamaSwap {
if config.Model == "" {
return nil, fmt.Errorf("model is required for llama-swap")
}
if config.BaseURL == "" {
return nil, fmt.Errorf("llama-swap base_url required")
}
if config.Streaming {
return nil, fmt.Errorf("llama-swap transcription currently supports batch mode only (set streaming = false)")
}
endpoint := &provider.EndpointConfig{BaseURL: config.BaseURL}
return NewSimpleTranscriber(config, NewOpenAIAdapter(endpoint, config.APIKey, config.Model, config.Language, config.Keywords, registryProvider)), nil
}
// lookup model from provider
model, err := provider.GetModel(registryProvider, config.Model)
if err != nil {