Momentum Chatbot
Python | Flask | SpaCy | FuzzyWuzzy | OpenAI API | JWT | Azure App Service | Swagger
The Challenge
Employees spent an average of 37.5 minutes locating information across 68 regulatory documents spanning ~770 pages. Manual searches, fragmented knowledge, and dependency on specialists created operational bottlenecks and inconsistent responses about internal policies.
The Solution
Chatbot architecture with intelligent hybrid system: local FAQ with SpaCy + FuzzyWuzzy to resolve ~60% of queries instantly (zero cost), with OpenAI fallback for remaining cases. Complete REST API with JWT authentication, interaction logging, and Swagger documentation. Proof of concept validated with real regulatory database.
Architecture
- • Flask REST API with 7 documented endpoints
- • JWT authentication with automatic refresh (1h access, 30d refresh)
- • SpaCy pt_core_news_md for NLP and semantic similarity
- • FuzzyWuzzy for fuzzy FAQ matching (~80 Q&A pairs)
- • OpenAI API as intelligent fallback (~40% of queries)
- • Complete logging system for analytics
- • Rate limiting (100 req/min per user)
- • Interactive Swagger/OpenAPI documentation
- • Deploy-ready for Azure App Service
Metrics
- • Projected average latency: 2.5s (vs. 37.5 min manual search)
- • Estimated accuracy rate: 92-98% precision
- • ~60% queries resolved locally (zero cost)
- • Capacity: 530+ queries/month | 30+ users
- • 68 documents | ~770 pages | 211k tokens indexed
- • Projected savings: ~R$ 136k/year in technical hours
Differentiators
- • Hybrid architecture: ~60% local (SpaCy), ~40% OpenAI. Architecture decision that reduces costs without sacrificing quality.
- • Evolving FAQ: Local base grows with usage, reducing external API dependency over time
- • Automatic citation: Each response references specific standard (code + title)
- • Complete logging: All interactions recorded for analysis and continuous improvement
- • API-first: Integrable with any frontend or internal system
Results
- • Potential 99.9% reduction in query time
- • Estimated 8,278 hours saved/year
- • Democratization of regulatory knowledge
- • Elimination of specialist dependency for basic queries
- • Scalable and auditable knowledge base
Scale: 68 standards | 770 pages | 30+ potential users | Validated PoC | 4-5 months architecture