- 提示词攻击
- 偏离预定义主题
- PII、敏感信息及关键词泄露
- 有害内容
- 等等
安装
使用 pip:前置条件
生成 API 密钥:- 前往 Settings(设置)
- 点击
+ Create new secret key。 - 将密钥命名为
Quickstart Key。 - 点击
Add按钮。 - 点击复制图标复制密钥值。
代码使用
使用 API 密钥实例化 将您的 API 密钥粘贴到环境变量 ZENGUARD_API_KEY 中检测提示词注入
-
is_detected(boolean):指示所提供的消息中是否检测到提示词注入攻击。本示例中为 False。 -
score(float: 0.0 - 1.0):表示检测到的提示词注入攻击可能性的分数。本示例中为 0.0。 -
sanitized_message(string or null):对于提示词注入检测器,此字段为 null。 -
latency(float or null):执行检测所用的时间(毫秒) 错误码: -
401 Unauthorized:API 密钥缺失或无效。 -
400 Bad Request:请求体格式错误。 -
500 Internal Server Error:内部错误,请联系团队处理。
更多示例
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

