Skip to content

Commit 30fabcb

Browse files
committed
update readme
1 parent 8cace7c commit 30fabcb

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ This library currently supports _Messages API_. If you need legacy _Text Complet
4141

4242
### [Create a Message API](https://docs.anthropic.com/claude/reference/messages_post)
4343

44-
Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation.
44+
Send a structured list of input messages with `text`, `image`, `pdf` and/or `tool` content, and the model will generate the next message in the conversation.
4545

4646
The Messages API can be used for for either single queries or stateless multi-turn conversations.
4747

@@ -53,10 +53,16 @@ let response = try await anthropic.messages.createMessage([message], maxTokens:
5353

5454
for content in response.content {
5555
switch content {
56-
case .text(let text):
56+
case .text(let text, _):
5757
print(text)
58-
case .image(let imageContent):
58+
case .image(let imageContent, _):
5959
// handle base64 encoded image content
60+
case .document(let documentContent, _):
61+
// handle base64 encoded pdf content
62+
case .toolResult(let toolResult):
63+
// handle tool result
64+
case .toolUse(let toolUse):
65+
// handle tool object
6066
}
6167
}
6268
```

0 commit comments

Comments
 (0)