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.
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
}'{
"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_KEYstringRequiredThe API key of your Confident AI project.
Path parameters
promptIdstringRequiredThe unique id of the prompt.
Request body
triggerlist of enumsRequiredThe 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
COMMITVERSIONMERGEPULL_REQUEST
evalTaskobjectRequiredThe evaluation the action runs.
Show 4 propertiesHide 4 properties
namestringRequiredThe name of the evaluation, unique within your project. Test runs the action starts are named after it.
datasetIdstring | nullThe id of the dataset whose finalized goldens the prompt is evaluated against, or
nullfor 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 | nullThe id of the evaluator collection that scores the outputs, or
nullfor none. Omit it to keep the current collection when updating.variableMappingobject | nullMaps each prompt variable to the dataset field that fills it, as
{ variable: field }. Sendnullto clear it, or omit it to keep the current mapping when updating.
enabledbooleanWhether the action runs when triggered. Defaults to
trueon create; omit it to keep the current value when updating.
Response
Create Prompt Action succeeded.
successbooleanIndicates if the request was successful.
dataobjectA reference to a prompt action.
Show 1 propertyHide 1 property
idstringThis is the unique id of the prompt action.
linkstringThis is the URL of the resource on the Confident AI platform.
deprecatedbooleanIndicates if this endpoint is deprecated.