Allow custom headers on OpenAI providers (to be added to more later)
This commit is contained in:
@@ -31,11 +31,12 @@ type Config struct {
|
||||
Tools []string `yaml:"tools"`
|
||||
} `yaml:"agents"`
|
||||
Providers []*struct {
|
||||
Name string `yaml:"name,omitempty"`
|
||||
Kind string `yaml:"kind"`
|
||||
BaseURL string `yaml:"baseUrl,omitempty"`
|
||||
APIKey string `yaml:"apiKey,omitempty"`
|
||||
Models []string `yaml:"models"`
|
||||
Name string `yaml:"name,omitempty"`
|
||||
Kind string `yaml:"kind"`
|
||||
BaseURL string `yaml:"baseUrl,omitempty"`
|
||||
APIKey string `yaml:"apiKey,omitempty"`
|
||||
Models []string `yaml:"models"`
|
||||
Headers map[string]string `yaml:"headers"`
|
||||
} `yaml:"providers"`
|
||||
}
|
||||
|
||||
|
||||
@@ -179,6 +179,7 @@ func (c *Context) GetModelProvider(model string) (string, api.ChatCompletionProv
|
||||
return model, &openai.OpenAIClient{
|
||||
BaseURL: url,
|
||||
APIKey: p.APIKey,
|
||||
Headers: p.Headers,
|
||||
}, nil
|
||||
default:
|
||||
return "", nil, fmt.Errorf("unknown provider kind: %s", p.Kind)
|
||||
|
||||
Reference in New Issue
Block a user