Преглед изворни кода

Fixed when testing the openai compatible interface model, an error is reported when no object is returned (#7808)

tags/0.7.3
hisir пре 1 година
родитељ
комит
f0273f00e1
No account linked to committer's email address
1 измењених фајлова са 2 додато и 2 уклоњено
  1. 2
    2
      api/core/model_runtime/model_providers/openai_api_compatible/llm/llm.py

+ 2
- 2
api/core/model_runtime/model_providers/openai_api_compatible/llm/llm.py Прегледај датотеку

except json.JSONDecodeError as e: except json.JSONDecodeError as e:
raise CredentialsValidateFailedError('Credentials validation failed: JSON decode error') raise CredentialsValidateFailedError('Credentials validation failed: JSON decode error')


if (completion_type is LLMMode.CHAT and json_result['object'] == ''):
if (completion_type is LLMMode.CHAT and json_result.get('object','') == ''):
json_result['object'] = 'chat.completion' json_result['object'] = 'chat.completion'
elif (completion_type is LLMMode.COMPLETION and json_result['object'] == ''):
elif (completion_type is LLMMode.COMPLETION and json_result.get('object','') == ''):
json_result['object'] = 'text_completion' json_result['object'] = 'text_completion'


if (completion_type is LLMMode.CHAT if (completion_type is LLMMode.CHAT

Loading…
Откажи
Сачувај