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"
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"