Skip to main content

Python SDK for Dify API

Project description

DifyPy

Python SDK for Dify API - 简单易用的 Dify API 客户端

安装

pip install difypy

快速开始

from difypy import Dify, ResponseMode

# 初始化客户端,url填写你们公司自己部署的
client = Dify(api_key="your_api_key", base_url="https://api.dify.ai/v1")

# 运行工作流
response = client.run_workflow(
    inputs={"query": "你好,请介绍一下自己"},
    user="user_123",
    response_mode=ResponseMode.BLOCKING
)

print(response.data)

# 上传文件
file_response = client.upload_file(
    file_path="path/to/file.pdf",
    user="user_123"
)

print(f"文件ID: {file_response.id}")

功能特性

  • 工作流执行(支持流式和阻塞模式)
  • 文件上传和管理
  • 工作流状态查询
  • 应用信息获取
  • 错误处理

许可证

MIT

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

difypy-0.1.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

difypy-0.1.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file difypy-0.1.0.tar.gz.

File metadata

  • Download URL: difypy-0.1.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.6

File hashes

Hashes for difypy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ad079f9b08b772f9258b2844a2a20e2ceae1317c18836fe93a9fc4b024adebde
MD5 c319710565d18b91b297d19af82a2e02
BLAKE2b-256 591472a1e1c9e4d39c2b15092cbbf5124a076d029fe45db8b1475f6a0f56745b

See more details on using hashes here.

File details

Details for the file difypy-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: difypy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.6

File hashes

Hashes for difypy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fe86c7aae8c9238393a9347c6dc63fd0c11e60e2258aeaafdbec3b6d4b713d42
MD5 3860921f8ae7df2e49292c7ce3c1e40b
BLAKE2b-256 4484557e73456c736910f58271b0806bd48c65382567068cc18ffa6ec054082d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page