Skip to content

Commit

Permalink
fix: golines
Browse files Browse the repository at this point in the history
  • Loading branch information
liushuangls committed Dec 17, 2024
1 parent 200c93a commit e3beec8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
5 changes: 4 additions & 1 deletion integrationtest/messages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 9 additions & 3 deletions message.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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,
Expand Down

0 comments on commit e3beec8

Please sign in to comment.