This repository contains a chatbot application designed to provide insights into Netflix engagement trends for the year 2023. The system consists of a Flask backend and a React frontend, utilizing advanced AI models, RAG pipeline and text-to-sql to handle user queries about Netflix titles, technical specifications, and engagement trends.
- GPT-4o powered Chat Interface: The chatbot leverages GPT-4o model for natural conversation.
- Vector Search: Uses FAISS for efficient similarity-based queries.
- OAuth2 Authentication: Supports Google login via OAuth2 for secure user access.
- Rate Limiting: Protects the API with rate limiting for a smoother experience.
- SQL-based querying: Provides insights into Netflix titles based on user queries through a powerful text-to-SQL pipeline.
- AI Agents: Utilizes intelligent agents to handle technical queries, provide guided prompts, and deliver structured information.
- Structured Responses: Returns related questions to help users explore similar topics.
- Python (Flask)
- LangChain
- PostgreSQL (TimescaleDB for vector storage)
- JWT-based Authentication
- OAuth2 with Google
- SQLAlchemy ORM
- ReactJS
- React Router
- Axios for HTTP requests
- JWT for authentication
Make sure you have the following installed on your machine:
- Docker & Docker Compose
- Node.js (if running frontend locally)
- Python 3.9+
Note: If you need the required environment variables, please feel free to reach out to me directly.
Create a .env
file in the backend
and frontend
directories with the following variables:
SECRET_KEY=<your-secret-key>
JWT_SECRET_KEY=<your-jwt-secret-key>
GOOGLE_OAUTH_CLIENT_ID=<your-google-client-id>
GOOGLE_OAUTH_CLIENT_SECRET=<your-google-client-secret>
OPENAI_API_KEY=<your-openai-api-key>
EXTERNAL_DB_URL=<your-external-db-url>
CHAT_DB_URL=<your-chat-db-url>
FRONTEND_URL=<frontend-url>
REACT_APP_BACKEND_URL=http://localhost:5001/api
The backend is located in the backend
folder and provides the agent setup for processing user input and retrieving insights from the database.
-
Install dependencies:
cd backend pip install -r requirements.txt
-
Start the Flask server:
python app.py
The frontend is located in the frontend
folder and provides a sleek chat interface for interacting with the chatbot.
-
Install dependencies:
cd frontend npm install
-
Start the React development server:
npm start
You can easily deploy the entire system using Docker and Docker Compose.
-
Build and run the containers:
docker-compose up --build
-
Access the frontend at
http://localhost:3000
and the backend athttp://localhost:5001/api
.
- POST /api/chat: Send a user message to the agent and receive a response.
- GET /api/history: Fetch the chat history of a user for a given chat window.
- GET /api/chat-windows: Retrieve all chat windows for a user.
- POST /api/chat-windows: Create a new chat window.
This project is licensed under the MIT License.