read me examples don't work
Closed this issue · 5 comments
I gave up after a couple of hours. I installed the dependency into my Xcode project, added the framework, imported the library into my contentView. Created my API key, added it to the code, but this failed every time:
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)
Invalid Request, replacement path not found.
Also on the next streaming example.
if the first two simple examples don't work, that's a problem.
Error: invalidRequestError
error: the replacement path doesn't exist: "/var/folders/ys/k34fssws6j1f16ngj8v26gk80000gn/T/swift-generated-sources/@_swiftmacro_11HelloClaude11ContentViewV5items33_4735AD49642E300F748EDA2BC5A74A9CLL5QueryfMa.swift"
error: the replacement path doesn't exist: "/var/folders/ys/k34fssws6j1f16ngj8v26gk80000gn/T/swift-generated-sources/@_swiftmacro_11HelloClaude11ContentViewV5items33_4735AD49642E300F748EDA2BC5A74A9CLL5QueryfMa.swift"
error: the replacement path doesn't exist: "/var/folders/ys/k34fssws6j1f16ngj8v26gk80000gn/T/swift-generated-sources/@_swiftmacro_11HelloClaude11ContentViewV5items33_4735AD49642E300F748EDA2BC5A74A9CLL5QueryfMa.swift"
(tried it with 0.5.0 and 0.5.1)
Hi @misbell . Thanks for your reporting. The problem for invalidRequest
is fixed. Please try https://github.com/fumito-ito/AnthropicSwiftSDK/releases/tag/0.5.2 .
Ok, I just tried the API with Python and succeeded. I'll try the new Swift API.
0.5.2 is returns a response as expected. thanks.