Skip to main content

Prompt SDK - 提示词管理 SDK

PyPI version Python

核心特性

  • set / get / get_histories / delete — 提示词 CRUD,自动版本管理
  • 统一异常体系:AuthenticationError / NotFoundError / RateLimitError 等
  • 自动链路追踪(X-Trace-ID)
  • 幂等读操作自动重试

安装

pip install huace-aigc-prompt-client

快速开始

from huace_aigc_prompt_client import PromptSDK
import os

# 必须配置:API_KEY + BASE_URL + ACCESS_TOKEN
sdk = PromptSDK(
    api_key=os.getenv("PROMPT_SDK_API_KEY"),
    base_url=os.getenv("PROMPT_SDK_BASE_URL", "http://localhost:7805"),
    access_token=os.getenv("AIGC_AUTH_ACCESS_TOKEN"),
)

# 新增提示词(operator 自动取自 token,无需显式传入)
result = sdk.set(
    prompt_type="system",
    key="chat_template",
    custom_prompt="You are a helpful AI assistant.",
)
print(f"prompt_id={result['prompt_id']}, version={result['version']}")

# 获取提示词
prompt = sdk.get(prompt_type="system", key="chat_template")
print(prompt["custom_prompt"])

环境变量

变量 必填 说明
PROMPT_SDK_API_KEY ✅ 业务 API Key
PROMPT_SDK_BASE_URL ✅ 服务端地址
AIGC_AUTH_ACCESS_TOKEN ✅ 用户访问令牌(JWT),用于注入 Authorization 头及解析用户名

License

MIT License

Metadata

Release files for huace-aigc-prompt-client 0.1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for huace-aigc-prompt-client 0.1.8
File Size Uploaded Provenance
huace_aigc_prompt_client-0.1.8.tar.gz 17.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for huace-aigc-prompt-client 0.1.8
File Interpreter ABI Platform
huace_aigc_prompt_client-0.1.8-py3-none-any.whl Python 3 none any Details

Total release size: 25.5 kB

Release files / huace_aigc_prompt_client-0.1.8.tar.gz

Download URL huace_aigc_prompt_client-0.1.8.tar.gz
Size 17.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e10b86af18485eaee333d81b11853c19da8e78e79fb8f45b82dd0a3ea2f5493f
BLAKE2b-256 checksum
How to use checksums
dcebb9f7558ef5e33b8da8baf7681c2ce64621ba0fdeacdf0a7da52deee0305a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.19

Release files / huace_aigc_prompt_client-0.1.8-py3-none-any.whl

Download URL huace_aigc_prompt_client-0.1.8-py3-none-any.whl
Size 8.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
af73aa587392ffa1a898c24b6c5bc8fe6de40deae9e9e28aa130d3ca4d033de9
BLAKE2b-256 checksum
How to use checksums
52c5f17a8cb19b9537afb221d071e4b8ba69f2b58d310d784ec2ef462290dbc8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.19

Security for huace-aigc-prompt-client 0.1.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page