Skip to main content

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

Project description

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

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.4.tar.gz (17.1 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.4-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: huace_aigc_prompt_client-0.1.4.tar.gz
  • Upload date:
  • Size: 17.1 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.4.tar.gz
Algorithm Hash digest
SHA256 a0c81ced41e93da0828100a8d8a2d63108759d1e79ff2db79a4b6e1c6c862b6d
MD5 a3949a1071ef65b00bca7e880cb97077
BLAKE2b-256 ef7a3bb2ef9e8980155b4f97e6abf336c273c5e87c8955b9b0b361496abdb053

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for huace_aigc_prompt_client-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f4d41d34f671159133b1c8ea23545a91271d433cabd7e795affb954d2a1ee7e9
MD5 455d56cb07d62fe77ddfb3c3d485dd7e
BLAKE2b-256 d2ab4fcd7943dc0387fd2966dfca6f5162fd587f30bdc53b0efae28ff3b25c73

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