mirror of
https://github.com/coder/coder.git
synced 2026-10-29 17:44:33 +08:00
chore: clean up env var usage in aibridge (#24783)
> AI tools where used when creating this PR This PR removes environment variable parsing from `/aibridge` directory. Added env variables/flags for dump dir as coder options. Only added to new indexed provider options (`CODER_AIBRIDGE_PROVIDER_<N>_*`) not to deprecated legacy env variables (`CODER_AIBRIDGE_ANTHROPIC_*` and `CODER_AIBRIDGE_OPENAI_KEY_*`). Reverted adding `MaxRetries` option as it will be removed soon due to key failover work: https://github.com/coder/coder/pull/24783#discussion_r3155544808
This commit is contained in:
@@ -46,9 +46,6 @@ type interceptionBase struct {
|
||||
|
||||
func (i *interceptionBase) newCompletionsService() openai.ChatCompletionService {
|
||||
opts := []option.RequestOption{option.WithAPIKey(i.cfg.Key), option.WithBaseURL(i.cfg.BaseURL)}
|
||||
if i.cfg.MaxRetries != nil {
|
||||
opts = append(opts, option.WithMaxRetries(*i.cfg.MaxRetries))
|
||||
}
|
||||
|
||||
// Add extra headers if configured.
|
||||
// Some providers require additional headers that are not added by the SDK.
|
||||
|
||||
@@ -217,9 +217,6 @@ func (i *interceptionBase) newMessagesService(ctx context.Context, opts ...optio
|
||||
opts = append(opts, option.WithAPIKey(i.cfg.Key))
|
||||
}
|
||||
opts = append(opts, option.WithBaseURL(i.cfg.BaseURL))
|
||||
if i.cfg.MaxRetries != nil {
|
||||
opts = append(opts, option.WithMaxRetries(*i.cfg.MaxRetries))
|
||||
}
|
||||
|
||||
// Add extra headers if configured.
|
||||
// Some providers require additional headers that are not added by the SDK.
|
||||
|
||||
@@ -55,9 +55,6 @@ type responsesInterceptionBase struct {
|
||||
|
||||
func (i *responsesInterceptionBase) newResponsesService() responses.ResponseService {
|
||||
opts := []option.RequestOption{option.WithBaseURL(i.cfg.BaseURL), option.WithAPIKey(i.cfg.Key)}
|
||||
if i.cfg.MaxRetries != nil {
|
||||
opts = append(opts, option.WithMaxRetries(*i.cfg.MaxRetries))
|
||||
}
|
||||
|
||||
// Add extra headers if configured.
|
||||
// Some providers require additional headers that are not added by the SDK.
|
||||
|
||||
Reference in New Issue
Block a user