<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Rishav Jain</title>
    <description>The latest articles on DEV Community by Rishav Jain (@rishavj90).</description>
    <link>https://dev.to/rishavj90</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1754662%2F3f62b200-6de1-4132-af6d-172709c77e95.jpeg</url>
      <title>DEV Community: Rishav Jain</title>
      <link>https://dev.to/rishavj90</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rishavj90"/>
    <language>en</language>
    <item>
      <title>Darvin - A RAG Study Buddy I Built For My Friend Drowning in PDFs</title>
      <dc:creator>Rishav Jain</dc:creator>
      <pubDate>Sun, 04 Oct 2026 14:23:17 +0000</pubDate>
      <link>https://dev.to/rishavj90/darvin-a-rag-study-buddy-i-built-for-my-friend-drowning-in-pdfs-2l2j</link>
      <guid>https://dev.to/rishavj90/darvin-a-rag-study-buddy-i-built-for-my-friend-drowning-in-pdfs-2l2j</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/hacktoberfest-weekend-2026-10-01"&gt;Hacktoberfest Weekend Challenge: Build for a Friend&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Darvin&lt;/strong&gt; is a terminal + FastAPI RAG chat where you give it the path to a PDF (or upload via API), and it answers questions &lt;em&gt;only&lt;/em&gt; from that PDF, with citations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Who I built it for:&lt;/strong&gt; My friend is preparing for semester exams and has 10+ bulky PDFs (notes, previous papers, manuals). Ctrl+F wasn't cutting it, and uploading everything to ChatGPT felt wrong for his personal notes. He needed a patient practice partner that would quiz him and answer strictly from his material without hallucinating.&lt;/p&gt;

&lt;p&gt;So I built Darvin for him: drop in his PDFs, ask in plain English, get grounded answers + follow-ups with chat memory.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What he said after trying it: "Bro this actually cites the page number, now I don't have to scroll 200 pages."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Test video: (youtube)[&lt;a href="https://www.youtube.com/watch?v=r6MwwP4BkHU" rel="noopener noreferrer"&gt;https://www.youtube.com/watch?v=r6MwwP4BkHU&lt;/a&gt;]&lt;/li&gt;
&lt;li&gt;GitHub: &lt;a href="https://github.com/Rishavj90/darvin" rel="noopener noreferrer"&gt;https://github.com/Rishavj90/darvin&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Demo flow:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;python test.py&lt;/code&gt; -&amp;gt; &lt;code&gt;prompt &amp;gt;&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Ingest PDF via &lt;code&gt;POST /upload&lt;/code&gt; (checks &lt;code&gt;.pdf&lt;/code&gt;, parses with PyMuPDF, chunks, stores)&lt;/li&gt;
&lt;li&gt;Ask via &lt;code&gt;POST /ask&lt;/code&gt; or terminal loop -&amp;gt; answer + sources + contexts + updated history&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/Rishavj90/darvin" rel="noopener noreferrer"&gt;https://github.com/Rishavj90/darvin&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Stack: &lt;code&gt;Python, FastAPI, LangChain, langchain-groq, ChromaDB, sentence-transformers, PyMuPDF&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Key files:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;backend/api.py&lt;/code&gt; - &lt;code&gt;/upload&lt;/code&gt; and &lt;code&gt;/ask&lt;/code&gt; routes&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;backend/ingestion/parse.py, chunk.py, store.py&lt;/code&gt; - PDF -&amp;gt; pages -&amp;gt; chunks -&amp;gt; Chroma&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;backend/query/result.py&lt;/code&gt; - top-5 retrieval + grounded prompt + &lt;code&gt;ChatGroq&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;backend/query/memory.py&lt;/code&gt; - rewrites follow-up into standalone question using last 5 turns&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;test.py&lt;/code&gt; - terminal chat loop&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How I Built It
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Open-source AI at the core - 2 layers:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Open-weight model:&lt;/strong&gt; &lt;code&gt;llama-3.1-8b-instant&lt;/code&gt; (Meta Llama 3.1 8B weights). I run inference through Groq for speed, but the brain itself is open weights - I can swap &lt;code&gt;GROQ_MODEL&lt;/code&gt; in &lt;code&gt;.env&lt;/code&gt; to any other Llama / Mistral / Gemma endpoint without changing code.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Open-source harness + retrieval:&lt;/strong&gt; &lt;code&gt;LangChain + langchain-text-splitters + ChromaDB + sentence-transformers&lt;/code&gt;. No black-box vector API. Embeddings are local (&lt;code&gt;EMBEDDING_MODEL&lt;/code&gt;), stored locally (&lt;code&gt;CHROMA_PATH&lt;/code&gt;, &lt;code&gt;COLLECTION_NAME&lt;/code&gt;).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Pipeline:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PDF -&amp;gt; PyMuPDF parse -&amp;gt; LangChain splitter chunk_pages -&amp;gt; sentence-transformers encode -&amp;gt; Chroma store
Query -&amp;gt; encode -&amp;gt; Chroma top-5 -&amp;gt; build context with [Source, Page] -&amp;gt; Llama-3.1 prompt (strict: "ONLY use context, say 'I cannot find...' otherwise, cite after each statement") -&amp;gt; answer
Follow-up -&amp;gt; memory.get_standalone_question() rewrites using history -&amp;gt; ask()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;.example.env&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;EMBEDDING_MODEL=
CHROMA_PATH=
COLLECTION_NAME=
GROQ_API_KEY=
GROQ_MODEL=llama-3.1-8b-instant
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Why terminal first? My friend lives in terminal, and I had ~1 weekend. FastAPI is already there so I can add a Streamlit / MERN UI later (I already ship MERN on Render).&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Does Open Innovation Matter?
&lt;/h2&gt;

&lt;p&gt;This project &lt;em&gt;only&lt;/em&gt; works because the pieces are open:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Swappable brain:&lt;/strong&gt; Closed API would lock the prompt + behavior. With Llama open weights, if Groq pricing/limits change, I move the same prompt to Ollama locally, Together, or self-hosted vLLM. My friend can even run a smaller quantized Llama fully offline in hostel with no internet.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Inspectable retrieval:&lt;/strong&gt; LangChain splitters + Chroma + sentence-transformers are all open. When answers were bad, I could actually debug chunk size, embedding model, and top-k=5. Closed RAG-in-a-box hides that.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zero cost to gift:&lt;/strong&gt; No per-seat SaaS. He clones the repo, sets 5 env vars, runs &lt;code&gt;pip install -r requirements.txt&lt;/code&gt;. Data stays in his &lt;code&gt;./chromaDB&lt;/code&gt; and &lt;code&gt;./tmp_files&lt;/code&gt;, not on someone else's server.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No hallucination by design:&lt;/strong&gt; The system prompt forces grounding + citations. Because I control the harness, I can enforce "do not use outside knowledge" - something you can't guarantee with a generic chatbot.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Closed would have been faster for a demo, but open made it giftable, debuggable, and portable.&lt;/p&gt;

&lt;h2&gt;
  
  
  My Agent Session
&lt;/h2&gt;

&lt;p&gt;Built mostly by hand + terminal testing. No DevRelay session to embed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prize Categories
&lt;/h2&gt;

&lt;p&gt;None - not using a partner tech this weekend. Entering for overall + completion badge.&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>weekendchallenge</category>
      <category>hf26challenge</category>
    </item>
  </channel>
</rss>
