Skip to content

vineet416/FinEduGuide-AI-Assistant

Repository files navigation

FinEduGuide - AI-Powered Financial Education Assistant πŸŽ“

An open-source, AI-powered platform that transforms financial education content into personalized learning experiences. Users can upload banking/finance documents or input topics to receive tailored educational content, quizzes, and explanations powered by advanced RAG (Retrieval-Augmented Generation) technology.

πŸ“‹ Table of Contents

🎯 Project Description

FinEduGuide is an intelligent educational platform designed for banking and finance learning. It combines the power of:

  • RAG (Retrieval-Augmented Generation) for context-aware responses
  • Vector Database (Pinecone) for efficient document storage and retrieval
  • Generative AI (OpenAI, Llama, Gemini via EuriAI) for content generation
  • FastAPI backend for robust API services
  • Streamlit frontend for intuitive user interaction
  • AWS Cloud Infrastructure for scalable deployment
  • CI/CD Pipeline with GitHub Actions for automated deployments

Target Users:

  • Students and educators in banking/finance
  • Self-learners interested in financial topics
  • Developers exploring AI in education

πŸ”— Project Links

✨ Features

  • πŸ“„ Document Upload: Upload PDF and text files containing financial education content
  • πŸ” Intelligent Q&A: Ask questions and receive AI-generated answers based on uploaded documents
  • 🧠 RAG-Powered Responses: Context-aware answers using retrieval-augmented generation
  • πŸ’Ύ Cloud Storage: Automatic file backup to AWS S3
  • πŸ”’ Vector Embeddings: Document content stored as embeddings in Pinecone for semantic search
  • 🎨 Interactive UI: User-friendly Streamlit interface for seamless interaction
  • ⚑ Fast API Backend: RESTful API with automatic Swagger documentation
  • 🐳 Dockerized: Containerized application for consistent deployments
  • πŸ”„ CI/CD Pipeline: Automated deployment using GitHub Actions
  • ☁️ AWS Deployment: Scalable cloud infrastructure with EC2 and ECR

πŸ› οΈ Technology Stack

Backend

  • Python 3.11
  • FastAPI (API framework)
  • Uvicorn (ASGI server)

Frontend

  • Streamlit (Web interface)

AI/ML

  • EuriAI (Generative AI API)
  • Pinecone (Vector database)
  • LangChain (LLM framework)
  • PyTorch (ML operations)
  • EasyOCR (Text extraction)
  • PyMuPDF (PDF processing)

Cloud & DevOps

  • AWS EC2 (Compute)
  • AWS S3 (Storage)
  • AWS ECR (Container registry)
  • Docker (Containerization)
  • GitHub Actions (CI/CD)

Additional Libraries

  • Boto3 (AWS SDK)
  • python-dotenv (Environment management)
  • python-multipart (File upload handling)

πŸ“ Project Structure

FinEduGuide/
β”‚
β”œβ”€β”€ main.py                      # FastAPI application entry point
β”œβ”€β”€ streamlit_app.py             # Streamlit frontend application
β”œβ”€β”€ requirements.txt             # Python dependencies
β”œβ”€β”€ setup.py                     # Package setup configuration
β”œβ”€β”€ Dockerfile                   # Docker configuration
β”œβ”€β”€ README.md                    # Project documentation
β”œβ”€β”€ LICENSE                      # License file
β”‚
β”œβ”€β”€ data/                        # Data directory
β”‚   └── RBI_SEBI_Finance_Education_Content.txt
β”‚
β”œβ”€β”€ src/                         # Source code
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ logger.py                # Logging configuration
β”‚   β”œβ”€β”€ exception.py             # Custom exception handling
β”‚   β”‚
β”‚   β”œβ”€β”€ components/              # Core components
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ input_handler.py         # Input processing
β”‚   β”‚   β”œβ”€β”€ generative_ai.py         # AI model integration
β”‚   β”‚   β”œβ”€β”€ rag_engine.py            # RAG implementation
β”‚   β”‚   β”œβ”€β”€ vector_db_client.py      # Pinecone operations
β”‚   β”‚   β”œβ”€β”€ content_formatter.py     # Content formatting
β”‚   β”‚   └── S3_storage_service.py    # AWS S3 operations
β”‚   β”‚
β”‚   β”œβ”€β”€ config/                  # Configuration modules
β”‚   β”‚   └── __init__.py
β”‚   β”‚
β”‚   └── utils/                   # Utility functions
β”‚       β”œβ”€β”€ __init__.py
β”‚       β”œβ”€β”€ process_file_utils.py    # File processing utilities
β”‚       └── prompt_templates.py      # AI prompt templates
β”‚
└── logs/                        # Application logs

πŸ”Œ API Endpoints

The FastAPI backend provides the following endpoints:

Base URL: http://13.200.38.182:8080

