Skip to content

Commit 5e3edd2

Browse files
yihong0618iamjoel
authored andcommitted
fix: better error message for stream (#11635)
Signed-off-by: yihong0618 <[email protected]>
1 parent 0dfa34e commit 5e3edd2

File tree

1 file changed

+4
-0
lines changed
  • api/core/model_runtime/model_providers/openai_api_compatible/llm

1 file changed

+4
-0
lines changed

api/core/model_runtime/model_providers/openai_api_compatible/llm/llm.py

+4
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,10 @@ def get_tool_call(tool_call_id: str):
478478
usage=usage,
479479
)
480480
break
481+
# handle the error here. for issue #11629
482+
if chunk_json.get("error") and chunk_json.get("choices") is None:
483+
raise ValueError(chunk_json.get("error"))
484+
481485
if chunk_json:
482486
if u := chunk_json.get("usage"):
483487
usage = u

0 commit comments

Comments
 (0)