dify-oapi2 0.1.1__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/completion/v1/model/annotation/annotation_info.py +43 -0
- dify_oapi/api/completion/v1/model/annotation/annotation_reply_settings_request.py +39 -0
- dify_oapi/api/completion/v1/model/annotation/annotation_reply_settings_request_body.py +33 -0
- dify_oapi/api/completion/v1/model/annotation/annotation_reply_settings_response.py +9 -0
- dify_oapi/api/completion/v1/model/annotation/create_annotation_request.py +32 -0
- dify_oapi/api/completion/v1/model/annotation/create_annotation_request_body.py +28 -0
- dify_oapi/api/completion/v1/model/annotation/create_annotation_response.py +9 -0
- dify_oapi/api/completion/v1/model/annotation/delete_annotation_request.py +30 -0
- dify_oapi/api/completion/v1/model/annotation/delete_annotation_response.py +7 -0
- dify_oapi/api/completion/v1/model/annotation/job_status_info.py +35 -0
- dify_oapi/api/completion/v1/model/annotation/list_annotations_request.py +32 -0
- dify_oapi/api/completion/v1/model/annotation/list_annotations_response.py +13 -0
- dify_oapi/api/completion/v1/model/annotation/query_annotation_reply_status_request.py +38 -0
- dify_oapi/api/completion/v1/model/annotation/query_annotation_reply_status_response.py +9 -0
- dify_oapi/api/completion/v1/model/annotation/update_annotation_request.py +38 -0
- dify_oapi/api/completion/v1/model/annotation/update_annotation_request_body.py +28 -0
- dify_oapi/api/completion/v1/model/annotation/update_annotation_response.py +9 -0
- dify_oapi/api/completion/v1/model/audio/audio_info.py +28 -0
- dify_oapi/api/completion/v1/model/audio/text_to_audio_request.py +32 -0
- dify_oapi/api/completion/v1/model/audio/text_to_audio_request_body.py +33 -0
- dify_oapi/api/completion/v1/model/audio/text_to_audio_response.py +9 -0
- dify_oapi/api/completion/v1/model/completion/completion_inputs.py +28 -0
- dify_oapi/api/completion/v1/model/completion/completion_message_info.py +46 -0
- dify_oapi/api/completion/v1/model/completion/completion_types.py +27 -0
- dify_oapi/api/completion/v1/model/completion/metadata.py +31 -0
- dify_oapi/api/completion/v1/model/completion/retriever_resource.py +58 -0
- dify_oapi/api/completion/v1/model/completion/send_message_request.py +32 -0
- dify_oapi/api/completion/v1/model/completion/send_message_request_body.py +76 -0
- dify_oapi/api/completion/v1/model/completion/send_message_response.py +9 -0
- dify_oapi/api/completion/v1/model/completion/stop_response_request.py +38 -0
- dify_oapi/api/completion/v1/model/completion/stop_response_request_body.py +23 -0
- dify_oapi/api/completion/v1/model/{stop_completion_response.py → completion/stop_response_response.py} +3 -1
- dify_oapi/api/completion/v1/model/completion/usage.py +78 -0
- dify_oapi/api/completion/v1/model/feedback/feedback_info.py +53 -0
- dify_oapi/api/completion/v1/model/feedback/get_feedbacks_request.py +32 -0
- dify_oapi/api/completion/v1/model/feedback/get_feedbacks_response.py +9 -0
- dify_oapi/api/completion/v1/model/feedback/message_feedback_request.py +38 -0
- dify_oapi/api/completion/v1/model/feedback/message_feedback_request_body.py +35 -0
- dify_oapi/api/completion/v1/model/feedback/message_feedback_response.py +7 -0
- dify_oapi/api/completion/v1/model/file/file_info.py +53 -0
- dify_oapi/api/completion/v1/model/file/upload_file_request.py +42 -0
- dify_oapi/api/completion/v1/model/file/upload_file_request_body.py +23 -0
- dify_oapi/api/completion/v1/model/file/upload_file_response.py +9 -0
- dify_oapi/api/completion/v1/model/info/app_info.py +43 -0
- dify_oapi/api/completion/v1/model/info/file_upload_config.py +23 -0
- dify_oapi/api/completion/v1/model/info/get_info_request.py +24 -0
- dify_oapi/api/completion/v1/model/info/get_info_response.py +9 -0
- dify_oapi/api/completion/v1/model/info/get_parameters_request.py +24 -0
- dify_oapi/api/completion/v1/model/info/get_parameters_response.py +9 -0
- dify_oapi/api/completion/v1/model/info/get_site_request.py +24 -0
- dify_oapi/api/completion/v1/model/info/get_site_response.py +9 -0
- dify_oapi/api/completion/v1/model/info/parameters_info.py +67 -0
- dify_oapi/api/completion/v1/model/info/site_info.py +90 -0
- dify_oapi/api/completion/v1/model/info/system_parameters.py +38 -0
- dify_oapi/api/completion/v1/model/info/user_input_form.py +43 -0
- dify_oapi/api/completion/v1/resource/__init__.py +5 -0
- dify_oapi/api/completion/v1/resource/annotation.py +99 -0
- dify_oapi/api/completion/v1/resource/audio.py +19 -0
- dify_oapi/api/completion/v1/resource/completion.py +36 -46
- dify_oapi/api/completion/v1/resource/feedback.py +33 -0
- dify_oapi/api/completion/v1/resource/file.py +19 -0
- dify_oapi/api/completion/v1/resource/info.py +39 -0
- dify_oapi/api/completion/v1/version.py +11 -1
- dify_oapi/api/knowledge_base/v1/model/dataset/create_request_body.py +3 -4
- dify_oapi/api/knowledge_base/v1/model/dataset/dataset_types.py +36 -0
- dify_oapi/api/knowledge_base/v1/model/dataset/retrieval_model.py +3 -6
- dify_oapi/api/knowledge_base/v1/model/document/create_by_text_request_body.py +7 -12
- dify_oapi/api/knowledge_base/v1/model/document/document_types.py +36 -0
- dify_oapi/api/knowledge_base/v1/model/metadata/metadata_types.py +15 -0
- dify_oapi/api/knowledge_base/v1/model/segment/segment_types.py +24 -0
- dify_oapi/api/knowledge_base/v1/model/tag/tag_types.py +12 -0
- dify_oapi/api/knowledge_base/v1/model/tag/update_response.py +5 -1
- 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_oapi/core/http/transport/_misc.py +54 -14
- {dify_oapi2-0.1.1.dist-info → dify_oapi2-0.3.0.dist-info}/METADATA +10 -6
- {dify_oapi2-0.1.1.dist-info → dify_oapi2-0.3.0.dist-info}/RECORD +127 -34
- dify_oapi/api/completion/v1/model/completion_request.py +0 -34
- dify_oapi/api/completion/v1/model/completion_request_body.py +0 -43
- dify_oapi/api/completion/v1/model/completion_request_body_input.py +0 -38
- dify_oapi/api/completion/v1/model/completion_request_file.py +0 -49
- dify_oapi/api/completion/v1/model/completion_response.py +0 -18
- dify_oapi/api/completion/v1/model/stop_completion_request.py +0 -38
- dify_oapi/api/completion/v1/model/stop_completion_request_body.py +0 -23
- 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.1.1.dist-info → dify_oapi2-0.3.0.dist-info}/LICENSE +0 -0
- {dify_oapi2-0.1.1.dist-info → dify_oapi2-0.3.0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,43 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from pydantic import BaseModel
|
4
|
+
|
5
|
+
|
6
|
+
class AnnotationInfo(BaseModel):
|
7
|
+
id: str | None = None
|
8
|
+
question: str | None = None
|
9
|
+
answer: str | None = None
|
10
|
+
hit_count: int | None = None
|
11
|
+
created_at: int | None = None
|
12
|
+
|
13
|
+
@staticmethod
|
14
|
+
def builder() -> AnnotationInfoBuilder:
|
15
|
+
return AnnotationInfoBuilder()
|
16
|
+
|
17
|
+
|
18
|
+
class AnnotationInfoBuilder:
|
19
|
+
def __init__(self):
|
20
|
+
self._annotation_info = AnnotationInfo()
|
21
|
+
|
22
|
+
def build(self) -> AnnotationInfo:
|
23
|
+
return self._annotation_info
|
24
|
+
|
25
|
+
def id(self, id: str) -> AnnotationInfoBuilder:
|
26
|
+
self._annotation_info.id = id
|
27
|
+
return self
|
28
|
+
|
29
|
+
def question(self, question: str) -> AnnotationInfoBuilder:
|
30
|
+
self._annotation_info.question = question
|
31
|
+
return self
|
32
|
+
|
33
|
+
def answer(self, answer: str) -> AnnotationInfoBuilder:
|
34
|
+
self._annotation_info.answer = answer
|
35
|
+
return self
|
36
|
+
|
37
|
+
def hit_count(self, hit_count: int) -> AnnotationInfoBuilder:
|
38
|
+
self._annotation_info.hit_count = hit_count
|
39
|
+
return self
|
40
|
+
|
41
|
+
def created_at(self, created_at: int) -> AnnotationInfoBuilder:
|
42
|
+
self._annotation_info.created_at = created_at
|
43
|
+
return self
|
@@ -0,0 +1,39 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from dify_oapi.core.enum import HttpMethod
|
4
|
+
from dify_oapi.core.model.base_request import BaseRequest
|
5
|
+
|
6
|
+
from ..completion.completion_types import AnnotationAction
|
7
|
+
from .annotation_reply_settings_request_body import AnnotationReplySettingsRequestBody
|
8
|
+
|
9
|
+
|
10
|
+
class AnnotationReplySettingsRequest(BaseRequest):
|
11
|
+
def __init__(self):
|
12
|
+
super().__init__()
|
13
|
+
self.action: AnnotationAction | None = None
|
14
|
+
self.request_body: AnnotationReplySettingsRequestBody | None = None
|
15
|
+
|
16
|
+
@staticmethod
|
17
|
+
def builder() -> AnnotationReplySettingsRequestBuilder:
|
18
|
+
return AnnotationReplySettingsRequestBuilder()
|
19
|
+
|
20
|
+
|
21
|
+
class AnnotationReplySettingsRequestBuilder:
|
22
|
+
def __init__(self):
|
23
|
+
annotation_reply_settings_request = AnnotationReplySettingsRequest()
|
24
|
+
annotation_reply_settings_request.http_method = HttpMethod.POST
|
25
|
+
annotation_reply_settings_request.uri = "/v1/apps/annotation-reply/:action"
|
26
|
+
self._annotation_reply_settings_request = annotation_reply_settings_request
|
27
|
+
|
28
|
+
def build(self) -> AnnotationReplySettingsRequest:
|
29
|
+
return self._annotation_reply_settings_request
|
30
|
+
|
31
|
+
def action(self, action: AnnotationAction) -> AnnotationReplySettingsRequestBuilder:
|
32
|
+
self._annotation_reply_settings_request.action = action
|
33
|
+
self._annotation_reply_settings_request.paths["action"] = action
|
34
|
+
return self
|
35
|
+
|
36
|
+
def request_body(self, request_body: AnnotationReplySettingsRequestBody) -> AnnotationReplySettingsRequestBuilder:
|
37
|
+
self._annotation_reply_settings_request.request_body = request_body
|
38
|
+
self._annotation_reply_settings_request.body = request_body.model_dump(exclude_none=True, mode="json")
|
39
|
+
return self
|
@@ -0,0 +1,33 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from pydantic import BaseModel
|
4
|
+
|
5
|
+
|
6
|
+
class AnnotationReplySettingsRequestBody(BaseModel):
|
7
|
+
embedding_provider_name: str | None = None
|
8
|
+
embedding_model_name: str | None = None
|
9
|
+
score_threshold: float | None = None
|
10
|
+
|
11
|
+
@staticmethod
|
12
|
+
def builder() -> AnnotationReplySettingsRequestBodyBuilder:
|
13
|
+
return AnnotationReplySettingsRequestBodyBuilder()
|
14
|
+
|
15
|
+
|
16
|
+
class AnnotationReplySettingsRequestBodyBuilder:
|
17
|
+
def __init__(self):
|
18
|
+
self._annotation_reply_settings_request_body = AnnotationReplySettingsRequestBody()
|
19
|
+
|
20
|
+
def build(self) -> AnnotationReplySettingsRequestBody:
|
21
|
+
return self._annotation_reply_settings_request_body
|
22
|
+
|
23
|
+
def embedding_provider_name(self, embedding_provider_name: str) -> AnnotationReplySettingsRequestBodyBuilder:
|
24
|
+
self._annotation_reply_settings_request_body.embedding_provider_name = embedding_provider_name
|
25
|
+
return self
|
26
|
+
|
27
|
+
def embedding_model_name(self, embedding_model_name: str) -> AnnotationReplySettingsRequestBodyBuilder:
|
28
|
+
self._annotation_reply_settings_request_body.embedding_model_name = embedding_model_name
|
29
|
+
return self
|
30
|
+
|
31
|
+
def score_threshold(self, score_threshold: float) -> AnnotationReplySettingsRequestBodyBuilder:
|
32
|
+
self._annotation_reply_settings_request_body.score_threshold = score_threshold
|
33
|
+
return self
|
@@ -0,0 +1,32 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from dify_oapi.core.enum import HttpMethod
|
4
|
+
from dify_oapi.core.model.base_request import BaseRequest
|
5
|
+
|
6
|
+
from .create_annotation_request_body import CreateAnnotationRequestBody
|
7
|
+
|
8
|
+
|
9
|
+
class CreateAnnotationRequest(BaseRequest):
|
10
|
+
def __init__(self):
|
11
|
+
super().__init__()
|
12
|
+
self.request_body: CreateAnnotationRequestBody | None = None
|
13
|
+
|
14
|
+
@staticmethod
|
15
|
+
def builder() -> CreateAnnotationRequestBuilder:
|
16
|
+
return CreateAnnotationRequestBuilder()
|
17
|
+
|
18
|
+
|
19
|
+
class CreateAnnotationRequestBuilder:
|
20
|
+
def __init__(self):
|
21
|
+
create_annotation_request = CreateAnnotationRequest()
|
22
|
+
create_annotation_request.http_method = HttpMethod.POST
|
23
|
+
create_annotation_request.uri = "/v1/apps/annotations"
|
24
|
+
self._create_annotation_request = create_annotation_request
|
25
|
+
|
26
|
+
def build(self) -> CreateAnnotationRequest:
|
27
|
+
return self._create_annotation_request
|
28
|
+
|
29
|
+
def request_body(self, request_body: CreateAnnotationRequestBody) -> CreateAnnotationRequestBuilder:
|
30
|
+
self._create_annotation_request.request_body = request_body
|
31
|
+
self._create_annotation_request.body = request_body.model_dump(exclude_none=True, mode="json")
|
32
|
+
return self
|
@@ -0,0 +1,28 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from pydantic import BaseModel
|
4
|
+
|
5
|
+
|
6
|
+
class CreateAnnotationRequestBody(BaseModel):
|
7
|
+
question: str | None = None
|
8
|
+
answer: str | None = None
|
9
|
+
|
10
|
+
@staticmethod
|
11
|
+
def builder() -> CreateAnnotationRequestBodyBuilder:
|
12
|
+
return CreateAnnotationRequestBodyBuilder()
|
13
|
+
|
14
|
+
|
15
|
+
class CreateAnnotationRequestBodyBuilder:
|
16
|
+
def __init__(self):
|
17
|
+
self._create_annotation_request_body = CreateAnnotationRequestBody()
|
18
|
+
|
19
|
+
def build(self) -> CreateAnnotationRequestBody:
|
20
|
+
return self._create_annotation_request_body
|
21
|
+
|
22
|
+
def question(self, question: str) -> CreateAnnotationRequestBodyBuilder:
|
23
|
+
self._create_annotation_request_body.question = question
|
24
|
+
return self
|
25
|
+
|
26
|
+
def answer(self, answer: str) -> CreateAnnotationRequestBodyBuilder:
|
27
|
+
self._create_annotation_request_body.answer = answer
|
28
|
+
return self
|
@@ -0,0 +1,30 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from dify_oapi.core.enum import HttpMethod
|
4
|
+
from dify_oapi.core.model.base_request import BaseRequest
|
5
|
+
|
6
|
+
|
7
|
+
class DeleteAnnotationRequest(BaseRequest):
|
8
|
+
def __init__(self):
|
9
|
+
super().__init__()
|
10
|
+
self.annotation_id: str | None = None
|
11
|
+
|
12
|
+
@staticmethod
|
13
|
+
def builder() -> DeleteAnnotationRequestBuilder:
|
14
|
+
return DeleteAnnotationRequestBuilder()
|
15
|
+
|
16
|
+
|
17
|
+
class DeleteAnnotationRequestBuilder:
|
18
|
+
def __init__(self):
|
19
|
+
delete_annotation_request = DeleteAnnotationRequest()
|
20
|
+
delete_annotation_request.http_method = HttpMethod.DELETE
|
21
|
+
delete_annotation_request.uri = "/v1/apps/annotations/:annotation_id"
|
22
|
+
self._delete_annotation_request = delete_annotation_request
|
23
|
+
|
24
|
+
def build(self) -> DeleteAnnotationRequest:
|
25
|
+
return self._delete_annotation_request
|
26
|
+
|
27
|
+
def annotation_id(self, annotation_id: str) -> DeleteAnnotationRequestBuilder:
|
28
|
+
self._delete_annotation_request.annotation_id = annotation_id
|
29
|
+
self._delete_annotation_request.paths["annotation_id"] = annotation_id
|
30
|
+
return self
|
@@ -0,0 +1,35 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from pydantic import BaseModel
|
4
|
+
|
5
|
+
from ..completion.completion_types import JobStatus
|
6
|
+
|
7
|
+
|
8
|
+
class JobStatusInfo(BaseModel):
|
9
|
+
job_id: str | None = None
|
10
|
+
job_status: JobStatus | None = None
|
11
|
+
error_msg: str | None = None
|
12
|
+
|
13
|
+
@staticmethod
|
14
|
+
def builder() -> JobStatusInfoBuilder:
|
15
|
+
return JobStatusInfoBuilder()
|
16
|
+
|
17
|
+
|
18
|
+
class JobStatusInfoBuilder:
|
19
|
+
def __init__(self):
|
20
|
+
self._job_status_info = JobStatusInfo()
|
21
|
+
|
22
|
+
def build(self) -> JobStatusInfo:
|
23
|
+
return self._job_status_info
|
24
|
+
|
25
|
+
def job_id(self, job_id: str) -> JobStatusInfoBuilder:
|
26
|
+
self._job_status_info.job_id = job_id
|
27
|
+
return self
|
28
|
+
|
29
|
+
def job_status(self, job_status: JobStatus) -> JobStatusInfoBuilder:
|
30
|
+
self._job_status_info.job_status = job_status
|
31
|
+
return self
|
32
|
+
|
33
|
+
def error_msg(self, error_msg: str) -> JobStatusInfoBuilder:
|
34
|
+
self._job_status_info.error_msg = error_msg
|
35
|
+
return self
|
@@ -0,0 +1,32 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from dify_oapi.core.enum import HttpMethod
|
4
|
+
from dify_oapi.core.model.base_request import BaseRequest
|
5
|
+
|
6
|
+
|
7
|
+
class ListAnnotationsRequest(BaseRequest):
|
8
|
+
def __init__(self):
|
9
|
+
super().__init__()
|
10
|
+
|
11
|
+
@staticmethod
|
12
|
+
def builder() -> ListAnnotationsRequestBuilder:
|
13
|
+
return ListAnnotationsRequestBuilder()
|
14
|
+
|
15
|
+
|
16
|
+
class ListAnnotationsRequestBuilder:
|
17
|
+
def __init__(self):
|
18
|
+
list_annotations_request = ListAnnotationsRequest()
|
19
|
+
list_annotations_request.http_method = HttpMethod.GET
|
20
|
+
list_annotations_request.uri = "/v1/apps/annotations"
|
21
|
+
self._list_annotations_request = list_annotations_request
|
22
|
+
|
23
|
+
def build(self) -> ListAnnotationsRequest:
|
24
|
+
return self._list_annotations_request
|
25
|
+
|
26
|
+
def page(self, page: str) -> ListAnnotationsRequestBuilder:
|
27
|
+
self._list_annotations_request.add_query("page", page)
|
28
|
+
return self
|
29
|
+
|
30
|
+
def limit(self, limit: str) -> ListAnnotationsRequestBuilder:
|
31
|
+
self._list_annotations_request.add_query("limit", limit)
|
32
|
+
return self
|
@@ -0,0 +1,13 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from dify_oapi.core.model.base_response import BaseResponse
|
4
|
+
|
5
|
+
from .annotation_info import AnnotationInfo
|
6
|
+
|
7
|
+
|
8
|
+
class ListAnnotationsResponse(BaseResponse):
|
9
|
+
data: list[AnnotationInfo] | None = None
|
10
|
+
has_more: bool | None = None
|
11
|
+
limit: int | None = None
|
12
|
+
total: int | None = None
|
13
|
+
page: int | None = None
|
@@ -0,0 +1,38 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from dify_oapi.core.enum import HttpMethod
|
4
|
+
from dify_oapi.core.model.base_request import BaseRequest
|
5
|
+
|
6
|
+
from ..completion.completion_types import AnnotationAction
|
7
|
+
|
8
|
+
|
9
|
+
class QueryAnnotationReplyStatusRequest(BaseRequest):
|
10
|
+
def __init__(self):
|
11
|
+
super().__init__()
|
12
|
+
self.action: AnnotationAction | None = None
|
13
|
+
self.job_id: str | None = None
|
14
|
+
|
15
|
+
@staticmethod
|
16
|
+
def builder() -> QueryAnnotationReplyStatusRequestBuilder:
|
17
|
+
return QueryAnnotationReplyStatusRequestBuilder()
|
18
|
+
|
19
|
+
|
20
|
+
class QueryAnnotationReplyStatusRequestBuilder:
|
21
|
+
def __init__(self):
|
22
|
+
query_annotation_reply_status_request = QueryAnnotationReplyStatusRequest()
|
23
|
+
query_annotation_reply_status_request.http_method = HttpMethod.GET
|
24
|
+
query_annotation_reply_status_request.uri = "/v1/apps/annotation-reply/:action/status/:job_id"
|
25
|
+
self._query_annotation_reply_status_request = query_annotation_reply_status_request
|
26
|
+
|
27
|
+
def build(self) -> QueryAnnotationReplyStatusRequest:
|
28
|
+
return self._query_annotation_reply_status_request
|
29
|
+
|
30
|
+
def action(self, action: AnnotationAction) -> QueryAnnotationReplyStatusRequestBuilder:
|
31
|
+
self._query_annotation_reply_status_request.action = action
|
32
|
+
self._query_annotation_reply_status_request.paths["action"] = action
|
33
|
+
return self
|
34
|
+
|
35
|
+
def job_id(self, job_id: str) -> QueryAnnotationReplyStatusRequestBuilder:
|
36
|
+
self._query_annotation_reply_status_request.job_id = job_id
|
37
|
+
self._query_annotation_reply_status_request.paths["job_id"] = job_id
|
38
|
+
return self
|
@@ -0,0 +1,38 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from dify_oapi.core.enum import HttpMethod
|
4
|
+
from dify_oapi.core.model.base_request import BaseRequest
|
5
|
+
|
6
|
+
from .update_annotation_request_body import UpdateAnnotationRequestBody
|
7
|
+
|
8
|
+
|
9
|
+
class UpdateAnnotationRequest(BaseRequest):
|
10
|
+
def __init__(self):
|
11
|
+
super().__init__()
|
12
|
+
self.annotation_id: str | None = None
|
13
|
+
self.request_body: UpdateAnnotationRequestBody | None = None
|
14
|
+
|
15
|
+
@staticmethod
|
16
|
+
def builder() -> UpdateAnnotationRequestBuilder:
|
17
|
+
return UpdateAnnotationRequestBuilder()
|
18
|
+
|
19
|
+
|
20
|
+
class UpdateAnnotationRequestBuilder:
|
21
|
+
def __init__(self):
|
22
|
+
update_annotation_request = UpdateAnnotationRequest()
|
23
|
+
update_annotation_request.http_method = HttpMethod.PUT
|
24
|
+
update_annotation_request.uri = "/v1/apps/annotations/:annotation_id"
|
25
|
+
self._update_annotation_request = update_annotation_request
|
26
|
+
|
27
|
+
def build(self) -> UpdateAnnotationRequest:
|
28
|
+
return self._update_annotation_request
|
29
|
+
|
30
|
+
def annotation_id(self, annotation_id: str) -> UpdateAnnotationRequestBuilder:
|
31
|
+
self._update_annotation_request.annotation_id = annotation_id
|
32
|
+
self._update_annotation_request.paths["annotation_id"] = annotation_id
|
33
|
+
return self
|
34
|
+
|
35
|
+
def request_body(self, request_body: UpdateAnnotationRequestBody) -> UpdateAnnotationRequestBuilder:
|
36
|
+
self._update_annotation_request.request_body = request_body
|
37
|
+
self._update_annotation_request.body = request_body.model_dump(exclude_none=True, mode="json")
|
38
|
+
return self
|
@@ -0,0 +1,28 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from pydantic import BaseModel
|
4
|
+
|
5
|
+
|
6
|
+
class UpdateAnnotationRequestBody(BaseModel):
|
7
|
+
question: str | None = None
|
8
|
+
answer: str | None = None
|
9
|
+
|
10
|
+
@staticmethod
|
11
|
+
def builder() -> UpdateAnnotationRequestBodyBuilder:
|
12
|
+
return UpdateAnnotationRequestBodyBuilder()
|
13
|
+
|
14
|
+
|
15
|
+
class UpdateAnnotationRequestBodyBuilder:
|
16
|
+
def __init__(self):
|
17
|
+
self._update_annotation_request_body = UpdateAnnotationRequestBody()
|
18
|
+
|
19
|
+
def build(self) -> UpdateAnnotationRequestBody:
|
20
|
+
return self._update_annotation_request_body
|
21
|
+
|
22
|
+
def question(self, question: str) -> UpdateAnnotationRequestBodyBuilder:
|
23
|
+
self._update_annotation_request_body.question = question
|
24
|
+
return self
|
25
|
+
|
26
|
+
def answer(self, answer: str) -> UpdateAnnotationRequestBodyBuilder:
|
27
|
+
self._update_annotation_request_body.answer = answer
|
28
|
+
return self
|
@@ -0,0 +1,28 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from pydantic import BaseModel
|
4
|
+
|
5
|
+
|
6
|
+
class AudioInfo(BaseModel):
|
7
|
+
content_type: str | None = None
|
8
|
+
data: bytes | None = None
|
9
|
+
|
10
|
+
@staticmethod
|
11
|
+
def builder() -> AudioInfoBuilder:
|
12
|
+
return AudioInfoBuilder()
|
13
|
+
|
14
|
+
|
15
|
+
class AudioInfoBuilder:
|
16
|
+
def __init__(self):
|
17
|
+
self._audio_info = AudioInfo()
|
18
|
+
|
19
|
+
def build(self) -> AudioInfo:
|
20
|
+
return self._audio_info
|
21
|
+
|
22
|
+
def content_type(self, content_type: str) -> AudioInfoBuilder:
|
23
|
+
self._audio_info.content_type = content_type
|
24
|
+
return self
|
25
|
+
|
26
|
+
def data(self, data: bytes) -> AudioInfoBuilder:
|
27
|
+
self._audio_info.data = data
|
28
|
+
return self
|
@@ -0,0 +1,32 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from dify_oapi.core.enum import HttpMethod
|
4
|
+
from dify_oapi.core.model.base_request import BaseRequest
|
5
|
+
|
6
|
+
from .text_to_audio_request_body import TextToAudioRequestBody
|
7
|
+
|
8
|
+
|
9
|
+
class TextToAudioRequest(BaseRequest):
|
10
|
+
def __init__(self):
|
11
|
+
super().__init__()
|
12
|
+
self.request_body: TextToAudioRequestBody | None = None
|
13
|
+
|
14
|
+
@staticmethod
|
15
|
+
def builder() -> TextToAudioRequestBuilder:
|
16
|
+
return TextToAudioRequestBuilder()
|
17
|
+
|
18
|
+
|
19
|
+
class TextToAudioRequestBuilder:
|
20
|
+
def __init__(self):
|
21
|
+
text_to_audio_request = TextToAudioRequest()
|
22
|
+
text_to_audio_request.http_method = HttpMethod.POST
|
23
|
+
text_to_audio_request.uri = "/v1/text-to-audio"
|
24
|
+
self._text_to_audio_request = text_to_audio_request
|
25
|
+
|
26
|
+
def build(self) -> TextToAudioRequest:
|
27
|
+
return self._text_to_audio_request
|
28
|
+
|
29
|
+
def request_body(self, request_body: TextToAudioRequestBody) -> TextToAudioRequestBuilder:
|
30
|
+
self._text_to_audio_request.request_body = request_body
|
31
|
+
self._text_to_audio_request.body = request_body.model_dump(exclude_none=True, mode="json")
|
32
|
+
return self
|
@@ -0,0 +1,33 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from pydantic import BaseModel
|
4
|
+
|
5
|
+
|
6
|
+
class TextToAudioRequestBody(BaseModel):
|
7
|
+
message_id: str | None = None
|
8
|
+
text: str | None = None
|
9
|
+
user: str | None = None
|
10
|
+
|
11
|
+
@staticmethod
|
12
|
+
def builder() -> TextToAudioRequestBodyBuilder:
|
13
|
+
return TextToAudioRequestBodyBuilder()
|
14
|
+
|
15
|
+
|
16
|
+
class TextToAudioRequestBodyBuilder:
|
17
|
+
def __init__(self):
|
18
|
+
self._text_to_audio_request_body = TextToAudioRequestBody()
|
19
|
+
|
20
|
+
def build(self) -> TextToAudioRequestBody:
|
21
|
+
return self._text_to_audio_request_body
|
22
|
+
|
23
|
+
def message_id(self, message_id: str) -> TextToAudioRequestBodyBuilder:
|
24
|
+
self._text_to_audio_request_body.message_id = message_id
|
25
|
+
return self
|
26
|
+
|
27
|
+
def text(self, text: str) -> TextToAudioRequestBodyBuilder:
|
28
|
+
self._text_to_audio_request_body.text = text
|
29
|
+
return self
|
30
|
+
|
31
|
+
def user(self, user: str) -> TextToAudioRequestBodyBuilder:
|
32
|
+
self._text_to_audio_request_body.user = user
|
33
|
+
return self
|
@@ -0,0 +1,28 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from pydantic import BaseModel
|
4
|
+
|
5
|
+
|
6
|
+
class CompletionInputs(BaseModel):
|
7
|
+
"""
|
8
|
+
Inputs for completion application containing variables defined in the App.
|
9
|
+
Text generation applications require at least the query field.
|
10
|
+
"""
|
11
|
+
|
12
|
+
query: str | None = None # User input text content (required for completion apps)
|
13
|
+
|
14
|
+
@staticmethod
|
15
|
+
def builder() -> CompletionInputsBuilder:
|
16
|
+
return CompletionInputsBuilder()
|
17
|
+
|
18
|
+
|
19
|
+
class CompletionInputsBuilder:
|
20
|
+
def __init__(self):
|
21
|
+
self._completion_inputs = CompletionInputs()
|
22
|
+
|
23
|
+
def build(self) -> CompletionInputs:
|
24
|
+
return self._completion_inputs
|
25
|
+
|
26
|
+
def query(self, query: str) -> CompletionInputsBuilder:
|
27
|
+
self._completion_inputs.query = query
|
28
|
+
return self
|
@@ -0,0 +1,46 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from pydantic import BaseModel
|
4
|
+
|
5
|
+
from .completion_types import AppMode
|
6
|
+
from .metadata import Metadata
|
7
|
+
|
8
|
+
|
9
|
+
class CompletionMessageInfo(BaseModel):
|
10
|
+
message_id: str | None = None
|
11
|
+
mode: AppMode | None = None
|
12
|
+
answer: str | None = None
|
13
|
+
metadata: Metadata | None = None
|
14
|
+
created_at: int | None = None
|
15
|
+
|
16
|
+
@staticmethod
|
17
|
+
def builder() -> CompletionMessageInfoBuilder:
|
18
|
+
return CompletionMessageInfoBuilder()
|
19
|
+
|
20
|
+
|
21
|
+
class CompletionMessageInfoBuilder:
|
22
|
+
def __init__(self):
|
23
|
+
self._completion_message_info = CompletionMessageInfo()
|
24
|
+
|
25
|
+
def build(self) -> CompletionMessageInfo:
|
26
|
+
return self._completion_message_info
|
27
|
+
|
28
|
+
def message_id(self, message_id: str) -> CompletionMessageInfoBuilder:
|
29
|
+
self._completion_message_info.message_id = message_id
|
30
|
+
return self
|
31
|
+
|
32
|
+
def mode(self, mode: AppMode) -> CompletionMessageInfoBuilder:
|
33
|
+
self._completion_message_info.mode = mode
|
34
|
+
return self
|
35
|
+
|
36
|
+
def answer(self, answer: str) -> CompletionMessageInfoBuilder:
|
37
|
+
self._completion_message_info.answer = answer
|
38
|
+
return self
|
39
|
+
|
40
|
+
def metadata(self, metadata: Metadata) -> CompletionMessageInfoBuilder:
|
41
|
+
self._completion_message_info.metadata = metadata
|
42
|
+
return self
|
43
|
+
|
44
|
+
def created_at(self, created_at: int) -> CompletionMessageInfoBuilder:
|
45
|
+
self._completion_message_info.created_at = created_at
|
46
|
+
return self
|
@@ -0,0 +1,27 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from typing import Literal
|
4
|
+
|
5
|
+
# Response mode types
|
6
|
+
ResponseMode = Literal["streaming", "blocking"]
|
7
|
+
|
8
|
+
# File types
|
9
|
+
FileType = Literal["image"]
|
10
|
+
|
11
|
+
# Transfer method types
|
12
|
+
TransferMethod = Literal["remote_url", "local_file"]
|
13
|
+
|
14
|
+
# Feedback rating types
|
15
|
+
FeedbackRating = Literal["like", "dislike", "null"]
|
16
|
+
|
17
|
+
# Annotation action types
|
18
|
+
AnnotationAction = Literal["enable", "disable"]
|
19
|
+
|
20
|
+
# Icon types
|
21
|
+
IconType = Literal["emoji", "image"]
|
22
|
+
|
23
|
+
# App mode types
|
24
|
+
AppMode = Literal["completion"]
|
25
|
+
|
26
|
+
# Job status types
|
27
|
+
JobStatus = Literal["waiting", "running", "completed", "failed"]
|