buhe / langchain-swift

🚀 LangChain for Swift. Optimized for iOS, macOS, watchOS (part) and visionOS.(beta)
https://buhe.dev
Apache License 2.0
323 stars 35 forks source link

Fatal Crash on ChatOpenAI #42

Closed Tobaibrahim closed 1 year ago

Tobaibrahim commented 1 year ago

This line -

let buffer = try! await openAIClient.chats.stream(model: model, messages: [.user(content: text)], temperature: temperature)

is causing fatal crashes when awaiting a response specifically for me on slow internet. I would recommend not force unwrapping here.

Thread 15: Fatal error: 'try!' expression unexpectedly raised an error: HTTPClientError.deadlineExceeded

buhe commented 1 year ago

You're right, I've done this on pr, I'll merge it first, use 0.27.0, happy hack.

Tobaibrahim commented 1 year ago

Thank You!