跳轉到

提示詞手動優化

此 API 用於根據使用者提供的優化意圖,產生一個針對指定 Prompt 的自定義優化版本。

透過提供:

  • current_issue:目前這個 Prompt 在使用上遇到的問題(如太冗長、不夠明確、回答風格錯誤等)

  • desired_behavior:期望模型在優化後的輸出行為(如更精簡、更正式、更適合摘要等)

系統會根據這些指示,自動調整 prompt 的語氣、結構與指令設計,並建立一個新的版本。

curl -X 'POST' \
  'http://127.0.0.1:8000/v1/prompt/{prompt_id}/optimize/instruct?current_issue={current_issue}&desired_behavior={desired_behavior}&model={model}' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer <your-api-key>'

Request Headers

Key Value
Request Method POST
accept application/json
Authorization Bearer

Query Parameters

Field Type Note Required
prompt_id string uuid true
current_issue string true
desired_behavior string true
model string 自訂優化 Prompt 的模型 false

Response Body

{
  "id": "6afecc03-ef73-4aa9-8ea6-88098047f3a2",
  "value": "Antibiotics are medications that target bacterial infections by either killing or stopping bacterial reproduction, typically taken orally or intravenously, but ineffective against viral infections and potentially causing resistance if misused.",
  "name": "derived from dae76e24-ca4b-414f-92be-21abe36a70f7",
  "metadata": {
    "tag": [
      "medication",
      "antibiotics"
    ],
    "derived_from": "2cf86e6f-92a1-4525-8717-2ab149e66c2f"
  },
  "created_at": "2025-06-09T07:33:47.632198Z"
}

Field Explanation

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

在複製 Fileset 時,系統會自動於 metadata 中加入一筆 derived_from 欄位,記錄來源的提示詞,方便後續追蹤來源關係與管理版本差異。