Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
Corrected type annotation to "Any" from "any" all files in "model_providers" folder (#9135)
ronaksingh2762051d51716d
diff --git a/api/core/model_runtime/model_providers/__base/tts_model.py b/api/core/model_runtime/model_providers/__base/tts_model.pyindex 70be9322a75..862ec29dafa 100644--- a/api/core/model_runtime/model_providers/__base/tts_model.py+++ b/api/core/model_runtime/model_providers/__base/tts_model.py@@ -1,7 +1,7 @@import loggingimport refrom abc import abstractmethod-from typing import Optional+from typing import Any, Optionalfrom pydantic import ConfigDict@@ -88,7 +88,7 @@ class TTSModel(AIModel):else:return [{"name": d["name"], "value": d["mode"]} for d in voices]- def _get_model_default_voice(self, model: str, credentials: dict) -> any:+ def _get_model_default_voice(self, model: str, credentials: dict) -> Any:"""Get voice for given tts modeldiff --git a/api/core/model_runtime/model_providers/azure_openai/tts/tts.py b/api/core/model_runtime/model_providers/azure_openai/tts/tts.pyindex af178703a06..133cc9f76e0 100644--- a/api/core/model_runtime/model_providers/azure_openai/tts/tts.py+++ b/api/core/model_runtime/model_providers/azure_openai/tts/tts.py@@ -1,6 +1,6 @@import concurrent.futuresimport copy-from typing import Optional+from typing import Any, Optionalfrom openai import AzureOpenAI@@ -19,7 +19,7 @@ class AzureOpenAIText2SpeechModel(_CommonAzureOpenAI, TTSModel):def _invoke(self, model: str, tenant_id: str, credentials: dict, content_text: str, voice: str, user: Optional[str] = None- ) -> any:+ ) -> Any:"""_invoke text2speech model@@ -56,7 +56,7 @@ class AzureOpenAIText2SpeechModel(_CommonAzureOpenAI, TTSModel):except Exception as ex:raise CredentialsValidateFailedError(str(ex))- def _tts_invoke_streaming(self, model: str, credentials: dict, content_text: str, voice: str) -> any:+ def _tts_invoke_streaming(self, model: str, credentials: dict, content_text: str, voice: str) -> Any:"""_tts_invoke_streaming text2speech model:param model: model namediff --git a/api/core/model_runtime/model_providers/fishaudio/tts/tts.py b/api/core/model_runtime/model_providers/fishaudio/tts/tts.pyindex 895a7a914c9..e518d7b95b6 100644--- a/api/core/model_runtime/model_providers/fishaudio/tts/tts.py+++ b/api/core/model_runtime/model_providers/fishaudio/tts/tts.py@@ -1,4 +1,4 @@-from typing import Optional+from typing import Any, Optionalimport httpx@@ -46,7 +46,7 @@ class FishAudioText2SpeechModel(TTSModel):content_text: str,voice: str,user: Optional[str] = None,- ) -> any:+ ) -> Any:"""Invoke text2speech model@@ -87,7 +87,7 @@ class FishAudioText2SpeechModel(TTSModel):except Exception as ex:raise CredentialsValidateFailedError(str(ex))- def _tts_invoke_streaming(self, model: str, credentials: dict, content_text: str, voice: str) -> any:+ def _tts_invoke_streaming(self, model: str, credentials: dict, content_text: str, voice: str) -> Any:"""Invoke streaming text2speech model:param model: model name@@ -112,7 +112,7 @@ class FishAudioText2SpeechModel(TTSModel):except Exception as ex:raise InvokeBadRequestError(str(ex))- def _tts_invoke_streaming_sentence(self, credentials: dict, content_text: str, voice: Optional[str] = None) -> any:+ def _tts_invoke_streaming_sentence(self, credentials: dict, content_text: str, voice: Optional[str] = None) -> Any:"""Invoke streaming text2speech modeldiff --git a/api/core/model_runtime/model_providers/openai/tts/tts.py b/api/core/model_runtime/model_providers/openai/tts/tts.pyindex a14c91639b8..2e57b95944c 100644--- a/api/core/model_runtime/model_providers/openai/tts/tts.py+++ b/api/core/model_runtime/model_providers/openai/tts/tts.py@@ -1,5 +1,5 @@import concurrent.futures-from typing import Optional+from typing import Any, Optionalfrom openai import OpenAI@@ -16,7 +16,7 @@ class OpenAIText2SpeechModel(_CommonOpenAI, TTSModel):def _invoke(self, model: str, tenant_id: str, credentials: dict, content_text: str, voice: str, user: Optional[str] = None- ) -> any:+ ) -> Any:"""_invoke text2speech model@@ -55,7 +55,7 @@ class OpenAIText2SpeechModel(_CommonOpenAI, TTSModel):except Exception as ex:raise CredentialsValidateFailedError(str(ex))- def _tts_invoke_streaming(self, model: str, credentials: dict, content_text: str, voice: str) -> any:+ def _tts_invoke_streaming(self, model: str, credentials: dict, content_text: str, voice: str) -> Any:"""_tts_invoke_streaming text2speech modeldiff --git a/api/core/model_runtime/model_providers/sagemaker/tts/tts.py b/api/core/model_runtime/model_providers/sagemaker/tts/tts.pyindex 9652e1d6505..1a5afd18f99 100644--- a/api/core/model_runtime/model_providers/sagemaker/tts/tts.py+++ b/api/core/model_runtime/model_providers/sagemaker/tts/tts.py@@ -192,7 +192,7 @@ class SageMakerText2SpeechModel(TTSModel):InvokeBadRequestError: [InvokeBadRequestError, KeyError, ValueError],}- def _get_model_default_voice(self, model: str, credentials: dict) -> any:+ def _get_model_default_voice(self, model: str, credentials: dict) -> Any:return ""def _get_model_word_limit(self, model: str, credentials: dict) -> int:@@ -225,7 +225,7 @@ class SageMakerText2SpeechModel(TTSModel):json_obj = json.loads(json_str)return json_obj- def _tts_invoke_streaming(self, model_type: str, payload: dict, sagemaker_endpoint: str) -> any:+ def _tts_invoke_streaming(self, model_type: str, payload: dict, sagemaker_endpoint: str) -> Any:"""_tts_invoke_streaming text2speech modeldiff --git a/api/core/model_runtime/model_providers/tongyi/tts/tts.py b/api/core/model_runtime/model_providers/tongyi/tts/tts.pyindex 48a38897a87..ca3b9fbc1c3 100644--- a/api/core/model_runtime/model_providers/tongyi/tts/tts.py+++ b/api/core/model_runtime/model_providers/tongyi/tts/tts.py@@ -1,6 +1,6 @@import threadingfrom queue import Queue-from typing import Optional+from typing import Any, Optionalimport dashscopefrom dashscope import SpeechSynthesizer@@ -20,7 +20,7 @@ class TongyiText2SpeechModel(_CommonTongyi, TTSModel):def _invoke(self, model: str, tenant_id: str, credentials: dict, content_text: str, voice: str, user: Optional[str] = None- ) -> any:+ ) -> Any:"""_invoke text2speech model@@ -58,7 +58,7 @@ class TongyiText2SpeechModel(_CommonTongyi, TTSModel):except Exception as ex:raise CredentialsValidateFailedError(str(ex))- def _tts_invoke_streaming(self, model: str, credentials: dict, content_text: str, voice: str) -> any:+ def _tts_invoke_streaming(self, model: str, credentials: dict, content_text: str, voice: str) -> Any:"""_tts_invoke_streaming text2speech modeldiff --git a/api/core/model_runtime/model_providers/xinference/tts/tts.py b/api/core/model_runtime/model_providers/xinference/tts/tts.pyindex 6290e8551d8..3f46b50c338 100644--- a/api/core/model_runtime/model_providers/xinference/tts/tts.py+++ b/api/core/model_runtime/model_providers/xinference/tts/tts.py@@ -1,5 +1,5 @@import concurrent.futures-from typing import Optional+from typing import Any, Optionalfrom xinference_client.client.restful.restful_client import RESTfulAudioModelHandle@@ -166,7 +166,7 @@ class XinferenceText2SpeechModel(TTSModel):return self.model_voices["__default"]["all"]- def _get_model_default_voice(self, model: str, credentials: dict) -> any:+ def _get_model_default_voice(self, model: str, credentials: dict) -> Any:return ""def _get_model_word_limit(self, model: str, credentials: dict) -> int:@@ -178,7 +178,7 @@ class XinferenceText2SpeechModel(TTSModel):def _get_model_workers_limit(self, model: str, credentials: dict) -> int:return 5- def _tts_invoke_streaming(self, model: str, credentials: dict, content_text: str, voice: str) -> any:+ def _tts_invoke_streaming(self, model: str, credentials: dict, content_text: str, voice: str) -> Any:"""_tts_invoke_streaming text2speech model