Переглянути джерело

fix: raise error in minimax stream generate (#1336)

tags/0.3.28
takatost 2 роки тому
джерело
коміт
f4be2b8bcd
Аккаунт користувача з таким Email не знайдено
1 змінених файлів з 10 додано та 0 видалено
  1. 10
    0
      api/core/third_party/langchain/llms/minimax_llm.py

+ 10
- 0
api/core/third_party/langchain/llms/minimax_llm.py Переглянути файл

@@ -211,6 +211,16 @@ class MinimaxChatLLM(BaseChatModel):

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 = {

Завантаження…
Відмінити
Зберегти