跳至主要内容
版本:PrivStation 2.6.0
Markdown 原文

新增提示詞

此 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​

KeyValue
Request MethodPOST
acceptapplication/json
AuthorizationBearer <your-api-key>
Content-Typeapplication/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

FieldTypeDetailRequired
metadatastringobject,使用者自訂的描述資訊false
namestring預設為 Prompt 建立的時間,格式:prompt_YYYYMMDD_hh:mmfalse
valuestringPrompt 內容true

Response Headers​

KeyValue
Status Code201

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

回傳 「提示詞物件」章節內容。