on main help sign in
chore: fix custom headers and system prefix
commit11a90e1cf6d6a63d5c9b2d369ed3d6207605247c authorKujtim Hoxha <kujtimii.h@gmail.com> dateWed 30 Jul 2025, 12:34 (1 year ago) parent229c0c7
2 files changed+14−12
internal/config/load.go+11−10 internal/llm/provider/anthropic.go+3−2
internal/config/load.go+11−10
@@ -145,16 +145,17 @@ func (c *Config) configureProviders(env env.Env, resolver VariableResolver, know
145145 maps.Copy(headers, config.ExtraHeaders)
146146 }
147147 prepared := ProviderConfig{
148− ID: string(p.ID),
149− Name: p.Name,
150− BaseURL: p.APIEndpoint,
151− APIKey: p.APIKey,
152− Type: p.Type,
153− Disable: config.Disable,
154− ExtraHeaders: headers,
155− ExtraBody: config.ExtraBody,
156− ExtraParams: make(map[string]string),
157− Models: p.Models,
148+ ID: string(p.ID),
149+ Name: p.Name,
150+ BaseURL: p.APIEndpoint,
151+ APIKey: p.APIKey,
152+ Type: p.Type,
153+ Disable: config.Disable,
154+ SystemPromptPrefix: config.SystemPromptPrefix,
155+ ExtraHeaders: headers,
156+ ExtraBody: config.ExtraBody,
157+ ExtraParams: make(map[string]string),
158+ Models: p.Models,
158159 }
159160
160161 switch p.ID {
internal/llm/provider/anthropic.go+3−2
@@ -67,8 +67,8 @@ func createAnthropicClient(opts providerClientOptions, useBedrock bool) anthropi
6767 if useBedrock {
6868 anthropicClientOptions = append(anthropicClientOptions, bedrock.WithLoadDefaultConfig(context.Background()))
6969 }
70− for _, header := range opts.extraHeaders {
71− anthropicClientOptions = append(anthropicClientOptions, option.WithHeaderAdd(header, opts.extraHeaders[header]))
70+ for key, header := range opts.extraHeaders {
71+ anthropicClientOptions = append(anthropicClientOptions, option.WithHeaderAdd(key, header))
7272 }
7373 for key, value := range opts.extraBody {
7474 anthropicClientOptions = append(anthropicClientOptions, option.WithJSONSet(key, value))
@@ -223,6 +223,7 @@ func (a *anthropicClient) preparedMessages(messages []anthropic.MessageParam, to
223223 }
224224
225225 systemBlocks := []anthropic.TextBlockParam{}
226+ slog.Info("Testing", "prefix", a.providerOptions.systemPromptPrefix)
226227
227228 // Add custom system prompt prefix if configured
228229 if a.providerOptions.systemPromptPrefix != "" {