Skip to content

Commit 2572500

Browse files
hyperwdclaude
andcommitted
fix: format code with gofmt -s
- Align constant definitions in provider.go - Align struct fields in test cases - Fix gofmt formatting issues reported in review 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 27a626c commit 2572500

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

pkg/providers/anthropic_messages/provider.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ type (
3030
)
3131

3232
const (
33-
defaultAPIVersion = "2023-06-01"
34-
defaultBaseURL = "https://api.anthropic.com/v1"
33+
defaultAPIVersion = "2023-06-01"
34+
defaultBaseURL = "https://api.anthropic.com/v1"
3535
defaultRequestTimeout = 120 * time.Second
3636
)
3737

@@ -145,9 +145,9 @@ func buildRequestBody(
145145
options map[string]any,
146146
) (map[string]any, error) {
147147
result := map[string]any{
148-
"model": model,
148+
"model": model,
149149
"max_tokens": int64(4096),
150-
"messages": []any{},
150+
"messages": []any{},
151151
}
152152

153153
// Set max_tokens from options
@@ -179,9 +179,9 @@ func buildRequestBody(
179179
// Tool result message
180180
content := []map[string]any{
181181
{
182-
"type": "tool_result",
182+
"type": "tool_result",
183183
"tool_use_id": msg.ToolCallID,
184-
"content": msg.Content,
184+
"content": msg.Content,
185185
},
186186
}
187187
apiMessages = append(apiMessages, map[string]any{
@@ -227,9 +227,9 @@ func buildRequestBody(
227227
// Tool result (alternative format)
228228
content := []map[string]any{
229229
{
230-
"type": "tool_result",
230+
"type": "tool_result",
231231
"tool_use_id": msg.ToolCallID,
232-
"content": msg.Content,
232+
"content": msg.Content,
233233
},
234234
}
235235
apiMessages = append(apiMessages, map[string]any{
@@ -259,8 +259,8 @@ func buildTools(tools []ToolDefinition) []any {
259259
result := make([]any, len(tools))
260260
for i, tool := range tools {
261261
toolDef := map[string]any{
262-
"name": tool.Function.Name,
263-
"description": tool.Function.Description,
262+
"name": tool.Function.Name,
263+
"description": tool.Function.Description,
264264
"input_schema": tool.Function.Parameters,
265265
}
266266
result[i] = toolDef
@@ -369,13 +369,13 @@ func asFloat(v any) (float64, bool) {
369369
// Anthropic API response structures
370370

371371
type anthropicMessageResponse struct {
372-
ID string `json:"id"`
373-
Type string `json:"type"`
374-
Role string `json:"role"`
375-
Content []contentBlock `json:"content"`
376-
StopReason string `json:"stop_reason"`
377-
Model string `json:"model"`
378-
Usage usageInfo `json:"usage"`
372+
ID string `json:"id"`
373+
Type string `json:"type"`
374+
Role string `json:"role"`
375+
Content []contentBlock `json:"content"`
376+
StopReason string `json:"stop_reason"`
377+
Model string `json:"model"`
378+
Usage usageInfo `json:"usage"`
379379
}
380380

381381
type contentBlock struct {

pkg/providers/anthropic_messages/provider_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,9 @@ func TestParseResponseBody(t *testing.T) {
202202
}
203203
}`),
204204
want: &LLMResponse{
205-
Content: "Hello, how can I help?",
206-
ToolCalls: []ToolCall{},
207-
FinishReason: "stop",
205+
Content: "Hello, how can I help?",
206+
ToolCalls: []ToolCall{},
207+
FinishReason: "stop",
208208
Usage: &UsageInfo{
209209
PromptTokens: 10,
210210
CompletionTokens: 5,
@@ -252,7 +252,7 @@ func TestParseResponseBody(t *testing.T) {
252252
},
253253
},
254254
},
255-
FinishReason: "tool_calls",
255+
FinishReason: "tool_calls",
256256
Usage: &UsageInfo{
257257
PromptTokens: 20,
258258
CompletionTokens: 15,
@@ -286,9 +286,9 @@ func TestParseResponseBody(t *testing.T) {
286286
}
287287
}`),
288288
want: &LLMResponse{
289-
Content: "Partial response",
290-
ToolCalls: []ToolCall{},
291-
FinishReason: "length",
289+
Content: "Partial response",
290+
ToolCalls: []ToolCall{},
291+
FinishReason: "length",
292292
Usage: &UsageInfo{
293293
PromptTokens: 100,
294294
CompletionTokens: 4096,

0 commit comments

Comments
 (0)