This is a Chat Function That calls Mpesa to Send money Without interacting with mpesa, Just using this OpenAi Chat Tool
# M-Pesa AI Backend with Enhanced Features
A robust FastAPI backend for M-Pesa payment processing with AI-powered conversation management, raw message tracking, and enhanced user experience.
## π Features
### β
**Core Features**
- **M-Pesa STK Push Integration**: Seamless payment processing
- **AI-Powered Conversations**: Google Gemini AI agent for natural interactions
- **Raw Message Tracking**: Track original user messages that triggered transactions
- **Firebase Integration**: User profile management and phone number fetching
- **Transaction History**: Complete payment history with message context
- **Real-time Status Updates**: Live payment status monitoring
### β
**Enhanced Features**
- **Message Deduplication**: Prevents duplicate message processing
- **Rate Limiting**: Protects against API abuse
- **Error Handling**: Graceful error management with user-friendly messages
- **Session Management**: Persistent conversation context
- **Entity Extraction**: Automatic extraction of payment details from messages
## π Project Structure
```
mpesa-ai-backend-corrected-fix/
βββ mpesa-ai-backend-fixed/
β βββ app/
β β βββ main.py # FastAPI application
β β βββ auth.py # Authentication module
β β βββ models.py # Database models
β β βββ conversation_service.py # Conversation management
β β βββ transaction_manager.py # Transaction handling
β β βββ mpesa_agent/
β β βββ agent.py # Base M-Pesa agent
β β βββ enhanced_agent.py # Enhanced AI agent
β β βββ mpesa_tools.py # M-Pesa tools and utilities
β β βββ callback_manager.py # Callback handling
β βββ docs/ # Documentation
β βββ docker/ # Docker configuration
β βββ requirements.txt # Python dependencies
β βββ README.md # This file
βββ .gitignore # Git ignore rules
βββ README.md # Projec β¦