取得單一提示詞資訊
此 API 用於取得單一 Prompt 的詳細資訊。
透過指定的 prompt_id,你可以查詢該提示詞的內容、名稱、描述資訊與建立時間等欄位。
curl -X 'GET' \
'http://127.0.0.1:8000/v1/prompts/{prompt_id}' \
-H 'accept: application/json' \
-H "Authorization: Bearer $PRIVAI_API_KEY"
Request Headers
| Key | Value |
|---|---|
| Request Method | GET |
| accept | application/json |
| Authorization | Bearer $PRIVAI_API_KEY |
Path Parameters
| Field | Type | Note | Required |
|---|---|---|---|
| prompt_id | string (uuid) | 提示詞的唯一鍵 | true |
Response Body
{
"id": "dae76e24-ca4b-414f-92be-21abe36a70f7",
"value": "Antibiotics are a type of medication used to treat bacterial infections. They work by either killing the bacteria or preventing them from reproducing, allowing the body's immune system to fight off the infection. Antibiotics are usually taken orally in the form of pills, capsules, or liquid solutions, or sometimes administered intravenously. They are not effective against viral infections, and using them inappropriately can lead to antibiotic resistance.\nExplain the above in one sentence:",
"name": "Antibiotics Explanation",
"metadata": {
"tag": [
"medication",
"antibiotics"
]
},
"created_at": "2025-01-01T00:15:00.000Z"
}
Field Explanation
回傳「提示詞物件」章節內容。
可能的錯誤
| Error Code | HTTP Status | 情境 |
|---|---|---|
AUTH_001、AUTH_002、AUTH_003 | 401 / 403 | 缺少 Authorization header、API Key 無效或已過期,見 「錯誤代碼說明-身份驗證類」 |
PROMPT_001 | 404 | 指定的 Prompt 不存在,或不屬於目前的 API Key,見 「錯誤代碼說明-提示詞管理類」 |
prompt_id 不是合法的 UUID 時,會回傳 422 參數驗證錯誤(格式見「例外狀況處理」章節)。