dylanshine / openai-kit

A community Swift package used to interact with the OpenAI API
https://platform.openai.com/docs/api-reference
MIT License
703 stars 109 forks source link

Stream fails the first time it's called #40

Closed ronaldmannak closed 1 year ago

ronaldmannak commented 1 year ago

Client.chats.stream() fails the first time it's called. An empty stream is returned and the subsequent for try await chat in stream { ... } will never loop.

However, if Client.chats.create() is invoked before the first Client.chats.stream(), then the first Client.chats.stream() will succeed.

dylanshine commented 1 year ago

@ronaldmannak The unit test in the suite has never failed on first call, curious what parameters you're passing in to reproduce this

dylanshine commented 1 year ago

https://github.com/dylanshine/openai-kit/pull/41