HTTPoison error cases aren't handled in Stream.new/1
bfolkens opened this issue · comments
When handling a streaming request, OpenAI.Client#91 may return %HTTPoison.Error{reason: _, id: nil}
, which then causes the following:
** (FunctionClauseError) no function clause matching in anonymous fn/1 in OpenAI.Stream.new/1
Having looked through the OpenAI.Stream
module, and to preserve backward compatibility, I propose we handle the error case in the OpenAI.Stream.new/1
resource and return the error as a stream item, similar to the %{"status" => :error}
pattern already present when non 200 status codes are received.