A Retrieval-Augmented Generation (RAG) powered assistant built to understand and answer coding questions using real codebases. It integrates LangChain, FAISS, and Transformers to deliver context-aware and accurate Python code support — like your AI pair programmer.
PROJECT/
├── data/
│ ├── merged_faiss_index/
│ │ ├── index.faiss
│ │ └── index.pkl
│ └── transformers_embeddings.pkl # (optional, >100MB)
├── main.py
├── utils.py
├── run.py
├── .env # Not pushed to repo
├── requirements.txt
└── README.md
1# Create and activate your virtual environment
2python -m venv venv
3source venv/bin/activate # or .\venv\Scripts\activate on Windows
4
5# Install dependencies
6pip install -r requirements.txt
7⚠️ You'll need to set environment variables in a .env file (not included). Example:
8
9env
10Copy
11Edit
12OPENAI_API_KEY=your_key_here
13
14## SAMPLE OUTPUT
15 You: write detailed code of linear regression
16
17 ANSWER: ```python
18# Import the necessary libraries
19from sklearn.linear_model import LinearRegression # Import the LinearRegression class
20from sklearn.datasets import load_boston # Import the load_boston function to load the Boston housing dataset
21
22# Load the Boston housing dataset
23boston = load_boston()
24
25# Extract the features (X) and the target (y) from the dataset
26X = boston.data
27y = boston.target
28
29# Create a linear regression model
30model = LinearRegression()
31
32# Train the model
33model.fit(X, y) # Fit the model to the data
34
35# Make predictions
36predictions = model.predict(X) # Use the predict method to make predictions
37
38# Print the coefficients
39print("Coefficients:", model.coef_) # Print the coefficients of the linear model
40
41# Print the intercept
42print("Intercept:", model.intercept_) # Print the intercept of the linear model
43
44# Print the mean squared error
45print("Mean squared error:", model.score(X, y)) # Print the mean squared error of the model
This code first imports the necessary libraries and loads the Boston housing dataset. It then creates a LinearRegression model and trains it on the dataset using the fit method. The predict method is then used to make predictions, and the coefficients, intercept, and mean squared error are printed.