Introducing Confident Voice: Watch the Launch Video Now

Create Prompt Action

(v2)

POST

Creates a prompt action that runs an evaluation whenever one of its triggers happens to the prompt. The evaluation is created with the action, so its datasetId and evaluatorCollectionId must belong to your project, and its name must not already be taken by another evaluation in the project.

POST/v2/prompts/{promptId}/prompt-actions
curl -X POST "https://api.confident-ai.com/v2/prompts/{promptId}/prompt-actions" \
  -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>"
  },
  "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.

Request body

  • triggerlist of enumsRequired

    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
  • evalTaskobjectRequired

    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

Create Prompt Action succeeded.

  • successboolean

    Indicates if the request was successful.

  • dataobject

    A reference to a prompt action.

    Show 1 propertyHide 1 property
    • idstring

      This is the unique id of the prompt action.

  • linkstring

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

  • deprecatedboolean

    Indicates if this endpoint is deprecated.

Built byConfident AI