dify-oapi2 0.2.0__py3-none-any.whl → 0.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dify_oapi/api/workflow/v1/model/file/__init__.py +1 -0
- dify_oapi/api/workflow/v1/model/file/file_info.py +53 -0
- dify_oapi/api/workflow/v1/model/file/preview_file_request.py +34 -0
- dify_oapi/api/workflow/v1/model/file/preview_file_response.py +9 -0
- dify_oapi/api/workflow/v1/model/file/upload_file_request.py +42 -0
- dify_oapi/api/workflow/v1/model/file/upload_file_request_body.py +23 -0
- dify_oapi/api/workflow/v1/model/file/upload_file_response.py +9 -0
- dify_oapi/api/workflow/v1/model/info/app_info.py +45 -0
- dify_oapi/api/workflow/v1/model/info/file_upload_config.py +45 -0
- dify_oapi/api/workflow/v1/model/info/get_info_request.py +24 -0
- dify_oapi/api/workflow/v1/model/info/get_info_response.py +9 -0
- dify_oapi/api/workflow/v1/model/info/get_parameters_request.py +24 -0
- dify_oapi/api/workflow/v1/model/info/get_parameters_response.py +9 -0
- dify_oapi/api/workflow/v1/model/info/get_site_request.py +24 -0
- dify_oapi/api/workflow/v1/model/info/get_site_response.py +9 -0
- dify_oapi/api/workflow/v1/model/info/parameters_info.py +37 -0
- dify_oapi/api/workflow/v1/model/info/site_info.py +75 -0
- dify_oapi/api/workflow/v1/model/info/system_parameters.py +38 -0
- dify_oapi/api/workflow/v1/model/info/user_input_form.py +43 -0
- dify_oapi/api/workflow/v1/model/log/__init__.py +0 -0
- dify_oapi/api/workflow/v1/model/log/end_user_info.py +38 -0
- dify_oapi/api/workflow/v1/model/log/get_workflow_logs_request.py +48 -0
- dify_oapi/api/workflow/v1/model/log/get_workflow_logs_response.py +13 -0
- dify_oapi/api/workflow/v1/model/log/log_info.py +57 -0
- dify_oapi/api/workflow/v1/model/log/workflow_run_log_info.py +65 -0
- dify_oapi/api/workflow/v1/model/workflow/execution_metadata.py +33 -0
- dify_oapi/api/workflow/v1/model/workflow/get_workflow_run_detail_request.py +30 -0
- dify_oapi/api/workflow/v1/model/{run_workflow_response.py → workflow/get_workflow_run_detail_response.py} +8 -11
- dify_oapi/api/workflow/v1/model/workflow/node_info.py +88 -0
- dify_oapi/api/workflow/v1/model/workflow/run_specific_workflow_request.py +38 -0
- dify_oapi/api/workflow/v1/model/workflow/run_specific_workflow_request_body.py +47 -0
- dify_oapi/api/workflow/v1/model/workflow/run_specific_workflow_response.py +9 -0
- dify_oapi/api/workflow/v1/model/{run_workflow_request.py → workflow/run_workflow_request.py} +4 -4
- dify_oapi/api/workflow/v1/model/workflow/run_workflow_request_body.py +47 -0
- dify_oapi/api/workflow/v1/model/workflow/run_workflow_response.py +9 -0
- dify_oapi/api/workflow/v1/model/{stop_workflow_request.py → workflow/stop_workflow_request.py} +9 -9
- dify_oapi/api/workflow/v1/model/{stop_workflow_request_body.py → workflow/stop_workflow_request_body.py} +3 -3
- dify_oapi/api/workflow/v1/model/{stop_workflow_response.py → workflow/stop_workflow_response.py} +2 -0
- dify_oapi/api/workflow/v1/model/workflow/streaming_event.py +42 -0
- dify_oapi/api/workflow/v1/model/workflow/workflow_file_info.py +40 -0
- dify_oapi/api/workflow/v1/model/workflow/workflow_inputs.py +56 -0
- dify_oapi/api/workflow/v1/model/workflow/workflow_run_data.py +72 -0
- dify_oapi/api/workflow/v1/model/workflow/workflow_run_info.py +35 -0
- dify_oapi/api/workflow/v1/model/workflow/workflow_types.py +54 -0
- dify_oapi/api/workflow/v1/resource/__init__.py +0 -1
- dify_oapi/api/workflow/v1/resource/file.py +63 -0
- dify_oapi/api/workflow/v1/resource/info.py +93 -0
- dify_oapi/api/workflow/v1/resource/log.py +43 -0
- dify_oapi/api/workflow/v1/resource/workflow.py +171 -53
- dify_oapi/api/workflow/v1/version.py +7 -1
- {dify_oapi2-0.2.0.dist-info → dify_oapi2-0.3.0.dist-info}/METADATA +2 -2
- {dify_oapi2-0.2.0.dist-info → dify_oapi2-0.3.0.dist-info}/RECORD +54 -18
- dify_oapi/api/workflow/v1/model/get_workflow_log_request.py +0 -50
- dify_oapi/api/workflow/v1/model/get_workflow_log_response.py +0 -42
- dify_oapi/api/workflow/v1/model/get_workflow_result_request.py +0 -30
- dify_oapi/api/workflow/v1/model/get_workflow_result_response.py +0 -17
- dify_oapi/api/workflow/v1/model/run_workflow_request_body.py +0 -42
- dify_oapi/api/workflow/v1/model/run_workflow_request_file.py +0 -50
- {dify_oapi2-0.2.0.dist-info → dify_oapi2-0.3.0.dist-info}/LICENSE +0 -0
- {dify_oapi2-0.2.0.dist-info → dify_oapi2-0.3.0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,72 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from typing import Any
|
4
|
+
|
5
|
+
from pydantic import BaseModel
|
6
|
+
|
7
|
+
from .workflow_types import WorkflowStatus
|
8
|
+
|
9
|
+
|
10
|
+
class WorkflowRunData(BaseModel):
|
11
|
+
id: str | None = None
|
12
|
+
workflow_id: str | None = None
|
13
|
+
status: WorkflowStatus | None = None
|
14
|
+
outputs: dict[str, Any] | None = None
|
15
|
+
error: str | None = None
|
16
|
+
elapsed_time: float | None = None
|
17
|
+
total_tokens: int | None = None
|
18
|
+
total_steps: int | None = None
|
19
|
+
created_at: int | None = None
|
20
|
+
finished_at: int | None = None
|
21
|
+
|
22
|
+
@staticmethod
|
23
|
+
def builder() -> WorkflowRunDataBuilder:
|
24
|
+
return WorkflowRunDataBuilder()
|
25
|
+
|
26
|
+
|
27
|
+
class WorkflowRunDataBuilder:
|
28
|
+
def __init__(self):
|
29
|
+
self._workflow_run_data = WorkflowRunData()
|
30
|
+
|
31
|
+
def build(self) -> WorkflowRunData:
|
32
|
+
return self._workflow_run_data
|
33
|
+
|
34
|
+
def id(self, id: str) -> WorkflowRunDataBuilder:
|
35
|
+
self._workflow_run_data.id = id
|
36
|
+
return self
|
37
|
+
|
38
|
+
def workflow_id(self, workflow_id: str) -> WorkflowRunDataBuilder:
|
39
|
+
self._workflow_run_data.workflow_id = workflow_id
|
40
|
+
return self
|
41
|
+
|
42
|
+
def status(self, status: WorkflowStatus) -> WorkflowRunDataBuilder:
|
43
|
+
self._workflow_run_data.status = status
|
44
|
+
return self
|
45
|
+
|
46
|
+
def outputs(self, outputs: dict[str, Any]) -> WorkflowRunDataBuilder:
|
47
|
+
self._workflow_run_data.outputs = outputs
|
48
|
+
return self
|
49
|
+
|
50
|
+
def error(self, error: str) -> WorkflowRunDataBuilder:
|
51
|
+
self._workflow_run_data.error = error
|
52
|
+
return self
|
53
|
+
|
54
|
+
def elapsed_time(self, elapsed_time: float) -> WorkflowRunDataBuilder:
|
55
|
+
self._workflow_run_data.elapsed_time = elapsed_time
|
56
|
+
return self
|
57
|
+
|
58
|
+
def total_tokens(self, total_tokens: int) -> WorkflowRunDataBuilder:
|
59
|
+
self._workflow_run_data.total_tokens = total_tokens
|
60
|
+
return self
|
61
|
+
|
62
|
+
def total_steps(self, total_steps: int) -> WorkflowRunDataBuilder:
|
63
|
+
self._workflow_run_data.total_steps = total_steps
|
64
|
+
return self
|
65
|
+
|
66
|
+
def created_at(self, created_at: int) -> WorkflowRunDataBuilder:
|
67
|
+
self._workflow_run_data.created_at = created_at
|
68
|
+
return self
|
69
|
+
|
70
|
+
def finished_at(self, finished_at: int) -> WorkflowRunDataBuilder:
|
71
|
+
self._workflow_run_data.finished_at = finished_at
|
72
|
+
return self
|
@@ -0,0 +1,35 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from pydantic import BaseModel
|
4
|
+
|
5
|
+
from .workflow_run_data import WorkflowRunData
|
6
|
+
|
7
|
+
|
8
|
+
class WorkflowRunInfo(BaseModel):
|
9
|
+
workflow_run_id: str | None = None
|
10
|
+
task_id: str | None = None
|
11
|
+
data: WorkflowRunData | None = None
|
12
|
+
|
13
|
+
@staticmethod
|
14
|
+
def builder() -> WorkflowRunInfoBuilder:
|
15
|
+
return WorkflowRunInfoBuilder()
|
16
|
+
|
17
|
+
|
18
|
+
class WorkflowRunInfoBuilder:
|
19
|
+
def __init__(self):
|
20
|
+
self._workflow_run_info = WorkflowRunInfo()
|
21
|
+
|
22
|
+
def build(self) -> WorkflowRunInfo:
|
23
|
+
return self._workflow_run_info
|
24
|
+
|
25
|
+
def workflow_run_id(self, workflow_run_id: str) -> WorkflowRunInfoBuilder:
|
26
|
+
self._workflow_run_info.workflow_run_id = workflow_run_id
|
27
|
+
return self
|
28
|
+
|
29
|
+
def task_id(self, task_id: str) -> WorkflowRunInfoBuilder:
|
30
|
+
self._workflow_run_info.task_id = task_id
|
31
|
+
return self
|
32
|
+
|
33
|
+
def data(self, data: WorkflowRunData) -> WorkflowRunInfoBuilder:
|
34
|
+
self._workflow_run_info.data = data
|
35
|
+
return self
|
@@ -0,0 +1,54 @@
|
|
1
|
+
from typing import Literal
|
2
|
+
|
3
|
+
# Response mode types
|
4
|
+
ResponseMode = Literal["streaming", "blocking"]
|
5
|
+
|
6
|
+
# File types
|
7
|
+
FileType = Literal["document", "image", "audio", "video", "custom"]
|
8
|
+
|
9
|
+
# Transfer method types
|
10
|
+
TransferMethod = Literal["remote_url", "local_file"]
|
11
|
+
|
12
|
+
# Workflow status types
|
13
|
+
WorkflowStatus = Literal["running", "succeeded", "failed", "stopped"]
|
14
|
+
|
15
|
+
# Event types
|
16
|
+
EventType = Literal[
|
17
|
+
"workflow_started",
|
18
|
+
"node_started",
|
19
|
+
"text_chunk",
|
20
|
+
"node_finished",
|
21
|
+
"workflow_finished",
|
22
|
+
"tts_message",
|
23
|
+
"tts_message_end",
|
24
|
+
"ping",
|
25
|
+
]
|
26
|
+
|
27
|
+
# Node types
|
28
|
+
NodeType = Literal[
|
29
|
+
"start",
|
30
|
+
"end",
|
31
|
+
"llm",
|
32
|
+
"code",
|
33
|
+
"template",
|
34
|
+
"knowledge_retrieval",
|
35
|
+
"question_classifier",
|
36
|
+
"if_else",
|
37
|
+
"variable_assigner",
|
38
|
+
"parameter_extractor",
|
39
|
+
]
|
40
|
+
|
41
|
+
# Icon types
|
42
|
+
IconType = Literal["emoji", "image"]
|
43
|
+
|
44
|
+
# App mode types
|
45
|
+
AppMode = Literal["workflow"]
|
46
|
+
|
47
|
+
# Log status types
|
48
|
+
LogStatus = Literal["succeeded", "failed", "stopped"]
|
49
|
+
|
50
|
+
# Created by role types
|
51
|
+
CreatedByRole = Literal["end_user", "account"]
|
52
|
+
|
53
|
+
# Created from types
|
54
|
+
CreatedFrom = Literal["service-api", "web-app"]
|
@@ -1 +0,0 @@
|
|
1
|
-
from .workflow import * # noqa 403
|
@@ -0,0 +1,63 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from dify_oapi.core.http.transport import ATransport, Transport
|
4
|
+
from dify_oapi.core.model.config import Config
|
5
|
+
from dify_oapi.core.model.request_option import RequestOption
|
6
|
+
|
7
|
+
from ..model.file.preview_file_request import PreviewFileRequest
|
8
|
+
from ..model.file.preview_file_response import PreviewFileResponse
|
9
|
+
from ..model.file.upload_file_request import UploadFileRequest
|
10
|
+
from ..model.file.upload_file_response import UploadFileResponse
|
11
|
+
|
12
|
+
|
13
|
+
class File:
|
14
|
+
def __init__(self, config: Config) -> None:
|
15
|
+
self.config = config
|
16
|
+
|
17
|
+
def upload_file(self, request: UploadFileRequest, request_option: RequestOption) -> UploadFileResponse:
|
18
|
+
"""Upload file for multimodal support.
|
19
|
+
|
20
|
+
Args:
|
21
|
+
request: The upload file request
|
22
|
+
request_option: Request options including API key
|
23
|
+
|
24
|
+
Returns:
|
25
|
+
UploadFileResponse with file information
|
26
|
+
"""
|
27
|
+
return Transport.execute(self.config, request, unmarshal_as=UploadFileResponse, option=request_option)
|
28
|
+
|
29
|
+
async def aupload_file(self, request: UploadFileRequest, request_option: RequestOption) -> UploadFileResponse:
|
30
|
+
"""Upload file for multimodal support asynchronously.
|
31
|
+
|
32
|
+
Args:
|
33
|
+
request: The upload file request
|
34
|
+
request_option: Request options including API key
|
35
|
+
|
36
|
+
Returns:
|
37
|
+
UploadFileResponse with file information
|
38
|
+
"""
|
39
|
+
return await ATransport.aexecute(self.config, request, unmarshal_as=UploadFileResponse, option=request_option)
|
40
|
+
|
41
|
+
def preview_file(self, request: PreviewFileRequest, request_option: RequestOption) -> PreviewFileResponse:
|
42
|
+
"""Preview or download uploaded file.
|
43
|
+
|
44
|
+
Args:
|
45
|
+
request: The preview file request
|
46
|
+
request_option: Request options including API key
|
47
|
+
|
48
|
+
Returns:
|
49
|
+
PreviewFileResponse with file content
|
50
|
+
"""
|
51
|
+
return Transport.execute(self.config, request, unmarshal_as=PreviewFileResponse, option=request_option)
|
52
|
+
|
53
|
+
async def apreview_file(self, request: PreviewFileRequest, request_option: RequestOption) -> PreviewFileResponse:
|
54
|
+
"""Preview or download uploaded file asynchronously.
|
55
|
+
|
56
|
+
Args:
|
57
|
+
request: The preview file request
|
58
|
+
request_option: Request options including API key
|
59
|
+
|
60
|
+
Returns:
|
61
|
+
PreviewFileResponse with file content
|
62
|
+
"""
|
63
|
+
return await ATransport.aexecute(self.config, request, unmarshal_as=PreviewFileResponse, option=request_option)
|
@@ -0,0 +1,93 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from dify_oapi.core.http.transport import ATransport, Transport
|
4
|
+
from dify_oapi.core.model.config import Config
|
5
|
+
from dify_oapi.core.model.request_option import RequestOption
|
6
|
+
|
7
|
+
from ..model.info.get_info_request import GetInfoRequest
|
8
|
+
from ..model.info.get_info_response import GetInfoResponse
|
9
|
+
from ..model.info.get_parameters_request import GetParametersRequest
|
10
|
+
from ..model.info.get_parameters_response import GetParametersResponse
|
11
|
+
from ..model.info.get_site_request import GetSiteRequest
|
12
|
+
from ..model.info.get_site_response import GetSiteResponse
|
13
|
+
|
14
|
+
|
15
|
+
class Info:
|
16
|
+
def __init__(self, config: Config) -> None:
|
17
|
+
self.config = config
|
18
|
+
|
19
|
+
def get_info(self, request: GetInfoRequest, request_option: RequestOption) -> GetInfoResponse:
|
20
|
+
"""Get application basic information.
|
21
|
+
|
22
|
+
Args:
|
23
|
+
request: The get info request
|
24
|
+
request_option: Request options including API key
|
25
|
+
|
26
|
+
Returns:
|
27
|
+
GetInfoResponse with application information
|
28
|
+
"""
|
29
|
+
return Transport.execute(self.config, request, unmarshal_as=GetInfoResponse, option=request_option)
|
30
|
+
|
31
|
+
async def aget_info(self, request: GetInfoRequest, request_option: RequestOption) -> GetInfoResponse:
|
32
|
+
"""Get application basic information asynchronously.
|
33
|
+
|
34
|
+
Args:
|
35
|
+
request: The get info request
|
36
|
+
request_option: Request options including API key
|
37
|
+
|
38
|
+
Returns:
|
39
|
+
GetInfoResponse with application information
|
40
|
+
"""
|
41
|
+
return await ATransport.aexecute(self.config, request, unmarshal_as=GetInfoResponse, option=request_option)
|
42
|
+
|
43
|
+
def get_parameters(self, request: GetParametersRequest, request_option: RequestOption) -> GetParametersResponse:
|
44
|
+
"""Get application parameters.
|
45
|
+
|
46
|
+
Args:
|
47
|
+
request: The get parameters request
|
48
|
+
request_option: Request options including API key
|
49
|
+
|
50
|
+
Returns:
|
51
|
+
GetParametersResponse with application parameters
|
52
|
+
"""
|
53
|
+
return Transport.execute(self.config, request, unmarshal_as=GetParametersResponse, option=request_option)
|
54
|
+
|
55
|
+
async def aget_parameters(
|
56
|
+
self, request: GetParametersRequest, request_option: RequestOption
|
57
|
+
) -> GetParametersResponse:
|
58
|
+
"""Get application parameters asynchronously.
|
59
|
+
|
60
|
+
Args:
|
61
|
+
request: The get parameters request
|
62
|
+
request_option: Request options including API key
|
63
|
+
|
64
|
+
Returns:
|
65
|
+
GetParametersResponse with application parameters
|
66
|
+
"""
|
67
|
+
return await ATransport.aexecute(
|
68
|
+
self.config, request, unmarshal_as=GetParametersResponse, option=request_option
|
69
|
+
)
|
70
|
+
|
71
|
+
def get_site(self, request: GetSiteRequest, request_option: RequestOption) -> GetSiteResponse:
|
72
|
+
"""Get WebApp settings.
|
73
|
+
|
74
|
+
Args:
|
75
|
+
request: The get site request
|
76
|
+
request_option: Request options including API key
|
77
|
+
|
78
|
+
Returns:
|
79
|
+
GetSiteResponse with WebApp settings
|
80
|
+
"""
|
81
|
+
return Transport.execute(self.config, request, unmarshal_as=GetSiteResponse, option=request_option)
|
82
|
+
|
83
|
+
async def aget_site(self, request: GetSiteRequest, request_option: RequestOption) -> GetSiteResponse:
|
84
|
+
"""Get WebApp settings asynchronously.
|
85
|
+
|
86
|
+
Args:
|
87
|
+
request: The get site request
|
88
|
+
request_option: Request options including API key
|
89
|
+
|
90
|
+
Returns:
|
91
|
+
GetSiteResponse with WebApp settings
|
92
|
+
"""
|
93
|
+
return await ATransport.aexecute(self.config, request, unmarshal_as=GetSiteResponse, option=request_option)
|
@@ -0,0 +1,43 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from dify_oapi.core.http.transport import ATransport, Transport
|
4
|
+
from dify_oapi.core.model.config import Config
|
5
|
+
from dify_oapi.core.model.request_option import RequestOption
|
6
|
+
|
7
|
+
from ..model.log.get_workflow_logs_request import GetWorkflowLogsRequest
|
8
|
+
from ..model.log.get_workflow_logs_response import GetWorkflowLogsResponse
|
9
|
+
|
10
|
+
|
11
|
+
class Log:
|
12
|
+
def __init__(self, config: Config) -> None:
|
13
|
+
self.config = config
|
14
|
+
|
15
|
+
def get_workflow_logs(
|
16
|
+
self, request: GetWorkflowLogsRequest, request_option: RequestOption
|
17
|
+
) -> GetWorkflowLogsResponse:
|
18
|
+
"""Get workflow execution logs.
|
19
|
+
|
20
|
+
Args:
|
21
|
+
request: The get workflow logs request
|
22
|
+
request_option: Request options including API key
|
23
|
+
|
24
|
+
Returns:
|
25
|
+
GetWorkflowLogsResponse with workflow logs
|
26
|
+
"""
|
27
|
+
return Transport.execute(self.config, request, unmarshal_as=GetWorkflowLogsResponse, option=request_option)
|
28
|
+
|
29
|
+
async def aget_workflow_logs(
|
30
|
+
self, request: GetWorkflowLogsRequest, request_option: RequestOption
|
31
|
+
) -> GetWorkflowLogsResponse:
|
32
|
+
"""Get workflow execution logs asynchronously.
|
33
|
+
|
34
|
+
Args:
|
35
|
+
request: The get workflow logs request
|
36
|
+
request_option: Request options including API key
|
37
|
+
|
38
|
+
Returns:
|
39
|
+
GetWorkflowLogsResponse with workflow logs
|
40
|
+
"""
|
41
|
+
return await ATransport.aexecute(
|
42
|
+
self.config, request, unmarshal_as=GetWorkflowLogsResponse, option=request_option
|
43
|
+
)
|
@@ -5,98 +5,216 @@ from dify_oapi.core.http.transport import ATransport, Transport
|
|
5
5
|
from dify_oapi.core.model.config import Config
|
6
6
|
from dify_oapi.core.model.request_option import RequestOption
|
7
7
|
|
8
|
-
from ..model.
|
9
|
-
from ..model.
|
10
|
-
from ..model.
|
11
|
-
from ..model.
|
12
|
-
from ..model.run_workflow_request import RunWorkflowRequest
|
13
|
-
from ..model.run_workflow_response import RunWorkflowResponse
|
14
|
-
from ..model.stop_workflow_request import StopWorkflowRequest
|
15
|
-
from ..model.stop_workflow_response import StopWorkflowResponse
|
8
|
+
from ..model.workflow.get_workflow_run_detail_request import GetWorkflowRunDetailRequest
|
9
|
+
from ..model.workflow.get_workflow_run_detail_response import GetWorkflowRunDetailResponse
|
10
|
+
from ..model.workflow.run_specific_workflow_request import RunSpecificWorkflowRequest
|
11
|
+
from ..model.workflow.run_specific_workflow_response import RunSpecificWorkflowResponse
|
12
|
+
from ..model.workflow.run_workflow_request import RunWorkflowRequest
|
13
|
+
from ..model.workflow.run_workflow_response import RunWorkflowResponse
|
14
|
+
from ..model.workflow.stop_workflow_request import StopWorkflowRequest
|
15
|
+
from ..model.workflow.stop_workflow_response import StopWorkflowResponse
|
16
16
|
|
17
17
|
|
18
18
|
class Workflow:
|
19
19
|
def __init__(self, config: Config) -> None:
|
20
|
-
self.config
|
20
|
+
self.config = config
|
21
21
|
|
22
22
|
@overload
|
23
|
-
def
|
23
|
+
def run_workflow(
|
24
24
|
self,
|
25
25
|
request: RunWorkflowRequest,
|
26
|
-
|
26
|
+
request_option: RequestOption,
|
27
27
|
stream: Literal[True],
|
28
28
|
) -> Generator[bytes, None, None]: ...
|
29
29
|
|
30
30
|
@overload
|
31
|
-
def
|
31
|
+
def run_workflow(
|
32
32
|
self,
|
33
33
|
request: RunWorkflowRequest,
|
34
|
-
|
35
|
-
stream: Literal[False],
|
34
|
+
request_option: RequestOption,
|
35
|
+
stream: Literal[False] = False,
|
36
36
|
) -> RunWorkflowResponse: ...
|
37
37
|
|
38
|
-
|
39
|
-
def run(self, request: RunWorkflowRequest, option: RequestOption | None) -> RunWorkflowResponse: ...
|
40
|
-
|
41
|
-
def run(
|
38
|
+
def run_workflow(
|
42
39
|
self,
|
43
40
|
request: RunWorkflowRequest,
|
44
|
-
|
41
|
+
request_option: RequestOption,
|
45
42
|
stream: bool = False,
|
46
|
-
):
|
43
|
+
) -> RunWorkflowResponse | Generator[bytes, None, None]:
|
44
|
+
"""Execute workflow.
|
45
|
+
|
46
|
+
Args:
|
47
|
+
request: The run workflow request
|
48
|
+
request_option: Request options including API key
|
49
|
+
stream: Whether to use streaming mode
|
50
|
+
|
51
|
+
Returns:
|
52
|
+
RunWorkflowResponse for blocking mode or Generator[bytes, None, None] for streaming mode
|
53
|
+
"""
|
47
54
|
if stream:
|
48
|
-
return Transport.execute(self.config, request,
|
49
|
-
|
50
|
-
return Transport.execute(self.config, request, unmarshal_as=RunWorkflowResponse, option=option)
|
55
|
+
return Transport.execute(self.config, request, stream=True, option=request_option)
|
56
|
+
return Transport.execute(self.config, request, unmarshal_as=RunWorkflowResponse, option=request_option)
|
51
57
|
|
52
58
|
@overload
|
53
|
-
async def
|
59
|
+
async def arun_workflow(
|
54
60
|
self,
|
55
61
|
request: RunWorkflowRequest,
|
56
|
-
|
62
|
+
request_option: RequestOption,
|
57
63
|
stream: Literal[True],
|
58
64
|
) -> AsyncGenerator[bytes, None]: ...
|
59
65
|
|
60
66
|
@overload
|
61
|
-
async def
|
67
|
+
async def arun_workflow(
|
62
68
|
self,
|
63
69
|
request: RunWorkflowRequest,
|
64
|
-
|
65
|
-
stream: Literal[False],
|
70
|
+
request_option: RequestOption,
|
71
|
+
stream: Literal[False] = False,
|
66
72
|
) -> RunWorkflowResponse: ...
|
67
73
|
|
68
|
-
|
69
|
-
async def arun(self, request: RunWorkflowRequest, option: RequestOption | None) -> RunWorkflowResponse: ...
|
70
|
-
|
71
|
-
async def arun(
|
74
|
+
async def arun_workflow(
|
72
75
|
self,
|
73
76
|
request: RunWorkflowRequest,
|
74
|
-
|
77
|
+
request_option: RequestOption,
|
75
78
|
stream: bool = False,
|
76
|
-
):
|
79
|
+
) -> RunWorkflowResponse | AsyncGenerator[bytes, None]:
|
80
|
+
"""Execute workflow asynchronously.
|
81
|
+
|
82
|
+
Args:
|
83
|
+
request: The run workflow request
|
84
|
+
request_option: Request options including API key
|
85
|
+
stream: Whether to use streaming mode
|
86
|
+
|
87
|
+
Returns:
|
88
|
+
RunWorkflowResponse for blocking mode or AsyncGenerator[bytes, None] for streaming mode
|
89
|
+
"""
|
77
90
|
if stream:
|
78
|
-
return await ATransport.aexecute(self.config, request,
|
79
|
-
|
80
|
-
|
91
|
+
return await ATransport.aexecute(self.config, request, stream=True, option=request_option)
|
92
|
+
return await ATransport.aexecute(self.config, request, unmarshal_as=RunWorkflowResponse, option=request_option)
|
93
|
+
|
94
|
+
@overload
|
95
|
+
def run_specific_workflow(
|
96
|
+
self,
|
97
|
+
request: RunSpecificWorkflowRequest,
|
98
|
+
request_option: RequestOption,
|
99
|
+
stream: Literal[True],
|
100
|
+
) -> Generator[bytes, None, None]: ...
|
101
|
+
|
102
|
+
@overload
|
103
|
+
def run_specific_workflow(
|
104
|
+
self,
|
105
|
+
request: RunSpecificWorkflowRequest,
|
106
|
+
request_option: RequestOption,
|
107
|
+
stream: Literal[False] = False,
|
108
|
+
) -> RunSpecificWorkflowResponse: ...
|
81
109
|
|
82
|
-
def
|
83
|
-
|
110
|
+
def run_specific_workflow(
|
111
|
+
self,
|
112
|
+
request: RunSpecificWorkflowRequest,
|
113
|
+
request_option: RequestOption,
|
114
|
+
stream: bool = False,
|
115
|
+
) -> RunSpecificWorkflowResponse | Generator[bytes, None, None]:
|
116
|
+
"""Execute specific version workflow.
|
84
117
|
|
85
|
-
|
86
|
-
|
118
|
+
Args:
|
119
|
+
request: The run specific workflow request
|
120
|
+
request_option: Request options including API key
|
121
|
+
stream: Whether to use streaming mode
|
87
122
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
123
|
+
Returns:
|
124
|
+
RunSpecificWorkflowResponse for blocking mode or Generator[bytes, None, None] for streaming mode
|
125
|
+
"""
|
126
|
+
if stream:
|
127
|
+
return Transport.execute(self.config, request, stream=True, option=request_option)
|
128
|
+
return Transport.execute(self.config, request, unmarshal_as=RunSpecificWorkflowResponse, option=request_option)
|
92
129
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
130
|
+
@overload
|
131
|
+
async def arun_specific_workflow(
|
132
|
+
self,
|
133
|
+
request: RunSpecificWorkflowRequest,
|
134
|
+
request_option: RequestOption,
|
135
|
+
stream: Literal[True],
|
136
|
+
) -> AsyncGenerator[bytes, None]: ...
|
97
137
|
|
98
|
-
|
99
|
-
|
138
|
+
@overload
|
139
|
+
async def arun_specific_workflow(
|
140
|
+
self,
|
141
|
+
request: RunSpecificWorkflowRequest,
|
142
|
+
request_option: RequestOption,
|
143
|
+
stream: Literal[False] = False,
|
144
|
+
) -> RunSpecificWorkflowResponse: ...
|
100
145
|
|
101
|
-
async def
|
102
|
-
|
146
|
+
async def arun_specific_workflow(
|
147
|
+
self,
|
148
|
+
request: RunSpecificWorkflowRequest,
|
149
|
+
request_option: RequestOption,
|
150
|
+
stream: bool = False,
|
151
|
+
) -> RunSpecificWorkflowResponse | AsyncGenerator[bytes, None]:
|
152
|
+
"""Execute specific version workflow asynchronously.
|
153
|
+
|
154
|
+
Args:
|
155
|
+
request: The run specific workflow request
|
156
|
+
request_option: Request options including API key
|
157
|
+
stream: Whether to use streaming mode
|
158
|
+
|
159
|
+
Returns:
|
160
|
+
RunSpecificWorkflowResponse for blocking mode or AsyncGenerator[bytes, None] for streaming mode
|
161
|
+
"""
|
162
|
+
if stream:
|
163
|
+
return await ATransport.aexecute(self.config, request, stream=True, option=request_option)
|
164
|
+
return await ATransport.aexecute(
|
165
|
+
self.config, request, unmarshal_as=RunSpecificWorkflowResponse, option=request_option
|
166
|
+
)
|
167
|
+
|
168
|
+
def get_workflow_run_detail(
|
169
|
+
self, request: GetWorkflowRunDetailRequest, request_option: RequestOption
|
170
|
+
) -> GetWorkflowRunDetailResponse:
|
171
|
+
"""Get workflow execution details.
|
172
|
+
|
173
|
+
Args:
|
174
|
+
request: The get workflow run detail request
|
175
|
+
request_option: Request options including API key
|
176
|
+
|
177
|
+
Returns:
|
178
|
+
GetWorkflowRunDetailResponse with workflow execution details
|
179
|
+
"""
|
180
|
+
return Transport.execute(self.config, request, unmarshal_as=GetWorkflowRunDetailResponse, option=request_option)
|
181
|
+
|
182
|
+
async def aget_workflow_run_detail(
|
183
|
+
self, request: GetWorkflowRunDetailRequest, request_option: RequestOption
|
184
|
+
) -> GetWorkflowRunDetailResponse:
|
185
|
+
"""Get workflow execution details asynchronously.
|
186
|
+
|
187
|
+
Args:
|
188
|
+
request: The get workflow run detail request
|
189
|
+
request_option: Request options including API key
|
190
|
+
|
191
|
+
Returns:
|
192
|
+
GetWorkflowRunDetailResponse with workflow execution details
|
193
|
+
"""
|
194
|
+
return await ATransport.aexecute(
|
195
|
+
self.config, request, unmarshal_as=GetWorkflowRunDetailResponse, option=request_option
|
196
|
+
)
|
197
|
+
|
198
|
+
def stop_workflow(self, request: StopWorkflowRequest, request_option: RequestOption) -> StopWorkflowResponse:
|
199
|
+
"""Stop workflow execution.
|
200
|
+
|
201
|
+
Args:
|
202
|
+
request: The stop workflow request
|
203
|
+
request_option: Request options including API key
|
204
|
+
|
205
|
+
Returns:
|
206
|
+
StopWorkflowResponse with stop result
|
207
|
+
"""
|
208
|
+
return Transport.execute(self.config, request, unmarshal_as=StopWorkflowResponse, option=request_option)
|
209
|
+
|
210
|
+
async def astop_workflow(self, request: StopWorkflowRequest, request_option: RequestOption) -> StopWorkflowResponse:
|
211
|
+
"""Stop workflow execution asynchronously.
|
212
|
+
|
213
|
+
Args:
|
214
|
+
request: The stop workflow request
|
215
|
+
request_option: Request options including API key
|
216
|
+
|
217
|
+
Returns:
|
218
|
+
StopWorkflowResponse with stop result
|
219
|
+
"""
|
220
|
+
return await ATransport.aexecute(self.config, request, unmarshal_as=StopWorkflowResponse, option=request_option)
|
@@ -1,8 +1,14 @@
|
|
1
1
|
from dify_oapi.core.model.config import Config
|
2
2
|
|
3
|
-
from .resource import
|
3
|
+
from .resource.file import File
|
4
|
+
from .resource.info import Info
|
5
|
+
from .resource.log import Log
|
6
|
+
from .resource.workflow import Workflow
|
4
7
|
|
5
8
|
|
6
9
|
class V1:
|
7
10
|
def __init__(self, config: Config):
|
8
11
|
self.workflow: Workflow = Workflow(config)
|
12
|
+
self.file: File = File(config)
|
13
|
+
self.log: Log = Log(config)
|
14
|
+
self.info: Info = Info(config)
|
@@ -1,11 +1,11 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: dify-oapi2
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.3.0
|
4
4
|
Summary: A package for interacting with the Dify Service-API
|
5
5
|
License: MIT
|
6
6
|
Keywords: dify,nlp,ai,language-processing
|
7
7
|
Author: Oscaner Miao
|
8
|
-
Author-email: oscaner1997@
|
8
|
+
Author-email: oscaner1997@gmail.com
|
9
9
|
Requires-Python: >=3.10
|
10
10
|
Classifier: License :: OSI Approved :: MIT License
|
11
11
|
Classifier: Programming Language :: Python :: 3
|