Skip to content

Commit 2931851

Browse files
committed
chore: remove unused headers
1 parent ef0ee71 commit 2931851

3 files changed

Lines changed: 9 additions & 54 deletions

File tree

ai/agent.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ type AgentCall struct {
144144
PresencePenalty *float64 `json:"presence_penalty"`
145145
FrequencyPenalty *float64 `json:"frequency_penalty"`
146146
ActiveTools []string `json:"active_tools"`
147-
Headers map[string]string
148147
ProviderOptions ProviderOptions
149148
OnRetry OnRetryCallback
150149
MaxRetries *int
@@ -336,10 +335,6 @@ func (a *agent) prepareCall(call AgentCall) AgentCall {
336335
maps.Copy(headers, a.settings.headers)
337336
}
338337

339-
if call.Headers != nil {
340-
maps.Copy(headers, call.Headers)
341-
}
342-
call.Headers = headers
343338
return call
344339
}
345340

@@ -420,7 +415,6 @@ func (a *agent) Generate(ctx context.Context, opts AgentCall) (*AgentResult, err
420415
FrequencyPenalty: opts.FrequencyPenalty,
421416
Tools: preparedTools,
422417
ToolChoice: &stepToolChoice,
423-
Headers: opts.Headers,
424418
ProviderOptions: opts.ProviderOptions,
425419
})
426420
})
@@ -747,7 +741,6 @@ func (a *agent) Stream(ctx context.Context, opts AgentStreamCall) (*AgentResult,
747741
PresencePenalty: opts.PresencePenalty,
748742
FrequencyPenalty: opts.FrequencyPenalty,
749743
ActiveTools: opts.ActiveTools,
750-
Headers: opts.Headers,
751744
ProviderOptions: opts.ProviderOptions,
752745
MaxRetries: opts.MaxRetries,
753746
StopWhen: opts.StopWhen,
@@ -838,7 +831,6 @@ func (a *agent) Stream(ctx context.Context, opts AgentStreamCall) (*AgentResult,
838831
FrequencyPenalty: call.FrequencyPenalty,
839832
Tools: preparedTools,
840833
ToolChoice: &stepToolChoice,
841-
Headers: call.Headers,
842834
ProviderOptions: call.ProviderOptions,
843835
}
844836

ai/agent_test.go

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -563,42 +563,6 @@ func TestAgent_Generate_WithSystemPrompt(t *testing.T) {
563563
require.NotNil(t, result)
564564
}
565565

566-
// Test options.headers
567-
func TestAgent_Generate_OptionsHeaders(t *testing.T) {
568-
t.Parallel()
569-
570-
model := &mockLanguageModel{
571-
generateFunc: func(ctx context.Context, call Call) (*Response, error) {
572-
// Verify headers are passed
573-
require.Equal(t, map[string]string{
574-
"custom-request-header": "request-header-value",
575-
}, call.Headers)
576-
577-
return &Response{
578-
Content: []Content{
579-
TextContent{Text: "Hello, world!"},
580-
},
581-
Usage: Usage{
582-
InputTokens: 3,
583-
OutputTokens: 10,
584-
TotalTokens: 13,
585-
},
586-
FinishReason: FinishReasonStop,
587-
}, nil
588-
},
589-
}
590-
591-
agent := NewAgent(model)
592-
result, err := agent.Generate(context.Background(), AgentCall{
593-
Prompt: "test-input",
594-
Headers: map[string]string{"custom-request-header": "request-header-value"},
595-
})
596-
597-
require.NoError(t, err)
598-
require.NotNil(t, result)
599-
require.Equal(t, "Hello, world!", result.Response.Content.Text())
600-
}
601-
602566
// Test options.activeTools filtering
603567
func TestAgent_Generate_OptionsActiveTools(t *testing.T) {
604568
t.Parallel()

ai/model.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -176,16 +176,15 @@ func SpecificToolChoice(name string) ToolChoice {
176176
}
177177

178178
type Call struct {
179-
Prompt Prompt `json:"prompt"`
180-
MaxOutputTokens *int64 `json:"max_output_tokens"`
181-
Temperature *float64 `json:"temperature"`
182-
TopP *float64 `json:"top_p"`
183-
TopK *int64 `json:"top_k"`
184-
PresencePenalty *float64 `json:"presence_penalty"`
185-
FrequencyPenalty *float64 `json:"frequency_penalty"`
186-
Tools []Tool `json:"tools"`
187-
ToolChoice *ToolChoice `json:"tool_choice"`
188-
Headers map[string]string `json:"headers"`
179+
Prompt Prompt `json:"prompt"`
180+
MaxOutputTokens *int64 `json:"max_output_tokens"`
181+
Temperature *float64 `json:"temperature"`
182+
TopP *float64 `json:"top_p"`
183+
TopK *int64 `json:"top_k"`
184+
PresencePenalty *float64 `json:"presence_penalty"`
185+
FrequencyPenalty *float64 `json:"frequency_penalty"`
186+
Tools []Tool `json:"tools"`
187+
ToolChoice *ToolChoice `json:"tool_choice"`
189188

190189
// for provider specific options, the key is the provider id
191190
ProviderOptions ProviderOptions `json:"provider_options"`

0 commit comments

Comments
 (0)