Rasa Configuration
About Rasa
Rasa Open Source is a conversational AI framework for building contextual assistants.
Rasa Open Source includes:
- NLU: Determines what the user wants and captures key contextual information
- Core: Selects the next best response or action based on conversation history
- Channels and integrations: connect assistant to users and backend systems
Rasa X is a tool set used to improve a contextual assistant built using Rasa Open Source.
Natural Language Model
Rasa NLU is an open-source natural language processing tool for intent classification, response retrieval, and entity extraction in chat bots.
Example
For example, taking a sentence like:
"I am looking for a Mexican restaurant in the center of town"
and returning structured data such as:
{
"intent": "search_restaurant",
"entities": {
"cuisine" : "Mexican",
"location" : "center"
}
}
Rasa NLU was once a separate library, but it is now part of the Rasa framework.
Model Configuration
Your model configuration file (YML file below) defines the NLU and Core components that your model uses.
cat config.yml
You can learn about the different NLU pipelines here.
- The
language
andpipeline
keys specify how the NLU model should be built. - The
policies
key defines the policies that the Core model will use.
Train Your Model
For information about how to train your model, see https://rasa.com/docs/rasa/api/http-api/#operation/trainModel.
- Here is where you create the Rasa schema that is used to train the model (you can upload any existing one so that you don’t have to start from scratch).
- Once you download the JSON file, modify it to work with the HTTP API.
- After you’ve modified the JSON file, you can train your model using Postman by making a POST request.
- For example: localhost:5000/train?project=search_for_legal_documents8 (project=search_for_legal_documents8 is optional).
- BA Insight recommends you give your project a name, but it is not required.
- Note that your Rasa NLS server must be running.
- For example: localhost:5000/train?project=search_for_legal_documents8 (project=search_for_legal_documents8 is optional).
Header
In the Header of the request you specify:
- Content Type: application/x-yml
- Request Body: binary
Next, you upload the modified JSON file.
Start-up and Training
- How to start the rasa server:
- rasa run -m models --enable-api --log-file out.log (open the server from the rasa-master folder)
- rasa run -m models --enable-api --log-file out.log (open the server from the rasa-master folder)
- The train request is now made at model/train.
- For example:
http://localhost:5005/model/train
- For example:
- The content type for the train request now has to be application/json
- For the request body, select “raw” and add the JSON found at https://rasa.com/docs/rasa/api/http-api/#operation/trainModel
Test Your Model
One way to test your model is by using Postman: https://www.getpostman.com/downloads/
Using Postman:
- Make a GET request.
- For example: http://localhost:5000/parse?project=search_for_legal_documents8&q=show me all of thomas hulme documents
- The final step is to go to NLQ Settings.
- Copy into the Endpointtext box the endpoint to your Rasa model
- For example: http://localhost:5000/parse?project=search_for_legal_documents8&q=
- You can find all the projects you create in C:\Users\{account}\AppData\Local\Programs\Python\Python37-32\projects
- ...where {account} is the name of the user account used to install Python
Rasa Settings
The NLQ Service Configuration page can be found by accessing theNLQ Service Settingspage from the Administrationpage:
Not every query reachesRasa.
By default, only querieswith at least 3 wordsreachRasa.
Note: At least 1 one the 3 words must be astop-word.
A built-in memory caches questions that are asked multiple times.
If the following settings are changed (such as lowering the value for theMinimum number of words in query necessary to be NLQ), then Rasa is called more often and the quota is reached faster:
- Minimum intent score
- Minimum number of words in query necessary to be NLQ
- Minimum number of stop words in query necessary to be NLQ
The administrator needs to complete the following fields fromNLQ Service Configurationpage:
- Endpoint
- The endpoint to your Rasa model.
- For example: http://localhost:5000/parse?project=search_for_legal_documents8&q=
- The endpoint to your Rasa model.
- Maximum query length
- Maximum query size.
- Supported Source IDs
- Minimum intent score
- Indicates the minimum prediction accuracy for intent.
- A prediction score is between 0 and 1.
- Minimum number of words in query necessary to be NLQ
- An integer.
- Minimum number of stop words in query necessary to be NLQ
- An integer.
- A stop word is a commonly used word (such as “the”, “a”, “an”, “in”).