Skip to content

Commit 6d1cb2f

Browse files
committed
Added a test for captions
1 parent 7b76c37 commit 6d1cb2f

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

pkg/anthropic/message_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,21 @@ func Test_message_004(t *testing.T) {
7171
assert.NoError(err)
7272
t.Log(content)
7373
}
74+
75+
func Test_message_005(t *testing.T) {
76+
assert := assert.New(t)
77+
client, err := anthropic.New(GetApiKey(t), opts.OptTrace(os.Stderr, true))
78+
assert.NoError(err)
79+
assert.NotNil(client)
80+
msg := schema.NewMessage("user", "Provide me with a caption for this image")
81+
content, err := schema.ImageData("../../etc/test/IMG_20130413_095348.JPG")
82+
if !assert.NoError(err) {
83+
t.SkipNow()
84+
}
85+
msg.Add(content)
86+
87+
// Request -> Response
88+
response, err := client.Messages(context.Background(), []*schema.Message{msg, schema.NewMessage("assistant", "The caption is:")})
89+
assert.NoError(err)
90+
t.Log(response)
91+
}

0 commit comments

Comments
 (0)