buhe/langchain-swift

Fatal Crash on ChatOpenAI

Closed this issue · 2 comments

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

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

Thank You!