fix: the object field is empty string in some openAI api compatible model (#3506)
This commit is contained in:
parent
443fee8537
commit
5e02a83b53
1 changed files with 3 additions and 1 deletions
|
|
@ -150,6 +150,8 @@ 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'] == ''):
|
||||||
|
json_result['object'] = 'chat.completion'
|
||||||
if (completion_type is LLMMode.CHAT
|
if (completion_type is LLMMode.CHAT
|
||||||
and ('object' not in json_result or json_result['object'] != 'chat.completion')):
|
and ('object' not in json_result or json_result['object'] != 'chat.completion')):
|
||||||
raise CredentialsValidateFailedError(
|
raise CredentialsValidateFailedError(
|
||||||
|
|
@ -807,4 +809,4 @@ class OAIAPICompatLargeLanguageModel(_CommonOAI_API_Compat, LargeLanguageModel):
|
||||||
function=function
|
function=function
|
||||||
)
|
)
|
||||||
|
|
||||||
return tool_call
|
return tool_call
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue