From 44f911a0a8a81cabd209e995c32425600ca13526 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9D=9E=E6=B3=95=E6=93=8D=E4=BD=9C?= Date: Mon, 31 Mar 2025 13:19:15 +0800 Subject: [PATCH] chore: docstring not match the function parameter (#17162) --- api/configs/feature/hosted_service/__init__.py | 2 +- api/configs/remote_settings_sources/__init__.py | 2 -- api/controllers/service_api/dataset/dataset.py | 1 + .../easy_ui_based_app/model_config/converter.py | 1 - api/core/app/apps/advanced_chat/app_generator.py | 10 +++++----- api/core/app/apps/agent_chat/app_generator.py | 2 +- api/core/app/apps/base_app_runner.py | 1 + api/core/app/apps/chat/app_generator.py | 2 +- api/core/app/apps/completion/app_generator.py | 2 +- api/core/app/apps/workflow/app_generator.py | 10 +++++----- api/core/app/apps/workflow/app_runner.py | 3 --- api/core/app/task_pipeline/message_cycle_manage.py | 2 +- api/core/app/task_pipeline/workflow_cycle_manage.py | 4 ++-- api/core/file/upload_file_parser.py | 2 +- api/core/helper/code_executor/code_executor.py | 1 + api/core/helper/position_helper.py | 2 +- api/core/helper/tool_parameter_cache.py | 7 +------ .../model_runtime/model_providers/__base/tts_model.py | 1 - api/core/rag/datasource/vdb/opengauss/opengauss.py | 1 - api/core/rag/datasource/vdb/oracle/oraclevector.py | 1 - api/core/rag/datasource/vdb/pgvector/pgvector.py | 1 - .../rag/datasource/vdb/tidb_on_qdrant/tidb_service.py | 6 ++---- .../rag/datasource/vdb/weaviate/weaviate_vector.py | 1 - .../rag/extractor/firecrawl/firecrawl_web_extractor.py | 5 ++--- .../unstructured/unstructured_markdown_extractor.py | 9 --------- api/core/rag/retrieval/dataset_retrieval.py | 4 ++-- .../rag/retrieval/router/multi_dataset_react_route.py | 1 + api/core/tools/__base/tool.py | 5 ++--- api/core/tools/builtin_tool/provider.py | 4 ++-- api/core/tools/builtin_tool/tool.py | 7 ++----- api/core/tools/custom_tool/provider.py | 1 - api/core/tools/custom_tool/tool.py | 4 +--- api/core/tools/entities/tool_entities.py | 2 +- api/core/tools/tool_engine.py | 1 - api/core/tools/tool_manager.py | 10 ++++++---- api/core/tools/utils/model_invocation_utils.py | 6 +----- api/core/tools/utils/parser.py | 6 ++++++ api/core/tools/workflow_as_tool/provider.py | 1 - api/core/tools/workflow_as_tool/tool.py | 4 +--- api/core/workflow/utils/variable_template_parser.py | 1 - api/core/workflow/workflow_entry.py | 2 ++ api/services/app_dsl_service.py | 1 + api/services/tools/builtin_tools_manage_service.py | 1 - api/services/tools/tools_transform_service.py | 1 + api/services/tools/workflow_tools_manage_service.py | 6 +++--- api/tasks/mail_account_deletion_task.py | 6 +----- api/tasks/ops_trace_task.py | 2 -- 47 files changed, 60 insertions(+), 95 deletions(-) diff --git a/api/configs/feature/hosted_service/__init__.py b/api/configs/feature/hosted_service/__init__.py index 71d06f4623..18ef1ed45b 100644 --- a/api/configs/feature/hosted_service/__init__.py +++ b/api/configs/feature/hosted_service/__init__.py @@ -1,6 +1,6 @@ from typing import Optional -from pydantic import Field, NonNegativeInt, computed_field +from pydantic import Field, NonNegativeInt from pydantic_settings import BaseSettings diff --git a/api/configs/remote_settings_sources/__init__.py b/api/configs/remote_settings_sources/__init__.py index 4f3878d13b..be5d5d896e 100644 --- a/api/configs/remote_settings_sources/__init__.py +++ b/api/configs/remote_settings_sources/__init__.py @@ -1,5 +1,3 @@ -from typing import Optional - from pydantic import Field from .apollo import ApolloSettingsSourceInfo diff --git a/api/controllers/service_api/dataset/dataset.py b/api/controllers/service_api/dataset/dataset.py index 8ab743dc44..d813ae7ebd 100644 --- a/api/controllers/service_api/dataset/dataset.py +++ b/api/controllers/service_api/dataset/dataset.py @@ -142,6 +142,7 @@ class DatasetApi(DatasetApiResource): Deletes a dataset given its ID. Args: + _: ignore dataset_id (UUID): The ID of the dataset to be deleted. Returns: diff --git a/api/core/app/app_config/easy_ui_based_app/model_config/converter.py b/api/core/app/app_config/easy_ui_based_app/model_config/converter.py index ecb045a30a..5beb09c2aa 100644 --- a/api/core/app/app_config/easy_ui_based_app/model_config/converter.py +++ b/api/core/app/app_config/easy_ui_based_app/model_config/converter.py @@ -16,7 +16,6 @@ class ModelConfigConverter: """ Convert app model config dict to entity. :param app_config: app config - :param skip_check: skip check :raises ProviderTokenNotInitError: provider token not init error :return: app orchestration config entity """ diff --git a/api/core/app/apps/advanced_chat/app_generator.py b/api/core/app/apps/advanced_chat/app_generator.py index 4fe22821f3..ef582d28e0 100644 --- a/api/core/app/apps/advanced_chat/app_generator.py +++ b/api/core/app/apps/advanced_chat/app_generator.py @@ -88,7 +88,7 @@ class AdvancedChatAppGenerator(MessageBasedAppGenerator): :param user: account or end user :param args: request args :param invoke_from: invoke from source - :param stream: is stream + :param streaming: is stream """ if not args.get("query"): raise ValueError("query is required") @@ -181,10 +181,10 @@ class AdvancedChatAppGenerator(MessageBasedAppGenerator): :param app_model: App :param workflow: Workflow + :param node_id: the node id :param user: account or end user :param args: request args - :param invoke_from: invoke from source - :param stream: is stream + :param streaming: is streamed """ if not node_id: raise ValueError("node_id is required") @@ -238,10 +238,10 @@ class AdvancedChatAppGenerator(MessageBasedAppGenerator): :param app_model: App :param workflow: Workflow + :param node_id: the node id :param user: account or end user :param args: request args - :param invoke_from: invoke from source - :param stream: is stream + :param streaming: is stream """ if not node_id: raise ValueError("node_id is required") diff --git a/api/core/app/apps/agent_chat/app_generator.py b/api/core/app/apps/agent_chat/app_generator.py index 23abe41080..3ed436c07a 100644 --- a/api/core/app/apps/agent_chat/app_generator.py +++ b/api/core/app/apps/agent_chat/app_generator.py @@ -80,7 +80,7 @@ class AgentChatAppGenerator(MessageBasedAppGenerator): :param user: account or end user :param args: request args :param invoke_from: invoke from source - :param stream: is stream + :param streaming: is stream """ if not streaming: raise ValueError("Agent Chat App does not support blocking mode") diff --git a/api/core/app/apps/base_app_runner.py b/api/core/app/apps/base_app_runner.py index 8c6b29731e..c813dbb9d1 100644 --- a/api/core/app/apps/base_app_runner.py +++ b/api/core/app/apps/base_app_runner.py @@ -157,6 +157,7 @@ class AppRunner: :param files: files :param query: query :param memory: memory + :param image_detail_config: the image quality config :return: """ # get prompt without memory and context diff --git a/api/core/app/apps/chat/app_generator.py b/api/core/app/apps/chat/app_generator.py index 5fc9ed55af..2d865795d8 100644 --- a/api/core/app/apps/chat/app_generator.py +++ b/api/core/app/apps/chat/app_generator.py @@ -76,7 +76,7 @@ class ChatAppGenerator(MessageBasedAppGenerator): :param user: account or end user :param args: request args :param invoke_from: invoke from source - :param stream: is stream + :param streaming: is stream """ if not args.get("query"): raise ValueError("query is required") diff --git a/api/core/app/apps/completion/app_generator.py b/api/core/app/apps/completion/app_generator.py index ac9ad346eb..b1bc412616 100644 --- a/api/core/app/apps/completion/app_generator.py +++ b/api/core/app/apps/completion/app_generator.py @@ -74,7 +74,7 @@ class CompletionAppGenerator(MessageBasedAppGenerator): :param user: account or end user :param args: request args :param invoke_from: invoke from source - :param stream: is stream + :param streaming: is stream """ query = args["query"] if not isinstance(query, str): diff --git a/api/core/app/apps/workflow/app_generator.py b/api/core/app/apps/workflow/app_generator.py index 0ee1ed5590..cc7bcdeee1 100644 --- a/api/core/app/apps/workflow/app_generator.py +++ b/api/core/app/apps/workflow/app_generator.py @@ -158,7 +158,7 @@ class WorkflowAppGenerator(BaseAppGenerator): :param user: account or end user :param application_generate_entity: application generate entity :param invoke_from: invoke from source - :param stream: is stream + :param streaming: is stream :param workflow_thread_pool_id: workflow thread pool id """ # init queue manager @@ -208,10 +208,10 @@ class WorkflowAppGenerator(BaseAppGenerator): :param app_model: App :param workflow: Workflow + :param node_id: the node id :param user: account or end user :param args: request args - :param invoke_from: invoke from source - :param stream: is stream + :param streaming: is streamed """ if not node_id: raise ValueError("node_id is required") @@ -264,10 +264,10 @@ class WorkflowAppGenerator(BaseAppGenerator): :param app_model: App :param workflow: Workflow + :param node_id: the node id :param user: account or end user :param args: request args - :param invoke_from: invoke from source - :param stream: is stream + :param streaming: is streamed """ if not node_id: raise ValueError("node_id is required") diff --git a/api/core/app/apps/workflow/app_runner.py b/api/core/app/apps/workflow/app_runner.py index 7bbf3612c9..b38ee18ac4 100644 --- a/api/core/app/apps/workflow/app_runner.py +++ b/api/core/app/apps/workflow/app_runner.py @@ -44,9 +44,6 @@ class WorkflowAppRunner(WorkflowBasedAppRunner): def run(self) -> None: """ Run application - :param application_generate_entity: application generate entity - :param queue_manager: application queue manager - :return: """ app_config = self.application_generate_entity.app_config app_config = cast(WorkflowAppConfig, app_config) diff --git a/api/core/app/task_pipeline/message_cycle_manage.py b/api/core/app/task_pipeline/message_cycle_manage.py index ef3a52442f..6223b33b67 100644 --- a/api/core/app/task_pipeline/message_cycle_manage.py +++ b/api/core/app/task_pipeline/message_cycle_manage.py @@ -48,7 +48,7 @@ class MessageCycleManage: def _generate_conversation_name(self, *, conversation_id: str, query: str) -> Optional[Thread]: """ Generate conversation name. - :param conversation: conversation + :param conversation_id: conversation id :param query: query :return: thread """ diff --git a/api/core/app/task_pipeline/workflow_cycle_manage.py b/api/core/app/task_pipeline/workflow_cycle_manage.py index ebae3285a6..4d629ca186 100644 --- a/api/core/app/task_pipeline/workflow_cycle_manage.py +++ b/api/core/app/task_pipeline/workflow_cycle_manage.py @@ -153,7 +153,7 @@ class WorkflowCycleManage: ) -> WorkflowRun: """ Workflow run success - :param workflow_run: workflow run + :param workflow_run_id: workflow run id :param start_at: start time :param total_tokens: total tokens :param total_steps: total steps @@ -236,7 +236,7 @@ class WorkflowCycleManage: ) -> WorkflowRun: """ Workflow run failed - :param workflow_run: workflow run + :param workflow_run_id: workflow run id :param start_at: start time :param total_tokens: total tokens :param total_steps: total steps diff --git a/api/core/file/upload_file_parser.py b/api/core/file/upload_file_parser.py index 1f81d351b6..96b2884811 100644 --- a/api/core/file/upload_file_parser.py +++ b/api/core/file/upload_file_parser.py @@ -36,7 +36,7 @@ class UploadFileParser: """ get signed url from upload file - :param upload_file: UploadFile object + :param upload_file_id: the id of UploadFile object :return: """ base_url = dify_config.FILES_URL diff --git a/api/core/helper/code_executor/code_executor.py b/api/core/helper/code_executor/code_executor.py index 15b501780e..5bb045cce9 100644 --- a/api/core/helper/code_executor/code_executor.py +++ b/api/core/helper/code_executor/code_executor.py @@ -60,6 +60,7 @@ class CodeExecutor: """ Execute code :param language: code language + :param preload: the preload script :param code: code :return: """ diff --git a/api/core/helper/position_helper.py b/api/core/helper/position_helper.py index 3efdc8aa47..8def6fe4ed 100644 --- a/api/core/helper/position_helper.py +++ b/api/core/helper/position_helper.py @@ -53,7 +53,7 @@ def pin_position_map(original_position_map: dict[str, int], pin_list: list[str]) """ Pin the items in the pin list to the beginning of the position map. Overall logic: exclude > include > pin - :param position_map: the position map to be sorted and filtered + :param original_position_map: the position map to be sorted and filtered :param pin_list: the list of pins to be put at the beginning :return: the sorted position map """ diff --git a/api/core/helper/tool_parameter_cache.py b/api/core/helper/tool_parameter_cache.py index 3b67b3f848..918b3e9eee 100644 --- a/api/core/helper/tool_parameter_cache.py +++ b/api/core/helper/tool_parameter_cache.py @@ -38,12 +38,7 @@ class ToolParameterCache: return None def set(self, parameters: dict) -> None: - """ - Cache model provider credentials. - - :param credentials: provider credentials - :return: - """ + """Cache model provider credentials.""" redis_client.setex(self.cache_key, 86400, json.dumps(parameters)) def delete(self) -> None: diff --git a/api/core/model_runtime/model_providers/__base/tts_model.py b/api/core/model_runtime/model_providers/__base/tts_model.py index 4feaa6f042..1f248d11ac 100644 --- a/api/core/model_runtime/model_providers/__base/tts_model.py +++ b/api/core/model_runtime/model_providers/__base/tts_model.py @@ -38,7 +38,6 @@ class TTSModel(AIModel): :param credentials: model credentials :param voice: model timbre :param content_text: text content to be translated - :param streaming: output is streaming :param user: unique user id :return: translated audio file """ diff --git a/api/core/rag/datasource/vdb/opengauss/opengauss.py b/api/core/rag/datasource/vdb/opengauss/opengauss.py index 4d57a651d5..dae908f67d 100644 --- a/api/core/rag/datasource/vdb/opengauss/opengauss.py +++ b/api/core/rag/datasource/vdb/opengauss/opengauss.py @@ -177,7 +177,6 @@ class OpenGauss(BaseVector): Search the nearest neighbors to a vector. :param query_vector: The input vector to search for similar items. - :param top_k: The number of nearest neighbors to return, default is 5. :return: List of Documents that are nearest to the query vector. """ top_k = kwargs.get("top_k", 4) diff --git a/api/core/rag/datasource/vdb/oracle/oraclevector.py b/api/core/rag/datasource/vdb/oracle/oraclevector.py index 5888e04c71..143dfb3258 100644 --- a/api/core/rag/datasource/vdb/oracle/oraclevector.py +++ b/api/core/rag/datasource/vdb/oracle/oraclevector.py @@ -197,7 +197,6 @@ class OracleVector(BaseVector): Search the nearest neighbors to a vector. :param query_vector: The input vector to search for similar items. - :param top_k: The number of nearest neighbors to return, default is 5. :return: List of Documents that are nearest to the query vector. """ top_k = kwargs.get("top_k", 4) diff --git a/api/core/rag/datasource/vdb/pgvector/pgvector.py b/api/core/rag/datasource/vdb/pgvector/pgvector.py index 7c0d36ebe0..eab51ab01d 100644 --- a/api/core/rag/datasource/vdb/pgvector/pgvector.py +++ b/api/core/rag/datasource/vdb/pgvector/pgvector.py @@ -167,7 +167,6 @@ class PGVector(BaseVector): Search the nearest neighbors to a vector. :param query_vector: The input vector to search for similar items. - :param top_k: The number of nearest neighbors to return, default is 5. :return: List of Documents that are nearest to the query vector. """ top_k = kwargs.get("top_k", 4) diff --git a/api/core/rag/datasource/vdb/tidb_on_qdrant/tidb_service.py b/api/core/rag/datasource/vdb/tidb_on_qdrant/tidb_service.py index 0a48c79511..3958280bd5 100644 --- a/api/core/rag/datasource/vdb/tidb_on_qdrant/tidb_service.py +++ b/api/core/rag/datasource/vdb/tidb_on_qdrant/tidb_service.py @@ -22,7 +22,6 @@ class TidbService: :param iam_url: The URL of the TiDB Cloud IAM API (required). :param public_key: The public key for the API (required). :param private_key: The private key for the API (required). - :param display_name: The user-friendly display name of the cluster (required). :param region: The region where the cluster will be created (required). :return: The response from the API. @@ -149,13 +148,12 @@ class TidbService: ): """ Update the status of a new TiDB Serverless cluster. + :param tidb_serverless_list: The TiDB serverless list (required). :param project_id: The project ID of the TiDB Cloud project (required). :param api_url: The URL of the TiDB Cloud API (required). :param iam_url: The URL of the TiDB Cloud IAM API (required). :param public_key: The public key for the API (required). :param private_key: The private key for the API (required). - :param display_name: The user-friendly display name of the cluster (required). - :param region: The region where the cluster will be created (required). :return: The response from the API. """ @@ -186,12 +184,12 @@ class TidbService: ) -> list[dict]: """ Creates a new TiDB Serverless cluster. + :param batch_size: The batch size (required). :param project_id: The project ID of the TiDB Cloud project (required). :param api_url: The URL of the TiDB Cloud API (required). :param iam_url: The URL of the TiDB Cloud IAM API (required). :param public_key: The public key for the API (required). :param private_key: The private key for the API (required). - :param display_name: The user-friendly display name of the cluster (required). :param region: The region where the cluster will be created (required). :return: The response from the API. diff --git a/api/core/rag/datasource/vdb/weaviate/weaviate_vector.py b/api/core/rag/datasource/vdb/weaviate/weaviate_vector.py index 01eaf947f1..8fe6199517 100644 --- a/api/core/rag/datasource/vdb/weaviate/weaviate_vector.py +++ b/api/core/rag/datasource/vdb/weaviate/weaviate_vector.py @@ -226,7 +226,6 @@ class WeaviateVector(BaseVector): Args: query: Text to look up documents similar to. - k: Number of Documents to return. Defaults to 4. Returns: List of Documents most similar to the query. diff --git a/api/core/rag/extractor/firecrawl/firecrawl_web_extractor.py b/api/core/rag/extractor/firecrawl/firecrawl_web_extractor.py index 355a2fb204..4de8318881 100644 --- a/api/core/rag/extractor/firecrawl/firecrawl_web_extractor.py +++ b/api/core/rag/extractor/firecrawl/firecrawl_web_extractor.py @@ -7,11 +7,10 @@ class FirecrawlWebExtractor(BaseExtractor): """ Crawl and scrape websites and return content in clean llm-ready markdown. - Args: url: The URL to scrape. - api_key: The API key for Firecrawl. - base_url: The base URL for the Firecrawl API. Defaults to 'https://api.firecrawl.dev'. + job_id: The crawl job id. + tenant_id: The tenant id. mode: The mode of operation. Defaults to 'scrape'. Options are 'crawl', 'scrape' and 'crawl_return_urls'. only_main_content: Only return the main content of the page excluding headers, navs, footers, etc. """ diff --git a/api/core/rag/extractor/unstructured/unstructured_markdown_extractor.py b/api/core/rag/extractor/unstructured/unstructured_markdown_extractor.py index d5418e612a..0a0c8d3a1c 100644 --- a/api/core/rag/extractor/unstructured/unstructured_markdown_extractor.py +++ b/api/core/rag/extractor/unstructured/unstructured_markdown_extractor.py @@ -14,15 +14,6 @@ class UnstructuredMarkdownExtractor(BaseExtractor): Args: file_path: Path to the file to load. - remove_hyperlinks: Whether to remove hyperlinks from the text. - - remove_images: Whether to remove images from the text. - - encoding: File encoding to use. If `None`, the file will be loaded - with the default system encoding. - - autodetect_encoding: Whether to try to autodetect the file encoding - if the specified encoding fails. """ def __init__(self, file_path: str, api_url: Optional[str] = None, api_key: str = ""): diff --git a/api/core/rag/retrieval/dataset_retrieval.py b/api/core/rag/retrieval/dataset_retrieval.py index 21c561f698..e00c989c9d 100644 --- a/api/core/rag/retrieval/dataset_retrieval.py +++ b/api/core/rag/retrieval/dataset_retrieval.py @@ -100,6 +100,7 @@ class DatasetRetrieval: :param hit_callback: hit callback :param message_id: message id :param memory: memory + :param inputs: inputs :return: """ dataset_ids = config.dataset_ids @@ -734,6 +735,7 @@ class DatasetRetrieval: Calculate keywords scores :param query: search query :param documents: documents for reranking + :param top_k: top k :return: """ @@ -1031,8 +1033,6 @@ class DatasetRetrieval: ) -> tuple[ModelInstance, ModelConfigWithCredentialsEntity]: """ Fetch model config - :param node_data: node data - :return: """ if model is None: raise ValueError("single_retrieval_config is required") diff --git a/api/core/rag/retrieval/router/multi_dataset_react_route.py b/api/core/rag/retrieval/router/multi_dataset_react_route.py index 05e8d043df..f0426ace1f 100644 --- a/api/core/rag/retrieval/router/multi_dataset_react_route.py +++ b/api/core/rag/retrieval/router/multi_dataset_react_route.py @@ -235,6 +235,7 @@ class ReactMultiDatasetRouter: tools: List of tools the agent will have access to, used to format the prompt. prefix: String to put before the list of tools. + format_instructions: The format instruction prompt. Returns: A PromptTemplate with the template assembled from the pieces here. """ diff --git a/api/core/tools/__base/tool.py b/api/core/tools/__base/tool.py index 63937f5f76..35e16b5c8f 100644 --- a/api/core/tools/__base/tool.py +++ b/api/core/tools/__base/tool.py @@ -29,9 +29,7 @@ class Tool(ABC): def fork_tool_runtime(self, runtime: ToolRuntime) -> "Tool": """ - fork a new tool with meta data - - :param meta: the meta data of a tool call processing, tenant_id is required + fork a new tool with metadata :return: the new tool """ return self.__class__( @@ -206,6 +204,7 @@ class Tool(ABC): create a blob message :param blob: the blob + :param meta: the meta info of blob object :return: the blob message """ return ToolInvokeMessage( diff --git a/api/core/tools/builtin_tool/provider.py b/api/core/tools/builtin_tool/provider.py index 037d86c89b..4f733f0ea1 100644 --- a/api/core/tools/builtin_tool/provider.py +++ b/api/core/tools/builtin_tool/provider.py @@ -153,7 +153,7 @@ class BuiltinToolProviderController(ToolProviderController): """ validate the credentials of the provider - :param tool_name: the name of the tool, defined in `get_tools` + :param user_id: use id :param credentials: the credentials of the tool """ # validate credentials format @@ -167,7 +167,7 @@ class BuiltinToolProviderController(ToolProviderController): """ validate the credentials of the provider - :param tool_name: the name of the tool, defined in `get_tools` + :param user_id: use id :param credentials: the credentials of the tool """ pass diff --git a/api/core/tools/builtin_tool/tool.py b/api/core/tools/builtin_tool/tool.py index e61cda5de5..7f37f98d0c 100644 --- a/api/core/tools/builtin_tool/tool.py +++ b/api/core/tools/builtin_tool/tool.py @@ -28,9 +28,7 @@ class BuiltinTool(Tool): def fork_tool_runtime(self, runtime: ToolRuntime) -> "BuiltinTool": """ - fork a new tool with meta data - - :param meta: the meta data of a tool call processing, tenant_id is required + fork a new tool with metadata :return: the new tool """ return self.__class__( @@ -43,7 +41,7 @@ class BuiltinTool(Tool): """ invoke model - :param model_config: the model config + :param user_id: the user id :param prompt_messages: the prompt messages :param stop: the stop words :return: the model result @@ -64,7 +62,6 @@ class BuiltinTool(Tool): """ get max tokens - :param model_config: the model config :return: the max tokens """ if self.runtime is None: diff --git a/api/core/tools/custom_tool/provider.py b/api/core/tools/custom_tool/provider.py index 7133535313..bfceb6679b 100644 --- a/api/core/tools/custom_tool/provider.py +++ b/api/core/tools/custom_tool/provider.py @@ -145,7 +145,6 @@ class ApiToolProviderController(ToolProviderController): """ fetch tools from database - :param user_id: the user id :param tenant_id: the tenant id :return: the tools """ diff --git a/api/core/tools/custom_tool/tool.py b/api/core/tools/custom_tool/tool.py index b1121fceec..2f2f1ebbdd 100644 --- a/api/core/tools/custom_tool/tool.py +++ b/api/core/tools/custom_tool/tool.py @@ -35,9 +35,7 @@ class ApiTool(Tool): def fork_tool_runtime(self, runtime: ToolRuntime): """ - fork a new tool with meta data - - :param meta: the meta data of a tool call processing, tenant_id is required + fork a new tool with metadata :return: the new tool """ if self.api_bundle is None: diff --git a/api/core/tools/entities/tool_entities.py b/api/core/tools/entities/tool_entities.py index 83e69d063d..d756763137 100644 --- a/api/core/tools/entities/tool_entities.py +++ b/api/core/tools/entities/tool_entities.py @@ -264,7 +264,7 @@ class ToolParameter(PluginParameter): :param name: the name of the parameter :param llm_description: the description presented to the LLM - :param type: the type of the parameter + :param typ: the type of the parameter :param required: if the parameter is required :param options: the options of the parameter """ diff --git a/api/core/tools/tool_engine.py b/api/core/tools/tool_engine.py index cf5411112d..997917f31c 100644 --- a/api/core/tools/tool_engine.py +++ b/api/core/tools/tool_engine.py @@ -313,7 +313,6 @@ class ToolEngine: """ Create message file - :param messages: messages :return: message file ids """ result = [] diff --git a/api/core/tools/tool_manager.py b/api/core/tools/tool_manager.py index 1caf02192d..f2d0b74f7c 100644 --- a/api/core/tools/tool_manager.py +++ b/api/core/tools/tool_manager.py @@ -161,8 +161,11 @@ class ToolManager: get the tool runtime :param provider_type: the type of the provider - :param provider_name: the name of the provider + :param provider_id: the id of the provider :param tool_name: the name of the tool + :param tenant_id: the tenant id + :param invoke_from: invoke from + :param tool_invoke_from: the tool invoke from :return: the tool """ @@ -427,8 +430,6 @@ class ToolManager: get the absolute path of the icon of the hardcoded provider :param provider: the name of the provider - :param tenant_id: the id of the tenant - :return: the absolute path of the icon, the mime type of the icon """ # get provider @@ -672,7 +673,8 @@ class ToolManager: """ get the api provider - :param provider_name: the name of the provider + :param tenant_id: the id of the tenant + :param provider_id: the id of the provider :return: the provider controller, the credentials """ diff --git a/api/core/tools/utils/model_invocation_utils.py b/api/core/tools/utils/model_invocation_utils.py index 245470ea49..3f59b3f472 100644 --- a/api/core/tools/utils/model_invocation_utils.py +++ b/api/core/tools/utils/model_invocation_utils.py @@ -84,12 +84,8 @@ class ModelInvocationUtils: :param user_id: user id :param tenant_id: tenant id, the tenant id of the creator of the tool - :param tool_provider: tool provider - :param tool_id: tool id + :param tool_type: tool type :param tool_name: tool name - :param provider: model provider - :param model: model name - :param model_parameters: model parameters :param prompt_messages: prompt messages :return: AssistantPromptMessage """ diff --git a/api/core/tools/utils/parser.py b/api/core/tools/utils/parser.py index 120c1fcfea..f72291783a 100644 --- a/api/core/tools/utils/parser.py +++ b/api/core/tools/utils/parser.py @@ -200,6 +200,8 @@ class ApiBasedToolSchemaParser: parse openapi yaml to tool bundle :param yaml: the yaml string + :param extra_info: the extra info + :param warning: the warning message :return: the tool bundle """ warning = warning if warning is not None else {} @@ -281,6 +283,8 @@ class ApiBasedToolSchemaParser: parse openapi plugin yaml to tool bundle :param json: the json string + :param extra_info: the extra info + :param warning: the warning message :return: the tool bundle """ warning = warning if warning is not None else {} @@ -315,6 +319,8 @@ class ApiBasedToolSchemaParser: auto parse to tool bundle :param content: the content + :param extra_info: the extra info + :param warning: the warning message :return: tools bundle, schema_type """ warning = warning if warning is not None else {} diff --git a/api/core/tools/workflow_as_tool/provider.py b/api/core/tools/workflow_as_tool/provider.py index 4777a019e4..7661e1e6a5 100644 --- a/api/core/tools/workflow_as_tool/provider.py +++ b/api/core/tools/workflow_as_tool/provider.py @@ -182,7 +182,6 @@ class WorkflowToolProviderController(ToolProviderController): """ fetch tools from database - :param user_id: the user id :param tenant_id: the tenant id :return: the tools """ diff --git a/api/core/tools/workflow_as_tool/tool.py b/api/core/tools/workflow_as_tool/tool.py index cf840880bf..241b4a94de 100644 --- a/api/core/tools/workflow_as_tool/tool.py +++ b/api/core/tools/workflow_as_tool/tool.py @@ -127,9 +127,8 @@ class WorkflowTool(Tool): def fork_tool_runtime(self, runtime: ToolRuntime) -> "WorkflowTool": """ - fork a new tool with meta data + fork a new tool with metadata - :param meta: the meta data of a tool call processing, tenant_id is required :return: the new tool """ return self.__class__( @@ -212,7 +211,6 @@ class WorkflowTool(Tool): """ extract files from the result - :param result: the result :return: the result, files """ files: list[File] = [] diff --git a/api/core/workflow/utils/variable_template_parser.py b/api/core/workflow/utils/variable_template_parser.py index 1d8fb38ebf..f86c54c50a 100644 --- a/api/core/workflow/utils/variable_template_parser.py +++ b/api/core/workflow/utils/variable_template_parser.py @@ -95,7 +95,6 @@ class VariableTemplateParser: Args: inputs: A dictionary containing the values for the template variables. - remove_template_variables: A boolean indicating whether to remove the template variables from the output. Returns: The formatted string with template variables replaced by their values. diff --git a/api/core/workflow/workflow_entry.py b/api/core/workflow/workflow_entry.py index 5a7d5373c1..50118a401c 100644 --- a/api/core/workflow/workflow_entry.py +++ b/api/core/workflow/workflow_entry.py @@ -204,6 +204,8 @@ class WorkflowEntry: NOTE: only parameter_extractor/question_classifier are supported :param node_data: node data + :param node_id: node id + :param tenant_id: tenant id :param user_id: user id :param user_inputs: user inputs :return: diff --git a/api/services/app_dsl_service.py b/api/services/app_dsl_service.py index d33d277d4b..67ef4c319a 100644 --- a/api/services/app_dsl_service.py +++ b/api/services/app_dsl_service.py @@ -513,6 +513,7 @@ class AppDslService: """ Export app :param app_model: App instance + :param include_secret: Whether include secret variable :return: """ app_mode = AppMode.value_of(app_model.mode) diff --git a/api/services/tools/builtin_tools_manage_service.py b/api/services/tools/builtin_tools_manage_service.py index 51b56ab586..075c60842b 100644 --- a/api/services/tools/builtin_tools_manage_service.py +++ b/api/services/tools/builtin_tools_manage_service.py @@ -28,7 +28,6 @@ class BuiltinToolManageService: """ list builtin tool provider tools - :param user_id: the id of the user :param tenant_id: the id of the tenant :param provider: the name of the provider diff --git a/api/services/tools/tools_transform_service.py b/api/services/tools/tools_transform_service.py index d44151befa..367121125b 100644 --- a/api/services/tools/tools_transform_service.py +++ b/api/services/tools/tools_transform_service.py @@ -60,6 +60,7 @@ class ToolTransformService: """ repack provider + :param tenant_id: the tenant id :param provider: the provider dict """ if isinstance(provider, dict) and "icon" in provider: diff --git a/api/services/tools/workflow_tools_manage_service.py b/api/services/tools/workflow_tools_manage_service.py index e486ed7b8c..c6b205557a 100644 --- a/api/services/tools/workflow_tools_manage_service.py +++ b/api/services/tools/workflow_tools_manage_service.py @@ -222,7 +222,7 @@ class WorkflowToolManageService: Delete a workflow tool. :param user_id: the user id :param tenant_id: the tenant id - :param workflow_app_id: the workflow app id + :param workflow_tool_id: the workflow tool id """ db.session.query(WorkflowToolProvider).filter( WorkflowToolProvider.tenant_id == tenant_id, WorkflowToolProvider.id == workflow_tool_id @@ -238,7 +238,7 @@ class WorkflowToolManageService: Get a workflow tool. :param user_id: the user id :param tenant_id: the tenant id - :param workflow_app_id: the workflow app id + :param workflow_tool_id: the workflow tool id :return: the tool """ db_tool: WorkflowToolProvider | None = ( @@ -313,7 +313,7 @@ class WorkflowToolManageService: List workflow tool provider tools. :param user_id: the user id :param tenant_id: the tenant id - :param workflow_app_id: the workflow app id + :param workflow_tool_id: the workflow tool id :return: the list of tools """ db_tool: WorkflowToolProvider | None = ( diff --git a/api/tasks/mail_account_deletion_task.py b/api/tasks/mail_account_deletion_task.py index 49a3a6d280..0c60ae53d5 100644 --- a/api/tasks/mail_account_deletion_task.py +++ b/api/tasks/mail_account_deletion_task.py @@ -10,11 +10,7 @@ from extensions.ext_mail import mail @shared_task(queue="mail") def send_deletion_success_task(to): - """Send email to user regarding account deletion. - - Args: - log (AccountDeletionLog): Account deletion log object - """ + """Send email to user regarding account deletion.""" if not mail.is_inited(): return diff --git a/api/tasks/ops_trace_task.py b/api/tasks/ops_trace_task.py index bb3b9e17ea..2b49e4bb23 100644 --- a/api/tasks/ops_trace_task.py +++ b/api/tasks/ops_trace_task.py @@ -17,8 +17,6 @@ from models.workflow import WorkflowRun def process_trace_tasks(file_info): """ Async process trace tasks - :param tasks_data: List of dictionaries containing task data - Usage: process_trace_tasks.delay(tasks_data) """ from core.ops.ops_trace_manager import OpsTraceManager