Retrieve Execution

Retrieve an execution’s status, and generated data

Retrieves execution by {id}

Asynchronous

Details

Path → https://api.discuro.com//v1/executions/retrieve Method → POST Query Params → ID Example Path → https://api.discuro.com/v1/executions/retrieve?id=10

 

How it works

  1. Invoke an Orchestrator or Prompt Template
  1. Receive ID of execution in body, following successful execution
  1. Periodically make requests to this API - please wait at least 10 seconds before making the first retrieval call to this API, our system can take up to 60 seconds to sync.
  1. When the “status” property in the response body changes to “ended”, the execution has completed.
  1. Check the “passed” property in the response body - this’ll tell your application whether or not the execution has been a success, or not.
  1. Extract your generated data by accessing the “transformation” property in the response body (more about this below)
 

Execution results are stored for a maximum of 24 hours, once that time has passed, we’ll automatically remove the results of your transformation from our system. If you intend to query executions 24 hours after invoking then you will not be able to access the data you generated.

 

Response Examples


 

Actively Processing Execution - Status Code 200

1 → This is the response you’ll receive when an execution is ongoing.

2 → Your system should poll this API until the “status” property changes to “ended”.

{
    "id": 1,
    "status": "started"
}
 

 
 

Successful Execution - Status Code 200

1 → This is the response you’ll receive when an execution has ended successfully.

2 → See the property “passed” - use this to figure out if an execution has been successfully processed, or has resulted in failure.

3 → To get your generated data, simply extract the “transformation.data” property from the JSON object.

4 → Your implementation should also handle failed executions (see further below). Response Body

{
    "id": 98,
		"passed": true,
    "status": "ended",
    "transformation": {
        "data": [
            {
                "author_country": "United States",
                "author_name": "Roger Ebert",
                "review": "James Cameron's Avatar is an emotional experience unlike any other, an extraordinary technical achievement to set beside 'Star Wars,' '2001' and 'Jurassic Park.'"
            },
            {
                "author_country": "United States",
                "author_name": "A.O. Scott",
                "review": "Avatar is a technical marvel, a visual feast that is also a sophisticated and emotionally engaging entertainment."
            },
            {
                "author_country": "United Kingdom",
                "author_name": "Peter Bradshaw",
                "review": "Avatar is a stunningly beautiful, visually groundbreaking 3D movie, and a thrilling, immersive experience."
            }
        ],
        "end": "2023-01-14T02:27:59.249105Z",
        "start": "2023-01-14T02:27:54.444364Z",
        "usage": {
            "completion_tokens": 135,
            "prompt_tokens": 81,
            "total_tokens": 216
        }
    }
}
 
 

 

Failed Process - Status Code 200 (error exists in response body)

1 → Upon failure we’ll mark the “passed” property as “false”. This indicates that during run-time, we’ve encountered an error, or a problem when processing your execution.

2 → Your application can get further information about the error, exactly where it failed at, and more, by traversing the “transformation.results” property.

The results object is structured as key → value pairs, where key is the Property ID, and the value is an object detailing the status of that properties execution results.

  • The results object is structured as key → value pairs, where key is the Property ID, and the value is an object detailing the status of that properties execution results.
  • Each property can also have “layer results” - of which are in the same key → value format.
  • You can also traverse the “layer results” property, and find out exactly which layer your execution failed at.

3 → If the error comes from OpenAI we’ll forward the request body in the “error” property/layer, wherever the execution failed. … for example, the below execution failed at property-level, so we appended the error we got back from OpenAI to that properties value in the “results” map.

 

Response Body

{
    "id": 144,
    "status": "ended",
		"passed": false,
    "transformation": {
        "results": {
            "71": {
                "end": "2023-01-14T15:07:47.762854Z",
                "start": "2023-01-14T15:07:47.05222Z",
                "passed": false,
                "error": "{\n  \"error\": {\n    \"message\": \"You requested a length 0 completion, but did not specify a 'logprobs' parameter to see the probability of each token. Either request a completion with length greater than 1, or set 'logprobs' to 0 (to see the probabilities of each token you submitted) or more (to also see the probabilities over alternative tokens).\",\n    \"type\": \"invalid_request_error\",\n    \"param\": null,\n    \"code\": null\n  }\n}\n",
                "property": {
                    "name": "blogs"
                },
                "layer_results": null
            }
        },
				"usage": {
            "completion_tokens": 135,
            "prompt_tokens": 81,
            "total_tokens": 216
        }
        "data": {}
    }
}
 

 

Instant Failure - Status Code 400

1 → If the execution log you’re looking for no longer exists, you will receive the following response body along with the status code 400.

 

Not Found Response Body

{
    "error": "Operation failed - execution_log not found",
    "meta_data": null
}

Last updated on January 14, 2023