Browse Source

fix: better error message for stream (#11635)

Signed-off-by: yihong0618 <zouzou0208@gmail.com>
tags/0.14.0
yihong 10 months ago
parent
commit
7e154a467b
No account linked to committer's email address

+ 4
- 0
api/core/model_runtime/model_providers/openai_api_compatible/llm/llm.py View File

@@ -478,6 +478,10 @@ class OAIAPICompatLargeLanguageModel(_CommonOaiApiCompat, LargeLanguageModel):
usage=usage,
)
break
# handle the error here. for issue #11629
if chunk_json.get("error") and chunk_json.get("choices") is None:
raise ValueError(chunk_json.get("error"))

if chunk_json:
if u := chunk_json.get("usage"):
usage = u

Loading…
Cancel
Save