fumito-ito / AnthropicSwiftSDK

Yet another Anthropic API client for Swift.
3 stars 1 forks source link

read me examples don't work #41

Open misbell opened 2 hours ago

misbell commented 2 hours ago

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_11HelloClaude11ContentViewV5items334735AD49642E300F748EDA2BC5A74A9CLL5QueryfMa.swift" error: the replacement path doesn't exist: "/var/folders/ys/k34fssws6j1f16ngj8v26gk80000gn/T/swift-generated-sources/@__swiftmacro_11HelloClaude11ContentViewV5items334735AD49642E300F748EDA2BC5A74A9CLL5QueryfMa.swift" error: the replacement path doesn't exist: "/var/folders/ys/k34fssws6j1f16ngj8v26gk80000gn/T/swift-generated-sources/@swiftmacro_11HelloClaude11ContentViewV5items334735AD49642E300F748EDA2BC5A74A9CLL5QueryfMa.swift"

misbell commented 2 hours ago

(tried it with 0.5.0 and 0.5.1)

misbell commented 2 hours ago

turning off debug executable on the scheme got rid of the replacement path error, but it's still an invalid request.

Screenshot 2024-09-27 at 8 52 56 PM