Skip to main content

Chatbot Implementation - Week 1 Kickoff Guide

Date Started: October 9, 2025
Phase: Week 1 of 10
Status: 🚀 Implementation Started


🎯 Week 1 Goals

Build the Core Chatbot Infrastructure foundation:

  1. ✅ Install all required dependencies
  2. 🔨 Create project structure
  3. 🔨 Build conversational layer (Rasa + spaCy)
  4. 🔨 Create basic API endpoints
  5. 🔨 Build Streamlit demo UI
  6. 🔨 Test end-to-end flow

📦 Step 1: Dependencies Installation

Core Conversational AI

# Rasa for intent recognition & dialogue
pip install rasa>=3.6.0

# NLP libraries
pip install spacy>=3.7.0
pip install nltk>=3.8.1

# Download spaCy model
python -m spacy download en_core_web_lg

UI Components (for demos)

pip install streamlit>=1.28.0
pip install streamlit-chat>=0.1.1
pip install gradio>=4.0.0

Additional utilities

pip install python-dotenv>=1.0.0
pip install pyyaml>=6.0.1

🗂️ Step 2: Project Structure

Create the following directories and files:

recoagent/
├── packages/
│ ├── conversational/ # NEW
│ │ ├── __init__.py
│ │ ├── intent_recognition.py # Rasa NLU integration
│ │ ├── entity_extraction.py # spaCy integration
│ │ ├── dialogue_manager.py # Rasa Core integration
│ │ └── config/
│ │ ├── nlu_config.yml # Rasa NLU config
│ │ ├── domain.yml # Rasa domain
│ │ └── stories.yml # Conversation flows
│ │
│ └── agents/ # EXISTING (enhance)
│ └── chatbot_orchestrator.py # NEW: Chatbot-specific orchestration

├── apps/
│ └── api/
│ ├── chatbot_api.py # NEW: Chatbot endpoints
│ └── main.py # EXISTING (enhance)

├── examples/
│ └── chatbot/ # NEW
│ ├── streamlit_demo.py # Quick demo UI
│ ├── basic_chatbot.py # Basic usage example
│ └── README.md # Examples documentation

└── tests/
└── test_conversational/ # NEW
├── test_intent_recognition.py
├── test_entity_extraction.py
└── test_dialogue_manager.py

🛠️ Step 3: Build Components

Task 3.1: Intent Recognition Layer

File: packages/conversational/intent_recognition.py

Purpose: Understand user intent using Rasa NLU

Key Features:

  • Load Rasa NLU model
  • Classify user intent
  • Extract confidence scores
  • Multi-language support (future)

Integration: Pre-processing before LangGraph agent


Task 3.2: Entity Extraction

File: packages/conversational/entity_extraction.py

Purpose: Extract entities using spaCy

Key Features:

  • Named entity recognition
  • Custom entity patterns
  • Context-aware extraction
  • Integration with Rasa entities

Task 3.3: Dialogue Manager

File: packages/conversational/dialogue_manager.py

Purpose: Manage multi-turn conversations using Rasa Core

Key Features:

  • Conversation state tracking
  • Context management
  • Slot filling
  • Follow-up question handling

Task 3.4: Chatbot API Endpoints

File: apps/api/chatbot_api.py

Endpoints to Create:

POST /chatbot/message          # Send message to chatbot
GET /chatbot/history/{user_id} # Get conversation history
POST /chatbot/feedback # Submit feedback
GET /chatbot/intents # List available intents
WS /chatbot/stream # WebSocket for streaming

Task 3.5: Streamlit Demo

File: examples/chatbot/streamlit_demo.py

Features:

  • Simple chat interface
  • Message history
  • Intent display
  • Entity display
  • Agent selection
  • Clear conversation button

🔄 Step 4: Integration Flow

User Input

Intent Recognition (Rasa NLU)

Entity Extraction (spaCy)

Dialogue Management (Rasa Core)

Agent Selection (Route to LangGraph)

Existing LangGraph Agent

Response

✅ Step 5: Testing Checklist

Unit Tests

  • Test intent recognition accuracy
  • Test entity extraction
  • Test dialogue state management
  • Test API endpoints
  • Test Streamlit UI

Integration Tests

  • Test intent → LangGraph flow
  • Test multi-turn conversations
  • Test conversation history
  • Test error handling

Manual Testing

  • Send simple query through Streamlit
  • Test multi-turn conversation
  • Test intent switching
  • Test error scenarios

📊 Success Criteria for Week 1

Must Have

  • ✅ All dependencies installed
  • ✅ Project structure created
  • ✅ Basic intent recognition working
  • ✅ Entity extraction functional
  • ✅ Simple dialogue flow working
  • ✅ API endpoints responding
  • ✅ Streamlit demo functional

Nice to Have

  • ⚠️ Multiple intents trained
  • ⚠️ Custom entity patterns
  • ⚠️ Error handling polished
  • ⚠️ Logging comprehensive

🚀 Getting Started

Immediate Actions (Today)

  1. Install Dependencies

    cd /Users/sparshagarwal/Desktop/work/recohut/recoagent
    pip install rasa>=3.6.0 spacy>=3.7.0 streamlit>=1.28.0
    python -m spacy download en_core_web_lg
  2. Create Project Structure

    mkdir -p packages/conversational/config
    mkdir -p examples/chatbot
    mkdir -p tests/test_conversational
  3. Create Initial Files

    • Create __init__.py files
    • Create placeholder files for each component
    • Set up basic Rasa configuration

📝 Implementation Order

Day 1-2: Setup & Intent Recognition

  1. Install dependencies
  2. Create project structure
  3. Build intent recognition layer
  4. Create basic Rasa NLU config
  5. Train first model

Day 3-4: Entity Extraction & Dialogue

  1. Build entity extraction
  2. Integrate with spaCy
  3. Create dialogue manager
  4. Test multi-turn conversations

Day 5-6: API & UI

  1. Create API endpoints
  2. Build Streamlit demo
  3. Integrate with existing agents
  4. Test end-to-end flow

Day 7: Testing & Polish

  1. Write unit tests
  2. Write integration tests
  3. Fix bugs
  4. Document code

🎯 Milestones

  • Milestone 1.1 (Day 2): Intent recognition working
  • Milestone 1.2 (Day 4): Dialogue management functional
  • Milestone 1.3 (Day 6): Streamlit demo deployed
  • Milestone 1.4 (Day 7): All tests passing

📚 Resources

Documentation

Tutorials

Examples


🐛 Common Issues & Solutions

Issue 1: Rasa Installation Fails

Solution: Use specific versions, install dependencies separately

pip install tensorflow>=2.12.0
pip install rasa>=3.6.0

Issue 2: spaCy Model Not Found

Solution: Download model explicitly

python -m spacy download en_core_web_lg

Issue 3: Streamlit Port Conflict

Solution: Use different port

streamlit run app.py --server.port 8502

💡 Tips for Success

  1. Start Simple: Get basic flow working first
  2. Test Early: Test each component as you build
  3. Use Examples: Refer to Rasa examples for patterns
  4. Document: Add docstrings and comments
  5. Iterate: Don't aim for perfection in Week 1

📞 Next Steps After Week 1

Once Week 1 is complete:

  1. Week 2: Enhance dialogue flows, add more intents
  2. Week 3-4: Build production UI (Chainlit)
  3. Week 5: Add multi-channel support
  4. Week 6: Add voice capabilities

✅ Ready to Start!

Current Status: Setup phase
Next Action: Install dependencies and create project structure

Let's build this! 🚀