π€ Edenred Invoice Assistant β Serverless AI Chatbot for Invoice & Payment Support
Part of my ongoing Weekend AI Project Series where I turn weekend experiments into production-grade AI systems.
π― Problem & Goal
Invoice and payment queries overwhelm finance teams β repetitive, predictable, and time-consuming.
I wanted to build a serverless AI assistant that handles these inquiries in real-time, with zero infrastructure overhead and full cost control.
βοΈ Architecture Overview
Tech Stack:
π§ AWS Lambda β Serverless compute for sub-second responses
π§© Amazon SageMaker β Model fine-tuning and batch training
π¦ S3 β Training data, model artifacts, and logs
π API Gateway β REST endpoint serving chatbot responses
π CloudWatch β Monitoring and error tracking
Frontend β API Gateway β AWS Lambda β SageMaker Inference (trained model)
β³ Fallback logic β Pre-trained responses (cost-optimized)
Key Design Principle:
The SageMaker endpoint spins down post-training. Fallback logic (pattern-based responses) handles common queries β maintaining user experience while cutting costs by ~90%.
π‘ Features Implemented
β
Smart Response System:
Handles invoice submissions, payment status, and account queries.
β
SageMaker Training Pipeline:
Fine-tuned Hugging Face model for domain-specific language understanding.
β
Cost-Optimized Fallback Logic:
Pattern-matched responses cover 95% of user queries without active inference cost.
β
Lambda Optimization:
Pre-loaded model weights and response caching = sub-second latency.
β
Enterprise Readiness:
CORS-enabled, IAM roles configured, and robust error handling for production-grade uptime.
π§© System Highlights
Metric Performance
Response Time < 1s average
Accuracy (trained scenarios) 95%+
Uptime 100% (fallback system)
Cost Reduction 90% vs always-on SageMaker
Deployment Serverless (Lambda + API Gateway)
π Chatbot in Action
Demo Scenarios:
βHow do I submit an invoice?β
βCheck payment status.β
βWhy was my invoice rejected?β
βHow do I update my bank details?β
π§± Fallback ensures continuity even if the model endpoint is offline.
βοΈ Technical Implementation
Lambda Function
Handles logic, invokes SageMaker if active, else triggers fallback:
def handler(event, context):
query = event["queryStringParameters"]["q"].lower()
if query in fallback_responses:
return fallback_responses[query]
else:
return sagemaker_inference(query)
Fallback Response Dictionary
python
Copy code
fallback_responses = {
"invoice submission": "You can submit invoices via the Finance Portal under 'Upload Invoice'.",
"payment status": "Payments are processed every Thursday. You can track them via your dashboard.",
"bank details": "Update your bank info under Profile > Payment Settings."
}
π§± Deployment Details
Environment Setup:
Python 3.11
Dependencies in requirements.txt
Deploy via AWS SAM CLI or Serverless Framework
Pipeline:
Train model β Save artifact to S3
Deploy Lambda with model fallback logic
Integrate API Gateway endpoint
Configure CloudWatch for monitoring
π§ Key Learnings
1οΈβ£ Cost vs. Performance: Smart fallbacks drastically reduce inference costs without hurting UX.
2οΈβ£ Serverless Design: Lambda is ideal for low-frequency workloads with instant scale.
3οΈβ£ MLOps Simplified: SageMaker pipelines streamline model iteration and retraining.
4οΈβ£ Enterprise Fit: Combining AI logic with predictable cost makes adoption easier for finance teams.
π§± Repository & Access
π Code: github.com/marcusmayo/ai-ml-portfolio-2
π§ Main Portfolio: github.com/marcusmayo/machine-learning-portfolio
π¬ Closing Thoughts
Building Edenred Invoice Assistant reinforced one key idea:
βIntelligent cost optimization is as valuable as model accuracy.β
This project shows how to merge AI innovation with business pragmatism β a skill every ML product engineer needs.
Follow for More:
πΌ LinkedIn Connect with me
π» GitHub Live Projects
Top comments (1)
π¬ If you enjoyed this deep dive, follow for more weekend AI projects β from cost-optimized MLOps deployments to production-grade LLM builds.