Skip to content

Commit

Permalink
Merge pull request #6 from hyperlink/patch-1
Browse files Browse the repository at this point in the history
Fix examples in the README.md
  • Loading branch information
fumito-ito authored Mar 29, 2024
2 parents d7a49c9 + f942f71 commit 90c9432
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ let package = Package(
let anthropic = Anthropic(apiKey: "YOUR_OWN_API_KEY")

let message = Message(role: .user, content: [.text("This is test text")])
let response = try await anthropic.messages.createMessage(message, maxTokens: 1024)
let response = try await anthropic.messages.createMessage([message], maxTokens: 1024)
```

## Supporting APIs
Expand All @@ -49,7 +49,7 @@ The Messages API can be used for for either single queries or stateless multi-tu
let anthropic = Anthropic(apiKey: "YOUR_OWN_API_KEY")

let message = Message(role: .user, content: [.text("This is test text")])
let response = try await anthropic.messages.createMessage(message, maxTokens: 1024)
let response = try await anthropic.messages.createMessage([message], maxTokens: 1024)

for content in response.content {
switch content {
Expand All @@ -69,7 +69,7 @@ Send a structured list of input messages with text and/or image content, and the
let anthropic = Anthropic(apiKey: "YOUR_OWN_API_KEY")

let message = Message(role: .user, content: [.text("This is test text")])
let stream = try await anthropic.messages.streamMessage(message, maxTokens: 1024)
let stream = try await anthropic.messages.streamMessage([message], maxTokens: 1024)

for try await chunk in stream {
switch chunk.type {
Expand Down

0 comments on commit 90c9432

Please sign in to comment.