<?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: Sri Deevi</title>
    <description>The latest articles on DEV Community by Sri Deevi (@sri_d_6dfd4d31319a6389eaa).</description>
    <link>https://dev.to/sri_d_6dfd4d31319a6389eaa</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%2F4029182%2Fcfb1a728-2796-48d4-8f9e-508273dc7623.jpg</url>
      <title>DEV Community: Sri Deevi</title>
      <link>https://dev.to/sri_d_6dfd4d31319a6389eaa</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sri_d_6dfd4d31319a6389eaa"/>
    <language>en</language>
    <item>
      <title>From Documents to Intelligent Answers: Building a RAG Agent from Scratch &amp; Lessons Learned</title>
      <dc:creator>Sri Deevi</dc:creator>
      <pubDate>Tue, 14 Jul 2026 20:16:45 +0000</pubDate>
      <link>https://dev.to/sri_d_6dfd4d31319a6389eaa/from-documents-to-intelligent-answers-building-a-rag-agent-from-scratch-lessons-learned-4e4i</link>
      <guid>https://dev.to/sri_d_6dfd4d31319a6389eaa/from-documents-to-intelligent-answers-building-a-rag-agent-from-scratch-lessons-learned-4e4i</guid>
      <description>&lt;p&gt;Artificial Intelligence applications are rapidly moving beyond simple question-answering systems. Modern enterprise AI assistants need to understand internal documents, retrieve accurate information, and provide reliable answers based on company knowledge.&lt;/p&gt;

&lt;p&gt;I started building agentic AI systems from scratch — not to theorize about them, but to actually write the code, break it, and understand it from the inside out. This post walks through the second project in that journey: a Retrieval-Augmented Generation (RAG) system, what I built, what tripped me up, and where I'm taking it next.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is RAG?
&lt;/h2&gt;

&lt;p&gt;Retrieval-Augmented Generation combines two capabilities:&lt;/p&gt;

&lt;p&gt;Retrieval: The system searches a knowledge base and finds relevant information related to the user's question.&lt;/p&gt;

&lt;p&gt;Generation: The retrieved information is provided as context to an LLM, which generates a response based on that knowledge.&lt;/p&gt;

&lt;p&gt;Instead of asking an LLM to remember everything, RAG allows the model to access external knowledge dynamically.&lt;/p&gt;

&lt;p&gt;Technologies Used&lt;br&gt;
Python, LangChain, Ollama (Local LLM), Embeddings, Vector Database, FastAPI.&lt;/p&gt;

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

&lt;p&gt;The core idea is to build a system that answers questions using only the content of a document, rather than whatever the underlying model already "knows."&lt;/p&gt;

&lt;p&gt;Documents → Text Splitter → Embeddings → Vector Store → Retriever → LLM → Answer&lt;/p&gt;

&lt;p&gt;Document loading — a company policy document, loaded with LangChain's TextLoader&lt;/p&gt;

&lt;p&gt;Text Splitting — split into 200-character chunks with 50-character overlap, using RecursiveCharacterTextSplitter&lt;/p&gt;

&lt;p&gt;Create Embeddings — generated with sentence-transformers/all-MiniLM-L6-v2 via HuggingFaceEmbeddings&lt;/p&gt;

&lt;p&gt;Vector store — persisted in Chroma&lt;/p&gt;

&lt;p&gt;Retrieval — top-2 most relevant chunks pulled per question&lt;/p&gt;

&lt;p&gt;Generation — a strict prompt template that instructs the model to answer only from the retrieved context, run through Ollama's tinyllama.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lessons Learned
&lt;/h2&gt;

&lt;p&gt;Building a RAG system taught me that successful AI applications are not only about selecting a powerful LLM. The quality of the final answer depends heavily on:&lt;/p&gt;

&lt;p&gt;Document quality&lt;/p&gt;

&lt;p&gt;Chunking strategy&lt;/p&gt;

&lt;p&gt;Retrieval accuracy&lt;/p&gt;

&lt;p&gt;Prompt design&lt;/p&gt;

&lt;p&gt;Evaluation methods&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;RAG provides a practical foundation for building enterprise AI assistants that can use private knowledge while reducing hallucination risks. This project became the foundation for my next experiments with multi-agent workflows, MCP servers, and autonomous AI systems.&lt;/p&gt;

&lt;p&gt;Source Code: &lt;a href="https://github.com/srirdeevi/agentic-ai-portfolio" rel="noopener noreferrer"&gt;https://github.com/srirdeevi/agentic-ai-portfolio&lt;/a&gt;&lt;/p&gt;

</description>
      <category>rag</category>
      <category>llm</category>
      <category>python</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
