Skip to content

Commit

Permalink
chore: update docstrings (#7343)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZuzooVn authored Aug 16, 2024
1 parent 9e6b755 commit dbc1ae4
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 7 deletions.
8 changes: 6 additions & 2 deletions api/core/agent/base_agent_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,19 @@ def __init__(self, tenant_id: str,
"""
Agent runner
:param tenant_id: tenant id
:param application_generate_entity: application generate entity
:param conversation: conversation
:param app_config: app generate entity
:param model_config: model config
:param config: dataset config
:param queue_manager: queue manager
:param message: message
:param user_id: user id
:param agent_llm_callback: agent llm callback
:param callback: callback
:param memory: memory
:param prompt_messages: prompt messages
:param variables_pool: variables pool
:param db_variables: db variables
:param model_instance: model instance
"""
self.tenant_id = tenant_id
self.application_generate_entity = application_generate_entity
Expand Down
2 changes: 2 additions & 0 deletions api/core/agent/cot_agent_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ def _handle_invoke_action(self, action: AgentScratchpadUnit.Action,
handle invoke action
:param action: action
:param tool_instances: tool instances
:param message_file_ids: message file ids
:param trace_manager: trace manager
:return: observation, meta
"""
# action is tool call, invoke tool
Expand Down
3 changes: 3 additions & 0 deletions api/core/app/apps/base_app_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ def _handle_invoke_result(self, invoke_result: Union[LLMResult, Generator],
:param invoke_result: invoke result
:param queue_manager: application queue manager
:param stream: stream
:param agent: agent
:return:
"""
if not stream:
Expand All @@ -278,6 +279,7 @@ def _handle_invoke_result_direct(self, invoke_result: LLMResult,
Handle invoke result direct
:param invoke_result: invoke result
:param queue_manager: application queue manager
:param agent: agent
:return:
"""
queue_manager.publish(
Expand All @@ -293,6 +295,7 @@ def _handle_invoke_result_stream(self, invoke_result: Generator,
Handle invoke result
:param invoke_result: invoke result
:param queue_manager: application queue manager
:param agent: agent
:return:
"""
model = None
Expand Down
1 change: 1 addition & 0 deletions api/core/app/apps/message_based_app_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ def _init_generate_records(self,
"""
Initialize generate records
:param application_generate_entity: application generate entity
:conversation conversation
:return:
"""
app_config = application_generate_entity.app_config
Expand Down
7 changes: 5 additions & 2 deletions api/core/model_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,8 @@ def invoke_tts(self, content_text: str, tenant_id: str, voice: str, user: Option
:param content_text: text content to be translated
:param tenant_id: user tenant id
:param user: unique user id
:param voice: model timbre
:param streaming: output is streaming
:param user: unique user id
:return: text for given audio file
"""
if not isinstance(self.model_type_instance, TTSModel):
Expand Down Expand Up @@ -401,6 +400,10 @@ def __init__(self, tenant_id: str,
managed_credentials: Optional[dict] = None) -> None:
"""
Load balancing model manager
:param tenant_id: tenant_id
:param provider: provider
:param model_type: model_type
:param model: model name
:param load_balancing_configs: all load balancing configurations
:param managed_credentials: credentials if load balancing configuration name is __inherit__
"""
Expand Down
2 changes: 1 addition & 1 deletion api/core/provider_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ def _to_model_settings(self, provider_entity: ProviderEntity,
-> list[ModelSettings]:
"""
Convert to model settings.
:param provider_entity: provider entity
:param provider_model_settings: provider model settings include enabled, load balancing enabled
:param load_balancing_model_configs: load balancing model configs
:return:
Expand Down
5 changes: 5 additions & 0 deletions api/core/tools/docs/zh_Hans/advanced_scale_out.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Dify支持`文本` `链接` `图片` `文件BLOB` `JSON` 等多种消息类型
create an image message
:param image: the url of the image
:param save_as: save as
:return: the image message
"""
```
Expand All @@ -34,6 +35,7 @@ Dify支持`文本` `链接` `图片` `文件BLOB` `JSON` 等多种消息类型
create a link message
:param link: the url of the link
:param save_as: save as
:return: the link message
"""
```
Expand All @@ -47,6 +49,7 @@ Dify支持`文本` `链接` `图片` `文件BLOB` `JSON` 等多种消息类型
create a text message
:param text: the text of the message
:param save_as: save as
:return: the text message
"""
```
Expand All @@ -63,6 +66,8 @@ Dify支持`文本` `链接` `图片` `文件BLOB` `JSON` 等多种消息类型
create a blob message
:param blob: the blob
:param meta: meta
:param save_as: save as
:return: the blob message
"""
```
Expand Down
10 changes: 9 additions & 1 deletion api/services/tools/workflow_tools_manage_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def create_workflow_tool(cls, user_id: str, tenant_id: str, workflow_app_id: str
:param description: the description
:param parameters: the parameters
:param privacy_policy: the privacy policy
:param labels: labels
:return: the created tool
"""
WorkflowToolConfigurationUtils.check_parameter_configurations(parameters)
Expand Down Expand Up @@ -92,7 +93,14 @@ def update_workflow_tool(cls, user_id: str, tenant_id: str, workflow_tool_id: st
Update a workflow tool.
:param user_id: the user id
:param tenant_id: the tenant id
:param tool: the tool
:param workflow_tool_id: workflow tool id
:param name: name
:param label: label
:param icon: icon
:param description: description
:param parameters: parameters
:param privacy_policy: privacy policy
:param labels: labels
:return: the updated tool
"""
WorkflowToolConfigurationUtils.check_parameter_configurations(parameters)
Expand Down
1 change: 1 addition & 0 deletions api/services/workflow/workflow_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,7 @@ def _replace_template_variables(self, template: str,
Replace Template Variables
:param template: template
:param variables: list of variables
:param external_data_variable_node_mapping: external data variable node mapping
:return:
"""
for v in variables:
Expand Down
2 changes: 1 addition & 1 deletion api/tasks/annotation/batch_import_annotations_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def batch_import_annotations_task(job_id: str, content_list: list[dict], app_id:
Add annotation to index.
:param job_id: job_id
:param content_list: content list
:param tenant_id: tenant id
:param app_id: app id
:param tenant_id: tenant id
:param user_id: user_id
"""
Expand Down

0 comments on commit dbc1ae4

Please sign in to comment.