Skip to content

Jun1409/FinalYearProject

Repository files navigation

Overview

This project is a full-stack AI-powered platform for document upload, search, and analysis. It combines FastAPI (Python backend), a modern frontend, and several AI/ML and database components (Weaviate, MySQL, Redis, Ollama, etc.) to provide semantic search, chunking, embedding, and LLM-based question answering over uploaded documents.


Folders

  • FastApiBackend: content all of the backend code including authentication logic, retreival logic and database setup.
  • test1: content all of the frontend code with interface setup the styling is with inline styling for easier modification
  • diagram: content all of the system flow charts

Tech Stack

  • Backend: FastAPI (Python)
  • Frontend: (React/Vue/Other) (Check frontend folder for details)
  • Database: MySQL (for metadata), Redis (for caching), Weaviate (vector DB)
  • LLM/Embedding: Ollama, LangChain, Nomic Embed, OpenAI, Google GenAI
  • Others: Docker, Docker Compose, NLTK, SQLAlchemy, Pydantic

Prerequisites

Before setting up the project, make sure you have the following dependencies installed and setup on your machine:

  • Python (required for the backend code Steps)
  • Nodejs (required for the frontend code Steps)
  • Docker Desktop (including Docker Compose)
  • Git (for cloning the repository)
  • NVIDIA GPU and drivers (required for GPU-accelerated LLMs and embeddings, make sure cuda is installed and setup properly Steps)
  • Sufficient RAM (at least 6GB recommended for all services to run smoothly)
  • Docker Hub account (if you want to push/pull images)
  • Ollama (for local llm usage, make sure nomic-embed-text is install in your ollama)
  • Test documents (for testing purposes, can download from arxiv with the provided scripts or other sources)

Getting Started

1. Clone the Repository

git clone <repo-url>
cd FYP_final

2. Set Up Environment Variables

Create a .env file in the FastApiBackend folder with the setting below, the value should follow your device settings and the docker service setup

DB_HOST
DB_PORT
DB_USER
DB_PASSWORD
DB_NAME
SECRET_KEY
ALGORITHM
ACCESS_TOKEN_EXPIRE_MINUTES
REDIS_HOST
REDIS_PORT 
FRONTEND_ADDRESS 
DEPLOYMENT_MODE 

3. Build and Run with Docker Compose

docker-compose build
docker-compose up

4. Access the Application


For development

1. Download dependencies libraries for backend

cd FastApiBackend
pip install -r requirement.txt

2. Download dependencies libraries for frontend

cd test1
npm install

3. Change all of the address from docker instance to localhost

Need to change from docker deployment environment to local development environment

Example:

api_endpoint="http://host.docker.internal:11434"

To

api_endpoint="http://localhost:11434"

Important

Do not change the docker.internal path in the def CollectionCreation() function in the preprocessing.py file

4. Run backend on localhost

uvicorn ApiEndPoint:app --reload   

5. Run frontend on localhost

npm start

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published