From 40fc6f529e77c50fef23e7cb578ace96cb248b63 Mon Sep 17 00:00:00 2001 From: yihong Date: Wed, 27 Nov 2024 17:27:11 +0800 Subject: [PATCH] fix: gitee ai wrong default model, and better para (#11168) Signed-off-by: yihong0618 --- .../model_runtime/model_providers/gitee_ai/llm/llm.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/api/core/model_runtime/model_providers/gitee_ai/llm/llm.py b/api/core/model_runtime/model_providers/gitee_ai/llm/llm.py index 1b85b7fced..0c253a4a0a 100644 --- a/api/core/model_runtime/model_providers/gitee_ai/llm/llm.py +++ b/api/core/model_runtime/model_providers/gitee_ai/llm/llm.py @@ -32,12 +32,12 @@ class GiteeAILargeLanguageModel(OAIAPICompatLargeLanguageModel): return super()._invoke(model, credentials, prompt_messages, model_parameters, tools, stop, stream, user) def validate_credentials(self, model: str, credentials: dict) -> None: - self._add_custom_parameters(credentials, model, None) + self._add_custom_parameters(credentials, None) super().validate_credentials(model, credentials) - def _add_custom_parameters(self, credentials: dict, model: str, model_parameters: dict) -> None: + def _add_custom_parameters(self, credentials: dict, model: Optional[str]) -> None: if model is None: - model = "bge-large-zh-v1.5" + model = "Qwen2-72B-Instruct" model_identity = GiteeAILargeLanguageModel.MODEL_TO_IDENTITY.get(model, model) credentials["endpoint_url"] = f"https://ai.gitee.com/api/serverless/{model_identity}/" @@ -47,5 +47,7 @@ class GiteeAILargeLanguageModel(OAIAPICompatLargeLanguageModel): credentials["mode"] = LLMMode.CHAT.value schema = self.get_model_schema(model, credentials) + assert schema is not None, f"Model schema not found for model {model}" + assert schema.features is not None, f"Model features not found for model {model}" if ModelFeature.TOOL_CALL in schema.features or ModelFeature.MULTI_TOOL_CALL in schema.features: credentials["function_calling_type"] = "tool_call"