dify-oapi2 0.4.0__py3-none-any.whl → 0.5.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/chat/v1/model/__init__.py +37 -0
- dify_oapi/api/chat/v1/model/agent_thought.py +69 -0
- dify_oapi/api/chat/v1/model/annotation_info.py +43 -0
- dify_oapi/api/chat/v1/model/app_info.py +35 -0
- dify_oapi/api/chat/v1/model/app_parameters.py +494 -0
- dify_oapi/api/chat/v1/model/audio_to_text_request_body.py +2 -2
- dify_oapi/api/chat/v1/model/chat_file.py +53 -0
- dify_oapi/api/chat/v1/model/chat_request_body.py +26 -13
- dify_oapi/api/chat/v1/model/chat_response.py +12 -2
- dify_oapi/api/chat/v1/model/chat_types.py +65 -0
- dify_oapi/api/chat/v1/model/configure_annotation_reply_request.py +36 -0
- dify_oapi/api/chat/v1/model/configure_annotation_reply_request_body.py +39 -0
- dify_oapi/api/chat/v1/model/configure_annotation_reply_response.py +10 -0
- dify_oapi/api/chat/v1/model/conversation_info.py +57 -0
- dify_oapi/api/chat/v1/model/conversation_variable.py +55 -0
- dify_oapi/api/chat/v1/model/create_annotation_request.py +29 -0
- dify_oapi/api/chat/v1/model/create_annotation_request_body.py +32 -0
- dify_oapi/api/chat/v1/model/create_annotation_response.py +9 -0
- dify_oapi/api/chat/v1/model/delete_annotation_request.py +26 -0
- dify_oapi/api/chat/v1/model/delete_annotation_response.py +7 -0
- dify_oapi/api/chat/v1/model/feedback_info.py +75 -0
- dify_oapi/api/chat/v1/model/file_info.py +59 -0
- dify_oapi/api/chat/v1/model/get_annotation_reply_status_request.py +32 -0
- dify_oapi/api/chat/v1/model/get_annotation_reply_status_response.py +11 -0
- dify_oapi/api/chat/v1/model/get_app_info_request.py +24 -0
- dify_oapi/api/chat/v1/model/get_app_info_response.py +9 -0
- dify_oapi/api/chat/v1/model/get_app_meta_request.py +24 -0
- dify_oapi/api/chat/v1/model/get_app_meta_response.py +9 -0
- dify_oapi/api/chat/v1/model/get_app_parameters_request.py +28 -0
- dify_oapi/api/chat/v1/model/get_app_parameters_response.py +9 -0
- dify_oapi/api/chat/v1/model/get_conversation_list_request.py +25 -24
- dify_oapi/api/chat/v1/model/get_conversation_list_response.py +4 -15
- dify_oapi/api/chat/v1/model/get_conversation_variables_request.py +54 -0
- dify_oapi/api/chat/v1/model/get_conversation_variables_response.py +10 -0
- dify_oapi/api/chat/v1/model/get_feedbacks_request.py +32 -0
- dify_oapi/api/chat/v1/model/get_feedbacks_response.py +7 -0
- dify_oapi/api/chat/v1/model/get_site_settings_request.py +24 -0
- dify_oapi/api/chat/v1/model/get_site_settings_response.py +9 -0
- dify_oapi/api/chat/v1/model/get_suggested_questions_request.py +36 -0
- dify_oapi/api/chat/v1/model/{message_suggested_response.py → get_suggested_questions_response.py} +1 -1
- dify_oapi/api/chat/v1/model/list_annotations_request.py +32 -0
- dify_oapi/api/chat/v1/model/list_annotations_response.py +11 -0
- dify_oapi/api/chat/v1/model/message_file.py +46 -0
- dify_oapi/api/chat/v1/model/message_history_request.py +24 -24
- dify_oapi/api/chat/v1/model/message_history_response.py +4 -43
- dify_oapi/api/chat/v1/model/message_info.py +73 -0
- dify_oapi/api/chat/v1/model/pagination_info.py +44 -0
- dify_oapi/api/chat/v1/model/rename_conversation_request_body.py +1 -1
- dify_oapi/api/chat/v1/model/retriever_resource.py +64 -0
- dify_oapi/api/chat/v1/model/site_settings.py +92 -0
- dify_oapi/api/chat/v1/model/submit_feedback_request.py +34 -0
- dify_oapi/api/chat/v1/model/submit_feedback_request_body.py +33 -0
- dify_oapi/api/chat/v1/model/submit_feedback_response.py +5 -0
- dify_oapi/api/chat/v1/model/text_to_audio_request.py +32 -0
- dify_oapi/api/chat/v1/model/text_to_audio_request_body.py +33 -0
- dify_oapi/api/chat/v1/model/text_to_audio_response.py +7 -0
- dify_oapi/api/chat/v1/model/tool_icon.py +52 -0
- dify_oapi/api/chat/v1/model/update_annotation_request.py +33 -0
- dify_oapi/api/chat/v1/model/update_annotation_request_body.py +32 -0
- dify_oapi/api/chat/v1/model/update_annotation_response.py +9 -0
- dify_oapi/api/chat/v1/model/upload_file_request.py +54 -0
- dify_oapi/api/chat/v1/model/upload_file_request_body.py +29 -0
- dify_oapi/api/chat/v1/model/upload_file_response.py +10 -0
- dify_oapi/api/chat/v1/model/usage_info.py +84 -0
- dify_oapi/api/chat/v1/resource/__init__.py +7 -3
- dify_oapi/api/chat/v1/resource/annotation.py +77 -0
- dify_oapi/api/chat/v1/resource/app.py +47 -0
- dify_oapi/api/chat/v1/resource/audio.py +13 -0
- dify_oapi/api/chat/v1/resource/chat.py +14 -0
- dify_oapi/api/chat/v1/resource/conversation.py +55 -9
- dify_oapi/api/chat/v1/resource/feedback.py +31 -0
- dify_oapi/api/chat/v1/resource/file.py +25 -0
- dify_oapi/api/chat/v1/resource/message.py +19 -15
- dify_oapi/api/chat/v1/version.py +8 -2
- dify_oapi/api/chatflow/__init__.py +0 -0
- dify_oapi/api/chatflow/service.py +25 -0
- dify_oapi/api/chatflow/v1/__init__.py +0 -0
- dify_oapi/api/chatflow/v1/model/__init__.py +0 -0
- dify_oapi/api/chatflow/v1/model/annotation_info.py +43 -0
- dify_oapi/api/chatflow/v1/model/annotation_reply_settings_request.py +37 -0
- dify_oapi/api/chatflow/v1/model/annotation_reply_settings_request_body.py +33 -0
- dify_oapi/api/chatflow/v1/model/annotation_reply_settings_response.py +10 -0
- dify_oapi/api/chatflow/v1/model/annotation_reply_status_request.py +36 -0
- dify_oapi/api/chatflow/v1/model/annotation_reply_status_response.py +11 -0
- dify_oapi/api/chatflow/v1/model/app_info.py +33 -0
- dify_oapi/api/chatflow/v1/model/app_parameters.py +276 -0
- dify_oapi/api/chatflow/v1/model/audio_to_text_request.py +37 -0
- dify_oapi/api/chatflow/v1/model/audio_to_text_response.py +21 -0
- dify_oapi/api/chatflow/v1/model/chat_file.py +40 -0
- dify_oapi/api/chatflow/v1/model/chat_message.py +88 -0
- dify_oapi/api/chatflow/v1/model/chatflow_types.py +210 -0
- dify_oapi/api/chatflow/v1/model/conversation_info.py +53 -0
- dify_oapi/api/chatflow/v1/model/conversation_variable.py +55 -0
- dify_oapi/api/chatflow/v1/model/create_annotation_request.py +30 -0
- dify_oapi/api/chatflow/v1/model/create_annotation_request_body.py +28 -0
- dify_oapi/api/chatflow/v1/model/create_annotation_response.py +9 -0
- dify_oapi/api/chatflow/v1/model/delete_annotation_request.py +28 -0
- dify_oapi/api/chatflow/v1/model/delete_annotation_response.py +7 -0
- dify_oapi/api/chatflow/v1/model/delete_conversation_request.py +36 -0
- dify_oapi/api/chatflow/v1/model/delete_conversation_request_body.py +21 -0
- dify_oapi/api/chatflow/v1/model/delete_conversation_response.py +17 -0
- dify_oapi/api/chatflow/v1/model/feedback_info.py +75 -0
- dify_oapi/api/chatflow/v1/model/file_info.py +53 -0
- dify_oapi/api/chatflow/v1/model/get_annotations_request.py +30 -0
- dify_oapi/api/chatflow/v1/model/get_annotations_response.py +13 -0
- dify_oapi/api/chatflow/v1/model/get_app_feedbacks_request.py +30 -0
- dify_oapi/api/chatflow/v1/model/get_app_feedbacks_response.py +23 -0
- dify_oapi/api/chatflow/v1/model/get_conversation_messages_request.py +38 -0
- dify_oapi/api/chatflow/v1/model/get_conversation_messages_response.py +33 -0
- dify_oapi/api/chatflow/v1/model/get_conversation_variables_request.py +44 -0
- dify_oapi/api/chatflow/v1/model/get_conversation_variables_response.py +33 -0
- dify_oapi/api/chatflow/v1/model/get_conversations_request.py +40 -0
- dify_oapi/api/chatflow/v1/model/get_conversations_response.py +33 -0
- dify_oapi/api/chatflow/v1/model/get_info_request.py +22 -0
- dify_oapi/api/chatflow/v1/model/get_info_response.py +7 -0
- dify_oapi/api/chatflow/v1/model/get_meta_request.py +22 -0
- dify_oapi/api/chatflow/v1/model/get_meta_response.py +7 -0
- dify_oapi/api/chatflow/v1/model/get_parameters_request.py +22 -0
- dify_oapi/api/chatflow/v1/model/get_parameters_response.py +7 -0
- dify_oapi/api/chatflow/v1/model/get_site_request.py +22 -0
- dify_oapi/api/chatflow/v1/model/get_site_response.py +7 -0
- dify_oapi/api/chatflow/v1/model/get_suggested_questions_request.py +32 -0
- dify_oapi/api/chatflow/v1/model/get_suggested_questions_response.py +6 -0
- dify_oapi/api/chatflow/v1/model/message_feedback_request.py +36 -0
- dify_oapi/api/chatflow/v1/model/message_feedback_request_body.py +33 -0
- dify_oapi/api/chatflow/v1/model/message_feedback_response.py +21 -0
- dify_oapi/api/chatflow/v1/model/rename_conversation_request.py +36 -0
- dify_oapi/api/chatflow/v1/model/rename_conversation_request_body.py +31 -0
- dify_oapi/api/chatflow/v1/model/rename_conversation_response.py +53 -0
- dify_oapi/api/chatflow/v1/model/retriever_resource.py +58 -0
- dify_oapi/api/chatflow/v1/model/send_chat_message_request.py +30 -0
- dify_oapi/api/chatflow/v1/model/send_chat_message_request_body.py +54 -0
- dify_oapi/api/chatflow/v1/model/send_chat_message_response.py +7 -0
- dify_oapi/api/chatflow/v1/model/stop_chat_message_request.py +36 -0
- dify_oapi/api/chatflow/v1/model/stop_chat_message_request_body.py +21 -0
- dify_oapi/api/chatflow/v1/model/stop_chat_message_response.py +5 -0
- dify_oapi/api/chatflow/v1/model/text_to_audio_request.py +30 -0
- dify_oapi/api/chatflow/v1/model/text_to_audio_request_body.py +36 -0
- dify_oapi/api/chatflow/v1/model/text_to_audio_response.py +19 -0
- dify_oapi/api/chatflow/v1/model/tool_icon.py +48 -0
- dify_oapi/api/chatflow/v1/model/update_annotation_request.py +36 -0
- dify_oapi/api/chatflow/v1/model/update_annotation_request_body.py +28 -0
- dify_oapi/api/chatflow/v1/model/update_annotation_response.py +9 -0
- dify_oapi/api/chatflow/v1/model/upload_file_request.py +41 -0
- dify_oapi/api/chatflow/v1/model/upload_file_response.py +11 -0
- dify_oapi/api/chatflow/v1/model/usage_info.py +78 -0
- dify_oapi/api/chatflow/v1/model/user_input_form.py +141 -0
- dify_oapi/api/chatflow/v1/model/webapp_settings.py +88 -0
- dify_oapi/api/chatflow/v1/resource/__init__.py +0 -0
- dify_oapi/api/chatflow/v1/resource/annotation.py +122 -0
- dify_oapi/api/chatflow/v1/resource/application.py +76 -0
- dify_oapi/api/chatflow/v1/resource/chatflow.py +91 -0
- dify_oapi/api/chatflow/v1/resource/conversation.py +104 -0
- dify_oapi/api/chatflow/v1/resource/feedback.py +69 -0
- dify_oapi/api/chatflow/v1/resource/file.py +39 -0
- dify_oapi/api/chatflow/v1/resource/tts.py +29 -0
- dify_oapi/api/chatflow/v1/version.py +29 -0
- dify_oapi/api/knowledge/v1/model/data_source_detail.py +23 -0
- dify_oapi/api/knowledge/v1/model/dataset_info.py +10 -9
- dify_oapi/api/knowledge/v1/model/dataset_metadata.py +14 -0
- dify_oapi/api/knowledge/v1/model/document_info.py +18 -6
- dify_oapi/api/knowledge/v1/model/external_knowledge_info.py +11 -1
- dify_oapi/api/knowledge/v1/model/external_retrieval_model.py +13 -0
- dify_oapi/api/knowledge/v1/model/knowledge_types.py +2 -2
- dify_oapi/api/knowledge/v1/model/retrieval_model.py +10 -4
- dify_oapi/api/knowledge/v1/model/weights.py +27 -0
- dify_oapi/api/workflow/v1/model/chunk_workflow_event.py +74 -0
- dify_oapi/api/workflow/v1/model/input_file_object_workflow.py +76 -0
- dify_oapi/api/workflow/v1/model/node_finished_data.py +118 -0
- dify_oapi/api/workflow/v1/model/node_started_data.py +81 -0
- dify_oapi/api/workflow/v1/model/ping_data.py +28 -0
- dify_oapi/api/workflow/v1/model/run_workflow_request_body.py +1 -1
- dify_oapi/api/workflow/v1/model/text_chunk_data.py +39 -0
- dify_oapi/api/workflow/v1/model/tts_message_data.py +45 -0
- dify_oapi/api/workflow/v1/model/tts_message_end_data.py +45 -0
- dify_oapi/api/workflow/v1/model/workflow_completion_response.py +50 -0
- dify_oapi/api/workflow/v1/model/workflow_finished_data.py +93 -0
- dify_oapi/api/workflow/v1/model/workflow_started_data.py +51 -0
- dify_oapi/api/workflow/v1/model/workflow_types.py +27 -12
- dify_oapi/client.py +45 -0
- dify_oapi/core/http/transport/__init__.py +2 -1
- dify_oapi/core/http/transport/async_transport.py +73 -50
- dify_oapi/core/http/transport/connection_pool.py +131 -0
- dify_oapi/core/http/transport/sync_transport.py +73 -50
- dify_oapi/core/model/config.py +10 -0
- {dify_oapi2-0.4.0.dist-info → dify_oapi2-0.5.0.dist-info}/METADATA +44 -12
- {dify_oapi2-0.4.0.dist-info → dify_oapi2-0.5.0.dist-info}/RECORD +189 -34
- dify_oapi/api/chat/v1/model/chat_request_file.py +0 -46
- dify_oapi/api/chat/v1/model/message_suggested_request.py +0 -36
- {dify_oapi2-0.4.0.dist-info → dify_oapi2-0.5.0.dist-info}/LICENSE +0 -0
- {dify_oapi2-0.4.0.dist-info → dify_oapi2-0.5.0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,39 @@
|
|
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.upload_file_request import UploadFileRequest
|
8
|
+
from ..model.upload_file_response import UploadFileResponse
|
9
|
+
|
10
|
+
|
11
|
+
class File:
|
12
|
+
"""File resource for chatflow API operations."""
|
13
|
+
|
14
|
+
def __init__(self, config: Config):
|
15
|
+
self.config = config
|
16
|
+
|
17
|
+
def upload(self, request: UploadFileRequest, request_option: RequestOption) -> UploadFileResponse:
|
18
|
+
"""Upload file for multimodal support.
|
19
|
+
|
20
|
+
Args:
|
21
|
+
request: Upload file request
|
22
|
+
request_option: Request options including API key
|
23
|
+
|
24
|
+
Returns:
|
25
|
+
Upload file response with file information
|
26
|
+
"""
|
27
|
+
return Transport.execute(self.config, request, unmarshal_as=UploadFileResponse, option=request_option)
|
28
|
+
|
29
|
+
async def aupload(self, request: UploadFileRequest, request_option: RequestOption) -> UploadFileResponse:
|
30
|
+
"""Upload file for multimodal support (async).
|
31
|
+
|
32
|
+
Args:
|
33
|
+
request: Upload file request
|
34
|
+
request_option: Request options including API key
|
35
|
+
|
36
|
+
Returns:
|
37
|
+
Upload file response with file information
|
38
|
+
"""
|
39
|
+
return await ATransport.aexecute(self.config, request, unmarshal_as=UploadFileResponse, option=request_option)
|
@@ -0,0 +1,29 @@
|
|
1
|
+
from dify_oapi.api.chatflow.v1.model.audio_to_text_request import AudioToTextRequest
|
2
|
+
from dify_oapi.api.chatflow.v1.model.audio_to_text_response import AudioToTextResponse
|
3
|
+
from dify_oapi.api.chatflow.v1.model.text_to_audio_request import TextToAudioRequest
|
4
|
+
from dify_oapi.api.chatflow.v1.model.text_to_audio_response import TextToAudioResponse
|
5
|
+
from dify_oapi.core.http.transport.async_transport import ATransport
|
6
|
+
from dify_oapi.core.http.transport.sync_transport import Transport
|
7
|
+
from dify_oapi.core.model.config import Config
|
8
|
+
from dify_oapi.core.model.request_option import RequestOption
|
9
|
+
|
10
|
+
|
11
|
+
class TTS:
|
12
|
+
def __init__(self, config: Config):
|
13
|
+
self.config = config
|
14
|
+
|
15
|
+
def speech_to_text(self, request: AudioToTextRequest, request_option: RequestOption) -> AudioToTextResponse:
|
16
|
+
"""Convert audio to text (sync)"""
|
17
|
+
return Transport.execute(self.config, request, unmarshal_as=AudioToTextResponse, option=request_option)
|
18
|
+
|
19
|
+
async def aspeech_to_text(self, request: AudioToTextRequest, request_option: RequestOption) -> AudioToTextResponse:
|
20
|
+
"""Convert audio to text (async)"""
|
21
|
+
return await ATransport.aexecute(self.config, request, unmarshal_as=AudioToTextResponse, option=request_option)
|
22
|
+
|
23
|
+
def text_to_audio(self, request: TextToAudioRequest, request_option: RequestOption) -> TextToAudioResponse:
|
24
|
+
"""Convert text to audio (sync)"""
|
25
|
+
return Transport.execute(self.config, request, unmarshal_as=TextToAudioResponse, option=request_option)
|
26
|
+
|
27
|
+
async def atext_to_audio(self, request: TextToAudioRequest, request_option: RequestOption) -> TextToAudioResponse:
|
28
|
+
"""Convert text to audio (async)"""
|
29
|
+
return await ATransport.aexecute(self.config, request, unmarshal_as=TextToAudioResponse, option=request_option)
|
@@ -0,0 +1,29 @@
|
|
1
|
+
"""Chatflow API V1 version integration."""
|
2
|
+
|
3
|
+
from dify_oapi.core.model.config import Config
|
4
|
+
|
5
|
+
from .resource.annotation import Annotation
|
6
|
+
from .resource.application import Application
|
7
|
+
from .resource.chatflow import Chatflow
|
8
|
+
from .resource.conversation import Conversation
|
9
|
+
from .resource.feedback import Feedback
|
10
|
+
from .resource.file import File
|
11
|
+
from .resource.tts import TTS
|
12
|
+
|
13
|
+
|
14
|
+
class V1:
|
15
|
+
"""Chatflow API V1 version class that integrates all resources."""
|
16
|
+
|
17
|
+
def __init__(self, config: Config):
|
18
|
+
"""Initialize V1 with all chatflow resources.
|
19
|
+
|
20
|
+
Args:
|
21
|
+
config: Configuration object containing API settings
|
22
|
+
"""
|
23
|
+
self.chatflow = Chatflow(config)
|
24
|
+
self.file = File(config)
|
25
|
+
self.feedback = Feedback(config)
|
26
|
+
self.conversation = Conversation(config)
|
27
|
+
self.tts = TTS(config)
|
28
|
+
self.application = Application(config)
|
29
|
+
self.annotation = Annotation(config)
|
@@ -0,0 +1,23 @@
|
|
1
|
+
"""Data source detail models."""
|
2
|
+
|
3
|
+
from typing import Optional
|
4
|
+
|
5
|
+
from pydantic import BaseModel
|
6
|
+
|
7
|
+
|
8
|
+
class UploadFileDetail(BaseModel):
|
9
|
+
"""Upload file detail information."""
|
10
|
+
|
11
|
+
id: Optional[str] = None
|
12
|
+
name: Optional[str] = None
|
13
|
+
size: Optional[int] = None
|
14
|
+
extension: Optional[str] = None
|
15
|
+
mime_type: Optional[str] = None
|
16
|
+
created_by: Optional[str] = None
|
17
|
+
created_at: Optional[float] = None
|
18
|
+
|
19
|
+
|
20
|
+
class DataSourceDetailDict(BaseModel):
|
21
|
+
"""Data source detail dictionary."""
|
22
|
+
|
23
|
+
upload_file: Optional[UploadFileDetail] = None
|
@@ -4,9 +4,10 @@ from typing import Optional
|
|
4
4
|
|
5
5
|
from pydantic import BaseModel
|
6
6
|
|
7
|
-
from .
|
7
|
+
from .dataset_metadata import DatasetMetadata
|
8
8
|
from .external_knowledge_info import ExternalKnowledgeInfo
|
9
|
-
from .
|
9
|
+
from .external_retrieval_model import ExternalRetrievalModel
|
10
|
+
from .knowledge_types import DataSourceType, DocumentForm, IndexingTechnique, Permission
|
10
11
|
from .retrieval_model import RetrievalModel
|
11
12
|
from .tag_info import TagInfo
|
12
13
|
|
@@ -25,18 +26,18 @@ class DatasetInfo(BaseModel):
|
|
25
26
|
document_count: Optional[int] = None
|
26
27
|
word_count: Optional[int] = None
|
27
28
|
created_by: Optional[str] = None
|
28
|
-
created_at: Optional[
|
29
|
+
created_at: Optional[int] = None
|
29
30
|
updated_by: Optional[str] = None
|
30
|
-
updated_at: Optional[
|
31
|
+
updated_at: Optional[int] = None
|
31
32
|
embedding_model: Optional[str] = None
|
32
33
|
embedding_model_provider: Optional[str] = None
|
33
34
|
embedding_available: Optional[bool] = None
|
34
35
|
retrieval_model_dict: Optional[RetrievalModel] = None
|
35
36
|
tags: Optional[list[TagInfo]] = None
|
36
|
-
doc_form: Optional[
|
37
|
+
doc_form: Optional[DocumentForm] = None
|
37
38
|
external_knowledge_info: Optional[ExternalKnowledgeInfo] = None
|
38
|
-
external_retrieval_model: Optional[
|
39
|
-
doc_metadata: Optional[list[
|
39
|
+
external_retrieval_model: Optional[ExternalRetrievalModel] = None
|
40
|
+
doc_metadata: Optional[list[DatasetMetadata]] = None
|
40
41
|
built_in_field_enabled: Optional[bool] = None
|
41
42
|
|
42
43
|
@staticmethod
|
@@ -89,7 +90,7 @@ class DatasetInfoBuilder:
|
|
89
90
|
self._dataset_info.created_by = created_by
|
90
91
|
return self
|
91
92
|
|
92
|
-
def created_at(self, created_at:
|
93
|
+
def created_at(self, created_at: int) -> "DatasetInfoBuilder":
|
93
94
|
self._dataset_info.created_at = created_at
|
94
95
|
return self
|
95
96
|
|
@@ -97,7 +98,7 @@ class DatasetInfoBuilder:
|
|
97
98
|
self._dataset_info.updated_by = updated_by
|
98
99
|
return self
|
99
100
|
|
100
|
-
def updated_at(self, updated_at:
|
101
|
+
def updated_at(self, updated_at: int) -> "DatasetInfoBuilder":
|
101
102
|
self._dataset_info.updated_at = updated_at
|
102
103
|
return self
|
103
104
|
|
@@ -0,0 +1,14 @@
|
|
1
|
+
"""Dataset metadata model."""
|
2
|
+
|
3
|
+
from typing import Optional
|
4
|
+
|
5
|
+
from pydantic import BaseModel
|
6
|
+
|
7
|
+
|
8
|
+
class DatasetMetadata(BaseModel):
|
9
|
+
"""Dataset metadata information."""
|
10
|
+
|
11
|
+
# Based on API response, this is typically an empty array
|
12
|
+
# Can be extended when actual metadata structure is known
|
13
|
+
key: Optional[str] = None
|
14
|
+
value: Optional[str] = None
|
@@ -4,7 +4,9 @@ from typing import Optional
|
|
4
4
|
|
5
5
|
from pydantic import BaseModel
|
6
6
|
|
7
|
+
from .data_source_detail import DataSourceDetailDict
|
7
8
|
from .data_source_info import DataSourceInfo
|
9
|
+
from .document_metadata import DocumentMetadata
|
8
10
|
from .knowledge_types import DataSourceType, DocumentDisplayStatus, DocumentForm, IndexingStatus
|
9
11
|
|
10
12
|
|
@@ -15,23 +17,25 @@ class DocumentInfo(BaseModel):
|
|
15
17
|
position: Optional[int] = None
|
16
18
|
data_source_type: Optional[DataSourceType] = None
|
17
19
|
data_source_info: Optional["DataSourceInfo"] = None
|
20
|
+
data_source_detail_dict: Optional[DataSourceDetailDict] = None
|
18
21
|
dataset_process_rule_id: Optional[str] = None
|
19
22
|
name: Optional[str] = None
|
20
23
|
created_from: Optional[str] = None
|
21
24
|
created_by: Optional[str] = None
|
22
|
-
created_at: Optional[
|
25
|
+
created_at: Optional[int] = None
|
23
26
|
tokens: Optional[int] = None
|
24
27
|
indexing_status: Optional[IndexingStatus] = None
|
25
28
|
error: Optional[str] = None
|
26
29
|
enabled: Optional[bool] = None
|
27
|
-
disabled_at: Optional[
|
30
|
+
disabled_at: Optional[int] = None
|
28
31
|
disabled_by: Optional[str] = None
|
29
32
|
archived: Optional[bool] = None
|
30
33
|
display_status: Optional[DocumentDisplayStatus] = None
|
31
34
|
word_count: Optional[int] = None
|
32
35
|
hit_count: Optional[int] = None
|
33
36
|
doc_form: Optional[DocumentForm] = None
|
34
|
-
|
37
|
+
doc_metadata: Optional[DocumentMetadata] = None
|
38
|
+
updated_at: Optional[int] = None
|
35
39
|
|
36
40
|
@staticmethod
|
37
41
|
def builder() -> "DocumentInfoBuilder":
|
@@ -63,6 +67,10 @@ class DocumentInfoBuilder:
|
|
63
67
|
self._document_info.data_source_info = data_source_info
|
64
68
|
return self
|
65
69
|
|
70
|
+
def data_source_detail_dict(self, data_source_detail_dict: DataSourceDetailDict) -> "DocumentInfoBuilder":
|
71
|
+
self._document_info.data_source_detail_dict = data_source_detail_dict
|
72
|
+
return self
|
73
|
+
|
66
74
|
def dataset_process_rule_id(self, dataset_process_rule_id: str) -> "DocumentInfoBuilder":
|
67
75
|
self._document_info.dataset_process_rule_id = dataset_process_rule_id
|
68
76
|
return self
|
@@ -79,7 +87,7 @@ class DocumentInfoBuilder:
|
|
79
87
|
self._document_info.created_by = created_by
|
80
88
|
return self
|
81
89
|
|
82
|
-
def created_at(self, created_at:
|
90
|
+
def created_at(self, created_at: int) -> "DocumentInfoBuilder":
|
83
91
|
self._document_info.created_at = created_at
|
84
92
|
return self
|
85
93
|
|
@@ -99,7 +107,7 @@ class DocumentInfoBuilder:
|
|
99
107
|
self._document_info.enabled = enabled
|
100
108
|
return self
|
101
109
|
|
102
|
-
def disabled_at(self, disabled_at:
|
110
|
+
def disabled_at(self, disabled_at: int) -> "DocumentInfoBuilder":
|
103
111
|
self._document_info.disabled_at = disabled_at
|
104
112
|
return self
|
105
113
|
|
@@ -127,6 +135,10 @@ class DocumentInfoBuilder:
|
|
127
135
|
self._document_info.doc_form = doc_form
|
128
136
|
return self
|
129
137
|
|
130
|
-
def
|
138
|
+
def doc_metadata(self, doc_metadata: DocumentMetadata) -> "DocumentInfoBuilder":
|
139
|
+
self._document_info.doc_metadata = doc_metadata
|
140
|
+
return self
|
141
|
+
|
142
|
+
def updated_at(self, updated_at: int) -> "DocumentInfoBuilder":
|
131
143
|
self._document_info.updated_at = updated_at
|
132
144
|
return self
|
@@ -8,8 +8,10 @@ from pydantic import BaseModel
|
|
8
8
|
class ExternalKnowledgeInfo(BaseModel):
|
9
9
|
"""External knowledge info model with builder pattern."""
|
10
10
|
|
11
|
-
external_knowledge_api_id: Optional[str] = None
|
12
11
|
external_knowledge_id: Optional[str] = None
|
12
|
+
external_knowledge_api_id: Optional[str] = None
|
13
|
+
external_knowledge_api_name: Optional[str] = None
|
14
|
+
external_knowledge_api_endpoint: Optional[str] = None
|
13
15
|
|
14
16
|
@staticmethod
|
15
17
|
def builder() -> "ExternalKnowledgeInfoBuilder":
|
@@ -32,3 +34,11 @@ class ExternalKnowledgeInfoBuilder:
|
|
32
34
|
def external_knowledge_id(self, external_knowledge_id: str) -> "ExternalKnowledgeInfoBuilder":
|
33
35
|
self._external_knowledge_info.external_knowledge_id = external_knowledge_id
|
34
36
|
return self
|
37
|
+
|
38
|
+
def external_knowledge_api_name(self, external_knowledge_api_name: str) -> "ExternalKnowledgeInfoBuilder":
|
39
|
+
self._external_knowledge_info.external_knowledge_api_name = external_knowledge_api_name
|
40
|
+
return self
|
41
|
+
|
42
|
+
def external_knowledge_api_endpoint(self, external_knowledge_api_endpoint: str) -> "ExternalKnowledgeInfoBuilder":
|
43
|
+
self._external_knowledge_info.external_knowledge_api_endpoint = external_knowledge_api_endpoint
|
44
|
+
return self
|
@@ -0,0 +1,13 @@
|
|
1
|
+
"""External retrieval model for Knowledge Base API."""
|
2
|
+
|
3
|
+
from typing import Optional
|
4
|
+
|
5
|
+
from pydantic import BaseModel
|
6
|
+
|
7
|
+
|
8
|
+
class ExternalRetrievalModel(BaseModel):
|
9
|
+
"""External retrieval model configuration."""
|
10
|
+
|
11
|
+
top_k: Optional[int] = None
|
12
|
+
score_threshold: Optional[float] = None
|
13
|
+
score_threshold_enabled: Optional[bool] = None
|
@@ -15,7 +15,7 @@ SearchMethod = Literal["hybrid_search", "semantic_search", "full_text_search", "
|
|
15
15
|
DocumentStatus = Literal["indexing", "completed", "error", "paused"]
|
16
16
|
|
17
17
|
# Processing mode types
|
18
|
-
ProcessingMode = Literal["automatic", "custom"]
|
18
|
+
ProcessingMode = Literal["automatic", "custom", "hierarchical"]
|
19
19
|
|
20
20
|
# File types
|
21
21
|
FileType = Literal["document", "image", "audio", "video", "custom"]
|
@@ -79,7 +79,7 @@ ExternalKnowledgeProvider = Literal["external_api", "notion", "web_crawler"]
|
|
79
79
|
DocumentCreatedFrom = Literal["api", "web", "upload"]
|
80
80
|
|
81
81
|
# Document display status types
|
82
|
-
DocumentDisplayStatus = Literal["available", "indexing", "error", "paused", "archived"]
|
82
|
+
DocumentDisplayStatus = Literal["available", "indexing", "error", "paused", "archived", "queuing"]
|
83
83
|
|
84
84
|
# Batch processing status types
|
85
85
|
BatchProcessingStatus = Literal["processing", "completed", "failed", "cancelled"]
|
@@ -6,6 +6,7 @@ from pydantic import BaseModel
|
|
6
6
|
|
7
7
|
from .knowledge_types import SearchMethod
|
8
8
|
from .reranking_mode import RerankingMode
|
9
|
+
from .weights import Weights
|
9
10
|
|
10
11
|
|
11
12
|
class RetrievalModel(BaseModel):
|
@@ -13,11 +14,12 @@ class RetrievalModel(BaseModel):
|
|
13
14
|
|
14
15
|
search_method: Optional[SearchMethod] = None
|
15
16
|
reranking_enable: Optional[bool] = None
|
16
|
-
reranking_mode: Optional[
|
17
|
+
reranking_mode: Optional[str] = None
|
18
|
+
reranking_model: Optional[RerankingMode] = None
|
17
19
|
top_k: Optional[int] = None
|
18
20
|
score_threshold_enabled: Optional[bool] = None
|
19
21
|
score_threshold: Optional[float] = None
|
20
|
-
weights: Optional[
|
22
|
+
weights: Optional[Weights] = None
|
21
23
|
|
22
24
|
@staticmethod
|
23
25
|
def builder() -> "RetrievalModelBuilder":
|
@@ -41,10 +43,14 @@ class RetrievalModelBuilder:
|
|
41
43
|
self._retrieval_model.reranking_enable = reranking_enable
|
42
44
|
return self
|
43
45
|
|
44
|
-
def reranking_mode(self, reranking_mode:
|
46
|
+
def reranking_mode(self, reranking_mode: str) -> "RetrievalModelBuilder":
|
45
47
|
self._retrieval_model.reranking_mode = reranking_mode
|
46
48
|
return self
|
47
49
|
|
50
|
+
def reranking_model(self, reranking_model: RerankingMode) -> "RetrievalModelBuilder":
|
51
|
+
self._retrieval_model.reranking_model = reranking_model
|
52
|
+
return self
|
53
|
+
|
48
54
|
def top_k(self, top_k: int) -> "RetrievalModelBuilder":
|
49
55
|
self._retrieval_model.top_k = top_k
|
50
56
|
return self
|
@@ -57,6 +63,6 @@ class RetrievalModelBuilder:
|
|
57
63
|
self._retrieval_model.score_threshold = score_threshold
|
58
64
|
return self
|
59
65
|
|
60
|
-
def weights(self, weights:
|
66
|
+
def weights(self, weights: Weights) -> "RetrievalModelBuilder":
|
61
67
|
self._retrieval_model.weights = weights
|
62
68
|
return self
|
@@ -0,0 +1,27 @@
|
|
1
|
+
"""Weights model for retrieval configuration."""
|
2
|
+
|
3
|
+
from typing import Optional
|
4
|
+
|
5
|
+
from pydantic import BaseModel
|
6
|
+
|
7
|
+
|
8
|
+
class KeywordSetting(BaseModel):
|
9
|
+
"""Keyword search weight settings."""
|
10
|
+
|
11
|
+
keyword_weight: Optional[float] = None
|
12
|
+
|
13
|
+
|
14
|
+
class VectorSetting(BaseModel):
|
15
|
+
"""Vector search weight settings."""
|
16
|
+
|
17
|
+
vector_weight: Optional[float] = None
|
18
|
+
embedding_model_name: Optional[str] = None
|
19
|
+
embedding_provider_name: Optional[str] = None
|
20
|
+
|
21
|
+
|
22
|
+
class Weights(BaseModel):
|
23
|
+
"""Weights configuration for hybrid search."""
|
24
|
+
|
25
|
+
weight_type: Optional[str] = None
|
26
|
+
keyword_setting: Optional[KeywordSetting] = None
|
27
|
+
vector_setting: Optional[VectorSetting] = None
|
@@ -0,0 +1,74 @@
|
|
1
|
+
"""Chunk workflow event for streaming mode.
|
2
|
+
|
3
|
+
This module defines the base structure for workflow streaming events
|
4
|
+
and specific event data models.
|
5
|
+
"""
|
6
|
+
|
7
|
+
from typing import Any, Optional
|
8
|
+
|
9
|
+
from pydantic import BaseModel
|
10
|
+
|
11
|
+
from .workflow_types import EventType
|
12
|
+
|
13
|
+
|
14
|
+
class ChunkWorkflowEvent(BaseModel):
|
15
|
+
"""Base streaming event structure for workflow execution."""
|
16
|
+
|
17
|
+
event: EventType
|
18
|
+
task_id: Optional[str] = None
|
19
|
+
workflow_run_id: Optional[str] = None
|
20
|
+
data: Optional[dict[str, Any]] = None
|
21
|
+
message_id: Optional[str] = None
|
22
|
+
audio: Optional[str] = None
|
23
|
+
created_at: Optional[int] = None
|
24
|
+
|
25
|
+
@staticmethod
|
26
|
+
def builder() -> "ChunkWorkflowEventBuilder":
|
27
|
+
"""Create a new ChunkWorkflowEvent builder."""
|
28
|
+
return ChunkWorkflowEventBuilder()
|
29
|
+
|
30
|
+
|
31
|
+
class ChunkWorkflowEventBuilder:
|
32
|
+
"""Builder for ChunkWorkflowEvent."""
|
33
|
+
|
34
|
+
def __init__(self):
|
35
|
+
self._chunk_workflow_event = ChunkWorkflowEvent(event="ping")
|
36
|
+
|
37
|
+
def build(self) -> ChunkWorkflowEvent:
|
38
|
+
"""Build the ChunkWorkflowEvent instance."""
|
39
|
+
return self._chunk_workflow_event
|
40
|
+
|
41
|
+
def event(self, event: EventType) -> "ChunkWorkflowEventBuilder":
|
42
|
+
"""Set the event type."""
|
43
|
+
self._chunk_workflow_event.event = event
|
44
|
+
return self
|
45
|
+
|
46
|
+
def task_id(self, task_id: str) -> "ChunkWorkflowEventBuilder":
|
47
|
+
"""Set the task ID."""
|
48
|
+
self._chunk_workflow_event.task_id = task_id
|
49
|
+
return self
|
50
|
+
|
51
|
+
def workflow_run_id(self, workflow_run_id: str) -> "ChunkWorkflowEventBuilder":
|
52
|
+
"""Set the workflow run ID."""
|
53
|
+
self._chunk_workflow_event.workflow_run_id = workflow_run_id
|
54
|
+
return self
|
55
|
+
|
56
|
+
def data(self, data: dict[str, Any]) -> "ChunkWorkflowEventBuilder":
|
57
|
+
"""Set the event data."""
|
58
|
+
self._chunk_workflow_event.data = data
|
59
|
+
return self
|
60
|
+
|
61
|
+
def message_id(self, message_id: str) -> "ChunkWorkflowEventBuilder":
|
62
|
+
"""Set the message ID (for TTS events)."""
|
63
|
+
self._chunk_workflow_event.message_id = message_id
|
64
|
+
return self
|
65
|
+
|
66
|
+
def audio(self, audio: str) -> "ChunkWorkflowEventBuilder":
|
67
|
+
"""Set the audio data (for TTS events)."""
|
68
|
+
self._chunk_workflow_event.audio = audio
|
69
|
+
return self
|
70
|
+
|
71
|
+
def created_at(self, created_at: int) -> "ChunkWorkflowEventBuilder":
|
72
|
+
"""Set the creation timestamp."""
|
73
|
+
self._chunk_workflow_event.created_at = created_at
|
74
|
+
return self
|
@@ -0,0 +1,76 @@
|
|
1
|
+
"""Input file object for workflow multimodal support.
|
2
|
+
|
3
|
+
This module defines the InputFileObjectWorkflow model for handling file inputs
|
4
|
+
in workflow execution with proper validation rules.
|
5
|
+
"""
|
6
|
+
|
7
|
+
from typing import Optional
|
8
|
+
|
9
|
+
from pydantic import BaseModel, model_validator
|
10
|
+
|
11
|
+
from .workflow_types import FileType, TransferMethod
|
12
|
+
|
13
|
+
|
14
|
+
class InputFileObjectWorkflow(BaseModel):
|
15
|
+
"""File input object for workflow execution.
|
16
|
+
|
17
|
+
Supports both remote URL and local file upload methods with validation rules:
|
18
|
+
- When transfer_method is "remote_url": url is required, upload_file_id must be None
|
19
|
+
- When transfer_method is "local_file": upload_file_id is required, url must be None
|
20
|
+
"""
|
21
|
+
|
22
|
+
type: FileType
|
23
|
+
transfer_method: TransferMethod
|
24
|
+
url: Optional[str] = None
|
25
|
+
upload_file_id: Optional[str] = None
|
26
|
+
|
27
|
+
@model_validator(mode="after")
|
28
|
+
def validate_transfer_method_fields(self):
|
29
|
+
"""Validate that the correct fields are provided based on transfer_method."""
|
30
|
+
if self.transfer_method == "remote_url":
|
31
|
+
if not self.url:
|
32
|
+
raise ValueError("url is required when transfer_method is 'remote_url'")
|
33
|
+
if self.upload_file_id is not None:
|
34
|
+
raise ValueError("upload_file_id must be None when transfer_method is 'remote_url'")
|
35
|
+
elif self.transfer_method == "local_file":
|
36
|
+
if not self.upload_file_id:
|
37
|
+
raise ValueError("upload_file_id is required when transfer_method is 'local_file'")
|
38
|
+
if self.url is not None:
|
39
|
+
raise ValueError("url must be None when transfer_method is 'local_file'")
|
40
|
+
return self
|
41
|
+
|
42
|
+
@staticmethod
|
43
|
+
def builder() -> "InputFileObjectWorkflowBuilder":
|
44
|
+
"""Create a new InputFileObjectWorkflow builder."""
|
45
|
+
return InputFileObjectWorkflowBuilder()
|
46
|
+
|
47
|
+
|
48
|
+
class InputFileObjectWorkflowBuilder:
|
49
|
+
"""Builder for InputFileObjectWorkflow."""
|
50
|
+
|
51
|
+
def __init__(self):
|
52
|
+
self._input_file_object_workflow = InputFileObjectWorkflow(type="document", transfer_method="local_file")
|
53
|
+
|
54
|
+
def build(self) -> InputFileObjectWorkflow:
|
55
|
+
"""Build the InputFileObjectWorkflow instance."""
|
56
|
+
return self._input_file_object_workflow
|
57
|
+
|
58
|
+
def type(self, file_type: FileType) -> "InputFileObjectWorkflowBuilder":
|
59
|
+
"""Set the file type."""
|
60
|
+
self._input_file_object_workflow.type = file_type
|
61
|
+
return self
|
62
|
+
|
63
|
+
def transfer_method(self, transfer_method: TransferMethod) -> "InputFileObjectWorkflowBuilder":
|
64
|
+
"""Set the transfer method."""
|
65
|
+
self._input_file_object_workflow.transfer_method = transfer_method
|
66
|
+
return self
|
67
|
+
|
68
|
+
def url(self, url: str) -> "InputFileObjectWorkflowBuilder":
|
69
|
+
"""Set the remote URL (for remote_url transfer method)."""
|
70
|
+
self._input_file_object_workflow.url = url
|
71
|
+
return self
|
72
|
+
|
73
|
+
def upload_file_id(self, upload_file_id: str) -> "InputFileObjectWorkflowBuilder":
|
74
|
+
"""Set the upload file ID (for local_file transfer method)."""
|
75
|
+
self._input_file_object_workflow.upload_file_id = upload_file_id
|
76
|
+
return self
|
@@ -0,0 +1,118 @@
|
|
1
|
+
"""Node finished event data model.
|
2
|
+
|
3
|
+
This module defines the data structure for node_finished streaming events.
|
4
|
+
"""
|
5
|
+
|
6
|
+
from typing import Any, Optional
|
7
|
+
|
8
|
+
from pydantic import BaseModel
|
9
|
+
|
10
|
+
from .execution_metadata import ExecutionMetadata
|
11
|
+
from .workflow_types import NodeStatus, NodeType
|
12
|
+
|
13
|
+
|
14
|
+
class NodeFinishedData(BaseModel):
|
15
|
+
"""Data structure for node_finished streaming event."""
|
16
|
+
|
17
|
+
id: str
|
18
|
+
node_id: str
|
19
|
+
node_type: NodeType
|
20
|
+
title: str
|
21
|
+
index: int
|
22
|
+
predecessor_node_id: Optional[str] = None
|
23
|
+
inputs: Optional[dict[str, Any]] = None
|
24
|
+
process_data: Optional[dict[str, Any]] = None
|
25
|
+
outputs: Optional[dict[str, Any]] = None
|
26
|
+
status: NodeStatus
|
27
|
+
error: Optional[str] = None
|
28
|
+
elapsed_time: Optional[float] = None
|
29
|
+
execution_metadata: Optional[ExecutionMetadata] = None
|
30
|
+
created_at: int
|
31
|
+
|
32
|
+
@staticmethod
|
33
|
+
def builder() -> "NodeFinishedDataBuilder":
|
34
|
+
"""Create a new NodeFinishedData builder."""
|
35
|
+
return NodeFinishedDataBuilder()
|
36
|
+
|
37
|
+
|
38
|
+
class NodeFinishedDataBuilder:
|
39
|
+
"""Builder for NodeFinishedData."""
|
40
|
+
|
41
|
+
def __init__(self):
|
42
|
+
self._node_finished_data = NodeFinishedData(
|
43
|
+
id="", node_id="", node_type="start", title="", index=0, status="succeeded", created_at=0
|
44
|
+
)
|
45
|
+
|
46
|
+
def build(self) -> NodeFinishedData:
|
47
|
+
"""Build the NodeFinishedData instance."""
|
48
|
+
return self._node_finished_data
|
49
|
+
|
50
|
+
def id(self, id: str) -> "NodeFinishedDataBuilder":
|
51
|
+
"""Set the node execution ID."""
|
52
|
+
self._node_finished_data.id = id
|
53
|
+
return self
|
54
|
+
|
55
|
+
def node_id(self, node_id: str) -> "NodeFinishedDataBuilder":
|
56
|
+
"""Set the node ID."""
|
57
|
+
self._node_finished_data.node_id = node_id
|
58
|
+
return self
|
59
|
+
|
60
|
+
def node_type(self, node_type: NodeType) -> "NodeFinishedDataBuilder":
|
61
|
+
"""Set the node type."""
|
62
|
+
self._node_finished_data.node_type = node_type
|
63
|
+
return self
|
64
|
+
|
65
|
+
def title(self, title: str) -> "NodeFinishedDataBuilder":
|
66
|
+
"""Set the node title."""
|
67
|
+
self._node_finished_data.title = title
|
68
|
+
return self
|
69
|
+
|
70
|
+
def index(self, index: int) -> "NodeFinishedDataBuilder":
|
71
|
+
"""Set the node index."""
|
72
|
+
self._node_finished_data.index = index
|
73
|
+
return self
|
74
|
+
|
75
|
+
def predecessor_node_id(self, predecessor_node_id: str) -> "NodeFinishedDataBuilder":
|
76
|
+
"""Set the predecessor node ID."""
|
77
|
+
self._node_finished_data.predecessor_node_id = predecessor_node_id
|
78
|
+
return self
|
79
|
+
|
80
|
+
def inputs(self, inputs: dict[str, Any]) -> "NodeFinishedDataBuilder":
|
81
|
+
"""Set the node inputs."""
|
82
|
+
self._node_finished_data.inputs = inputs
|
83
|
+
return self
|
84
|
+
|
85
|
+
def process_data(self, process_data: dict[str, Any]) -> "NodeFinishedDataBuilder":
|
86
|
+
"""Set the process data."""
|
87
|
+
self._node_finished_data.process_data = process_data
|
88
|
+
return self
|
89
|
+
|
90
|
+
def outputs(self, outputs: dict[str, Any]) -> "NodeFinishedDataBuilder":
|
91
|
+
"""Set the node outputs."""
|
92
|
+
self._node_finished_data.outputs = outputs
|
93
|
+
return self
|
94
|
+
|
95
|
+
def status(self, status: NodeStatus) -> "NodeFinishedDataBuilder":
|
96
|
+
"""Set the node status."""
|
97
|
+
self._node_finished_data.status = status
|
98
|
+
return self
|
99
|
+
|
100
|
+
def error(self, error: str) -> "NodeFinishedDataBuilder":
|
101
|
+
"""Set the error message."""
|
102
|
+
self._node_finished_data.error = error
|
103
|
+
return self
|
104
|
+
|
105
|
+
def elapsed_time(self, elapsed_time: float) -> "NodeFinishedDataBuilder":
|
106
|
+
"""Set the elapsed time."""
|
107
|
+
self._node_finished_data.elapsed_time = elapsed_time
|
108
|
+
return self
|
109
|
+
|
110
|
+
def execution_metadata(self, execution_metadata: ExecutionMetadata) -> "NodeFinishedDataBuilder":
|
111
|
+
"""Set the execution metadata."""
|
112
|
+
self._node_finished_data.execution_metadata = execution_metadata
|
113
|
+
return self
|
114
|
+
|
115
|
+
def created_at(self, created_at: int) -> "NodeFinishedDataBuilder":
|
116
|
+
"""Set the creation timestamp."""
|
117
|
+
self._node_finished_data.created_at = created_at
|
118
|
+
return self
|