dify-oapi2 0.5.0__py3-none-any.whl → 1.0.1__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 +137 -37
- dify_oapi/api/chat/v1/model/chat_response.py +1 -0
- dify_oapi/api/chat/v1/model/configure_annotation_reply_request.py +1 -0
- dify_oapi/api/chat/v1/model/create_annotation_request.py +1 -0
- dify_oapi/api/chat/v1/model/get_conversation_list_request.py +10 -10
- dify_oapi/api/chat/v1/model/get_conversations_request.py +49 -0
- dify_oapi/api/chat/v1/model/update_annotation_request.py +1 -0
- dify_oapi/api/chat/v1/resource/__init__.py +1 -8
- dify_oapi/api/chat/v1/resource/annotation.py +37 -27
- dify_oapi/api/chat/v1/resource/chat.py +37 -29
- dify_oapi/api/chat/v1/resource/conversation.py +26 -58
- dify_oapi/api/chat/v1/resource/message.py +13 -15
- dify_oapi/api/chat/v1/version.py +18 -11
- dify_oapi/api/chatflow/service.py +1 -18
- dify_oapi/api/chatflow/v1/model/__init__.py +135 -0
- dify_oapi/api/chatflow/v1/model/send_chat_message_request_body.py +4 -1
- dify_oapi/api/chatflow/v1/resource/annotation.py +14 -49
- dify_oapi/api/chatflow/v1/resource/chatflow.py +6 -19
- dify_oapi/api/chatflow/v1/resource/conversation.py +12 -41
- dify_oapi/api/chatflow/v1/version.py +11 -18
- dify_oapi/api/completion/v1/model/__init__.py +62 -0
- dify_oapi/api/completion/v1/model/annotation/__init__.py +40 -0
- dify_oapi/api/completion/v1/model/completion/__init__.py +22 -0
- dify_oapi/api/completion/v1/resource/__init__.py +0 -6
- dify_oapi/api/completion/v1/version.py +8 -6
- dify_oapi/api/dify/v1/model/__init__.py +38 -0
- dify_oapi/api/dify/v1/model/get_feedbacks_response.py +26 -0
- dify_oapi/api/{completion/v1/model/info → dify/v1/model}/get_parameters_request.py +4 -0
- dify_oapi/api/dify/v1/model/{get_parameter_response.py → get_parameters_response.py} +6 -2
- dify_oapi/api/dify/v1/model/get_site_response.py +17 -0
- dify_oapi/api/{chat → dify}/v1/model/submit_feedback_request_body.py +3 -1
- dify_oapi/api/{chat → dify}/v1/model/submit_feedback_response.py +3 -1
- dify_oapi/api/dify/v1/resource/__init__.py +0 -6
- dify_oapi/api/dify/v1/resource/audio.py +12 -0
- dify_oapi/api/{chat → dify}/v1/resource/feedback.py +6 -6
- dify_oapi/api/dify/v1/resource/info.py +34 -2
- dify_oapi/api/dify/v1/version.py +5 -4
- dify_oapi/api/knowledge/service.py +3 -3
- dify_oapi/api/knowledge/v1/model/__init__.py +234 -0
- dify_oapi/api/knowledge/v1/model/create_document_by_file_request.py +1 -3
- dify_oapi/api/knowledge/v1/model/create_document_by_file_request_body.py +4 -46
- dify_oapi/api/knowledge/v1/model/create_document_by_file_request_body_data.py +73 -0
- dify_oapi/api/knowledge/v1/model/process_rule.py +0 -6
- dify_oapi/api/knowledge/v1/model/update_document_by_file_request.py +1 -3
- dify_oapi/api/knowledge/v1/model/update_document_by_file_request_body.py +4 -41
- dify_oapi/api/knowledge/v1/model/update_document_by_file_request_body_data.py +68 -0
- dify_oapi/api/knowledge/v1/resource/__init__.py +0 -8
- dify_oapi/api/workflow/v1/model/__init__.py +72 -0
- dify_oapi/api/workflow/v1/model/workflow_inputs.py +1 -0
- dify_oapi/api/workflow/v1/resource/workflow.py +0 -34
- dify_oapi/api/workflow/v1/version.py +9 -0
- dify_oapi/client.py +4 -4
- dify_oapi2-1.0.1.dist-info/METADATA +367 -0
- {dify_oapi2-0.5.0.dist-info → dify_oapi2-1.0.1.dist-info}/RECORD +62 -139
- {dify_oapi2-0.5.0.dist-info → dify_oapi2-1.0.1.dist-info}/WHEEL +1 -1
- dify_oapi/api/chat/v1/model/get_app_info_request.py +0 -24
- dify_oapi/api/chat/v1/model/get_app_info_response.py +0 -9
- dify_oapi/api/chat/v1/model/get_app_meta_request.py +0 -24
- dify_oapi/api/chat/v1/model/get_app_meta_response.py +0 -9
- dify_oapi/api/chat/v1/model/get_app_parameters_request.py +0 -28
- dify_oapi/api/chat/v1/model/get_app_parameters_response.py +0 -9
- dify_oapi/api/chat/v1/model/get_feedbacks_response.py +0 -7
- dify_oapi/api/chat/v1/model/get_site_settings_request.py +0 -24
- dify_oapi/api/chat/v1/model/get_site_settings_response.py +0 -9
- dify_oapi/api/chat/v1/model/text_to_audio_request.py +0 -32
- dify_oapi/api/chat/v1/model/text_to_audio_request_body.py +0 -33
- dify_oapi/api/chat/v1/model/upload_file_request.py +0 -54
- dify_oapi/api/chat/v1/model/upload_file_response.py +0 -10
- dify_oapi/api/chat/v1/resource/app.py +0 -47
- dify_oapi/api/chat/v1/resource/audio.py +0 -30
- dify_oapi/api/chat/v1/resource/file.py +0 -25
- dify_oapi/api/chatflow/v1/model/audio_to_text_request.py +0 -37
- dify_oapi/api/chatflow/v1/model/audio_to_text_response.py +0 -21
- dify_oapi/api/chatflow/v1/model/get_app_feedbacks_request.py +0 -30
- dify_oapi/api/chatflow/v1/model/get_app_feedbacks_response.py +0 -23
- dify_oapi/api/chatflow/v1/model/get_info_request.py +0 -22
- dify_oapi/api/chatflow/v1/model/get_info_response.py +0 -7
- dify_oapi/api/chatflow/v1/model/get_meta_request.py +0 -22
- dify_oapi/api/chatflow/v1/model/get_meta_response.py +0 -7
- dify_oapi/api/chatflow/v1/model/get_parameters_request.py +0 -22
- dify_oapi/api/chatflow/v1/model/get_parameters_response.py +0 -7
- dify_oapi/api/chatflow/v1/model/get_site_request.py +0 -22
- dify_oapi/api/chatflow/v1/model/get_site_response.py +0 -7
- dify_oapi/api/chatflow/v1/model/message_feedback_request.py +0 -36
- dify_oapi/api/chatflow/v1/model/message_feedback_request_body.py +0 -33
- dify_oapi/api/chatflow/v1/model/message_feedback_response.py +0 -21
- dify_oapi/api/chatflow/v1/model/text_to_audio_request.py +0 -30
- dify_oapi/api/chatflow/v1/model/text_to_audio_request_body.py +0 -36
- dify_oapi/api/chatflow/v1/model/text_to_audio_response.py +0 -19
- dify_oapi/api/chatflow/v1/model/upload_file_request.py +0 -41
- dify_oapi/api/chatflow/v1/model/upload_file_response.py +0 -11
- dify_oapi/api/chatflow/v1/resource/application.py +0 -76
- dify_oapi/api/chatflow/v1/resource/feedback.py +0 -69
- dify_oapi/api/chatflow/v1/resource/file.py +0 -39
- dify_oapi/api/chatflow/v1/resource/tts.py +0 -29
- dify_oapi/api/completion/v1/model/audio/audio_info.py +0 -28
- dify_oapi/api/completion/v1/model/audio/text_to_audio_request.py +0 -32
- dify_oapi/api/completion/v1/model/audio/text_to_audio_request_body.py +0 -33
- dify_oapi/api/completion/v1/model/audio/text_to_audio_response.py +0 -9
- dify_oapi/api/completion/v1/model/feedback/feedback_info.py +0 -53
- dify_oapi/api/completion/v1/model/feedback/get_feedbacks_request.py +0 -32
- dify_oapi/api/completion/v1/model/feedback/get_feedbacks_response.py +0 -9
- dify_oapi/api/completion/v1/model/feedback/message_feedback_request.py +0 -38
- dify_oapi/api/completion/v1/model/feedback/message_feedback_request_body.py +0 -35
- dify_oapi/api/completion/v1/model/feedback/message_feedback_response.py +0 -7
- dify_oapi/api/completion/v1/model/file/file_info.py +0 -53
- dify_oapi/api/completion/v1/model/file/upload_file_request.py +0 -42
- dify_oapi/api/completion/v1/model/file/upload_file_request_body.py +0 -23
- dify_oapi/api/completion/v1/model/file/upload_file_response.py +0 -9
- dify_oapi/api/completion/v1/model/info/app_info.py +0 -43
- dify_oapi/api/completion/v1/model/info/feature_config.py +0 -91
- dify_oapi/api/completion/v1/model/info/file_upload_config.py +0 -23
- dify_oapi/api/completion/v1/model/info/get_info_request.py +0 -24
- dify_oapi/api/completion/v1/model/info/get_info_response.py +0 -9
- dify_oapi/api/completion/v1/model/info/get_parameters_response.py +0 -9
- dify_oapi/api/completion/v1/model/info/get_site_response.py +0 -9
- dify_oapi/api/completion/v1/model/info/parameters_info.py +0 -75
- dify_oapi/api/completion/v1/model/info/site_info.py +0 -90
- dify_oapi/api/completion/v1/model/info/system_parameters.py +0 -38
- dify_oapi/api/completion/v1/model/info/user_input_form.py +0 -158
- dify_oapi/api/completion/v1/resource/audio.py +0 -19
- dify_oapi/api/completion/v1/resource/feedback.py +0 -33
- dify_oapi/api/completion/v1/resource/file.py +0 -19
- dify_oapi/api/completion/v1/resource/info.py +0 -39
- dify_oapi/api/dify/v1/model/get_parameter_request.py +0 -30
- dify_oapi/api/dify/v1/model/message_feedback_request.py +0 -38
- dify_oapi/api/dify/v1/model/message_feedback_request_body.py +0 -30
- dify_oapi/api/dify/v1/model/message_feedback_response.py +0 -5
- dify_oapi/api/dify/v1/resource/message.py +0 -21
- dify_oapi/api/dify/v1/resource/meta.py +0 -17
- dify_oapi/api/dify/v1/resource/parameter.py +0 -19
- dify_oapi/api/workflow/v1/model/get_info_request.py +0 -24
- dify_oapi/api/workflow/v1/model/get_info_response.py +0 -9
- dify_oapi/api/workflow/v1/model/get_parameters_request.py +0 -24
- dify_oapi/api/workflow/v1/model/get_parameters_response.py +0 -9
- dify_oapi/api/workflow/v1/model/get_site_request.py +0 -24
- dify_oapi/api/workflow/v1/model/get_site_response.py +0 -9
- dify_oapi/api/workflow/v1/model/upload_file_request.py +0 -42
- dify_oapi/api/workflow/v1/model/upload_file_response.py +0 -9
- dify_oapi2-0.5.0.dist-info/METADATA +0 -335
- /dify_oapi/api/{chat → dify}/v1/model/audio_to_text_request.py +0 -0
- /dify_oapi/api/{chat → dify}/v1/model/audio_to_text_request_body.py +0 -0
- /dify_oapi/api/{chat → dify}/v1/model/audio_to_text_response.py +0 -0
- /dify_oapi/api/{chat → dify}/v1/model/get_feedbacks_request.py +0 -0
- /dify_oapi/api/{completion/v1/model/info → dify/v1/model}/get_site_request.py +0 -0
- /dify_oapi/api/{chat → dify}/v1/model/submit_feedback_request.py +0 -0
- {dify_oapi2-0.5.0.dist-info → dify_oapi2-1.0.1.dist-info/licenses}/LICENSE +0 -0
@@ -1,335 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.3
|
2
|
-
Name: dify-oapi2
|
3
|
-
Version: 0.5.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@gmail.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,<1)
|
17
|
-
Requires-Dist: pydantic (>=2,<3)
|
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 (22 APIs), Completion (15 APIs), Knowledge Base (33 APIs), Chatflow (17 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
|
-
- **Connection Pool Optimization**: Efficient TCP connection reuse to reduce resource overhead
|
42
|
-
|
43
|
-
## 📦 Installation
|
44
|
-
|
45
|
-
```bash
|
46
|
-
pip install dify-oapi2
|
47
|
-
```
|
48
|
-
|
49
|
-
**Requirements**: Python 3.10+
|
50
|
-
|
51
|
-
**Dependencies**:
|
52
|
-
- `pydantic` (>=1.10,<3.0.0) - Data validation and settings management
|
53
|
-
- `httpx` (>=0.24,<1.0) - Modern HTTP client
|
54
|
-
|
55
|
-
## 🚀 Quick Start
|
56
|
-
|
57
|
-
### Basic Chat Example
|
58
|
-
|
59
|
-
```python
|
60
|
-
from dify_oapi.api.chat.v1.model.chat_request import ChatRequest
|
61
|
-
from dify_oapi.api.chat.v1.model.chat_request_body import ChatRequestBody
|
62
|
-
from dify_oapi.client import Client
|
63
|
-
from dify_oapi.core.model.request_option import RequestOption
|
64
|
-
|
65
|
-
# Initialize client
|
66
|
-
client = Client.builder().domain("https://api.dify.ai").build()
|
67
|
-
|
68
|
-
# Build request
|
69
|
-
req_body = (
|
70
|
-
ChatRequestBody.builder()
|
71
|
-
.inputs({})
|
72
|
-
.query("What can Dify API do?")
|
73
|
-
.response_mode("blocking")
|
74
|
-
.user("user-123")
|
75
|
-
.build()
|
76
|
-
)
|
77
|
-
|
78
|
-
req = ChatRequest.builder().request_body(req_body).build()
|
79
|
-
req_option = RequestOption.builder().api_key("your-api-key").build()
|
80
|
-
|
81
|
-
# Execute request
|
82
|
-
response = client.chat.v1.chat.chat(req, req_option, False)
|
83
|
-
print(response.answer)
|
84
|
-
```
|
85
|
-
|
86
|
-
### Streaming Chat Example
|
87
|
-
|
88
|
-
```python
|
89
|
-
# Enable streaming for real-time responses
|
90
|
-
req_body = (
|
91
|
-
ChatRequestBody.builder()
|
92
|
-
.query("Tell me a story")
|
93
|
-
.response_mode("streaming")
|
94
|
-
.user("user-123")
|
95
|
-
.build()
|
96
|
-
)
|
97
|
-
|
98
|
-
req = ChatRequest.builder().request_body(req_body).build()
|
99
|
-
response = client.chat.v1.chat.chat(req, req_option, True)
|
100
|
-
|
101
|
-
# Process streaming response
|
102
|
-
for chunk in response:
|
103
|
-
print(chunk, end="", flush=True)
|
104
|
-
```
|
105
|
-
|
106
|
-
### Async Support
|
107
|
-
|
108
|
-
```python
|
109
|
-
import asyncio
|
110
|
-
|
111
|
-
async def async_chat():
|
112
|
-
response = await client.chat.v1.chat.achat(req, req_option, False)
|
113
|
-
print(response.answer)
|
114
|
-
|
115
|
-
asyncio.run(async_chat())
|
116
|
-
```
|
117
|
-
|
118
|
-
## 🔧 API Services
|
119
|
-
|
120
|
-
### Chat API (22 APIs)
|
121
|
-
- **Chat Messages**: Interactive conversations with AI assistants (3 APIs)
|
122
|
-
- **File Management**: Upload and manage images and documents (1 API)
|
123
|
-
- **Feedback Management**: Collect and analyze user feedback (2 APIs)
|
124
|
-
- **Conversation Management**: Complete conversation lifecycle management (5 APIs)
|
125
|
-
- **Audio Processing**: Speech-to-text and text-to-speech capabilities (2 APIs)
|
126
|
-
- **Application Information**: App configuration and metadata retrieval (4 APIs)
|
127
|
-
- **Annotation Management**: Create and manage annotations with reply settings (6 APIs)
|
128
|
-
- **Streaming Support**: Real-time streaming for chat and completion
|
129
|
-
- **Type Safety**: Comprehensive type hints with strict Literal types
|
130
|
-
|
131
|
-
### Completion API (15 APIs)
|
132
|
-
- **Message Processing**: Send messages and control responses
|
133
|
-
- **Annotation Management**: Create, update, and manage annotations
|
134
|
-
- **Audio Processing**: Text-to-audio conversion
|
135
|
-
- **Feedback System**: Collect and analyze user feedback
|
136
|
-
- **File Upload**: Support for document and media files
|
137
|
-
- **Application Info**: Configuration and metadata retrieval
|
138
|
-
|
139
|
-
### Knowledge Base API (33 APIs)
|
140
|
-
- **Dataset Management**: 6 APIs for dataset CRUD operations and content retrieval
|
141
|
-
- **Document Management**: 10 APIs for document upload, processing, and management
|
142
|
-
- **Segment Management**: 5 APIs for fine-grained content segmentation
|
143
|
-
- **Child Chunks Management**: 4 APIs for sub-segment management
|
144
|
-
- **Tag Management**: 7 APIs for metadata and knowledge type tags
|
145
|
-
- **Model Management**: 1 API for embedding model information
|
146
|
-
|
147
|
-
### Chatflow API (17 APIs)
|
148
|
-
- **Advanced Chat**: 3 APIs for enhanced chat functionality with workflow events
|
149
|
-
- **File Management**: 1 API for multimodal file upload and processing
|
150
|
-
- **Feedback System**: 2 APIs for comprehensive feedback collection and analysis
|
151
|
-
- **Conversation Management**: 5 APIs for complete conversation lifecycle management
|
152
|
-
- **TTS Integration**: 2 APIs for speech-to-text and text-to-speech capabilities
|
153
|
-
- **Application Configuration**: 4 APIs for app settings and metadata management
|
154
|
-
- **Annotation System**: 6 APIs for annotation management and reply settings
|
155
|
-
- **Streaming Support**: Real-time streaming with comprehensive event handling
|
156
|
-
- **Type Safety**: Strict Literal types for all predefined values
|
157
|
-
|
158
|
-
### Workflow API
|
159
|
-
- Automated workflow execution
|
160
|
-
- Parameter configuration
|
161
|
-
- Status monitoring
|
162
|
-
|
163
|
-
### Dify Core API
|
164
|
-
- Essential Dify service functionality
|
165
|
-
|
166
|
-
## 💡 Examples
|
167
|
-
|
168
|
-
Explore comprehensive examples in the [examples directory](./examples):
|
169
|
-
|
170
|
-
### Chat Examples
|
171
|
-
- [**Chat Messages**](./examples/chat/chat/) - Send messages, stop generation, get suggestions
|
172
|
-
- [**File Management**](./examples/chat/file/) - Upload and manage files
|
173
|
-
- [**Feedback Management**](./examples/chat/feedback/) - Submit and retrieve feedback
|
174
|
-
- [**Conversation Management**](./examples/chat/conversation/) - Complete conversation operations
|
175
|
-
- [**Audio Processing**](./examples/chat/audio/) - Speech-to-text and text-to-speech
|
176
|
-
- [**Application Information**](./examples/chat/app/) - App configuration and settings
|
177
|
-
- [**Annotation Management**](./examples/chat/annotation/) - Annotation CRUD and reply settings
|
178
|
-
|
179
|
-
### Completion Examples
|
180
|
-
- [**Basic Completion**](./examples/completion/basic_completion.py) - Text generation
|
181
|
-
|
182
|
-
### Knowledge Base Examples
|
183
|
-
- [**Dataset Management**](./examples/knowledge/dataset/) - Complete dataset operations
|
184
|
-
- [**Document Processing**](./examples/knowledge/document/) - File upload and text processing
|
185
|
-
- [**Content Organization**](./examples/knowledge/segment/) - Segment and chunk management
|
186
|
-
- [**Tag Management**](./examples/knowledge/tag/) - Metadata and tagging system
|
187
|
-
|
188
|
-
### Chatflow Examples
|
189
|
-
- [**Advanced Chat**](./examples/chatflow/chatflow/) - Enhanced chat with streaming and workflow events
|
190
|
-
- [**File Operations**](./examples/chatflow/file/) - Multimodal file upload and processing
|
191
|
-
- [**Feedback Management**](./examples/chatflow/feedback/) - Comprehensive feedback collection
|
192
|
-
- [**Conversation Management**](./examples/chatflow/conversation/) - Complete conversation operations
|
193
|
-
- [**TTS Operations**](./examples/chatflow/tts/) - Speech-to-text and text-to-speech
|
194
|
-
- [**Application Configuration**](./examples/chatflow/application/) - App settings and metadata
|
195
|
-
- [**Annotation Management**](./examples/chatflow/annotation/) - Annotation CRUD and reply settings
|
196
|
-
|
197
|
-
For detailed examples and usage patterns, see the [examples README](./examples/README.md).
|
198
|
-
|
199
|
-
## 🛠️ Development
|
200
|
-
|
201
|
-
### Prerequisites
|
202
|
-
- Python 3.10+
|
203
|
-
- Poetry
|
204
|
-
|
205
|
-
### Setup
|
206
|
-
|
207
|
-
```bash
|
208
|
-
# Clone repository
|
209
|
-
git clone https://github.com/nodite/dify-oapi2.git
|
210
|
-
cd dify-oapi
|
211
|
-
|
212
|
-
# Setup development environment (installs dependencies and pre-commit hooks)
|
213
|
-
make dev-setup
|
214
|
-
```
|
215
|
-
|
216
|
-
### Code Quality Tools
|
217
|
-
|
218
|
-
This project uses modern Python tooling:
|
219
|
-
|
220
|
-
- **Ruff**: Fast Python linter and formatter
|
221
|
-
- **MyPy**: Static type checking
|
222
|
-
- **Pre-commit**: Git hooks for code quality
|
223
|
-
- **Pylint**: Additional code analysis
|
224
|
-
|
225
|
-
```bash
|
226
|
-
# Format code
|
227
|
-
make format
|
228
|
-
|
229
|
-
# Lint code
|
230
|
-
make lint
|
231
|
-
|
232
|
-
# Fix linting issues
|
233
|
-
make fix
|
234
|
-
|
235
|
-
# Run all checks (lint + type check)
|
236
|
-
make check
|
237
|
-
|
238
|
-
# Install pre-commit hooks
|
239
|
-
make install-hooks
|
240
|
-
|
241
|
-
# Run pre-commit hooks manually
|
242
|
-
make pre-commit
|
243
|
-
```
|
244
|
-
|
245
|
-
### Testing
|
246
|
-
|
247
|
-
```bash
|
248
|
-
# Set environment variables
|
249
|
-
export DOMAIN="https://api.dify.ai"
|
250
|
-
export CHAT_KEY="your-api-key"
|
251
|
-
|
252
|
-
# Run tests
|
253
|
-
make test
|
254
|
-
|
255
|
-
# Run tests with coverage
|
256
|
-
make test-cov
|
257
|
-
```
|
258
|
-
|
259
|
-
### Build & Publish
|
260
|
-
|
261
|
-
```bash
|
262
|
-
# Configure PyPI tokens (one-time setup)
|
263
|
-
poetry config http-basic.testpypi __token__ <your-testpypi-token>
|
264
|
-
poetry config http-basic.pypi __token__ <your-pypi-token>
|
265
|
-
|
266
|
-
# Build package
|
267
|
-
make build
|
268
|
-
|
269
|
-
# Publish to TestPyPI (for testing)
|
270
|
-
make publish-test
|
271
|
-
|
272
|
-
# Publish to PyPI (maintainers only)
|
273
|
-
make publish
|
274
|
-
```
|
275
|
-
|
276
|
-
### Project Structure
|
277
|
-
|
278
|
-
```
|
279
|
-
dify-oapi/
|
280
|
-
├── dify_oapi/ # Main SDK package
|
281
|
-
│ ├── api/ # API service modules
|
282
|
-
│ │ ├── chat/ # Chat API
|
283
|
-
│ │ ├── completion/ # Completion API
|
284
|
-
│ │ ├── dify/ # Core Dify API
|
285
|
-
│ │ ├── knowledge/ # Knowledge Base API (33 APIs)
|
286
|
-
│ │ ├── chatflow/ # Chatflow API (17 APIs)
|
287
|
-
│ │ └── workflow/ # Workflow API
|
288
|
-
│ ├── core/ # Core functionality
|
289
|
-
│ │ ├── http/ # HTTP transport layer
|
290
|
-
│ │ ├── model/ # Base models
|
291
|
-
│ │ └── utils/ # Utilities
|
292
|
-
│ └── client.py # Main client interface
|
293
|
-
├── docs/ # Documentation
|
294
|
-
├── examples/ # Usage examples
|
295
|
-
├── tests/ # Test suite
|
296
|
-
└── pyproject.toml # Project configuration
|
297
|
-
```
|
298
|
-
|
299
|
-
## 📖 Documentation
|
300
|
-
|
301
|
-
- [**Project Overview**](./docs/overview.md) - Architecture and technical details
|
302
|
-
- [**TCP Connection Optimization**](./docs/tcp-optimization.md) - Connection pool configuration and performance tuning
|
303
|
-
- [**Completion APIs**](./docs/completion/apis.md) - Complete completion API documentation
|
304
|
-
- [**Knowledge Base APIs**](./docs/knowledge/apis.md) - Complete knowledge base API documentation
|
305
|
-
- [**Examples**](./examples/README.md) - Usage examples and patterns
|
306
|
-
|
307
|
-
## 🤝 Contributing
|
308
|
-
|
309
|
-
Contributions are welcome! Please:
|
310
|
-
|
311
|
-
1. Fork the repository
|
312
|
-
2. Create a feature branch
|
313
|
-
3. Make your changes with tests
|
314
|
-
4. Ensure code quality (`ruff format`, `ruff check`, `mypy`)
|
315
|
-
5. Submit a pull request
|
316
|
-
|
317
|
-
## 📄 License
|
318
|
-
|
319
|
-
This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.
|
320
|
-
|
321
|
-
## 🔗 Links
|
322
|
-
|
323
|
-
- **PyPI Package**: https://pypi.org/project/dify-oapi2/
|
324
|
-
- **Source Code**: https://github.com/nodite/dify-oapi2
|
325
|
-
- **Dify Platform**: https://dify.ai/
|
326
|
-
- **Dify API Docs**: https://docs.dify.ai/
|
327
|
-
|
328
|
-
## 📄 License
|
329
|
-
|
330
|
-
MIT License - see [LICENSE](./LICENSE) file for details.
|
331
|
-
|
332
|
-
---
|
333
|
-
|
334
|
-
**Keywords**: dify, nlp, ai, language-processing
|
335
|
-
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|