Fixed when testing the openai compatible interface model, an error is reported when no object is returned (#7808)
This commit is contained in:
parent
962cdbbebd
commit
f0273f00e1
1 changed files with 2 additions and 2 deletions
|
|
@ -150,9 +150,9 @@ class OAIAPICompatLargeLanguageModel(_CommonOAI_API_Compat, LargeLanguageModel):
|
||||||
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…
Add table
Add a link
Reference in a new issue