Skip to main content

华策AIGC Prompt Client -- 提供提示词管理等功能

Project description

Prompt SDK - 提示词管理 SDK

PyPI version Python

核心特性

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

huace_aigc_prompt_client-0.1.2.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

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

huace_aigc_prompt_client-0.1.2-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file huace_aigc_prompt_client-0.1.2.tar.gz.

File metadata

  • Download URL: huace_aigc_prompt_client-0.1.2.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for huace_aigc_prompt_client-0.1.2.tar.gz
Algorithm Hash digest
SHA256 47b152ca51b8b404d720b74313cafc2242666c3f8ccb9bffb933214984f1ed0c
MD5 e6a6359dc038c58be030cebd633dc554
BLAKE2b-256 2e142f0fad3d9bf2dd568d149db50c124716c26fe8a4e2e8755e950bdea8c0c6

See more details on using hashes here.

File details

Details for the file huace_aigc_prompt_client-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for huace_aigc_prompt_client-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a923a41f83b3887b62e29e4f8ab2339bf25afbe59fac2413f05d3421188d7b19
MD5 b9cc9a0859fddd1381217fbd20aa0feb
BLAKE2b-256 63549bb45c176540df8dc0d8a2ded22124a6891fae773f7936df8c4dd41fadcf

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