Callbacks
Callbacks enable the retrieval of a model’s status when it transitions to either ‘complete’ or ‘error’. This is accomplished by sending a POST request to the specified URL, with the payload structured as follows:
Let’s break down each key:
name
: name of the modelversion
: version of the trained modelactive
: indicates whether the newly trained model is activepredictor_id
: unique identifier for the trained modelproject_name
: the name of the project in which the model was createdpredictor_created_at
: time at which the model was createdold_status
: status the model had prior to receiving thenew_status
new_status
: current status of the modelchanged_at
: time when the model’s status transitioned fromold_status
tonew_status
Please note that this feature works only in MinsdDB Cloud and only for MindsDB Starter users.
Callbacks API
Callback API provides information on how to add, get, edit, and delete callbacks.
Add a Callback
This is the Request format:
And this is the Response format:
Only the url
key is required in the Request. All others are optional.
url
- this represents the address that will be utilized to send a POST request, containing detailed information about the model’s statusfilter
- this is used to restrict the triggering of callbacks:model_name
- python-style regular expression used to filter the names of models that trigger a callbackproject_name
- python-style regular expression used to filter the names of projects
attempt
- this outlines the configuration of the number and frequency of attempts to send callbackscount
- maximum number of attemptsinterval
- represents the interval between failed attemptshttp_timeout
- time allotted to wait for a successful response.
Get a Callback
This is the Request format:
And this is the Response format:
Edit a Callback
This is the Request format:
And this is the Response format:
Delete a Callback
This is the Request format:
And this is the Response format:
Handling Callbacks using Python SDK
Below is an example of using callbacks with the home_rentals
model. Be sure that your endpoint HOSTNAME
is accessible from the internet.
Please note that localhost
is not accessible from the internet - you can make localhost
accessible via multiple ways, like ngrok tunnel.
Handling Callbacks using JavaScript SDK
Below is an example of using callbacks with the home_rentals
model. Be sure that the callback HOSTNAME
is accessible from MindsDB Cloud.