rasa
**Rasa**
- Open Source Conversational AI
**Overview**
Rasa is an open-source framework for building contextual assistants and chatbots. Unlike visual flow builders (like Botpress), Rasa is "code-first" and uses machine learning to manage dialogue, allowing for more flexible, non-linear conversations.
**Architecture**
**1. Rasa NLU**
Turning text into structure.
- **Intent Classification**: "I want pizza" -> `intent: order_food`
- **Entity Extraction**: "large pepperoni" -> `size: large`, `topping: pepperoni`
**2. Rasa Core (Dialogue Management)**
Deciding what to do next.
Rather than `if/else` flowcharts, Rasa uses "Stories" (training data) to teach a machine learning model how to respond. It can handle interruptions and context switching naturally.
**Files**
- `nlu.yml`: Examples of intents.
- `stories.yml`: Example conversation flows.
- `domain.yml`: List of all intents, entities, slots, and responses.
**Action Server**
Rasa communicates with an external "Action Server" (usually Python) to execute custom code (API calls, DB lookups).
```python
class ActionCheckWeather(Action):
def run(self, dispatcher, tracker, domain):
city = tracker.get_slot("city")
temp = get_weather(city)
dispatcher.utter_message(text=f"It is {temp} in {city}")
return []
```
**Privacy**
Rasa is self-hosted (no data leaves your server), making it popular in healthcare and banking.