Execute Prompt Template
Invoke a Prompt Template
Executes prompt template by {uuid}
Asynchronous
Details
Path → https://api.discuro.com/v1/prompt-templates/execute Method → POST
How it works
- Invoke a prompt template
- Receive ID of execution in body, following successful execution
- Periodically make requests to our Retrieve Execution API to check the status, and pull your data once “status” has been updated to “ended”
Request Body Example
{ "prompt_template_uuid": "<prompt template UUID>", "inputs": [ { "name": "<input name>", "value": "<input value>" }, { "name": "<input name>", "value": "<input value>" } ], "tags": [ { "key": "<key>", "value": "<value>" } ] }
Response Examples
Success - Status Code 200
1 → Upon successful execution, we’ll send back an ID in the request body, this is the “execution ID”.
2 → Your application should save this ID temporarily (in memory)
3 → Your application should make requests to the Retrieve Execution API to get the status of the execution.
4 → When the execution status changes to “ended” - you will be able to extract your data from the Retrieve Execution API.
Learn more about how to consume this flow here Request Body:
{ "id": 142 }
Failure - Status Code 400
1 → Upon failure we’ll send back the error message in the request body.
2 → Your application should parse this, and log internally, or display to your end users in a friendly format
3 → Your application should also take into account executions that don’t immediately fail. See “additional considerations below”
Request Body:
{ "error": "Error: missing input values (industry, number_of_topics, )", "meta_data": null }
Additional Considerations / Error Handling
- An execution can also fail after it has been invoked. You can check the status of an execution via Retrieve Execution API
- Your application should handle instant failure (status code 400 on this resource)
- … as well as handling process failure (via Retrieve Execution API)
- We recommend you read more about failed executions on the “Retrieve Execution” API documentation page.
Last updated on January 12, 2023