How rasahq/rasa-calm-demo works
Project Type and Purpose
• This is a full-stack conversational AI demo built on Rasa’s “CALM” (LLM-native) architecture.
• Purpose: showcase different conversational flows (LLM-based and NLU-based), enterprise search via Qdrant, and end-to-end testing for QA.
File Structure Analysis
• Top-level folders:
• actions/ → custom Python actions invoked by the bot
• data/ → training data: CALM flows, NLU stories, prompts
• domain/ → domain definitions for each flow (slots, responses, actions)
• config/ → Rasa pipeline & policy configurations (config.yml plus alternatives)
• e2e_tests/ → end-to-end test scripts, including a mock LLM server under llm_mock_server/
• addons/ → custom enterprise-search component (Qdrant connector)
• scripts/ → utilities: load data into Qdrant, patch dependencies, explore data
• llm_mock_server/→ standalone mock server for simulating LLM responses
• db/ → static JSON files simulating persistent store (contacts, transactions)
• logging_config.yml, endpoints.yml, Makefile, pyproject.toml, etc. (build & run)
README Insights
• Describes CALM flows (YAML files under data/flows and domain/flows) coexisting with NLU-based flows.
• Highlights components: Rasa Core, custom actions, Duckling for entity extraction, OpenAI API for LLMs, Qdrant for vector search.
• Outlines dev setup: Rasa Pro license, Python env, Duckling server, training & running via Makefile, E2E tests.
a. Main Components
• User Channel (CLI or Rasa Inspector)
• Rasa Server (Core & Execution Engine)
• Configuration & Data Stores:
• domain/ (slots, responses, actions)
• data/ (flows, NLU training data, prompts)
• models/ (trained Rasa models)
• Action Server (actions/ folder)
• External Services:
• LLM Provider (OpenAI API or Mock LLM Server)
• Duckling Server (entity extraction)
• Qdrant Vector DB (enterprise search)
• JSON DB files (db/ folder for demo persistence)
b. Relationships and Interactions
1. User → Rasa HTTP endpoint (shell or inspect)
2. Rasa NLU Pipeline (config.yml) calls Duckling for date/number extraction
3. Rasa Core applies policies (FlowPolicy, EnterpriseSearchPolicy) to select next step
4. If custom action is needed → Rasa Core makes HTTP request to Action Server
5. Action Server code may:
• Read/write JSON DB
• Call external LLM (OpenAI or mock) for prompt generation or completions
• Query Qdrant for enterprise search via addons/qdrant.py
6. Action Server returns results → Rasa Core → user response
c. Architectural Patterns & Principles
• Separation of Concerns: Core engine vs. custom action execution
• Pluggable Pipelines: configurable via config/*.yml
• Flow-based vs. NLU-based hybrid conversational design
• Microservice-style external dependencies (Duckling, Qdrant, LLM server)
d. Key Technologies & Frameworks
• Rasa Pro (3.14.0): Core, NLU, CALM flows
• Python 3.10+
• Duckling (Docker container)
• OpenAI LLM API (or local mock)
• Qdrant (vector database)
• pytest-style E2E tests with YAML scenarios