We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 50619d8 commit 04e4a3bCopy full SHA for 04e4a3b
chatlas/_provider_openai.py
@@ -275,6 +275,16 @@ def stream_text(self, chunk):
275
def stream_merge_chunks(self, completion, chunk):
276
if chunk.type == "response.completed":
277
return chunk.response
278
+ elif chunk.type == "response.failed":
279
+ error = chunk.response.error
280
+ if error is None:
281
+ msg = "Request failed with an unknown error."
282
+ else:
283
+ msg = f"Request failed ({error.code}): {error.message}"
284
+ raise RuntimeError(msg)
285
+ elif chunk.type == "error":
286
+ raise RuntimeError(f"Request errored: {chunk.message}")
287
+
288
# Since this value won't actually be used, we can lie about the type
289
return cast(Response, None)
290
0 commit comments