dify-oapi2 0.1.0__tar.gz
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_oapi2-0.1.0/LICENSE +21 -0
- dify_oapi2-0.1.0/PKG-INFO +295 -0
- dify_oapi2-0.1.0/README.md +273 -0
- dify_oapi2-0.1.0/dify_oapi/__init__.py +0 -0
- dify_oapi2-0.1.0/dify_oapi/api/__init__.py +0 -0
- dify_oapi2-0.1.0/dify_oapi/api/chat/__init__.py +0 -0
- dify_oapi2-0.1.0/dify_oapi/api/chat/service.py +8 -0
- dify_oapi2-0.1.0/dify_oapi/api/chat/v1/__init__.py +0 -0
- dify_oapi2-0.1.0/dify_oapi/api/chat/v1/model/__init__.py +0 -0
- dify_oapi2-0.1.0/dify_oapi/api/chat/v1/model/audio_to_text_request.py +40 -0
- dify_oapi2-0.1.0/dify_oapi/api/chat/v1/model/audio_to_text_request_body.py +23 -0
- dify_oapi2-0.1.0/dify_oapi/api/chat/v1/model/audio_to_text_response.py +5 -0
- dify_oapi2-0.1.0/dify_oapi/api/chat/v1/model/chat_request.py +32 -0
- dify_oapi2-0.1.0/dify_oapi/api/chat/v1/model/chat_request_body.py +57 -0
- dify_oapi2-0.1.0/dify_oapi/api/chat/v1/model/chat_request_file.py +46 -0
- dify_oapi2-0.1.0/dify_oapi/api/chat/v1/model/chat_response.py +19 -0
- dify_oapi2-0.1.0/dify_oapi/api/chat/v1/model/delete_conversation_request.py +38 -0
- dify_oapi2-0.1.0/dify_oapi/api/chat/v1/model/delete_conversation_request_body.py +23 -0
- dify_oapi2-0.1.0/dify_oapi/api/chat/v1/model/delete_conversation_response.py +5 -0
- dify_oapi2-0.1.0/dify_oapi/api/chat/v1/model/get_conversation_list_request.py +48 -0
- dify_oapi2-0.1.0/dify_oapi/api/chat/v1/model/get_conversation_list_response.py +21 -0
- dify_oapi2-0.1.0/dify_oapi/api/chat/v1/model/message_history_request.py +48 -0
- dify_oapi2-0.1.0/dify_oapi/api/chat/v1/model/message_history_response.py +49 -0
- dify_oapi2-0.1.0/dify_oapi/api/chat/v1/model/message_suggested_request.py +36 -0
- dify_oapi2-0.1.0/dify_oapi/api/chat/v1/model/message_suggested_response.py +6 -0
- dify_oapi2-0.1.0/dify_oapi/api/chat/v1/model/rename_conversation_request.py +38 -0
- dify_oapi2-0.1.0/dify_oapi/api/chat/v1/model/rename_conversation_request_body.py +33 -0
- dify_oapi2-0.1.0/dify_oapi/api/chat/v1/model/rename_conversation_response.py +11 -0
- dify_oapi2-0.1.0/dify_oapi/api/chat/v1/model/stop_chat_request.py +38 -0
- dify_oapi2-0.1.0/dify_oapi/api/chat/v1/model/stop_chat_request_body.py +23 -0
- dify_oapi2-0.1.0/dify_oapi/api/chat/v1/model/stop_chat_response.py +5 -0
- dify_oapi2-0.1.0/dify_oapi/api/chat/v1/resource/__init__.py +4 -0
- dify_oapi2-0.1.0/dify_oapi/api/chat/v1/resource/audio.py +17 -0
- dify_oapi2-0.1.0/dify_oapi/api/chat/v1/resource/chat.py +68 -0
- dify_oapi2-0.1.0/dify_oapi/api/chat/v1/resource/conversation.py +59 -0
- dify_oapi2-0.1.0/dify_oapi/api/chat/v1/resource/message.py +35 -0
- dify_oapi2-0.1.0/dify_oapi/api/chat/v1/version.py +11 -0
- dify_oapi2-0.1.0/dify_oapi/api/completion/__init__.py +0 -0
- dify_oapi2-0.1.0/dify_oapi/api/completion/service.py +8 -0
- dify_oapi2-0.1.0/dify_oapi/api/completion/v1/__init__.py +0 -0
- dify_oapi2-0.1.0/dify_oapi/api/completion/v1/model/__init__.py +0 -0
- dify_oapi2-0.1.0/dify_oapi/api/completion/v1/model/completion_request.py +34 -0
- dify_oapi2-0.1.0/dify_oapi/api/completion/v1/model/completion_request_body.py +43 -0
- dify_oapi2-0.1.0/dify_oapi/api/completion/v1/model/completion_request_body_input.py +38 -0
- dify_oapi2-0.1.0/dify_oapi/api/completion/v1/model/completion_request_file.py +49 -0
- dify_oapi2-0.1.0/dify_oapi/api/completion/v1/model/completion_response.py +18 -0
- dify_oapi2-0.1.0/dify_oapi/api/completion/v1/model/stop_completion_request.py +38 -0
- dify_oapi2-0.1.0/dify_oapi/api/completion/v1/model/stop_completion_request_body.py +23 -0
- dify_oapi2-0.1.0/dify_oapi/api/completion/v1/model/stop_completion_response.py +5 -0
- dify_oapi2-0.1.0/dify_oapi/api/completion/v1/resource/__init__.py +1 -0
- dify_oapi2-0.1.0/dify_oapi/api/completion/v1/resource/completion.py +84 -0
- dify_oapi2-0.1.0/dify_oapi/api/completion/v1/version.py +8 -0
- dify_oapi2-0.1.0/dify_oapi/api/dify/__init__.py +0 -0
- dify_oapi2-0.1.0/dify_oapi/api/dify/service.py +8 -0
- dify_oapi2-0.1.0/dify_oapi/api/dify/v1/__init__.py +0 -0
- dify_oapi2-0.1.0/dify_oapi/api/dify/v1/model/__init__.py +0 -0
- dify_oapi2-0.1.0/dify_oapi/api/dify/v1/model/get_info_request.py +30 -0
- dify_oapi2-0.1.0/dify_oapi/api/dify/v1/model/get_info_response.py +7 -0
- dify_oapi2-0.1.0/dify_oapi/api/dify/v1/model/get_meta_request.py +30 -0
- dify_oapi2-0.1.0/dify_oapi/api/dify/v1/model/get_meta_response.py +19 -0
- dify_oapi2-0.1.0/dify_oapi/api/dify/v1/model/get_parameter_request.py +30 -0
- dify_oapi2-0.1.0/dify_oapi/api/dify/v1/model/get_parameter_response.py +13 -0
- dify_oapi2-0.1.0/dify_oapi/api/dify/v1/model/message_feedback_request.py +38 -0
- dify_oapi2-0.1.0/dify_oapi/api/dify/v1/model/message_feedback_request_body.py +30 -0
- dify_oapi2-0.1.0/dify_oapi/api/dify/v1/model/message_feedback_response.py +5 -0
- dify_oapi2-0.1.0/dify_oapi/api/dify/v1/model/text_to_audio_request.py +32 -0
- dify_oapi2-0.1.0/dify_oapi/api/dify/v1/model/text_to_audio_request_body.py +33 -0
- dify_oapi2-0.1.0/dify_oapi/api/dify/v1/model/text_to_audio_response.py +4 -0
- dify_oapi2-0.1.0/dify_oapi/api/dify/v1/model/upload_file_body.py +23 -0
- dify_oapi2-0.1.0/dify_oapi/api/dify/v1/model/upload_file_request.py +42 -0
- dify_oapi2-0.1.0/dify_oapi/api/dify/v1/model/upload_file_response.py +11 -0
- dify_oapi2-0.1.0/dify_oapi/api/dify/v1/resource/__init__.py +6 -0
- dify_oapi2-0.1.0/dify_oapi/api/dify/v1/resource/audio.py +17 -0
- dify_oapi2-0.1.0/dify_oapi/api/dify/v1/resource/file.py +17 -0
- dify_oapi2-0.1.0/dify_oapi/api/dify/v1/resource/info.py +19 -0
- dify_oapi2-0.1.0/dify_oapi/api/dify/v1/resource/message.py +21 -0
- dify_oapi2-0.1.0/dify_oapi/api/dify/v1/resource/meta.py +17 -0
- dify_oapi2-0.1.0/dify_oapi/api/dify/v1/resource/parameter.py +19 -0
- dify_oapi2-0.1.0/dify_oapi/api/dify/v1/version.py +13 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/__init__.py +0 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/service.py +8 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/__init__.py +0 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/__init__.py +0 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/dataset/__init__.py +49 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/dataset/create_request.py +32 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/dataset/create_request_body.py +73 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/dataset/create_response.py +11 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/dataset/dataset_info.py +150 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/dataset/delete_request.py +30 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/dataset/delete_response.py +9 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/dataset/external_knowledge_info.py +38 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/dataset/filter_condition.py +72 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/dataset/get_request.py +30 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/dataset/get_response.py +11 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/dataset/list_request.py +45 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/dataset/list_response.py +13 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/dataset/metadata_filtering_conditions.py +30 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/dataset/reranking_model.py +28 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/dataset/retrieval_model.py +147 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/dataset/retrieve_request.py +38 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/dataset/retrieve_request_body.py +38 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/dataset/retrieve_response.py +53 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/dataset/update_request.py +38 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/dataset/update_request_body.py +58 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/dataset/update_response.py +11 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/__init__.py +0 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/create_by_file_request.py +53 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/create_by_file_request_body.py +31 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/create_by_file_request_body_data.py +78 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/create_by_file_response.py +12 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/create_by_text_request.py +38 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/create_by_text_request_body.py +80 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/create_by_text_response.py +12 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/data_source_info.py +30 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/delete_request.py +38 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/delete_response.py +9 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/document_info.py +164 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/get_request.py +40 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/get_response.py +9 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/get_upload_file_request.py +38 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/get_upload_file_response.py +11 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/indexing_status_info.py +80 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/indexing_status_request.py +36 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/indexing_status_response.py +11 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/list_request.py +42 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/list_response.py +15 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/pre_processing_rule.py +32 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/process_rule.py +34 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/retrieval_model.py +54 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/rules.py +31 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/segmentation.py +35 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/subchunk_segmentation.py +35 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/update_by_file_request.py +53 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/update_by_file_request_body.py +26 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/update_by_file_request_body_data.py +40 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/update_by_file_response.py +12 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/update_by_text_request.py +55 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/update_by_text_request_body.py +46 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/update_by_text_response.py +14 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/update_status_request.py +55 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/update_status_request_body.py +32 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/update_status_response.py +9 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/document/upload_file_info.py +65 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/metadata/__init__.py +35 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/metadata/create_request.py +38 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/metadata/create_request_body.py +31 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/metadata/create_response.py +13 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/metadata/delete_request.py +36 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/metadata/delete_response.py +7 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/metadata/list_request.py +30 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/metadata/list_response.py +9 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/metadata/metadata_info.py +38 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/metadata/toggle_builtin_request.py +36 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/metadata/toggle_builtin_response.py +7 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/metadata/update_document_request.py +38 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/metadata/update_document_request_body.py +79 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/metadata/update_document_response.py +7 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/metadata/update_request.py +44 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/metadata/update_request_body.py +24 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/metadata/update_response.py +13 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/segment/__init__.py +77 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/segment/child_chunk_info.py +88 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/segment/create_child_chunk_request.py +52 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/segment/create_child_chunk_request_body.py +23 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/segment/create_child_chunk_response.py +7 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/segment/create_request.py +42 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/segment/create_request_body.py +25 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/segment/create_response.py +8 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/segment/delete_child_chunk_request.py +50 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/segment/delete_child_chunk_response.py +5 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/segment/delete_request.py +40 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/segment/delete_response.py +5 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/segment/get_request.py +40 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/segment/get_response.py +8 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/segment/list_child_chunks_request.py +56 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/segment/list_child_chunks_response.py +11 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/segment/list_request.py +50 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/segment/list_response.py +12 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/segment/segment_data.py +43 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/segment/segment_info.py +123 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/segment/update_child_chunk_request.py +58 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/segment/update_child_chunk_request_body.py +23 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/segment/update_child_chunk_response.py +7 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/segment/update_request.py +48 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/segment/update_request_body.py +25 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/segment/update_response.py +8 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/tag/__init__.py +41 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/tag/bind_request.py +32 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/tag/bind_request_body.py +29 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/tag/bind_response.py +7 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/tag/create_request.py +32 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/tag/create_request_body.py +24 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/tag/create_response.py +16 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/tag/delete_request.py +32 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/tag/delete_request_body.py +24 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/tag/delete_response.py +7 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/tag/list_request.py +24 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/tag/list_response.py +19 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/tag/query_bound_request.py +30 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/tag/query_bound_response.py +9 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/tag/tag_info.py +38 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/tag/unbind_request.py +32 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/tag/unbind_request_body.py +29 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/tag/unbind_response.py +7 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/tag/update_request.py +32 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/tag/update_request_body.py +29 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/model/tag/update_response.py +19 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/resource/__init__.py +7 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/resource/dataset.py +58 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/resource/document.py +107 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/resource/metadata.py +65 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/resource/segment.py +110 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/resource/tag.py +65 -0
- dify_oapi2-0.1.0/dify_oapi/api/knowledge_base/v1/version.py +12 -0
- dify_oapi2-0.1.0/dify_oapi/api/workflow/__init__.py +0 -0
- dify_oapi2-0.1.0/dify_oapi/api/workflow/service.py +8 -0
- dify_oapi2-0.1.0/dify_oapi/api/workflow/v1/__init__.py +0 -0
- dify_oapi2-0.1.0/dify_oapi/api/workflow/v1/model/__init__.py +0 -0
- dify_oapi2-0.1.0/dify_oapi/api/workflow/v1/model/get_workflow_log_request.py +50 -0
- dify_oapi2-0.1.0/dify_oapi/api/workflow/v1/model/get_workflow_log_response.py +42 -0
- dify_oapi2-0.1.0/dify_oapi/api/workflow/v1/model/get_workflow_result_request.py +30 -0
- dify_oapi2-0.1.0/dify_oapi/api/workflow/v1/model/get_workflow_result_response.py +17 -0
- dify_oapi2-0.1.0/dify_oapi/api/workflow/v1/model/run_workflow_request.py +32 -0
- dify_oapi2-0.1.0/dify_oapi/api/workflow/v1/model/run_workflow_request_body.py +42 -0
- dify_oapi2-0.1.0/dify_oapi/api/workflow/v1/model/run_workflow_request_file.py +50 -0
- dify_oapi2-0.1.0/dify_oapi/api/workflow/v1/model/run_workflow_response.py +24 -0
- dify_oapi2-0.1.0/dify_oapi/api/workflow/v1/model/stop_workflow_request.py +38 -0
- dify_oapi2-0.1.0/dify_oapi/api/workflow/v1/model/stop_workflow_request_body.py +23 -0
- dify_oapi2-0.1.0/dify_oapi/api/workflow/v1/model/stop_workflow_response.py +5 -0
- dify_oapi2-0.1.0/dify_oapi/api/workflow/v1/resource/__init__.py +1 -0
- dify_oapi2-0.1.0/dify_oapi/api/workflow/v1/resource/workflow.py +102 -0
- dify_oapi2-0.1.0/dify_oapi/api/workflow/v1/version.py +8 -0
- dify_oapi2-0.1.0/dify_oapi/client.py +97 -0
- dify_oapi2-0.1.0/dify_oapi/core/__init__.py +0 -0
- dify_oapi2-0.1.0/dify_oapi/core/const.py +15 -0
- dify_oapi2-0.1.0/dify_oapi/core/enum.py +21 -0
- dify_oapi2-0.1.0/dify_oapi/core/http/__init__.py +0 -0
- dify_oapi2-0.1.0/dify_oapi/core/http/transport/__init__.py +4 -0
- dify_oapi2-0.1.0/dify_oapi/core/http/transport/_misc.py +145 -0
- dify_oapi2-0.1.0/dify_oapi/core/http/transport/async_transport.py +217 -0
- dify_oapi2-0.1.0/dify_oapi/core/http/transport/sync_transport.py +220 -0
- dify_oapi2-0.1.0/dify_oapi/core/json.py +61 -0
- dify_oapi2-0.1.0/dify_oapi/core/log.py +8 -0
- dify_oapi2-0.1.0/dify_oapi/core/misc.py +41 -0
- dify_oapi2-0.1.0/dify_oapi/core/model/__init__.py +0 -0
- dify_oapi2-0.1.0/dify_oapi/core/model/base_request.py +21 -0
- dify_oapi2-0.1.0/dify_oapi/core/model/base_response.py +27 -0
- dify_oapi2-0.1.0/dify_oapi/core/model/config.py +9 -0
- dify_oapi2-0.1.0/dify_oapi/core/model/raw_request.py +5 -0
- dify_oapi2-0.1.0/dify_oapi/core/model/raw_response.py +17 -0
- dify_oapi2-0.1.0/dify_oapi/core/model/request_option.py +27 -0
- dify_oapi2-0.1.0/dify_oapi/core/type.py +5 -0
- dify_oapi2-0.1.0/dify_oapi/core/utils/__init__.py +0 -0
- dify_oapi2-0.1.0/dify_oapi/core/utils/strings.py +8 -0
- dify_oapi2-0.1.0/pyproject.toml +168 -0
dify_oapi2-0.1.0/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2023 LangGenius
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
@@ -0,0 +1,295 @@
|
|
1
|
+
Metadata-Version: 2.3
|
2
|
+
Name: dify-oapi2
|
3
|
+
Version: 0.1.0
|
4
|
+
Summary: A package for interacting with the Dify Service-API
|
5
|
+
License: MIT
|
6
|
+
Keywords: dify,nlp,ai,language-processing
|
7
|
+
Author: Oscaner Miao
|
8
|
+
Author-email: oscaner1997@163.com
|
9
|
+
Requires-Python: >=3.10
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
16
|
+
Requires-Dist: httpx (>=0.24,<1.0)
|
17
|
+
Requires-Dist: pydantic (>=1.10,<3.0.0)
|
18
|
+
Project-URL: Homepage, https://github.com/nodite/dify-oapi2
|
19
|
+
Project-URL: Source, https://github.com/nodite/dify-oapi2
|
20
|
+
Description-Content-Type: text/markdown
|
21
|
+
|
22
|
+
# Dify-OAPI
|
23
|
+
|
24
|
+
[](https://badge.fury.io/py/dify-oapi2)
|
25
|
+
[](https://www.python.org/downloads/)
|
26
|
+
[](https://opensource.org/licenses/MIT)
|
27
|
+
|
28
|
+
A Python SDK for interacting with the Dify Service-API. This library provides a fluent, type-safe interface for building AI-powered applications using Dify's API services including chat, completion, knowledge base, and workflow features.
|
29
|
+
|
30
|
+
> This project is based on https://github.com/QiMington/dify-oapi, with refactoring and support for the latest Dify API.
|
31
|
+
|
32
|
+
## ✨ Features
|
33
|
+
|
34
|
+
- **Multiple API Services**: Chat, Completion, Knowledge Base (39 APIs), Workflow, and Core Dify APIs
|
35
|
+
- **Builder Pattern**: Fluent, chainable interface for constructing requests
|
36
|
+
- **Sync & Async Support**: Both synchronous and asynchronous operations
|
37
|
+
- **Streaming Responses**: Real-time streaming for chat and completion
|
38
|
+
- **Type Safety**: Comprehensive type hints with Pydantic validation
|
39
|
+
- **File Upload**: Support for images and documents
|
40
|
+
- **Modern HTTP Client**: Built on httpx for reliable API communication
|
41
|
+
|
42
|
+
## 📦 Installation
|
43
|
+
|
44
|
+
```bash
|
45
|
+
pip install dify-oapi2
|
46
|
+
```
|
47
|
+
|
48
|
+
**Requirements**: Python 3.10+
|
49
|
+
|
50
|
+
**Dependencies**:
|
51
|
+
- `pydantic` (>=1.10,<3.0.0) - Data validation and settings management
|
52
|
+
- `httpx` (>=0.24,<1.0) - Modern HTTP client
|
53
|
+
|
54
|
+
## 🚀 Quick Start
|
55
|
+
|
56
|
+
### Basic Chat Example
|
57
|
+
|
58
|
+
```python
|
59
|
+
from dify_oapi.api.chat.v1.model.chat_request import ChatRequest
|
60
|
+
from dify_oapi.api.chat.v1.model.chat_request_body import ChatRequestBody
|
61
|
+
from dify_oapi.client import Client
|
62
|
+
from dify_oapi.core.model.request_option import RequestOption
|
63
|
+
|
64
|
+
# Initialize client
|
65
|
+
client = Client.builder().domain("https://api.dify.ai").build()
|
66
|
+
|
67
|
+
# Build request
|
68
|
+
req_body = (
|
69
|
+
ChatRequestBody.builder()
|
70
|
+
.inputs({})
|
71
|
+
.query("What can Dify API do?")
|
72
|
+
.response_mode("blocking")
|
73
|
+
.user("user-123")
|
74
|
+
.build()
|
75
|
+
)
|
76
|
+
|
77
|
+
req = ChatRequest.builder().request_body(req_body).build()
|
78
|
+
req_option = RequestOption.builder().api_key("your-api-key").build()
|
79
|
+
|
80
|
+
# Execute request
|
81
|
+
response = client.chat.v1.chat.chat(req, req_option, False)
|
82
|
+
print(response.answer)
|
83
|
+
```
|
84
|
+
|
85
|
+
### Streaming Chat Example
|
86
|
+
|
87
|
+
```python
|
88
|
+
# Enable streaming for real-time responses
|
89
|
+
req_body = (
|
90
|
+
ChatRequestBody.builder()
|
91
|
+
.query("Tell me a story")
|
92
|
+
.response_mode("streaming")
|
93
|
+
.user("user-123")
|
94
|
+
.build()
|
95
|
+
)
|
96
|
+
|
97
|
+
req = ChatRequest.builder().request_body(req_body).build()
|
98
|
+
response = client.chat.v1.chat.chat(req, req_option, True)
|
99
|
+
|
100
|
+
# Process streaming response
|
101
|
+
for chunk in response:
|
102
|
+
print(chunk, end="", flush=True)
|
103
|
+
```
|
104
|
+
|
105
|
+
### Async Support
|
106
|
+
|
107
|
+
```python
|
108
|
+
import asyncio
|
109
|
+
|
110
|
+
async def async_chat():
|
111
|
+
response = await client.chat.v1.chat.achat(req, req_option, False)
|
112
|
+
print(response.answer)
|
113
|
+
|
114
|
+
asyncio.run(async_chat())
|
115
|
+
```
|
116
|
+
|
117
|
+
## 🔧 API Services
|
118
|
+
|
119
|
+
### Chat API
|
120
|
+
- Interactive conversations with AI assistants
|
121
|
+
- File upload support (images, documents)
|
122
|
+
- Conversation and message history management
|
123
|
+
- Streaming and blocking response modes
|
124
|
+
|
125
|
+
### Completion API
|
126
|
+
- Text generation and completion
|
127
|
+
- Custom input parameters
|
128
|
+
- Streaming support
|
129
|
+
|
130
|
+
### Knowledge Base API (39 APIs)
|
131
|
+
- **Dataset Management**: CRUD operations for datasets
|
132
|
+
- **Document Management**: Upload, process, and manage documents
|
133
|
+
- **Segment Management**: Fine-grained content segmentation
|
134
|
+
- **Metadata & Tags**: Custom metadata and knowledge type tags
|
135
|
+
- **Retrieval**: Advanced search and retrieval functionality
|
136
|
+
|
137
|
+
### Workflow API
|
138
|
+
- Automated workflow execution
|
139
|
+
- Parameter configuration
|
140
|
+
- Status monitoring
|
141
|
+
|
142
|
+
### Dify Core API
|
143
|
+
- Essential Dify service functionality
|
144
|
+
|
145
|
+
## 💡 Examples
|
146
|
+
|
147
|
+
Explore comprehensive examples in the [examples directory](./examples):
|
148
|
+
|
149
|
+
### Chat Examples
|
150
|
+
- [**Blocking Response**](./examples/chat/blocking_response.py) - Standard chat interactions
|
151
|
+
- [**Streaming Response**](./examples/chat/streaming_response.py) - Real-time streaming chat
|
152
|
+
- [**Conversation Management**](./examples/chat/conversation_management.py) - Managing chat history
|
153
|
+
|
154
|
+
### Completion Examples
|
155
|
+
- [**Basic Completion**](./examples/completion/basic_completion.py) - Text generation
|
156
|
+
|
157
|
+
### Knowledge Base Examples
|
158
|
+
- [**List Datasets**](./examples/knowledge_base/list_datasets.py) - Dataset management
|
159
|
+
|
160
|
+
For detailed examples and usage patterns, see the [examples README](./examples/README.md).
|
161
|
+
|
162
|
+
## 🛠️ Development
|
163
|
+
|
164
|
+
### Prerequisites
|
165
|
+
- Python 3.10+
|
166
|
+
- Poetry
|
167
|
+
|
168
|
+
### Setup
|
169
|
+
|
170
|
+
```bash
|
171
|
+
# Clone repository
|
172
|
+
git clone https://github.com/nodite/dify-oapi2.git
|
173
|
+
cd dify-oapi
|
174
|
+
|
175
|
+
# Setup development environment (installs dependencies and pre-commit hooks)
|
176
|
+
make dev-setup
|
177
|
+
```
|
178
|
+
|
179
|
+
### Code Quality Tools
|
180
|
+
|
181
|
+
This project uses modern Python tooling:
|
182
|
+
|
183
|
+
- **Ruff**: Fast Python linter and formatter
|
184
|
+
- **MyPy**: Static type checking
|
185
|
+
- **Pre-commit**: Git hooks for code quality
|
186
|
+
- **Pylint**: Additional code analysis
|
187
|
+
|
188
|
+
```bash
|
189
|
+
# Format code
|
190
|
+
make format
|
191
|
+
|
192
|
+
# Lint code
|
193
|
+
make lint
|
194
|
+
|
195
|
+
# Fix linting issues
|
196
|
+
make fix
|
197
|
+
|
198
|
+
# Run all checks (lint + type check)
|
199
|
+
make check
|
200
|
+
|
201
|
+
# Install pre-commit hooks
|
202
|
+
make install-hooks
|
203
|
+
|
204
|
+
# Run pre-commit hooks manually
|
205
|
+
make pre-commit
|
206
|
+
```
|
207
|
+
|
208
|
+
### Testing
|
209
|
+
|
210
|
+
```bash
|
211
|
+
# Set environment variables
|
212
|
+
export DOMAIN="https://api.dify.ai"
|
213
|
+
export CHAT_KEY="your-api-key"
|
214
|
+
|
215
|
+
# Run tests
|
216
|
+
make test
|
217
|
+
|
218
|
+
# Run tests with coverage
|
219
|
+
make test-cov
|
220
|
+
```
|
221
|
+
|
222
|
+
### Build & Publish
|
223
|
+
|
224
|
+
```bash
|
225
|
+
# Configure PyPI tokens (one-time setup)
|
226
|
+
poetry config http-basic.testpypi __token__ <your-testpypi-token>
|
227
|
+
poetry config http-basic.pypi __token__ <your-pypi-token>
|
228
|
+
|
229
|
+
# Build package
|
230
|
+
make build
|
231
|
+
|
232
|
+
# Publish to TestPyPI (for testing)
|
233
|
+
make publish-test
|
234
|
+
|
235
|
+
# Publish to PyPI (maintainers only)
|
236
|
+
make publish
|
237
|
+
```
|
238
|
+
|
239
|
+
### Project Structure
|
240
|
+
|
241
|
+
```
|
242
|
+
dify-oapi/
|
243
|
+
├── dify_oapi/ # Main SDK package
|
244
|
+
│ ├── api/ # API service modules
|
245
|
+
│ │ ├── chat/ # Chat API
|
246
|
+
│ │ ├── completion/ # Completion API
|
247
|
+
│ │ ├── dify/ # Core Dify API
|
248
|
+
│ │ ├── knowledge_base/ # Knowledge Base API (39 APIs)
|
249
|
+
│ │ └── workflow/ # Workflow API
|
250
|
+
│ ├── core/ # Core functionality
|
251
|
+
│ │ ├── http/ # HTTP transport layer
|
252
|
+
│ │ ├── model/ # Base models
|
253
|
+
│ │ └── utils/ # Utilities
|
254
|
+
│ └── client.py # Main client interface
|
255
|
+
├── docs/ # Documentation
|
256
|
+
├── examples/ # Usage examples
|
257
|
+
├── tests/ # Test suite
|
258
|
+
└── pyproject.toml # Project configuration
|
259
|
+
```
|
260
|
+
|
261
|
+
## 📖 Documentation
|
262
|
+
|
263
|
+
- [**Project Overview**](./docs/overview.md) - Architecture and technical details
|
264
|
+
- [**Knowledge Base APIs**](./docs/datasets/apis.md) - Complete dataset API documentation
|
265
|
+
- [**Examples**](./examples/README.md) - Usage examples and patterns
|
266
|
+
|
267
|
+
## 🤝 Contributing
|
268
|
+
|
269
|
+
Contributions are welcome! Please:
|
270
|
+
|
271
|
+
1. Fork the repository
|
272
|
+
2. Create a feature branch
|
273
|
+
3. Make your changes with tests
|
274
|
+
4. Ensure code quality (`ruff format`, `ruff check`, `mypy`)
|
275
|
+
5. Submit a pull request
|
276
|
+
|
277
|
+
## 📄 License
|
278
|
+
|
279
|
+
This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.
|
280
|
+
|
281
|
+
## 🔗 Links
|
282
|
+
|
283
|
+
- **PyPI Package**: https://pypi.org/project/dify-oapi2/
|
284
|
+
- **Source Code**: https://github.com/nodite/dify-oapi2
|
285
|
+
- **Dify Platform**: https://dify.ai/
|
286
|
+
- **Dify API Docs**: https://docs.dify.ai/
|
287
|
+
|
288
|
+
## 📄 License
|
289
|
+
|
290
|
+
MIT License - see [LICENSE](./LICENSE) file for details.
|
291
|
+
|
292
|
+
---
|
293
|
+
|
294
|
+
**Keywords**: dify, nlp, ai, language-processing
|
295
|
+
|
@@ -0,0 +1,273 @@
|
|
1
|
+
# Dify-OAPI
|
2
|
+
|
3
|
+
[](https://badge.fury.io/py/dify-oapi2)
|
4
|
+
[](https://www.python.org/downloads/)
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
6
|
+
|
7
|
+
A Python SDK for interacting with the Dify Service-API. This library provides a fluent, type-safe interface for building AI-powered applications using Dify's API services including chat, completion, knowledge base, and workflow features.
|
8
|
+
|
9
|
+
> This project is based on https://github.com/QiMington/dify-oapi, with refactoring and support for the latest Dify API.
|
10
|
+
|
11
|
+
## ✨ Features
|
12
|
+
|
13
|
+
- **Multiple API Services**: Chat, Completion, Knowledge Base (39 APIs), Workflow, and Core Dify APIs
|
14
|
+
- **Builder Pattern**: Fluent, chainable interface for constructing requests
|
15
|
+
- **Sync & Async Support**: Both synchronous and asynchronous operations
|
16
|
+
- **Streaming Responses**: Real-time streaming for chat and completion
|
17
|
+
- **Type Safety**: Comprehensive type hints with Pydantic validation
|
18
|
+
- **File Upload**: Support for images and documents
|
19
|
+
- **Modern HTTP Client**: Built on httpx for reliable API communication
|
20
|
+
|
21
|
+
## 📦 Installation
|
22
|
+
|
23
|
+
```bash
|
24
|
+
pip install dify-oapi2
|
25
|
+
```
|
26
|
+
|
27
|
+
**Requirements**: Python 3.10+
|
28
|
+
|
29
|
+
**Dependencies**:
|
30
|
+
- `pydantic` (>=1.10,<3.0.0) - Data validation and settings management
|
31
|
+
- `httpx` (>=0.24,<1.0) - Modern HTTP client
|
32
|
+
|
33
|
+
## 🚀 Quick Start
|
34
|
+
|
35
|
+
### Basic Chat Example
|
36
|
+
|
37
|
+
```python
|
38
|
+
from dify_oapi.api.chat.v1.model.chat_request import ChatRequest
|
39
|
+
from dify_oapi.api.chat.v1.model.chat_request_body import ChatRequestBody
|
40
|
+
from dify_oapi.client import Client
|
41
|
+
from dify_oapi.core.model.request_option import RequestOption
|
42
|
+
|
43
|
+
# Initialize client
|
44
|
+
client = Client.builder().domain("https://api.dify.ai").build()
|
45
|
+
|
46
|
+
# Build request
|
47
|
+
req_body = (
|
48
|
+
ChatRequestBody.builder()
|
49
|
+
.inputs({})
|
50
|
+
.query("What can Dify API do?")
|
51
|
+
.response_mode("blocking")
|
52
|
+
.user("user-123")
|
53
|
+
.build()
|
54
|
+
)
|
55
|
+
|
56
|
+
req = ChatRequest.builder().request_body(req_body).build()
|
57
|
+
req_option = RequestOption.builder().api_key("your-api-key").build()
|
58
|
+
|
59
|
+
# Execute request
|
60
|
+
response = client.chat.v1.chat.chat(req, req_option, False)
|
61
|
+
print(response.answer)
|
62
|
+
```
|
63
|
+
|
64
|
+
### Streaming Chat Example
|
65
|
+
|
66
|
+
```python
|
67
|
+
# Enable streaming for real-time responses
|
68
|
+
req_body = (
|
69
|
+
ChatRequestBody.builder()
|
70
|
+
.query("Tell me a story")
|
71
|
+
.response_mode("streaming")
|
72
|
+
.user("user-123")
|
73
|
+
.build()
|
74
|
+
)
|
75
|
+
|
76
|
+
req = ChatRequest.builder().request_body(req_body).build()
|
77
|
+
response = client.chat.v1.chat.chat(req, req_option, True)
|
78
|
+
|
79
|
+
# Process streaming response
|
80
|
+
for chunk in response:
|
81
|
+
print(chunk, end="", flush=True)
|
82
|
+
```
|
83
|
+
|
84
|
+
### Async Support
|
85
|
+
|
86
|
+
```python
|
87
|
+
import asyncio
|
88
|
+
|
89
|
+
async def async_chat():
|
90
|
+
response = await client.chat.v1.chat.achat(req, req_option, False)
|
91
|
+
print(response.answer)
|
92
|
+
|
93
|
+
asyncio.run(async_chat())
|
94
|
+
```
|
95
|
+
|
96
|
+
## 🔧 API Services
|
97
|
+
|
98
|
+
### Chat API
|
99
|
+
- Interactive conversations with AI assistants
|
100
|
+
- File upload support (images, documents)
|
101
|
+
- Conversation and message history management
|
102
|
+
- Streaming and blocking response modes
|
103
|
+
|
104
|
+
### Completion API
|
105
|
+
- Text generation and completion
|
106
|
+
- Custom input parameters
|
107
|
+
- Streaming support
|
108
|
+
|
109
|
+
### Knowledge Base API (39 APIs)
|
110
|
+
- **Dataset Management**: CRUD operations for datasets
|
111
|
+
- **Document Management**: Upload, process, and manage documents
|
112
|
+
- **Segment Management**: Fine-grained content segmentation
|
113
|
+
- **Metadata & Tags**: Custom metadata and knowledge type tags
|
114
|
+
- **Retrieval**: Advanced search and retrieval functionality
|
115
|
+
|
116
|
+
### Workflow API
|
117
|
+
- Automated workflow execution
|
118
|
+
- Parameter configuration
|
119
|
+
- Status monitoring
|
120
|
+
|
121
|
+
### Dify Core API
|
122
|
+
- Essential Dify service functionality
|
123
|
+
|
124
|
+
## 💡 Examples
|
125
|
+
|
126
|
+
Explore comprehensive examples in the [examples directory](./examples):
|
127
|
+
|
128
|
+
### Chat Examples
|
129
|
+
- [**Blocking Response**](./examples/chat/blocking_response.py) - Standard chat interactions
|
130
|
+
- [**Streaming Response**](./examples/chat/streaming_response.py) - Real-time streaming chat
|
131
|
+
- [**Conversation Management**](./examples/chat/conversation_management.py) - Managing chat history
|
132
|
+
|
133
|
+
### Completion Examples
|
134
|
+
- [**Basic Completion**](./examples/completion/basic_completion.py) - Text generation
|
135
|
+
|
136
|
+
### Knowledge Base Examples
|
137
|
+
- [**List Datasets**](./examples/knowledge_base/list_datasets.py) - Dataset management
|
138
|
+
|
139
|
+
For detailed examples and usage patterns, see the [examples README](./examples/README.md).
|
140
|
+
|
141
|
+
## 🛠️ Development
|
142
|
+
|
143
|
+
### Prerequisites
|
144
|
+
- Python 3.10+
|
145
|
+
- Poetry
|
146
|
+
|
147
|
+
### Setup
|
148
|
+
|
149
|
+
```bash
|
150
|
+
# Clone repository
|
151
|
+
git clone https://github.com/nodite/dify-oapi2.git
|
152
|
+
cd dify-oapi
|
153
|
+
|
154
|
+
# Setup development environment (installs dependencies and pre-commit hooks)
|
155
|
+
make dev-setup
|
156
|
+
```
|
157
|
+
|
158
|
+
### Code Quality Tools
|
159
|
+
|
160
|
+
This project uses modern Python tooling:
|
161
|
+
|
162
|
+
- **Ruff**: Fast Python linter and formatter
|
163
|
+
- **MyPy**: Static type checking
|
164
|
+
- **Pre-commit**: Git hooks for code quality
|
165
|
+
- **Pylint**: Additional code analysis
|
166
|
+
|
167
|
+
```bash
|
168
|
+
# Format code
|
169
|
+
make format
|
170
|
+
|
171
|
+
# Lint code
|
172
|
+
make lint
|
173
|
+
|
174
|
+
# Fix linting issues
|
175
|
+
make fix
|
176
|
+
|
177
|
+
# Run all checks (lint + type check)
|
178
|
+
make check
|
179
|
+
|
180
|
+
# Install pre-commit hooks
|
181
|
+
make install-hooks
|
182
|
+
|
183
|
+
# Run pre-commit hooks manually
|
184
|
+
make pre-commit
|
185
|
+
```
|
186
|
+
|
187
|
+
### Testing
|
188
|
+
|
189
|
+
```bash
|
190
|
+
# Set environment variables
|
191
|
+
export DOMAIN="https://api.dify.ai"
|
192
|
+
export CHAT_KEY="your-api-key"
|
193
|
+
|
194
|
+
# Run tests
|
195
|
+
make test
|
196
|
+
|
197
|
+
# Run tests with coverage
|
198
|
+
make test-cov
|
199
|
+
```
|
200
|
+
|
201
|
+
### Build & Publish
|
202
|
+
|
203
|
+
```bash
|
204
|
+
# Configure PyPI tokens (one-time setup)
|
205
|
+
poetry config http-basic.testpypi __token__ <your-testpypi-token>
|
206
|
+
poetry config http-basic.pypi __token__ <your-pypi-token>
|
207
|
+
|
208
|
+
# Build package
|
209
|
+
make build
|
210
|
+
|
211
|
+
# Publish to TestPyPI (for testing)
|
212
|
+
make publish-test
|
213
|
+
|
214
|
+
# Publish to PyPI (maintainers only)
|
215
|
+
make publish
|
216
|
+
```
|
217
|
+
|
218
|
+
### Project Structure
|
219
|
+
|
220
|
+
```
|
221
|
+
dify-oapi/
|
222
|
+
├── dify_oapi/ # Main SDK package
|
223
|
+
│ ├── api/ # API service modules
|
224
|
+
│ │ ├── chat/ # Chat API
|
225
|
+
│ │ ├── completion/ # Completion API
|
226
|
+
│ │ ├── dify/ # Core Dify API
|
227
|
+
│ │ ├── knowledge_base/ # Knowledge Base API (39 APIs)
|
228
|
+
│ │ └── workflow/ # Workflow API
|
229
|
+
│ ├── core/ # Core functionality
|
230
|
+
│ │ ├── http/ # HTTP transport layer
|
231
|
+
│ │ ├── model/ # Base models
|
232
|
+
│ │ └── utils/ # Utilities
|
233
|
+
│ └── client.py # Main client interface
|
234
|
+
├── docs/ # Documentation
|
235
|
+
├── examples/ # Usage examples
|
236
|
+
├── tests/ # Test suite
|
237
|
+
└── pyproject.toml # Project configuration
|
238
|
+
```
|
239
|
+
|
240
|
+
## 📖 Documentation
|
241
|
+
|
242
|
+
- [**Project Overview**](./docs/overview.md) - Architecture and technical details
|
243
|
+
- [**Knowledge Base APIs**](./docs/datasets/apis.md) - Complete dataset API documentation
|
244
|
+
- [**Examples**](./examples/README.md) - Usage examples and patterns
|
245
|
+
|
246
|
+
## 🤝 Contributing
|
247
|
+
|
248
|
+
Contributions are welcome! Please:
|
249
|
+
|
250
|
+
1. Fork the repository
|
251
|
+
2. Create a feature branch
|
252
|
+
3. Make your changes with tests
|
253
|
+
4. Ensure code quality (`ruff format`, `ruff check`, `mypy`)
|
254
|
+
5. Submit a pull request
|
255
|
+
|
256
|
+
## 📄 License
|
257
|
+
|
258
|
+
This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.
|
259
|
+
|
260
|
+
## 🔗 Links
|
261
|
+
|
262
|
+
- **PyPI Package**: https://pypi.org/project/dify-oapi2/
|
263
|
+
- **Source Code**: https://github.com/nodite/dify-oapi2
|
264
|
+
- **Dify Platform**: https://dify.ai/
|
265
|
+
- **Dify API Docs**: https://docs.dify.ai/
|
266
|
+
|
267
|
+
## 📄 License
|
268
|
+
|
269
|
+
MIT License - see [LICENSE](./LICENSE) file for details.
|
270
|
+
|
271
|
+
---
|
272
|
+
|
273
|
+
**Keywords**: dify, nlp, ai, language-processing
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,40 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from io import BytesIO
|
4
|
+
|
5
|
+
from dify_oapi.core.enum import HttpMethod
|
6
|
+
from dify_oapi.core.model.base_request import BaseRequest
|
7
|
+
|
8
|
+
from .audio_to_text_request_body import AudioToTextRequestBody
|
9
|
+
|
10
|
+
|
11
|
+
class AudioToTextRequest(BaseRequest):
|
12
|
+
def __init__(self):
|
13
|
+
super().__init__()
|
14
|
+
self.file: BytesIO | None = None
|
15
|
+
self.request_body: AudioToTextRequestBody | None = None
|
16
|
+
|
17
|
+
@staticmethod
|
18
|
+
def builder() -> AudioToTextRequestBuilder:
|
19
|
+
return AudioToTextRequestBuilder()
|
20
|
+
|
21
|
+
|
22
|
+
class AudioToTextRequestBuilder:
|
23
|
+
def __init__(self):
|
24
|
+
audio_to_text_request = AudioToTextRequest()
|
25
|
+
audio_to_text_request.http_method = HttpMethod.POST
|
26
|
+
audio_to_text_request.uri = "/v1/audio-to-text"
|
27
|
+
self._audio_to_text_request = audio_to_text_request
|
28
|
+
|
29
|
+
def build(self) -> AudioToTextRequest:
|
30
|
+
return self._audio_to_text_request
|
31
|
+
|
32
|
+
def request_body(self, request_body: AudioToTextRequestBody) -> AudioToTextRequestBuilder:
|
33
|
+
self._audio_to_text_request.request_body = request_body
|
34
|
+
self._audio_to_text_request.body = request_body.model_dump(exclude_none=True, mode="json")
|
35
|
+
return self
|
36
|
+
|
37
|
+
def file(self, file: BytesIO, file_name: str) -> AudioToTextRequestBuilder:
|
38
|
+
self._audio_to_text_request.file = file
|
39
|
+
self._audio_to_text_request.files = {"file": (file_name, file)}
|
40
|
+
return self
|
@@ -0,0 +1,23 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from pydantic import BaseModel
|
4
|
+
|
5
|
+
|
6
|
+
class AudioToTextRequestBody(BaseModel):
|
7
|
+
user: str | None = None
|
8
|
+
|
9
|
+
@staticmethod
|
10
|
+
def builder() -> AudioToTextRequestBodyBuilder:
|
11
|
+
return AudioToTextRequestBodyBuilder()
|
12
|
+
|
13
|
+
|
14
|
+
class AudioToTextRequestBodyBuilder:
|
15
|
+
def __init__(self):
|
16
|
+
self._audio_to_text_request_body = AudioToTextRequestBody()
|
17
|
+
|
18
|
+
def build(self) -> AudioToTextRequestBody:
|
19
|
+
return self._audio_to_text_request_body
|
20
|
+
|
21
|
+
def user(self, user: str) -> AudioToTextRequestBodyBuilder:
|
22
|
+
self._audio_to_text_request_body.user = user
|
23
|
+
return self
|