fix: deepseek reports an error when using Response Format #11677 (#11678)

Co-authored-by: zhaobs <zhaobs@cailian.net>
This commit is contained in:
zhaobingshuang 2024-12-16 12:58:03 +08:00 committed by GitHub
parent 9c7a1bc067
commit 79801f5c30
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -24,6 +24,9 @@ class DeepseekLargeLanguageModel(OAIAPICompatLargeLanguageModel):
user: Optional[str] = None,
) -> Union[LLMResult, Generator]:
self._add_custom_parameters(credentials)
# {"response_format": "xx"} need convert to {"response_format": {"type": "xx"}}
if "response_format" in model_parameters:
model_parameters["response_format"] = {"type": model_parameters.get("response_format")}
return super()._invoke(model, credentials, prompt_messages, model_parameters, tools, stop, stream)
def validate_credentials(self, model: str, credentials: dict) -> None: