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.5.tar.gz
(3.2 kB
view details)
Built Distribution
File details
Details for the file dify-client-0.1.5.tar.gz
.
File metadata
- Download URL: dify-client-0.1.5.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 | 7eeee9290250a30ba431fef4ca684df557cab8a444eb2c670aad772473b94f06 |
|
MD5 | 512fd6f560431dbeab9d084e6f879012 |
|
BLAKE2b-256 | e63e9cf37da3c9ed0ea45301e1a12ea7d31bf2f37071d2bdb83d55930b3d5e6b |
File details
Details for the file dify_client-0.1.5-py3-none-any.whl
.
File metadata
- Download URL: dify_client-0.1.5-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 | 0e373a493996c97baa7643ce547b67454e5ff74699cd4150a5c8bc7c9e29d2bc |
|
MD5 | 5c0df2e239a0322eb47ad930b828baa0 |
|
BLAKE2b-256 | c9fc740548b74ad09948cf6bb2bc5aaf731ce1911806064b924108ffdaebf6a6 |