Skip to content

This repo contains code for a custom RAG system that I use to ask questions about the different slides and class content when I am studying.

Notifications You must be signed in to change notification settings

ahmed-boutar/custom-RAG

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Custom RAG

This project is an attempt to create a custom RAG system, where I can upload my lecture slides and have an LLM answer my questions with content from the slides and sources referencing each slide. The LLM used is gpt-4o.

This repo us currently being used for a hosted streamlit app.

How it works

When you upload a pptx or a collection of powerpoint files, the app will process each file and:

  • Parses all the slides to extract the text
  • Chunks the text (you can look into preprocessAndChunk.py to learn about the chunking strategy => very naive since I haven't used any library and tried to do it on my own)
  • Generates embeddings from the text using gpt-4o
  • Saves the embeddings to a pinecone index

When you prompt the LLM for information, it will:

  • Turn the prompt into an embedding
  • Retrieve all of the embeddings from pinecone (I am using my own semantic search with cosine similarity. Just wanted to implement it for practice)
  • Return the top 5 most similar embeddings
  • Extract the text that represents the embeddings
  • Add the text to the LLM prompt
  • Generate a response and includes the sources (file and slide the information comes from)

About

This repo contains code for a custom RAG system that I use to ask questions about the different slides and class content when I am studying.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages