A package for interacting with the Dify Service-API
Project description
dify-client
A Dify App Service-API Client, using for build a webapp by request Service-API
Usage
First, install dify-client
python sdk package:
pip install dify-client
Write your code with sdk:
api_key = "your_api_key"
# Initialize CompletionClient
completion_client = CompletionClient(api_key)
# Create Completion Message using CompletionClient
completion_response = completion_client.create_completion_message(inputs={}, query="Hello", response_mode="blocking", user="user_id")
print(completion_response)
# Initialize ChatClient
chat_client = ChatClient(api_key)
# Create Chat Message using ChatClient
chat_response = chat_client.create_chat_message(inputs={}, message="Hello", user="user_id", response_mode="streaming")
print(chat_response)
# Get Chat History using ChatClient
chat_history = chat_client.get_chat_history(user="user_id")
print(chat_history)
# Get Conversation List using ChatClient
conversations = chat_client.list_conversations(user="user_id")
print(conversations)
# Rename Conversation using ChatClient
rename_conversation_response = chat_client.rename_conversation(conversation_id="conversation_id", name="new_name", user="user_id")
print(rename_conversation_response)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dify-client-0.1.3.tar.gz
(3.2 kB
view details)
Built Distribution
File details
Details for the file dify-client-0.1.3.tar.gz
.
File metadata
- Download URL: dify-client-0.1.3.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38fe83170cd39d961eaef81b897ecd452c45cb3c38d95988e8b2bb521deaa899 |
|
MD5 | 894c45ec23a43d0dc8ef154bcd0b238c |
|
BLAKE2b-256 | 8860a4adbdf68f79d1e565ccf62dc93261dc3bae8fbf2eda7ad2458f2f7be686 |
File details
Details for the file dify_client-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: dify_client-0.1.3-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26d6ea984986c8ff649d3572583053c7728403df0953af281f88c40425075a2e |
|
MD5 | dca2a491ba697b7cb471859ddc59680b |
|
BLAKE2b-256 | 8fe0e3c0e290b8306b83807e61fb01268081466a351b83ba0be357cfcb26b394 |