新增提示詞¶
此 API 用於建立一個新的 Prompt,作為語言模型推論時的前置模板。
curl -X 'POST' \
'https://127.0.0.1:8000/v1/prompt' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <your-api-key>' \
-H 'Content-Type: application/json' \
-d '{
"metadata": {
"tag": [
"medication",
"antibiotics"
]
},
"name": "Antibiotics Explanation",
"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:"
}'
Request Headers¶
| Key | Value |
|---|---|
| Request Method | POST |
| accept | application/json |
| Authorization | Bearer |
| Content-Type | application/json |
Request Payload¶
{
"metadata": {
"tag": [
"medication",
"antibiotics"
]
},
"name": "Antibiotics Explanation",
"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:"
}
Field Explanation
| Field | Type | Detail | Required |
|---|---|---|---|
| metadata | string | object,使用者自訂的描述資訊 | false |
| name | string | 預設為 Prompt 建立的時間,格式:prompt_YYYYMMDD_hh:mm | false |
| value | string | Prompt 內容 | true |
Response Headers¶
| Key | Value |
|---|---|
| Status Code | 201 |
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
回傳 「提示詞物件」章節內容。