DEV Community

Sree Sruthi Alur
Sree Sruthi Alur

Posted on

OpenCopilot: An Open-Source RAG Assistant for Research Cramming

Hacktoberfest Weekend Challenge: Build for a Friend Submission 🤝

What I Built & Who It's For

For this weekend's "Build for a Friend" challenge, I built OpenCopilot—a lightweight, private Retrieval-Augmented Generation (RAG) assistant designed for my project teammate.

During hackathons and semester project crunches, we juggle massive technical documentation, research papers, and API specs across dozens of tabs. Finding specific implementation constraints or database schemas under tight deadlines is a massive bottleneck.

OpenCopilot solves this by letting my friend drop in research papers or project PDFs and immediately query them through a clean chat interface—getting precise answers grounded strictly in our project files without hallucinations.


The Open-Source AI Core

OpenCopilot was built around an entirely open ecosystem to ensure zero vendor lock-in, data privacy, and rapid iteration:

  • Embeddings: Hugging Face's open-source sentence-transformers/all-MiniLM-L6-v2 model running locally in Python to vectorize document chunks.
  • Vector Storage: ChromaDB, an open-source vector database that manages embeddings and similarity search directly on the host machine.
  • LLM Reasoning: Powered by high-speed open-weights through Groq's open inference infrastructure, providing instant answers without subscription paywalls.
  • Interface & Pipeline: Built using Streamlit with a direct, transparent RAG retrieval pipeline without heavy, opaque abstractions.

Why Open Innovation Matters Here

When building tools for university projects and peer collaboration, open innovation is essential:

  1. Academic Data Privacy: Hackathon prototypes and university research proposals often contain unpublished work. By leveraging local open-source embeddings and self-contained vector storage, proprietary project materials aren't indexed by proprietary cloud model providers.
  2. Zero Cost & Accessible Collaboration: Commercial LLM subscriptions and paid enterprise APIs are cost-prohibitive for students. An open stack allows our entire team to run and test the assistant without worrying about API quotas or monthly fees.
  3. Model Transparency & Portability: Unlike closed platforms where underlying models can be altered or deprecated overnight, open-source building blocks let us swap embedding models or switch the generation backend seamlessly.

Handing It Over: Teammate Feedback

I sent OpenCopilot over to Hasini to test against our latest coursework documentation.

"This cut through a 40-page technical specification in seconds. Instead of searching keywords across five open PDFs, I asked for the exact architectural constraints and got back the exact paragraphs I needed. It's going to save us hours on our upcoming hackathon deck."


How It Works

  1. Ingest & Chunk: The user uploads a PDF in the Streamlit sidebar. The document is chunked into 500-character segments with overlap via RecursiveCharacterTextSplitter.
  2. Vector Indexing: Embeddings are generated using all-MiniLM-L6-v2 and indexed in a local Chroma store.
  3. Contextual Retrieval: User queries trigger a top-$k$ similarity search in Chroma to gather the most relevant document chunks.
  4. Grounded Generation: The retrieved context is formatted directly into a strict prompt template that forces the open-weight model to base its reasoning only on the provided evidence.

Development Session & Code

Top comments (0)