华策AIGC Prompt Client -- 提供提示词管理等功能
Project description
Prompt SDK - 提示词管理 SDK
核心特性
1. 轻量级客户端
专注于提示词(Prompt)的管理,提供简洁的 API 接口:
set- 新增/更新提示词(自动版本管理)get- 获取提示词最新版本get_histories- 获取提示词历史版本delete- 删除提示词(软删除)
2. 统一异常体系
针对不同错误类型设计对应的异常类:
AuthenticationError- 认证/鉴权失败(401/403)NotFoundError- 资源未找到(404)RateLimitError- 限流(429)ConflictError- 冲突(409)ValidationError- 参数校验失败(400)ServerError- 服务端错误(5xx)
3. 自动链路追踪
基于 huace-aigc-auth-client 自动注入 trace_id,便于问题排查。
4. 请求重试机制
对幂等读操作(get、get_histories)自动重试,提高可用性。
安装
pip install huace-aigc-prompt-client
快速开始
from huace_aigc_prompt_client import PromptSDK
# 初始化
sdk = PromptSDK(
api_key="your_api_key",
base_url="http://localhost:7805"
)
# 新增提示词
result = sdk.set(
prompt_type="system",
key="chat_template",
custom_prompt="You are a helpful AI assistant."
)
# 获取提示词
prompt = sdk.get(prompt_type="system", key="chat_template")
print(prompt["custom_prompt"])
License
MIT License
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file huace_aigc_prompt_client-0.1.1.tar.gz.
File metadata
- Download URL: huace_aigc_prompt_client-0.1.1.tar.gz
- Upload date:
- Size: 16.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1fb18f5f07b1455ff9d71aff0444017c12a2762de76412fc0d4fe2c29981a186
|
|
| MD5 |
dbcb248b2a031af98a1103c11cb631f0
|
|
| BLAKE2b-256 |
3c7f7d10324ef78a2fbb490eca2682b0ff0c7ba634d4422be98cff63581c5135
|
File details
Details for the file huace_aigc_prompt_client-0.1.1-py3-none-any.whl.
File metadata
- Download URL: huace_aigc_prompt_client-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f2531594b24e277172de9e2dc9064a48879289cb99b2d0619fa0d13012621a2
|
|
| MD5 |
f0a649e41fcdf51f60e81c08aae776a3
|
|
| BLAKE2b-256 |
4debd614e1f2fb038c96a8ae0dc706d863131f1db753e784ade70e3fa9986299
|