Method Endpoint Description
POST /upload-file Upload financial education documents (PDF/TXT)
POST /generate-content Generate AI responses based on user queries
GET /docs Interactive API documentation (Swagger UI)
GET /redoc Alternative API documentation (ReDoc)

Swagger Documentation: Visit /docs endpoint for interactive API testing

πŸ—οΈ Architecture Diagram

FinEduGuide Architecture Diagram

πŸš€ Deployment

Production Deployment

Backend (FastAPI)

  • Platform: AWS EC2 (Ubuntu)
  • Container: Docker image stored in AWS ECR
  • CI/CD: GitHub Actions for automated deployments
  • Access: http://13.200.38.182:8080

Frontend (Streamlit)

Infrastructure

  • Storage: AWS S3 (Document storage)
  • Vector DB: Pinecone Cloud
  • CI/CD: GitHub Actions with self-hosted runner on EC2

πŸš€ How to Run

Prerequisites

  • Python 3.11
  • Conda or venv
  • AWS Account
  • Pinecone Account
  • EuriAI API Key

Local Development Setup

1. Clone the Repository

git clone https://github.com/vineet416/FinEduGuide-AI-Assistant.git
cd FinEduGuide-AI-Assistant

2. Create Virtual Environment

conda create -p venv python==3.11 -y
conda activate venv/

3. Install Dependencies

pip install -r requirements.txt

4. Set Up Pinecone

5. Set Up EuriAI

6. Set Up AWS

  • Login to AWS Console
  • Create IAM user with policies:
    • AmazonS3FullAccess
    • AmazonEC2ContainerRegistryFullAccess
    • AmazonEC2FullAccess
  • Generate Access Key and Secret Access Key (CLI)
  • Create S3 bucket: fineduguide-bucket

7. Configure Environment Variables

Create .env file in root directory:

EURIAI_API_KEY=your_euriai_api_key_here
PINECONE_API_KEY=your_pinecone_api_key_here
AWS_ACCESS_KEY_ID=your_aws_access_key_here
AWS_SECRET_ACCESS_KEY=your_aws_secret_key_here

8. Run FastAPI Server

uvicorn main:app --reload

API will be available at: http://127.0.0.1:8000

9. Configure Streamlit

Create .streamlit/secrets.toml:

FASTAPI_BASE_URL = "http://127.0.0.1:8000"

10. Run Streamlit App

streamlit run streamlit_app.py

App will open at: http://localhost:8501

11. Start Using the App

  • Upload financial education documents via Streamlit UI
  • Documents are processed and stored in Pinecone (vector embeddings) and AWS S3
  • Ask questions in the chatbox to get AI-generated answers

AWS CI/CD Deployment

1. Create ECR Repository

  • Navigate to AWS ECR console
  • Create a new repository
  • Save the repository URI

2. Launch EC2 Instance

  • Instance type: Minimum 8GB RAM, 2 vCPU
  • OS: Ubuntu
  • Configure security groups (allow ports 8080, 22)

3. Install Docker on EC2

sudo apt-get update -y
sudo apt-get upgrade
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker ubuntu
newgrp docker

4. Configure Self-Hosted Runner

  • Go to GitHub repo β†’ Settings β†’ Actions β†’ Runners
  • Click "New self-hosted runner"
  • Select OS: Linux
  • Run provided commands on EC2 instance

5. Set Up GitHub Secrets

Add the following secrets in: Settings β†’ Secrets and variables β†’ Actions

  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
  • AWS_DEFAULT_REGION (e.g., ap-south-1)
  • ECR_REPO (your ECR repository name)
  • EURIAI_API_KEY
  • PINECONE_API_KEY

6. Deploy to AWS

git add .
git commit -m "Deploy to AWS"
git push origin main

7. Monitor Deployment

  • Check Actions tab in GitHub repository
  • Once successful, access FastAPI at: http://<EC2-PUBLIC-IP>:8080/docs

8. Deploy Streamlit to Cloud

  • Go to Streamlit Cloud
  • Connect your GitHub repository
  • Add secret in Streamlit dashboard:
FASTAPI_BASE_URL = "http://<EC2-PUBLIC-IP>:8080"

πŸŽ‰ Congratulations! Your FinEduGuide AI Assistant is now deployed!

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

How to Contribute

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ‘€ Author

Vineet Patel


πŸ“„ License

This project is licensed under the terms specified in the LICENSE file.

⭐ Show Your Support

Give a ⭐️ if this project helped you!

About

AI-powered financial education platform using RAG (Retrieval-Augmented Generation) with FastAPI backend and Streamlit frontend. Features Pinecone vector database, LangChain framework, and EuriAI for embeddings and LLM-powered intelligent content generation. Deployed on AWS EC2 with Docker, ECR, S3, and automated CI/CD via GitHub Actions.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors