ai-travel-policy-assistant
by diyamohandas
README.md
# AI Travel & Policy Assistant
An AI-powered Travel & Policy Assistant for corporate travel and employee operations.
## Features
- Travel and expense policy question answering
- Retrieval-Augmented Generation (RAG)
- Semantic search using Sentence Transformers
- FAISS vector database
- Source attribution for policy answers
- Hallucination prevention
- Employee eligibility checking
- Travel request validation
- Reimbursement calculation
- Agentic routing between RAG, tools, and memory
- Conversation memory
- MCP server
- Flask conversational chatbot interface
## Technologies
- Python
- Pandas
- Sentence Transformers
- FAISS
- Flask
- Ollama
- Llama 3.2 3B
- MCP
- HTML, CSS, JavaScript
- Git and GitHub
## Architecture
User -> Flask Chatbot -> Agent Router
The Agent Router determines whether the request requires:
1. RAG for general policy questions
2. Employee tools for eligibility and travel validation
3. Reimbursement calculation
4. Conversation memory
RAG uses policy documents, document chunking, Sentence Transformer embeddings, FAISS retrieval, and an LLM.
## Policy Documents
The knowledge base contains seven fictional policy documents:
- travel_policy_india.txt
- travel_policy_us.txt
- expense_policy.txt
- employee_eligibility.txt
- cancellation_policy.txt
- approval_policy.txt
- airport_policy.txt
Employee information is stored in:
data/employees.csv
All data is fictional training data.
## RAG Pipeline
Policy Documents
-> Ingestion
-> Preprocessing
-> Chunking
-> Sentence Transformer Embeddings
-> FAISS Vector Index
-> Semantic Retrieval
-> Policy Context
-> LLM
-> Answer with Sources
Embedding model:
sentence-transformers/all-MiniLM-L6-v2
Embedding dimension: 384
## Agent Tools
The project provides three main tools:
### Employee Eligibility
Checks whether an employee is eligible for company travel.
### Trip Validation
Validates a travel request using employee and applicable policy information.
### Reimbursement Calculator
Calculates the reimbursable amount and excess amount.
## Memory
Conversation memory is stored in:
artifacts/memory.json
The memory module supports storing and retrieving relevant conversation information.
## MCP
The MCP server is located at:
mcp/server.py
Available MCP tools:
- employee_eligibility
- trip_validation
- reimbursement_calculator
## Flask Application
Start the application with:
python app/app.py
Then open:
http://127.0.0.1:5000
The interface provides a continuous chatbot conversation where previous questions and answers remain visible.
## Build Knowledge Base
To rebuild the FAISS knowledge base:
python scripts/build_knowledge_base.py
Generated artifacts:
- artifacts/chunks.json
- artifacts/policy.index
## Example Questions
What is the standard trip limit in India?
What happens if I exceed the travel limit?
Is EMP001 eligible for company travel?
Is EMP004 eligible for company travel?
Validate trip for EMP001 to Mumbai costing 1500.
Validate trip for EMP001 to Mumbai costing 2500.
Calculate reimbursement for 2500 with a limit of 2000.
What did we discuss earlier?
## Testing
Test scenarios are documented in:
tests/test_cases.md
Testing covers policy retrieval, semantic search, employee eligibility, trip validation, reimbursement calculation, memory, agent routing, hallucination prevention, Flask API behavior, and error handling.
## Project Structure
ai-travel-policy-assistant/
- app/
- artifacts/
- data/
- mcp/
- scripts/
- src/
- tests/
- README.md
- requirements.txt
## Disclaimer
This is a fictional educational training project. Employee records and company policies are sample data and should not be treated as real corporate policies or employee information.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo issues