chore: docstring not match the function parameter (#17162)

This commit is contained in:
非法操作
2025-03-31 13:19:15 +08:00
committed by GitHub
parent 32527b26d5
commit 44f911a0a8
47 changed files with 60 additions and 95 deletions

View File

@@ -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(

View File

@@ -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

View File

@@ -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:

View File

@@ -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
"""

View File

@@ -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:

View File

@@ -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
"""

View File

@@ -313,7 +313,6 @@ class ToolEngine:
"""
Create message file
:param messages: messages
:return: message file ids
"""
result = []

View File

@@ -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
"""

View File

@@ -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
"""

View File

@@ -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 {}

View File

@@ -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
"""

View File

@@ -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] = []