Model Download API for CI Integration | Rasa Documentation
Introduction
The Model Download API provides external access to retrieve download URLs for artifacts generated in Rasa Studio, facilitating CI/CD integration.
Built with GraphQL, this API allows queries to request trained assistant models and associated input data in YAML format.
Requirements
Required API Role
Model download urls. See Authorization to learn how to get an access token.Assistant API ID. See authorization guide for configuration for more details.
Assistant Version Name. See user guide for training for more details.
Available APIs
Query: ModelDownloadUrls
Schema:
type Query {
modelDownloadUrls(input: ModelDownloadUrlsInput!): ModelDownloadUrlsOutput!
}
input ModelDownloadUrlsInput {
assistantId: ID!
assistantVersionName: ID
}
type ModelDownloadUrlsOutput {
modelFileUrl: String!
modelInputUrl: String!
}
Input: ModelDownloadUrlsInput
| Field | Description |
|---|---|
assistantId |
Unique identifier of the assistant. |
assistantVersionName |
Optional version of the trained assistant. Default is latest. |
Output: ModelDownloadUrlsOutput
| Field | Description |
|---|---|
modelFileUrl |
Url to download the model file <assistant-version-name>.tar.gz. |
modelInputUrl |
Url to download the model input data in YAML format. |
Usage
The query can be used to fetch the download URLs for the trained model and the input data in YAML format for an assistant.
Example curl Request
Request the Model Download API using e.g. curl:
curl -X POST https://<api-url>/api/graphql \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <access-token>" \
-d '{\
"query": "query ModelDownloadUrls($input: ModelDownloadUrlsInput!) { modelDownloadUrls(input: $input) { modelFileUrl modelInputUrl } }",\
"variables": {\
"input": {\
"assistantId": "<assistant-id>",\
"assistantVersionName": "<assistant-version-name>"\
}\
}\
}'
Example Response
The response will contain the download URLs for the trained model and the model input data.
{"data":
{"modelDownloadUrls":
{
"modelFileUrl":"https://<api-url>/api/v1/download/model-file/<assistant-version-name>",
"modelInputUrl":"https://<api-url>/api/v1/download/model-input/<assistant-version-name>"
}
}
}
Download model file
To download the model file, request the modelFileUrl with authorization header.
curl "https://<api-url>/api/v1/download/model-file/<assistant-version-name>" \
-H "Authorization: Bearer <access-token>" \
-O -J
The downloaded model file <assistant-version-name>.tar.gz can be used to deploy the trained model.
Download model input data
To download the model input YAML files, request the modelInputUrl with authorization header.
curl "https://<api-url>/api/v1/download/model-input/<assistant-version-name>" \
-H "Authorization: Bearer <access-token>" \
-O -J
The downloaded model input zipped directory <assistant-version-name>_model-input.tar.gz contains the model input data in YAML format:
data/flows.yamldata/nlu.yamlconfig.yamlcredentials.yamldomain.yamlendpoints.yaml