Introducing Confident Voice: Watch the Launch Video Now

Update Prompt Action

(v2)

PUT

Updates a prompt action and returns it. Send at least one field. When you send evalTask, name is required and its other fields you omit keep their stored values. The new dataset and evaluator collection must belong to your project, and the evaluation name must not be taken by another evaluation.

PUT/v2/prompts/{promptId}/prompt-actions/{promptActionId}
curl -X PUT "https://api.confident-ai.com/v2/prompts/{promptId}/prompt-actions/{promptActionId}" \
  -H "CONFIDENT_API_KEY: <PROJECT-API-KEY>" \
  -H "Content-Type: application/json" \
  -d '{
  "trigger": [
    "COMMIT"
  ],
  "evalTask": {
    "name": "Greeting regression",
    "datasetId": "<DATASET-ID>",
    "evaluatorCollectionId": "<EVALUATOR-COLLECTION-ID>",
    "variableMapping": {
      "name": "input"
    }
  },
  "enabled": true
}'
200
{
  "success": true,
  "data": {
    "id": "<PROMPT-ACTION-ID>",
    "promptId": "<PROMPT-ID>",
    "enabled": true,
    "trigger": [
      "COMMIT"
    ],
    "evalTask": {
      "id": "<EVAL-TASK-ID>",
      "name": "Greeting regression",
      "datasetId": "<DATASET-ID>",
      "evaluatorCollectionId": "<EVALUATOR-COLLECTION-ID>",
      "variableMapping": {
        "name": "input"
      }
    },
    "createdAt": "2025-01-18T16:45:00.000Z",
    "updatedAt": "2025-01-20T09:12:00.000Z"
  },
  "link": "https://app.confident-ai.com/project/<PROJECT-ID>/prompt-studio/<PROMPT-ID>/actions",
  "deprecated": false
}

Headers

  • CONFIDENT_API_KEYstringRequired

    The API key of your Confident AI project.

Path parameters

  • promptIdstringRequired

    The unique id of the prompt.

  • promptActionIdstringRequired

    The unique id of the prompt action.

Request body

  • triggerlist of enums

    The events that start the action. List each trigger once; the action runs whenever any of them happens to the prompt.

    Show 4 enum valuesHide 4 enum values
    • COMMIT
    • VERSION
    • MERGE
    • PULL_REQUEST
  • evalTaskobject

    The evaluation the action runs.

    Show 4 propertiesHide 4 properties
    • namestringRequired

      The name of the evaluation, unique within your project. Test runs the action starts are named after it.

    • datasetIdstring | null

      The id of the dataset whose finalized goldens the prompt is evaluated against, or null for none. Omit it to keep the current dataset when updating. The action only runs once a dataset and an evaluator collection are both set.

    • evaluatorCollectionIdstring | null

      The id of the evaluator collection that scores the outputs, or null for none. Omit it to keep the current collection when updating.

    • variableMappingobject | null

      Maps each prompt variable to the dataset field that fills it, as { variable: field }. Send null to clear it, or omit it to keep the current mapping when updating.

  • enabledboolean

    Whether the action runs when triggered. Defaults to true on create; omit it to keep the current value when updating.

Response

Update Prompt Action succeeded.

  • successboolean

    Indicates if the request was successful.

  • dataobject

    An evaluation that runs automatically when something happens to the prompt.

    Show 7 propertiesHide 7 properties
    • idstring

      This is the unique id of the prompt action.

    • promptIdstring

      This is the id of the prompt the action belongs to.

    • enabledboolean

      Whether the action runs when triggered.

    • triggerlist of enums

      These are the events that start the action.

      Show 4 enum valuesHide 4 enum values
      • COMMIT
      • VERSION
      • MERGE
      • PULL_REQUEST
    • evalTaskobject

      The evaluation a prompt action runs.

      Show 5 propertiesHide 5 properties
      • idstring

        This is the unique id of the evaluation.

      • namestring

        This is the name of the evaluation, unique within your project.

      • datasetIdstring | null

        This is the id of the dataset the prompt is evaluated against, or null when none is set.

      • evaluatorCollectionIdstring | null

        This is the id of the evaluator collection that scores the outputs, or null when none is set.

      • variableMappingobject | null

        This maps each prompt variable to the dataset field that fills it, or is null when none is set.

    • createdAtstring

      When the action was created.

    • updatedAtstring

      When the action was last changed.

  • linkstring

    This is the URL of the resource on the Confident AI platform.

  • deprecatedboolean

    Indicates if this endpoint is deprecated.

Built byConfident AI