From e3beec8f3ef5812c8211a6a98dc92ac16343b66e Mon Sep 17 00:00:00 2001 From: liushuang Date: Tue, 17 Dec 2024 10:05:06 +0800 Subject: [PATCH] fix: golines --- integrationtest/messages_test.go | 5 ++++- message.go | 12 +++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/integrationtest/messages_test.go b/integrationtest/messages_test.go index 41a445c..21bcce9 100644 --- a/integrationtest/messages_test.go +++ b/integrationtest/messages_test.go @@ -88,7 +88,10 @@ func TestIntegrationMessages(t *testing.T) { func TestComputerUse(t *testing.T) { testAPIKey(t) - client := anthropic.NewClient(APIKey, anthropic.WithBetaVersion(anthropic.BetaComputerUse20241022)) + client := anthropic.NewClient( + APIKey, + anthropic.WithBetaVersion(anthropic.BetaComputerUse20241022), + ) ctx := context.Background() var temperature float32 = 0.0 diff --git a/message.go b/message.go index 69e102e..31f77f8 100644 --- a/message.go +++ b/message.go @@ -369,6 +369,9 @@ type ToolDefinition struct { // The jsonschema package is provided for convenience, but you should // consider another specialized library if you require more complex schemas. InputSchema any `json:"input_schema,omitempty"` + + CacheControl *MessageCacheControl `json:"cache_control,omitempty"` + // Type is required for Anthropic defined tools. Type string `json:"type,omitempty"` // DisplayWidthPx is a required parameter of the Computer Use tool. @@ -377,11 +380,14 @@ type ToolDefinition struct { DisplayHeightPx int `json:"display_height_px,omitempty"` // DisplayNumber is an optional parameter of the Computer Use tool. DisplayNumber *int `json:"display_number,omitempty"` - - CacheControl *MessageCacheControl `json:"cache_control,omitempty"` } -func NewComputerUseToolDefinition(name string, displayWidthPx int, displayHeightPx int, displayNumber *int) ToolDefinition { +func NewComputerUseToolDefinition( + name string, + displayWidthPx int, + displayHeightPx int, + displayNumber *int, +) ToolDefinition { return ToolDefinition{ Type: "computer_20241022", Name: name,