Rasa Model API
The Model API from Rasa — 6 operation(s) for model.
The Model API from Rasa — 6 operation(s) for model.
openapi: 3.0.2
info:
title: Rasa SDK - Action Server Endpoint Domain Model API
version: 0.0.0
description: API of the action server which is used by Rasa to execute custom actions.
servers:
- url: http://localhost:5055/webhook
description: Local development action server
tags:
- name: Model
paths:
/model/train:
post:
security:
- TokenAuth: []
- JWT: []
operationId: trainModel
tags:
- Model
summary: Train a Rasa model
description: Trains a new Rasa model. Depending on the data given only a dialogue model, only a NLU model, or a model combining a trained dialogue model with an NLU model will be trained. The new model is not loaded by default.
parameters:
- in: query
name: save_to_default_model_directory
schema:
type: boolean
default: true
description: If `true` (default) the trained model will be saved in the default model directory, if `false` it will be saved in a temporary directory
- in: query
name: force_training
schema:
type: boolean
default: false
description: Force a model training even if the data has not changed
- in: query
name: augmentation
schema:
type: string
default: 50
description: How much data augmentation to use during training
- in: query
name: num_threads
schema:
type: string
default: 1
description: Maximum amount of threads to use when training
- $ref: '#/components/parameters/callback_url'
requestBody:
required: true
description: The training data should be in YAML format.
content:
application/yaml:
schema:
$ref: '#/components/schemas/YAMLTrainingRequest'
example: "pipeline: []\n\npolicies: []\n\nintents:\n - greet\n - goodbye\n\nentities: []\nslots: {}\nactions: []\nforms: {}\ne2e_actions: []\n\nresponses:\n utter_greet:\n - text: \"Hey! How are you?\"\n\n utter_goodbye:\n - text: \"Bye\"\n\nsession_config:\n session_expiration_time: 60\n carry_over_slots_to_new_session: true\n\nnlu:\n- intent: greet\n examples: |\n - hey\n - hello\n\n- intent: goodbye\n examples: |\n - bye\n - goodbye\n\nrules:\n\n- rule: Say goodbye anytime the user says goodbye\n steps:\n - intent: goodbye\n - action: utter_goodbye\n\nstories:\n\n- story: happy path\n steps:\n - intent: greet\n - action: utter_greet\n - intent: goodbye\n - action: utter_goodbye\n"
responses:
200:
description: Zipped Rasa model
headers:
filename:
schema:
type: string
description: File name of the trained model.
content:
application/octet-stream:
schema:
$ref: '#/components/schemas/TrainingResult'
204:
$ref: '#/components/responses/204Callback'
400:
$ref: '#/components/responses/400BadRequest'
401:
$ref: '#/components/responses/401NotAuthenticated'
403:
$ref: '#/components/responses/403NotAuthorized'
500:
$ref: '#/components/responses/500ServerError'
/model/test/stories:
post:
security:
- TokenAuth: []
- JWT: []
operationId: testModelStories
tags:
- Model
summary: Evaluate stories
description: Evaluates one or multiple stories against the currently loaded Rasa model.
parameters:
- $ref: '#/components/parameters/e2e'
requestBody:
required: true
content:
text/yml:
schema:
$ref: '#/components/schemas/StoriesTrainingData'
responses:
200:
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/EvaluationStoriesResult'
400:
$ref: '#/components/responses/400BadRequest'
401:
$ref: '#/components/responses/401NotAuthenticated'
403:
$ref: '#/components/responses/403NotAuthorized'
409:
$ref: '#/components/responses/409Conflict'
500:
$ref: '#/components/responses/500ServerError'
/model/test/intents:
post:
security:
- TokenAuth: []
- JWT: []
operationId: testModelIntent
tags:
- Model
summary: Perform an intent evaluation
description: Evaluates NLU model against a model or using cross-validation.
parameters:
- $ref: '#/components/parameters/model'
- $ref: '#/components/parameters/callback_url'
- in: query
name: cross_validation_folds
schema:
type: integer
default: null
description: Number of cross validation folds. If this parameter is specified the given training data will be used for a cross-validation instead of using it as test set for the specified model. Note that this is only supported for YAML data.
requestBody:
required: true
content:
application/x-yaml:
schema:
type: string
description: NLU training data and model configuration. The model configuration is only required if cross-validation is used.
example: "nlu: - intent: greet\n examples: |\n - hey\n - hello\n - hi\n- intent: bye\n examples: |\n - goodbye\n - bye\n - cheers\n\npipeline: - name: KeywordIntentClassifier"
application/json:
schema:
$ref: '#/components/schemas/RasaNLUData'
responses:
200:
description: NLU evaluation result
content:
application/json:
schema:
$ref: '#/components/schemas/NLUEvaluationResult'
204:
$ref: '#/components/responses/204Callback'
400:
$ref: '#/components/responses/400BadRequest'
401:
$ref: '#/components/responses/401NotAuthenticated'
403:
$ref: '#/components/responses/403NotAuthorized'
409:
$ref: '#/components/responses/409Conflict'
500:
$ref: '#/components/responses/500ServerError'
/model/predict:
post:
security:
- TokenAuth: []
- JWT: []
operationId: predictModelAction
tags:
- Model
summary: Predict an action on a temporary state
description: Predicts the next action on the tracker state as it is posted to this endpoint. Rasa will create a temporary tracker from the provided events and will use it to predict an action. No messages will be sent and no action will be run.
parameters:
- $ref: '#/components/parameters/include_events'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/EventList'
responses:
200:
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/PredictResult'
400:
$ref: '#/components/responses/400BadRequest'
401:
$ref: '#/components/responses/401NotAuthenticated'
403:
$ref: '#/components/responses/403NotAuthorized'
409:
$ref: '#/components/responses/409Conflict'
500:
$ref: '#/components/responses/500ServerError'
/model/parse:
post:
security:
- TokenAuth: []
- JWT: []
operationId: parseModelMessage
tags:
- Model
summary: Parse a message using the Rasa model
description: Predicts the intent and entities of the message posted to this endpoint. No messages will be stored to a conversation and no action will be run. This will just retrieve the NLU parse results.
parameters:
- $ref: '#/components/parameters/emulation_mode'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
text:
type: string
description: Message to be parsed
example: Hello, I am Rasa!
message_id:
type: string
description: Optional ID for message to be parsed
example: b2831e73-1407-4ba0-a861-0f30a42a2a5a
responses:
200:
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/ParseResult'
400:
$ref: '#/components/responses/400BadRequest'
401:
$ref: '#/components/responses/401NotAuthenticated'
403:
$ref: '#/components/responses/403NotAuthorized'
500:
$ref: '#/components/responses/500ServerError'
/model:
put:
security:
- TokenAuth: []
- JWT: []
operationId: replaceModel
tags:
- Model
summary: Replace the currently loaded model
description: 'Updates the currently loaded model. First, tries to load the model from the local (note: local to Rasa server) storage system. Secondly, tries to load the model from the provided model server configuration. Last, tries to load the model from the provided remote storage.'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ModelRequest'
responses:
204:
description: Model was successfully replaced.
400:
$ref: '#/components/responses/400BadRequest'
401:
$ref: '#/components/responses/401NotAuthenticated'
403:
$ref: '#/components/responses/403NotAuthorized'
500:
$ref: '#/components/responses/500ServerError'
delete:
security:
- TokenAuth: []
- JWT: []
operationId: unloadModel
tags:
- Model
summary: Unload the trained model
description: Unloads the currently loaded trained model from the server.
responses:
204:
description: Model was sucessfully unloaded.
401:
$ref: '#/components/responses/401NotAuthenticated'
403:
$ref: '#/components/responses/403NotAuthorized'
components:
schemas:
FormEvent:
allOf:
- $ref: '#/components/schemas/BasicEvent'
- type: object
properties:
event:
enum:
- form
example: form
SessionStartedEvent:
allOf:
- $ref: '#/components/schemas/BasicEvent'
- type: object
properties:
event:
enum:
- session_started
example: session_started
ActionExecutionRejectedEvent:
allOf:
- $ref: '#/components/schemas/BasicEvent'
- type: object
properties:
event:
enum:
- action_execution_rejected
example: action_execution_rejected
ConversationAccuracyReport:
type: object
properties:
accuracy:
type: number
example: 0.19047619047619047
correct:
type: number
example: 18
with_warnings:
type: number
example: 1
total:
type: number
example: 20
EntitiesAddedEvent:
allOf:
- $ref: '#/components/schemas/BasicEvent'
- type: object
properties:
event:
enum:
- entities
example: entities
entities:
type: array
items:
type: object
properties:
start:
type: integer
end:
type: integer
entity:
type: string
confidence:
type: number
extractor:
type: string
nullable: true
value: {}
role:
type: string
nullable: true
group:
type: string
nullable: true
required:
- entity
- value
required:
- entities
Error:
type: object
properties:
version:
type: string
description: Rasa version
status:
type: string
enum:
- failure
description: Status of the requested action
message:
type: string
description: Error message
reason:
type: string
description: Error category
details:
type: object
description: Additional error information
help:
type: string
description: Optional URL to additonal material
code:
type: number
description: HTTP status code
SlotEvent:
allOf:
- $ref: '#/components/schemas/BasicEvent'
- type: object
properties:
event:
enum:
- slot
example: slot
name:
type: string
value: {}
required:
- name
- value
ParseResult:
type: object
properties:
entities:
type: array
description: Parsed entities
items:
$ref: '#/components/schemas/Entity'
intent:
$ref: '#/components/schemas/Intent'
intent_ranking:
type: array
description: Scores of all intents
items:
$ref: '#/components/schemas/Intent'
text:
type: string
description: Text of the message
example: Hello!
description: NLU parser information. If set, message will not be passed through NLU, but instead this parsing information will be used.
required:
- text
RestartEvent:
allOf:
- $ref: '#/components/schemas/BasicEvent'
- type: object
properties:
event:
enum:
- restart
example: restart
CancelReminderEvent:
allOf:
- $ref: '#/components/schemas/BasicEvent'
- type: object
properties:
event:
enum:
- cancel_reminder
example: cancel_reminder
Slot:
type: object
additionalProperties:
$ref: '#/components/schemas/SlotValue'
example:
slot_name: slot_value
Event:
anyOf:
- $ref: '#/components/schemas/UserEvent'
- $ref: '#/components/schemas/BotEvent'
- $ref: '#/components/schemas/SessionStartedEvent'
- $ref: '#/components/schemas/ActionEvent'
- $ref: '#/components/schemas/SlotEvent'
- $ref: '#/components/schemas/ResetSlotsEvent'
- $ref: '#/components/schemas/RestartEvent'
- $ref: '#/components/schemas/ReminderEvent'
- $ref: '#/components/schemas/CancelReminderEvent'
- $ref: '#/components/schemas/PauseEvent'
- $ref: '#/components/schemas/ResumeEvent'
- $ref: '#/components/schemas/FollowupEvent'
- $ref: '#/components/schemas/ExportEvent'
- $ref: '#/components/schemas/UndoEvent'
- $ref: '#/components/schemas/RewindEvent'
- $ref: '#/components/schemas/AgentEvent'
- $ref: '#/components/schemas/EntitiesAddedEvent'
- $ref: '#/components/schemas/UserFeaturizationEvent'
- $ref: '#/components/schemas/ActionExecutionRejectedEvent'
- $ref: '#/components/schemas/FormValidationEvent'
- $ref: '#/components/schemas/LoopInterruptedEvent'
- $ref: '#/components/schemas/FormEvent'
- $ref: '#/components/schemas/ActiveLoopEvent'
FormValidationEvent:
allOf:
- $ref: '#/components/schemas/BasicEvent'
- type: object
properties:
event:
enum:
- form_validation
example: form_validation
TrainingResult:
type: string
format: binary
Entity:
type: object
description: Entities within a message
properties:
start:
type: integer
description: Char offset of the start
end:
type: integer
description: Char offset of the end
value:
type: string
description: Found value for entity
entity:
type: string
description: Type of the entity
confidence:
type: number
required:
- start
- end
- value
- entity
BotEvent:
allOf:
- $ref: '#/components/schemas/BasicEvent'
- type: object
properties:
event:
enum:
- bot
example: bot
ResponseSelectorTestError:
description: Error during response prediction which was made during testing
type: object
properties:
text:
type: string
description: Test message
example: are you alright?
intent_response_key_target:
description: Expected retrieval intent
type: string
intent_response_key_prediction:
description: Predicted retrieval intent
$ref: '#/components/schemas/Intent'
SlotValue:
oneOf:
- type: string
- type: array
items:
type: string
ExportEvent:
allOf:
- $ref: '#/components/schemas/BasicEvent'
- type: object
properties:
event:
enum:
- export
example: export
RasaNLUData:
type: object
properties:
common_examples:
type: object
items:
type: array
items:
$ref: '#/components/schemas/CommonExample'
example:
rasa_nlu_data:
common_examples:
- text: hey
intent: greet
entities: []
- text: dear sir
intent: greet
entities: []
- text: i'm looking for a place to eat
intent: restaurant_search
entities: []
- text: i'm looking for a place in the north of town
intent: restaurant_search
entities:
- start: 31
end: 36
value: north
entity: location
- text: show me a mexican place in the centre
intent: restaurant_search
entities:
- start: 31
end: 37
value: centre
entity: location
- start: 10
end: 17
value: mexican
entity: cuisine
UserEvent:
allOf:
- $ref: '#/components/schemas/BasicEvent'
- type: object
description: Event for incoming user message.
properties:
event:
enum:
- user
example: user
text:
type: string
nullable: true
description: Text of user message.
input_channel:
type: string
nullable: true
message_id:
type: string
nullable: true
parse_data:
$ref: '#/components/schemas/ParseResult'
UndoEvent:
allOf:
- $ref: '#/components/schemas/BasicEvent'
- type: object
properties:
event:
enum:
- undo
example: undo
EvaluationItem:
type: object
description: Evaluation Result
properties:
report:
$ref: '#/components/schemas/EvaluationReport'
accuracy:
type: number
example: 0.19047619047619047
f1_score:
type: number
example: 0.06095238095238095
precision:
type: number
example: 0.036281179138321996
predictions:
type: array
description: The predictions for each item in the test set
items:
type: object
properties:
intent:
type: string
example: greet
predicted:
type: string
example: greet
text:
type: string
example: hey
confidence:
type: number
example: 0.9973567
errors:
description: The errors which were made during the testing.
type: array
items:
oneOf:
- $ref: '#/components/schemas/IntentTestError'
- $ref: '#/components/schemas/EntityTestError'
- $ref: '#/components/schemas/ResponseSelectorTestError'
EndpointConfig:
type: object
properties:
url:
type: string
description: URL pointing to model
params:
type: object
description: Parameters of request
headers:
type: object
description: HTTP headers
basic_auth:
description: Basic authentification data
type: object
token:
description: Token
type: string
token_name:
description: Name of token
type: string
wait_time_between_pulls:
type: integer
description: Time to wait between pulls from model server
IntentTestError:
description: Intent prediction errors which was made during testing
type: object
properties:
text:
type: string
description: Test message
example: are you alright?
intent_response_key_target:
description: Expected intent
type: string
intent_response_key_prediction:
description: Predicted intent
$ref: '#/components/schemas/Intent'
ReminderEvent:
allOf:
- $ref: '#/components/schemas/BasicEvent'
- type: object
properties:
event:
enum:
- reminder
example: reminder
EntityTestError:
description: Entity prediction errors which was made during testing
type: object
properties:
text:
type: string
description: Test message
example: what is the weather in zurich?
entities:
description: Expected entities
type: array
items:
$ref: '#/components/schemas/Entity'
predicted_entities:
description: Predicted entities
type: array
items:
$ref: '#/components/schemas/Entity'
ResetSlotsEvent:
allOf:
- $ref: '#/components/schemas/BasicEvent'
- type: object
properties:
event:
enum:
- reset_slots
example: reset_slots
EventList:
type: array
items:
$ref: '#/components/schemas/Event'
EvaluationReport:
type: object
description: Sklearn classification report, see http://scikit-learn.org/stable/modules/generated/sklearn.metrics.classification_report.html
example:
greet:
precision: 0.123
recall: 0.456
f1-score: 0.12
support: 100
confused_with:
chitchat: 3
nlu_fallback: 5
micro avg:
precision: 0.123
recall: 0.456
f1-score: 0.12
support: 100
macro avg:
precision: 0.123
recall: 0.456
f1-score: 0.12
support: 100
weightedq avg:
precision: 0.123
recall: 0.456
f1-score: 0.12
support: 100
NLUEvaluationResult:
type: object
properties:
intent_evaluation:
description: Rasa NLU intent evaluation
$ref: '#/components/schemas/EvaluationItem'
response_selection_evaluation:
description: Evaluation for the retrieval intents
$ref: '#/components/schemas/EvaluationItem'
entity_evaluation:
description: Rasa NLU entity evaluation.
type: object
additionalProperties:
type: object
description: Evaluation for a specific extractor
$ref: '#/components/schemas/EvaluationItem'
EvaluationStoriesResult:
type: object
properties:
actions:
type: array
items:
type: object
properties:
action:
type: string
description: Name of the actual action
example: utter_ask_howcanhelp
predicted:
type: string
description: Name of the predicted action
example: utter_ask_howcanhelp
policy:
type: string
description: Machine-learning policy used in the prediction
example: policy_0_MemoizationPolicy
confidence:
type: string
description: Confidence score of the prediction
example: 1.0
description: Accuracy of the classification, http://scikit-learn.org/stable/modules/generated/sklearn.metrics.accuracy_score.html
is_end_to_end_evaluation:
type: boolean
description: True if evaluation is end-to-end, false otherwise
example: true
precision:
type: number
description: Precision of the classification, see http://scikit-learn.org/stable/modules/generated/sklearn.metrics.precision_score.html
example: 1.0
f1:
type: number
description: F1 score of the classification, http://scikit-learn.org/stable/modules/generated/sklearn.metrics.precision_score.html
example: 0.9333333333333333
accuracy:
type: number
description: Accuracy of the classification, http://scikit-learn.org/stable/modules/generated/sklearn.metrics.accuracy_score.html
example: 0.9
in_training_data_fraction:
type: number
description: Fraction of stories that are present in the training data of the model loaded at evaluation time.
example: 0.8571428571428571
report:
type: object
description: Sklearn classification reported extended with information about conversation accuracy.
additionalProperties:
type: object
properties:
intent_name:
type: string
classification_report:
$ref: '#/components/schemas/EvaluationReport'
properties:
conversation_accuracy:
$ref: '#/components/schemas/ConversationAccuracyReport'
CommonExample:
type: object
properties:
entities:
description: Expected entities
type: array
items:
$ref: '#/components/schemas/Entity'
intent:
type: string
description: Intent name
text:
type: string
description: Text of the message
example: Hello!
ActiveLoopEvent:
allOf:
- $ref: '#/components/schemas/BasicEvent'
- type: object
properties:
event:
enum:
- active_loop
example: active_loop
UserFeaturizationEvent:
allOf:
- $ref: '#/components/schemas/BasicEvent'
- type: object
properties:
event:
enum:
- user_featurization
example: user_featurization
LoopInterruptedEvent:
allOf:
- $ref: '#/components/schemas/BasicEvent'
- type: object
properties:
event:
enum:
- loop_interrupted
example: loop_interrupted
PredictResult:
type: object
properties:
scores:
type: array
description: Prediction results
items:
type: object
properties:
action:
type: string
description: Action name
example: utter_greet
score:
type: number
description: Assigned score
example: 1.0
policy:
type: string
description: Policy which predicted the most likely action
example: policy_2_TEDPolicy
tracker:
$ref: '#/components/schemas/Tracker'
StoriesTrainingData:
type: string
description: Rasa Core stories in YAML format
example: "- story: happy path\n steps:\n - intent: greet\n - action: utter_greet\n - intent: mood_great\n - action: utter_happy\n\n- story: sad path 1\n steps:\n - intent: greet\n - action: utter_greet\n - intent: mood_unhappy\n - action: utter_cheer_up\n - action: utter_did_that_help\n - intent: affirm\n - action: utter_happy\n\n- story: sad path 2\n steps:\n - intent: greet\n - action: utter_greet\n - intent: mood_unhappy\n - action: utter_cheer_up\n - action: utter_did_that_help\n - intent: deny\n - action: utter_goodbye\n\n- story: say goodbye\n steps:\n - intent: goodbye\n - action: utter_goodbye"
FollowupEvent:
allOf:
- $ref: '#/components/schemas/BasicEvent'
- type: object
properties:
event:
enum:
- followup
example: followup
PauseEvent:
allOf:
- $ref: '#/components/schemas/BasicEvent'
- type: object
properties:
event:
enum:
- pause
example: pause
LatestAction:
type: object
properties:
action_name:
type: string
description: latest action name
action_text:
type: string
description: text of last bot utterance
description: Latest bot action.
RewindEvent:
allOf:
- $ref: '#/components/schemas/BasicEvent'
- type: object
properties:
event:
enum:
- rewind
example: rewind
ActionEvent:
allOf:
- $ref: '#/components/schemas/BasicEvent'
- type: object
properties:
event:
enum:
- action
example: action
policy:
type: string
nullable: true
confidence:
type: number
nullable: true
name:
type: string
nullable: true
hide_rule_turn:
type: boolean
action_text:
type: string
nullable: true
ModelRequest:
type: object
properties:
model_file:
type: string
description: Path to model file
example: /absolute-path-to-models-directory/models/20190512.tar.gz
model_server:
$ref: '#/components/schemas/EndpointConfig'
remote_storage:
description: Name of remote storage system
type: string
example: aws
enum:
- aws
- gcs
- azure
Tracker:
type: object
description: Conversation tracker which stores the conversation state.
properties:
conversation_id:
type: string
description: ID of the conversation
example: default
slots:
type: array
description: Slot values
items:
$ref: '#/components/schemas/Slot'
latest_message:
$ref: '#/components/schemas/ParseResult'
latest_event_time:
type: number
description: Most recent event time
example: 1537645578.314389
followup_action:
type: string
description: Deterministic scheduled next action
paused:
type: boolean
description: Bot is paused
example: false
events:
description: Event history
$ref: '#/components/schemas/EventList'
latest_input_channel:
type: string
description: Communication channel
example: rest
latest_action_name:
type: string
description: Name of last bot action
example: action_listen
latest_action:
$ref: '#/components/schemas/LatestAction'
active_loop:
type: object
description: Name of the active loop
properties:
name:
type: string
description: Name of the active loop
# --- truncated at 32 KB (39 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/rasa/refs/heads/main/openapi/rasa-model-api-openapi.yml