<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ajinkya V Lele on Medium]]></title>
        <description><![CDATA[Stories by Ajinkya V Lele on Medium]]></description>
        <link>https://medium.com/@ajinkya.v.lele?source=rss-3954b074eef6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*J-awRWc8OFUiDff4</url>
            <title>Stories by Ajinkya V Lele on Medium</title>
            <link>https://medium.com/@ajinkya.v.lele?source=rss-3954b074eef6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 15:46:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ajinkya.v.lele/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[RAG Made Simple: A Beginner’s Guide with LangChain and Pinecone]]></title>
            <link>https://medium.com/@ajinkya.v.lele/rag-made-simple-a-beginners-guide-with-langchain-and-pinecone-fd7226d83ea2?source=rss-3954b074eef6------2</link>
            <guid isPermaLink="false">https://medium.com/p/fd7226d83ea2</guid>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Ajinkya V Lele]]></dc:creator>
            <pubDate>Mon, 16 Dec 2024 05:34:36 GMT</pubDate>
            <atom:updated>2024-12-16T05:34:36.775Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is RAG and Why Is It Helpful?</h3><p><strong>RAG</strong> stands for <strong>Retrieval-Augmented Generation</strong>. It is a method that combines two powerful techniques:</p><ol><li><strong>Retrieval</strong>: Finding relevant data from an external knowledge base.</li><li><strong>Generation</strong>: Creating meaningful responses using a language model like GPT.</li></ol><p>Why is RAG helpful?</p><ul><li><strong>Solves knowledge limitations</strong>: Instead of relying only on the pre-trained knowledge of a language model, it retrieves real-time data from a vector database.</li><li><strong>Up-to-date answers</strong>: If your knowledge base contains the latest data, RAG helps provide accurate, timely responses.</li><li><strong>Improves response quality</strong>: By retrieving relevant documents first, RAG allows the language model to generate more focused and accurate answers.</li></ul><h3>Introduction to LangChain</h3><p><strong>LangChain</strong> is a Python library that helps you create applications powered by <strong>language models</strong> (like OpenAI GPT) in combination with external tools. It connects different components of a language model pipeline into a seamless flow. Let’s break it down into key features:</p><h4>What Does LangChain Provide?</h4><ol><li><strong>Document Loading</strong>: LangChain supports loading data from multiple sources — text files, PDFs, APIs, or even web scraping.</li><li><strong>Text Splitting</strong>: Large documents are split into smaller chunks for efficient processing.</li><li><strong>Embeddings</strong>: LangChain integrates with popular embedding models like OpenAI, HuggingFace, or Sentence Transformers to convert text into vector representations.</li><li><strong>Vector Store Integration</strong>: LangChain connects with vector databases like <strong>Pinecone</strong>, <strong>FAISS</strong>, or <strong>Weaviate</strong> to store and retrieve embeddings.</li><li><strong>Prompt Templates</strong>: You can customize how your query interacts with retrieved data using LangChain’s prompts.</li><li><strong>Chains</strong>: LangChain allows you to chain multiple steps together — like retrieval, generation, and output formatting.</li></ol><p>In short, LangChain acts like <strong>“glue”</strong> to connect your language model with tools like Pinecone, making it easier to build AI applications like chatbots, question-answering systems, and search engines.</p><h3>Introduction to Pinecone</h3><p><strong>Pinecone</strong> is a <strong>managed vector database</strong> that allows you to store, search, and retrieve embeddings efficiently. It is built for applications that need high-speed and scalable <strong>similarity search</strong>. Let’s dive deeper into its features:</p><h4>Why Use Pinecone?</h4><ol><li><strong>Scalability</strong>: Pinecone can handle millions or even billions of vectors efficiently.</li><li><strong>Speed</strong>: It provides lightning-fast search and retrieval for semantic search tasks.</li><li><strong>Easy to Use</strong>: With its simple APIs, Pinecone integrates seamlessly into workflows using tools like LangChain.</li><li><strong>Managed Infrastructure</strong>: Pinecone eliminates the need to manage servers, indexes, or maintenance. You focus only on using the database.</li><li><strong>High Accuracy</strong>: It supports approximate nearest neighbor (ANN) search, ensuring you get the most relevant results for your queries.</li></ol><h3>Vector Embeddings</h3><p><strong>Vector embeddings</strong> are numerical representations of text, created to capture the meaning and context of words, sentences, or entire documents. In simple terms, embeddings convert human language into <strong>vectors</strong> (lists of numbers) that computers can understand and compare. These vectors are generated by machine learning models like OpenAI’s Embedding API, which map similar pieces of text closer together in a high-dimensional space.</p><p>For example, words like “dog” and “puppy” will have embeddings that are closer together because they share similar meanings. When we work with larger text, like sentences or documents, embeddings capture <strong>semantic relationships</strong> (the meaning) rather than just exact words.</p><p>These embeddings are crucial in RAG systems because they enable the <strong>vector search</strong> process. By comparing query embeddings with stored embeddings in a vector database like <strong>Pinecone</strong>, the system can quickly find relevant text chunks that closely match the query’s intent. This powers tasks like <strong>semantic search</strong>, <strong>chatbots</strong>, and <strong>retrieval-augmented generation</strong>.</p><h4>How Pinecone Works:</h4><ul><li>Text data is first converted into <strong>vector embeddings</strong> using models like OpenAI embeddings.</li><li>These embeddings are stored in Pinecone’s vector database.</li><li>When a query is made, Pinecone quickly finds the closest vectors using <strong>similarity search</strong> (cosine similarity or Euclidean distance).</li></ul><p>Pinecone is ideal for applications like <strong>semantic search</strong>, <strong>recommendation systems</strong>, and <strong>RAG-based AI pipelines</strong>.</p><h3>POC</h3><p>This Proof of Concept (POC) demonstrates how to build a <strong>Retrieval-Augmented Generation (RAG)</strong> pipeline using <strong>LangChain</strong> and <strong>Pinecone</strong>. The goal is to enhance a language model’s ability to answer questions by retrieving relevant data from an external knowledge base.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/831/0*qT_DfwK1JBe9qxEf.png" /></figure><ol><li><strong>Ingesting Data</strong>: Text data is loaded, split into smaller chunks, and converted into embeddings (vector representations). These embeddings are stored in the <strong>Pinecone</strong> vector database.<strong>Load Data</strong>:</li></ol><ul><li>The TextLoader loads the text file (ikigai_feedback.txt).</li></ul><ol><li><strong>Split the Data into Chunks</strong>:</li></ol><ul><li>The text is split into chunks of <strong>1000 characters</strong>. This is necessary because working with smaller chunks improves retrieval accuracy.</li></ul><ol><li><strong>Generate Embeddings</strong>:</li></ol><ul><li>Using the OpenAIEmbeddings model, LangChain creates vector representations for each text chunk.</li></ul><ol><li><strong>Retrieving Data</strong>: When a query is made, the system retrieves the most relevant chunks from Pinecone using vector similarity.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/0*EoOi-okRishAbeW7.png" /></figure><ol><li><strong>Generating Answers</strong>: The retrieved chunks are passed to a language model (OpenAI GPT) via LangChain, which generates an accurate and meaningful answer.</li></ol><h3>References</h3><ul><li><a href="https://github.com/AjinkyaCSharp/Intro-Vector-Store">GitHub</a></li><li><a href="https://login.pinecone.io/login?state=hKFo2SBfU3NBeWhiOWF0bTlkdWV4cmNSZmNBU1IwOGVJR3cwUaFupWxvZ2luo3RpZNkgRGNRMTF3NTUtaFEzVHZsSU1iR1Y0UmNvbmhWa2ZWeWSjY2lk2SBUOEkyaEc2Q2FaazUwT05McWhmN3h6a1I0WmhMcVM0Qw&amp;client=T8I2hG6CaZk50ONLqhf7xzkR4ZhLqS4C&amp;protocol=oauth2&amp;audience=https%3A%2F%2Fus-central1-production-console.cloudfunctions.net%2Fapi%2Fv1&amp;scope=openid%20profile%20email%20read%3Acurrent_user&amp;redirect_uri=https%3A%2F%2Fapp.pinecone.io&amp;sessionType=signup&amp;response_type=code&amp;response_mode=query&amp;nonce=Zjg5ZTI2ZGltZE82STJMVWVWaWRHQjRrX3JPdnVJY3J3T0Z4QWlTdEFYRw%3D%3D&amp;code_challenge=JqmG7r--Hf1PRH45QNhKLqMYoJv3-_cITKjGsxkGf4E&amp;code_challenge_method=S256&amp;auth0Client=eyJuYW1lIjoiYXV0aDAtcmVhY3QiLCJ2ZXJzaW9uIjoiMS4xMi4xIn0%3D">Pine Cone Vector DB</a></li><li><a href="https://python.langchain.com/docs/introduction/">LangChain</a></li><li><a href="https://www.udemy.com/course/langchain/">Udemy</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fd7226d83ea2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>