Skip to content

Commit

Permalink
fix: raise error in minimax stream generate (#1336)
Browse files Browse the repository at this point in the history
  • Loading branch information
takatost authored Oct 13, 2023
1 parent e83e239 commit f4be2b8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions api/core/third_party/langchain/llms/minimax_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,16 @@ def _stream(

token = token.lstrip("data:").strip()
data = json.loads(token)

if "base_resp" in data and data["base_resp"]["status_code"] > 0:
raise ValueError(
f"API {data['base_resp']['status_code']}"
f" error: {data['base_resp']['status_msg']}"
)

if not data['choices']:
continue

content = data['choices'][0]['delta']

chunk_kwargs = {
Expand Down

0 comments on commit f4be2b8

Please sign in to comment.