Skip to content

Commit

Permalink
feat: add integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowpigy committed Dec 16, 2024
1 parent 86739f4 commit 8c36ad5
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions integrationtest/messages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,33 @@ func TestIntegrationMessages(t *testing.T) {
})
})
}

func TestComputerUse(t *testing.T) {
testAPIKey(t)
client := anthropic.NewClient(APIKey, anthropic.WithBetaVersion(anthropic.BetaComputerUse20241022))
ctx := context.Background()
var temperature float32 = 0.0

req := anthropic.MessagesRequest{
Model: anthropic.ModelClaude3Dot5SonnetLatest,
MaxTokens: 4096,
Messages: []anthropic.Message{
anthropic.NewUserTextMessage("use chrome to google today's weather"),
},
Tools: []anthropic.ToolDefinition{
anthropic.NewComputerUseToolDefinition("computer", 1024, 768, nil),
},
Temperature: &temperature,
}

t.Run("CreateMessages on real API with computer use", func(t *testing.T) {
resp, err := client.CreateMessages(ctx, req)
if err != nil {
t.Fatalf("CreateMessages error: %s", err)
}
t.Logf("CreateMessages resp: %+v", resp)
t.Logf("CreateMessages resp content: %s", resp.GetFirstContentText())

})

}

0 comments on commit 8c36ad5

Please sign in to comment.