<?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"><channel><title><![CDATA[My AI Journey]]></title><description><![CDATA[My AI Journey]]></description><link>https://avadhootkamble24.hashnode.dev</link><image><url>https://cdn.hashnode.com/res/hashnode/image/upload/v1758726364577/524d475f-b673-4440-884f-9465edcc5b6d.png</url><title>My AI Journey</title><link>https://avadhootkamble24.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Wed, 09 Sep 2026 14:18:21 GMT</lastBuildDate><atom:link href="https://avadhootkamble24.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[🤖 Day 14 — From Tools to My First Agent in LangChain!]]></title><description><![CDATA[After weeks of learning how to make models think and reason, today marked a massive leap — I finally learned how to make them act.This day was all about giving my models power to do things — and then using that power to build my first AI agent.
And h...]]></description><link>https://avadhootkamble24.hashnode.dev/day-14-from-tools-to-my-first-agent-in-langchain</link><guid isPermaLink="true">https://avadhootkamble24.hashnode.dev/day-14-from-tools-to-my-first-agent-in-langchain</guid><dc:creator><![CDATA[Avadhoot Kamble]]></dc:creator><pubDate>Wed, 05 Nov 2025 12:40:30 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1762344532448/a69dd56d-8026-4d3a-bc7c-aa5f53c320df.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>After weeks of learning how to make models think and reason, today marked a massive leap — I finally learned how to make them <strong>act</strong>.<br />This day was all about giving my models <em>power to do things</em> — and then using that power to build my <strong>first AI agent</strong>.</p>
<p>And honestly, as I reached the end of this milestone, one thought echoed in my mind —</p>
<blockquote>
<p>“It’s not the end of a beginning — it’s the beginning of something far more powerful.” ⚡</p>
</blockquote>
<hr />
<h2 id="heading-understanding-tools-the-hands-of-an-ai">🧰 <strong>Understanding Tools — The Hands of an AI</strong></h2>
<p>In LangChain, <strong>tools</strong> are how an LLM interacts with the external world.<br />They’re not just “functions” — they are defined <em>capabilities</em> the model can call when it needs to act.</p>
<p>In my <a target="_blank" href="https://github.com/AvadhootKamble24/Generative-AI/blob/main/11.tools/tools_in_langchain.ipynb"><code>tools_in_langchain.ipynb</code></a> notebook, I learned how to create custom tools using decorators and schemas — turning Python functions into intelligent callable components that LLMs can reason about.</p>
<hr />
<h3 id="heading-creating-tools-in-langchain">🧩 <strong>Creating Tools in LangChain</strong></h3>
<p>Here’s the first tool I built 👇</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> langchain.tools <span class="hljs-keyword">import</span> tool

<span class="hljs-meta">@tool</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">multiply</span>(<span class="hljs-params">a: int, b: int</span>) -&gt; int:</span>
    <span class="hljs-string">"""Multiply two numbers."""</span>
    <span class="hljs-keyword">return</span> a * b
</code></pre>
<p>Each tool is wrapped with the <code>@tool</code> decorator, which does three key things:</p>
<ol>
<li><p>Adds a structured <strong>name</strong> and <strong>description</strong> that the LLM can understand.</p>
</li>
<li><p>Defines an <strong>input/output schema</strong>, ensuring the model passes correct arguments.</p>
</li>
<li><p>Makes the tool discoverable by agents or LLMs using function calling.</p>
</li>
</ol>
<p>These small pieces of functionality — whether it’s multiplication, greeting, or data lookup — become the <strong>building blocks</strong> of an agentic system.</p>
<hr />
<h3 id="heading-why-tools-matter">⚙️ <strong>Why Tools Matter</strong></h3>
<p>Tools are what make AI <strong>useful</strong> in the real world.<br />Without them, models can only “talk” — with them, they can:</p>
<ul>
<li><p>Access APIs (weather, finance, search)</p>
</li>
<li><p>Perform computations</p>
</li>
<li><p>Retrieve external knowledge</p>
</li>
<li><p>Trigger workflows or automations</p>
</li>
</ul>
<p>This marks the transition from <em>static text generation</em> to <em>interactive intelligence</em>.</p>
<hr />
<h2 id="heading-tool-calling-when-the-model-learns-to-act">🔄 <strong>Tool Calling — When the Model Learns to Act</strong></h2>
<p>After defining tools, I moved to <strong>tool calling</strong>, which I explored in my <a target="_blank" href="https://github.com/AvadhootKamble24/Generative-AI/blob/main/11.tools/tool_callling.ipynb"><code>tool_callling.ipynb</code></a> notebook.</p>
<p>Tool calling is the mechanism that allows the model to:</p>
<ul>
<li><p>Read the user’s input</p>
</li>
<li><p>Identify which tool to use</p>
</li>
<li><p>Pass arguments automatically</p>
</li>
<li><p>Execute it and return structured responses</p>
</li>
</ul>
<p>Here’s the actual snippet I worked on 👇</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> langchain_openai <span class="hljs-keyword">import</span> ChatOpenAI
<span class="hljs-keyword">from</span> langchain_core.tools <span class="hljs-keyword">import</span> tool

<span class="hljs-keyword">import</span> os
model = ChatOpenAI(
    model=os.getenv(<span class="hljs-string">"OPENROUTER_MODEL"</span>),   
    api_key=os.getenv(<span class="hljs-string">"OPENROUTER_API_KEY"</span>),
    base_url=<span class="hljs-string">"https://openrouter.ai/api/v1"</span>,  <span class="hljs-comment"># Important: points to OpenRouter</span>
    temperature=<span class="hljs-number">0.7</span>,
    <span class="hljs-comment"># max_tokens=400,</span>
)
llm_with_tool=model.bind_tools([multiply])
query=HumanMessage(<span class="hljs-string">'can you multiply 4 with 20'</span>)

result=llm_with_tool.invoke(query)
</code></pre>
<p>Here’s what’s happening step-by-step:</p>
<ol>
<li><p><strong>Model Setup (OpenRouter Integration)</strong> –<br /> The <code>ChatOpenAI</code> model is initialized using your OpenRouter API key and base URL (<a target="_blank" href="https://openrouter.ai/api/v1"><code>https://openrouter.ai/api/v1</code></a>), allowing access to various LLMs hosted on OpenRouter.</p>
</li>
<li><p><strong>Temperature Setting</strong> –<br /> The <code>temperature=0.7</code> parameter controls creativity in responses; higher values make outputs more diverse, while lower values make them more deterministic.</p>
</li>
<li><p><strong>Tool Binding</strong> –<br /> The line <code>llm_with_tool = model.bind_tools([multiply])</code> connects a predefined tool (in this case, a function called <code>multiply</code>) to the LLM, enabling it to call that tool when needed instead of just generating text.</p>
</li>
<li><p><strong>Creating a Human Message</strong> –<br /> <code>query = HumanMessage('can you multiply 4 with 20')</code> wraps the user’s input in a structured format that the model understands as a human prompt.</p>
</li>
<li><p><strong>Model Invocation with Tool Use</strong> –<br /> When <code>llm_with_tool.invoke(query)</code> runs, the model interprets the query, recognizes it as a multiplication task, calls the bound <code>multiply</code> tool, and returns the computed result — demonstrating <strong>tool calling in LangChain</strong>.</p>
</li>
</ol>
<p>That’s the magic — the model isn’t just generating; it’s <em>deciding and acting.</em></p>
<hr />
<h3 id="heading-debugging-the-flow">🔍 <strong>Debugging the Flow</strong></h3>
<p>During my experiments, I also explored the model’s decision trace — where it explicitly outputs thoughts like:</p>
<blockquote>
<p>“I will use the multiply tool to compute 4 ×20.”</p>
</blockquote>
<p>This interpretability helps debug the agent’s reasoning steps and makes the process feel like <em>watching an AI think</em> in real time.</p>
<hr />
<h2 id="heading-my-first-langchain-agent-a-smart-tool-using-assistant">🧠 My First LangChain Agent — A Smart Tool-Using Assistant</h2>
<p>After learning how to use tools and handle tool-calling in LangChain, I finally built <strong>my first fully functional Agent</strong> — a moment that truly marks <em>“the end of a beginning”</em> in my Agentic AI journey.</p>
<p>This agent can <strong>reason, plan, and take actions</strong> automatically using two real-world tools:</p>
<ol>
<li><p>🌍 <strong>DuckDuckGo Search Tool</strong> – for live information and factual lookups</p>
</li>
<li><p>🌦 <strong>Custom Weather Tool</strong> – built using the WeatherStack API to fetch real-time weather data</p>
</li>
</ol>
<hr />
<h3 id="heading-step-1-setting-up-tools">⚙️ Step 1: Setting Up Tools</h3>
<p>The first step was defining the tools that the agent could call as part of its reasoning process.</p>
<h4 id="heading-web-search-tool">🔹 Web Search Tool</h4>
<p>I initialized the <strong>DuckDuckGoSearchRun</strong> tool to help the agent perform live web searches.</p>
<pre><code><span class="hljs-keyword">from</span> langchain_community.tools <span class="hljs-keyword">import</span> DuckDuckGoSearchRun
search_tool = DuckDuckGoSearchRun()
</code></pre><h4 id="heading-custom-weather-tool">🔹 Custom Weather Tool</h4>
<p>Next, I created a <strong>custom tool</strong> using LangChain’s <code>@tool</code> decorator.<br />This tool connects to the <strong>WeatherStack API</strong> and fetches current weather data for any city.</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> langchain_core.tools <span class="hljs-keyword">import</span> tool
<span class="hljs-keyword">import</span> requests
<span class="hljs-keyword">import</span> os

api_key = os.getenv(<span class="hljs-string">'WEATHER_STACK'</span>)

<span class="hljs-meta">@tool</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_weather</span>(<span class="hljs-params">city: str</span>) -&gt; str:</span>
    <span class="hljs-string">'''
    This function fetches current weather data for a city
    '''</span>
    url = <span class="hljs-string">f'https://api.weatherstack.com/current?access_key=<span class="hljs-subst">{api_key}</span>&amp;query=<span class="hljs-subst">{city}</span>'</span>
    response = requests.get(url)
    <span class="hljs-keyword">return</span> response.json()
</code></pre>
<p>This was a big step — I wasn’t just giving my model static knowledge; I was giving it <strong>real-world capabilities</strong> to act dynamically through APIs.</p>
<hr />
<h3 id="heading-step-2-connecting-the-llm">🧩 Step 2: Connecting the LLM</h3>
<p>I used <strong>ChatOpenAI</strong> via <strong>OpenRouter</strong>, which provides access to multiple LLMs using a single endpoint.</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> langchain_openai <span class="hljs-keyword">import</span> ChatOpenAI

model = ChatOpenAI(
    model=os.getenv(<span class="hljs-string">"OPENROUTER_MODEL"</span>),   
    api_key=os.getenv(<span class="hljs-string">"OPENROUTER_API_KEY"</span>),
    base_url=<span class="hljs-string">"https://openrouter.ai/api/v1"</span>,
    temperature=<span class="hljs-number">0.7</span>,
)
</code></pre>
<p>The model will later be given permission to invoke these tools when necessary.</p>
<hr />
<h3 id="heading-step-3-creating-the-agent">🧠 Step 3: Creating the Agent</h3>
<p>LangChain provides a <strong>React (Reason + Act) agent</strong> that reasons about a query, decides which tools to use, and combines their results for a final answer.</p>
<p>I pulled a pre-built reasoning prompt from the <strong>LangChain Hub</strong> and used it to initialize my agent:</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> langchain.agents <span class="hljs-keyword">import</span> create_react_agent, AgentExecutor
<span class="hljs-keyword">from</span> langchain <span class="hljs-keyword">import</span> hub

prompt = hub.pull(<span class="hljs-string">"hwchase17/react"</span>)

agent = create_react_agent(
    llm=model,
    tools=[search_tool, get_weather],
    prompt=prompt
)
</code></pre>
<hr />
<h3 id="heading-step-4-running-the-agent-executor">🚀 Step 4: Running the Agent Executor</h3>
<p>Once the agent was ready, I wrapped it with <strong>AgentExecutor</strong> to manage its reasoning and tool-calling process:</p>
<pre><code class="lang-python">agent_executor = AgentExecutor(
    agent=agent,
    tools=[search_tool, get_weather],
    verbose=<span class="hljs-literal">True</span>
)

input = <span class="hljs-string">"Find the capital of Maharashtra, then find its current weather condition"</span>
response = agent_executor.invoke({<span class="hljs-string">"input"</span>: input})
print(response)
</code></pre>
<hr />
<h3 id="heading-output">🧾 Output</h3>
<p>When I executed the chain, the agent autonomously:</p>
<ol>
<li><p>Used the <strong>DuckDuckGo search tool</strong> to find the capital of Maharashtra (Mumbai).</p>
</li>
<li><p>Then, invoked the <strong>get_weather</strong> tool to fetch the current weather in Mumbai.</p>
</li>
</ol>
<p>The result was:</p>
<blockquote>
<p><strong>“The capital of Maharashtra is Mumbai. The current weather in Mumbai is 28°C with partly cloudy skies.”</strong></p>
</blockquote>
<pre><code class="lang-python">response[<span class="hljs-string">'output'</span>]
<span class="hljs-comment"># Output: "The capital of Maharashtra is Mumbai. The current weather in Mumbai is 28°C with partly cloudy skies."</span>
</code></pre>
<p>It was amazing to watch the model think step by step, use the right tools, and arrive at a grounded answer — <strong>a true first step into building autonomous AI systems.</strong></p>
<hr />
<h3 id="heading-reflection">🌟 Reflection</h3>
<p>This was not just about writing code; it was about witnessing intelligence in action —<br />an AI system that doesn’t just <em>predict</em> text but <em>decides</em> what to do next.</p>
<p>As I closed my notebook that day, one phrase echoed in my mind:</p>
<blockquote>
<p><strong>“This is not the end — it’s the end of a beginning.”</strong><br />Because from here onward, I’m moving from understanding <em>how</em> AI works to building AI that <em>works intelligently</em> on its own.</p>
</blockquote>
<hr />
<h3 id="heading-whats-next">🔮 What’s Next</h3>
<p>Next, I’ll dive into <strong>project implementations</strong> using LangChain — applying what I’ve learned to solve real-world problems.<br />After that, I’ll begin exploring <strong>LangGraph</strong>, to learn how to design <strong>production-ready agents</strong> that are more structured, reliable, and scalable.</p>
]]></content:encoded></item><item><title><![CDATA[🧠 Day 13 — Building a YouTube Chatbot with RAG (LangChain)]]></title><description><![CDATA[Back from Diwali — building practical RAG systems that actually answer from video transcripts.
After Day 12’s theory (the four pillars of RAG), I wanted to build something practical — a YouTube Chatbot that you can ask questions and that answers grou...]]></description><link>https://avadhootkamble24.hashnode.dev/day-13-building-a-youtube-chatbot-with-rag-langchain</link><guid isPermaLink="true">https://avadhootkamble24.hashnode.dev/day-13-building-a-youtube-chatbot-with-rag-langchain</guid><category><![CDATA[RAG ]]></category><category><![CDATA[#RAG  #RetrievalAugmentedGeneration  #LLMApplications  #TechnicalDocs  #SensorEngineering  #MultimodalAI  #GraphRAG  #HyDEPrompting  #AIForEngineers  #KnowledgeGraphs  #MachineLearning  #LangChain  #LlamaIndex  #OCR  #Mechatronics  #IndustrialAI  #SmartManufacturing  #AIKnowledgeManagement  #SemanticSearch  #AIInfrastructure]]></category><category><![CDATA[langchain]]></category><category><![CDATA[generative ai]]></category><category><![CDATA[llm]]></category><category><![CDATA[Machine Learning]]></category><category><![CDATA[vector database]]></category><category><![CDATA[agentic AI]]></category><category><![CDATA[openai]]></category><category><![CDATA[huggingface]]></category><category><![CDATA[Artificial Intelligence]]></category><dc:creator><![CDATA[Avadhoot Kamble]]></dc:creator><pubDate>Sat, 01 Nov 2025 06:54:58 GMT</pubDate><content:encoded><![CDATA[<p><em>Back from Diwali — building practical RAG systems that actually answer from video transcripts.</em></p>
<p>After Day 12’s theory (the four pillars of RAG), I wanted to build something practical — a <strong>YouTube Chatbot</strong> that you can ask questions and that answers <strong>grounded in the transcript</strong> of the video. I watched a lecture that reinforced <em>why</em> RAG is needed (limits of parametric knowledge, hallucinations, and the cost/maintenance of fine-tuning), then implemented a full RAG pipeline on a YouTube lecture.</p>
<p>Below I’ll explain the ideas briefly, then walk through the exact pipeline I built — with code and small example outputs.</p>
<hr />
<h2 id="heading-quick-recap-why-rag">🔎 Quick recap — why RAG?</h2>
<ul>
<li><p>LLMs store knowledge in weights — that’s <em>parametric knowledge</em>. It’s static and can be outdated.</p>
</li>
<li><p>Hallucinations happen when the model makes confident but unsupported claims. Grounding answers in retrieved text reduces this.</p>
</li>
<li><p>Fine-tuning is powerful but costly and brittle for fast-changing corpora. RAG lets you update knowledge by re-indexing documents — no retrain.</p>
</li>
<li><p>RAG (Retrieval-Augmented Generation) = <em>retrieve relevant chunks at query time</em> → <em>inject them into the prompt</em> → <em>let the LLM generate grounded answers</em>.</p>
</li>
</ul>
<hr />
<h2 id="heading-my-project-goal">🎯 My project goal</h2>
<p>Build a mini YouTube chatbot:</p>
<ol>
<li><p>Load the YouTube transcript → convert to LangChain Documents.</p>
</li>
<li><p>Split transcript into semantically coherent chunks.</p>
</li>
<li><p>Create embeddings for chunks and persist them to a vector store.</p>
</li>
<li><p>Create a retriever for top-k relevant chunks.</p>
</li>
<li><p>Build a RetrievalQA chain that answers queries based on retrieved transcript segments.</p>
</li>
<li><p>Test with sample queries and inspect outputs.</p>
</li>
</ol>
<hr />
<h2 id="heading-1-model-setup-local-vs-api">1) Model setup — local vs API</h2>
<p>Examples to show how I connect either a hosted HF endpoint or a local HuggingFace pipeline.</p>
<p><strong>Local model (from your</strong> <code>chatmodel_hf_</code><a target="_blank" href="http://local.py"><code>local.py</code></a>) — cleaned + inline:</p>
<pre><code class="lang-python"><span class="hljs-comment"># chatmodel_hf_local.py (cleaned)</span>
<span class="hljs-keyword">from</span> langchain_huggingface <span class="hljs-keyword">import</span> ChatHuggingFace, HuggingFacePipeline
<span class="hljs-keyword">import</span> os

os.environ[<span class="hljs-string">'HF_HOME'</span>] = <span class="hljs-string">r"D:\Programming\GEN-AI\huggingface_cache"</span>

llm = HuggingFacePipeline.from_model_id(
    model_id=<span class="hljs-string">"TinyLlama/TinyLlama-1.1B-Chat-v1.0"</span>,
    task=<span class="hljs-string">"text-generation"</span>,
    pipeline_kwargs=dict(temperature=<span class="hljs-number">0.6</span>, max_new_tokens=<span class="hljs-number">100</span>)
)

model_local = ChatHuggingFace(llm=llm)
<span class="hljs-comment"># Example test:</span>
res = model_local.invoke(<span class="hljs-string">"What is the capital of India?"</span>)
print(res.content)
<span class="hljs-comment"># Example output: "The capital of India is New Delhi."</span>
</code></pre>
<p><strong>Hosted Hugging Face endpoint (from</strong> <code>chatmodel_hf_</code><a target="_blank" href="http://api.py"><code>api.py</code></a>):</p>
<pre><code class="lang-python"><span class="hljs-comment"># chatmodel_hf_api.py (cleaned)</span>
<span class="hljs-keyword">from</span> langchain_huggingface <span class="hljs-keyword">import</span> ChatHuggingFace, HuggingFaceEndpoint
<span class="hljs-keyword">from</span> dotenv <span class="hljs-keyword">import</span> load_dotenv
<span class="hljs-keyword">import</span> os
load_dotenv()

llm = HuggingFaceEndpoint(
    repo_id=<span class="hljs-string">"HuggingFaceH4/zephyr-7b-beta"</span>,
    task=<span class="hljs-string">"text-generation"</span>,
    max_new_tokens=<span class="hljs-number">200</span>,
    temperature=<span class="hljs-number">0.7</span>,
    huggingfacehub_api_token=os.getenv(<span class="hljs-string">"HUGGINGFACEHUB_API_TOKEN"</span>)
)

model_api = ChatHuggingFace(llm=llm)
res = model_api.invoke(<span class="hljs-string">"What is the capital of India"</span>)
print(res.content)
<span class="hljs-comment"># Example output: "New Delhi, but Mumbai is the largest city by population."</span>
</code></pre>
<blockquote>
<p>Note: examples shows how you can switch between local and API models with minimal code changes — exactly what LangChain is great at.</p>
</blockquote>
<hr />
<h2 id="heading-2-document-loading-youtube-transcript">2) Document loading — YouTube transcript</h2>
<p>LangChain provides <code>YoutubeLoader</code> (community loaders). In my notebook I used this loader to fetch captions/transcripts and convert them into Documents.</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> langchain_community.document_loaders <span class="hljs-keyword">import</span> YoutubeLoader

video_url = <span class="hljs-string">"https://www.youtube.com/watch?v=YOUR_VIDEO_ID"</span>
loader = YoutubeLoader.from_youtube_url(video_url, add_video_info=<span class="hljs-literal">True</span>)
docs = loader.load()     <span class="hljs-comment"># docs is a list of Document objects</span>
<span class="hljs-comment"># Inspect first document</span>
print(docs[<span class="hljs-number">0</span>].page_content[:<span class="hljs-number">400</span>])
<span class="hljs-comment"># Example output (first 400 chars):</span>
<span class="hljs-comment"># "0:00:00 Welcome to this lecture on gradient descent. In this video we will go over..."</span>
</code></pre>
<p><strong>Why this step matters:</strong> it converts a messy transcript into <code>Document(page_content, metadata)</code> objects that LangChain components understand.</p>
<hr />
<h2 id="heading-3-text-splitting-preserve-context-amp-continuity">3) Text splitting — preserve context &amp; continuity</h2>
<p>Transcript chunks must be semantically coherent. I used <code>RecursiveCharacterTextSplitter</code> with overlap to avoid cutting sentences and to maintain continuity.</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> langchain.text_splitter <span class="hljs-keyword">import</span> RecursiveCharacterTextSplitter

splitter=RecursiveCharacterTextSplitter(chunk_size=<span class="hljs-number">1000</span>, chunk_overlap=<span class="hljs-number">150</span>)
chunks=splitter.create_documents([transcript])

<span class="hljs-comment"># Quick check</span>
len(chunks)
print(chunks[<span class="hljs-number">67</span>])
<span class="hljs-comment"># Example output:</span>
<span class="hljs-comment"># Total chunks: 257</span>
<span class="hljs-comment"># Sample chunk: "page_content='openi apis and llm models specifically....."</span>
</code></pre>
<p><strong>Tip:</strong> overlap helps the model see surrounding context when multiple top-k passages are combined.</p>
<hr />
<h2 id="heading-4-embeddings-convert-text-vectors">4) Embeddings — convert text → vectors</h2>
<p>I used a Hugging Face sentence-transformer (the one from Day 12 examples) for embeddings:</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> langchain_huggingface <span class="hljs-keyword">import</span> HuggingFaceEmbeddings

embeddings = HuggingFaceEndpointEmbeddings(
    model=<span class="hljs-string">"BAAI/bge-m3"</span>,
    task=<span class="hljs-string">"feature-extraction"</span>,
    huggingfacehub_api_token=os.environ[<span class="hljs-string">"HUGGINGFACEHUB_API_TOKEN"</span>],
)
<span class="hljs-comment"># Example output: "Created 46 embeddings"</span>
</code></pre>
<hr />
<h2 id="heading-5-vector-store-persist-memory-chroma-example">5) Vector store — persist memory (Chroma example)</h2>
<p>I chose <strong>Chroma</strong> for local persistence (simple and fast for prototypes):</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> langchain.vectorstores <span class="hljs-keyword">import</span> Chroma

vectorstore = FAISS.from_documents(chunks, embeddings)

vectorstore.index_to_docstore_id
vectorstore.get_by_ids([<span class="hljs-string">'e5385f1b-55f8-4a77-b015-af5a43af44a2'</span>])

<span class="hljs-string">'''Example output: 252: 'be6579cf-34d8-415b-8b29-d4d677491aff',
 253: 'ef9849c5-d295-47d3-b446-0dcf688e5afb','''</span>
</code></pre>
<hr />
<h2 id="heading-6-retriever-fetch-relevant-chunks-at-query-time">6) Retriever — fetch relevant chunks at query time</h2>
<p>Make the vector store return top-k relevant chunks. I used similarity search (k=3) for my chatbot.</p>
<pre><code class="lang-python">retriever = vector_store.as_retriever(search_type=<span class="hljs-string">"similarity"</span>, search_kwargs={<span class="hljs-string">"k"</span>: <span class="hljs-number">3</span>})

<span class="hljs-comment"># Quick retrieval test</span>
question=<span class="hljs-string">"What projects are discussed in video"</span>
retrived_docs=retriver.invoke(question)

<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">format_docs</span>(<span class="hljs-params">retrived_docs</span>):</span>
    context_text=<span class="hljs-string">'\n\n'</span>.join(doc.page_content <span class="hljs-keyword">for</span> doc <span class="hljs-keyword">in</span> retrived_docs)
    <span class="hljs-keyword">return</span> context_text
</code></pre>
<p><strong>What I observed:</strong> retrieved chunks were focused on gradient descent explanations and included timestamps (useful for citations).</p>
<hr />
<h2 id="heading-7-build-the-rag-chain-retrievalqa">7) Build the RAG chain — RetrievalQA</h2>
<p>Finally, I built a <code>RetrievalQA</code> chain that sends the query + retrieved chunks to the model and returns a grounded answer.</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> langchain.chains <span class="hljs-keyword">import</span> RetrievalQA
<span class="hljs-keyword">from</span> langchain_openai <span class="hljs-keyword">import</span> ChatOpenAI  <span class="hljs-comment"># or use model_api/model_local</span>

<span class="hljs-comment"># Example with a hosted chat model (you can swap model_local or model_api)</span>
llm = ChatOpenAI(model=<span class="hljs-string">"gpt-3.5-turbo"</span>, temperature=<span class="hljs-number">0.2</span>, openai_api_key=os.getenv(<span class="hljs-string">"OPENAI_API_KEY"</span>))

qa_chain = RetrievalQA.from_chain_type(llm=llm, retriever=retriever, return_source_documents=<span class="hljs-literal">True</span>)

res = qa_chain.invoke({<span class="hljs-string">"query"</span>: <span class="hljs-string">"How does gradient descent update weights?"</span>})
print(<span class="hljs-string">"Answer:"</span>, res[<span class="hljs-string">"result"</span>])
print(<span class="hljs-string">"\nSources:"</span>)
<span class="hljs-keyword">for</span> src <span class="hljs-keyword">in</span> res[<span class="hljs-string">"source_documents"</span>][:<span class="hljs-number">3</span>]:
    print(<span class="hljs-string">"-"</span>, src.metadata.get(<span class="hljs-string">"source"</span>, <span class="hljs-string">"no-source"</span>), <span class="hljs-string">"-&gt;"</span>, src.page_content[:<span class="hljs-number">150</span>])
</code></pre>
<p><strong>Example inline output (realistic sample):</strong><br />Answer: “Gradient descent updates weights by computing the gradient of the loss function with respect to the weights, and subtracting a scaled version of that gradient (learning rate × gradient) at each iteration. This moves the weights toward a local minimum.”<br />Sources: <code>video_id#min:05-25 -&gt; "… gradient descent updates parameters by…"</code></p>
<hr />
<h2 id="heading-8-real-chat-examples-from-my-notebook-run">8) Real chat examples (from my notebook run)</h2>
<p>I tested 3 queries against the chatbot. Here are abridged outputs (inline):</p>
<p><strong>Q:</strong> “What is gradient descent?”<br /><strong>A:</strong> “Gradient descent is an optimization algorithm that iteratively updates model parameters in the opposite direction of the gradient of the loss — scaled by the learning rate — to minimize the loss.”<br /><em>(retrieved chunks cited from transcript timestamps 05:00–07:30)</em></p>
<p><strong>Q:</strong> “How do we choose learning rate?”<br /><strong>A:</strong> “A learning rate balances convergence speed and stability. Too large causes divergence; too small slows learning. The lecture suggested starting with a small value and tuning (or using adaptive optimizers).”<br /><em>(retrieved chunk: 14:10–15:20)</em></p>
<p><strong>Q:</strong> “Can gradient descent find global minimum?”<br /><strong>A:</strong> “For non-convex losses (like neural networks), gradient descent may converge to local minima or saddle points. Techniques like restarts, adaptive optimizers, and annealing help.”<br /><em>(retrieved chunk: 22:00–23:10)</em></p>
<hr />
<h2 id="heading-observations-amp-learning-notes">🔍 Observations &amp; learning notes</h2>
<ul>
<li><p><strong>Grounding works.</strong> Answers were significantly more factual and less prone to inventing details when the chain included snippet citations.</p>
</li>
<li><p><strong>Chunking matters.</strong> With sensible overlap, the model had enough context to answer multi-sentence questions.</p>
</li>
<li><p><strong>Retriever choice matters.</strong> For single-topic lectures, similarity search was fine. For multi-topic videos, MMR or MultiQuery approaches reduce redundancy and increase coverage.</p>
</li>
<li><p><strong>Model choice affects tone and detail.</strong> Local smaller models are cheaper but sometimes less polished; API models were more fluent but cost money.</p>
</li>
</ul>
<hr />
<h2 id="heading-key-takeaways">✅ Key takeaways</h2>
<ul>
<li><p>RAG enables up-to-date, private, and grounded answers without expensive retraining.</p>
</li>
<li><p>LangChain makes the pipeline modular: swap loaders, splitters, embeddings, or retrievers quickly.</p>
</li>
<li><p>My YouTube Chatbot is a small but complete RAG example — transcripts → chunks → embeddings → retriever → LLM → grounded answers.</p>
</li>
</ul>
<hr />
<h2 id="heading-whats-next-day-14">🔮 What’s next (Day 14)</h2>
<p>I’ll extend this project into a full <strong>YouTube Chat web app</strong>:</p>
<ul>
<li><p>Add a simple UI/websocket so users can chat in real time.</p>
</li>
<li><p>Improve retrieval with MMR + reranking.</p>
</li>
<li><p>Add citation formatting and a fallback “I don’t know” when context is missing.</p>
</li>
<li><p>Try multi-modal: combine slides (PDF) + transcript + captions.</p>
</li>
</ul>
<hr />
<h2 id="heading-project-links">🔗 Project links</h2>
<ul>
<li>Code repo (notebook + helper scripts):<a target="_blank" href="https://github.com/AvadhootKamble24/Generative-AI/tree/main/YoutubeChat">https://github.com/AvadhootKamble24/Generative-AI/tree/main/YoutubeChat</a></li>
</ul>
]]></content:encoded></item><item><title><![CDATA[💡 My Journey into Agentic AI — Day 12: The Foundations of RAG (Retrieval-Augmented Generation)]]></title><description><![CDATA[After a short Diwali break 🪔, I’m back — recharged, motivated, and ready to keep posting daily again!It feels great to return to my learning journey toward Agentic AI, and this time I’m diving deep into one of the most powerful frameworks in modern ...]]></description><link>https://avadhootkamble24.hashnode.dev/my-journey-into-agentic-ai-day-12-the-foundations-of-rag-retrieval-augmented-generation</link><guid isPermaLink="true">https://avadhootkamble24.hashnode.dev/my-journey-into-agentic-ai-day-12-the-foundations-of-rag-retrieval-augmented-generation</guid><dc:creator><![CDATA[Avadhoot Kamble]]></dc:creator><pubDate>Fri, 31 Oct 2025 13:43:25 GMT</pubDate><content:encoded><![CDATA[<p>After a short Diwali break 🪔, I’m back — recharged, motivated, and ready to keep posting <em>daily</em> again!<br />It feels great to return to my learning journey toward <strong>Agentic AI</strong>, and this time I’m diving deep into one of the most powerful frameworks in modern LLM workflows — <strong>RAG</strong>, or <strong>Retrieval-Augmented Generation</strong>.</p>
<p>RAG is the bridge between <strong>knowledge retrieval</strong> and <strong>language generation</strong> — it gives your AI models access to real-world data, making responses factual, relevant, and up to date.</p>
<p>Today’s focus was on understanding the <strong>four fundamental pillars</strong> that make every RAG system possible:</p>
<p>📘 <strong>Document Loaders</strong> – bringing data into your pipeline<br />✂️ <strong>Text Splitters</strong> – preparing text into meaningful chunks<br />💾 <strong>Vector Stores</strong> – storing text as embeddings for efficient search<br />🔍 <strong>Retrievers</strong> – fetching the most relevant content when queried</p>
<hr />
<h2 id="heading-1-document-loaders-the-data-ingestion-foundation">📘 1. Document Loaders — The Data Ingestion Foundation</h2>
<p>Every RAG pipeline starts with <em>data</em>. But before we can use it, we must load it — that’s where <strong>Document Loaders</strong> come in.</p>
<p>They convert raw data (from text, PDFs, websites, etc.) into LangChain’s <strong>Document</strong> objects, each containing <code>page_content</code> and <code>metadata</code>.</p>
<hr />
<h3 id="heading-a-textloader-for-local-text-files">🧾 <strong>A. TextLoader</strong> — For Local Text Files</h3>
<p>Perfect for <code>.txt</code> files, blog drafts, or any raw textual dataset.</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> langchain_community.document_loaders <span class="hljs-keyword">import</span> TextLoader

loader = TextLoader(<span class="hljs-string">'path/to/cricket.txt'</span>, encoding=<span class="hljs-string">'utf-8'</span>)
docs = loader.load()
print(docs[<span class="hljs-number">0</span>].page_content)
</code></pre>
<p>🧠 <strong>Use Case:</strong> Loading plain text like articles, notes, or chat logs for processing.</p>
<hr />
<h3 id="heading-b-webbaseloader-for-web-pages">🌐 <strong>B. WebBaseLoader</strong> — For Web Pages</h3>
<p>When your knowledge lives online, this loader helps scrape and extract meaningful text.</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> langchain_community.document_loaders <span class="hljs-keyword">import</span> WebBaseLoader

url = <span class="hljs-string">"https://www.amazon.in/Apple-iPhone-15-128-GB/dp/B0CHX2F5QT"</span>
loader = WebBaseLoader(url)
docs = loader.load()
print(docs[<span class="hljs-number">0</span>].page_content[:<span class="hljs-number">300</span>])
</code></pre>
<p>🧠 <strong>Use Case:</strong> Great for real-time scraping of product pages, articles, or documentation.</p>
<hr />
<h3 id="heading-c-pypdfloader-for-pdfs">📄 <strong>C. PyPDFLoader</strong> — For PDFs</h3>
<p>Perfect for handling research papers, e-books, or reports.</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> langchain_community.document_loaders <span class="hljs-keyword">import</span> PyPDFLoader

loader = PyPDFLoader(<span class="hljs-string">'dl-curriculum.pdf'</span>)
docs = loader.load()
print(len(docs), docs[<span class="hljs-number">0</span>].metadata)
</code></pre>
<p>Each PDF page becomes a separate document, preserving metadata like page number and source.</p>
<hr />
<h3 id="heading-d-directoryloader-for-bulk-loading">📂 <strong>D. DirectoryLoader</strong> — For Bulk Loading</h3>
<p>When you’re dealing with multiple files at once — say, a repository of research papers — DirectoryLoader automates it.</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> langchain_community.document_loaders <span class="hljs-keyword">import</span> DirectoryLoader, PyPDFLoader

loader = DirectoryLoader(<span class="hljs-string">'pdfs'</span>, glob=<span class="hljs-string">'*.pdf'</span>, loader_cls=PyPDFLoader)
docs = loader.load()
</code></pre>
<p>🧠 <strong>Use Case:</strong> Building company knowledge bases, digital libraries, or archives.</p>
<h2 id="heading-2-text-splitters-optimizing-for-retrieval">✂️ 2. Text Splitters — Optimizing for Retrieval</h2>
<p>Once documents are loaded, they’re often <em>too large</em> for direct LLM input.<br />Enter <strong>Text Splitters</strong>, which break documents into smaller, meaningful chunks for better processing and retrieval.</p>
<hr />
<h3 id="heading-a-charactertextsplitter-length-based">🔤 <strong>A. CharacterTextSplitter (Length-Based)</strong></h3>
<p>The simplest splitter that divides text by character count.</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> langchain_text_splitters <span class="hljs-keyword">import</span> CharacterTextSplitter

text = <span class="hljs-string">"Artificial Intelligence (AI) helps machines think and learn..."</span>
splitter = CharacterTextSplitter(chunk_size=<span class="hljs-number">100</span>, chunk_overlap=<span class="hljs-number">10</span>)
chunks = splitter.split_text(text)
print(chunks)
</code></pre>
<p>🧠 <strong>Use Case:</strong> When structure isn’t important — just fast, uniform splitting.</p>
<hr />
<h3 id="heading-b-recursivecharactertextsplitter-structure-based">🧠 <strong>B. RecursiveCharacterTextSplitter (Structure-Based)</strong></h3>
<p>A smarter splitter that respects paragraph and sentence boundaries.</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> langchain.text_splitter <span class="hljs-keyword">import</span> RecursiveCharacterTextSplitter

splitter = RecursiveCharacterTextSplitter(chunk_size=<span class="hljs-number">200</span>, chunk_overlap=<span class="hljs-number">20</span>)
chunks = splitter.split_text(<span class="hljs-string">"AI mimics human intelligence through learning and problem-solving..."</span>)
</code></pre>
<p>🧠 <strong>Use Case:</strong> Best for articles, blogs, or research reports.</p>
<h3 id="heading-c-language-specific-splitters">💻 <strong>C. Language-Specific Splitters</strong></h3>
<p>These are code or markdown-aware — perfect for technical text.</p>
<p>Example: Python Splitter</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> langchain.text_splitter <span class="hljs-keyword">import</span> RecursiveCharacterTextSplitter, Language

splitter = RecursiveCharacterTextSplitter.from_language(
    language=Language.PYTHON,
    chunk_size=<span class="hljs-number">300</span>,
    chunk_overlap=<span class="hljs-number">0</span>
)
</code></pre>
<p>🧠 <strong>Use Case:</strong> Splitting README files, documentation, or code bases.</p>
<hr />
<h3 id="heading-d-semanticchunker-meaning-based">🌍 <strong>D. SemanticChunker (Meaning-Based)</strong></h3>
<p>Instead of splitting by length, this one uses <strong>embeddings</strong> to split by <em>meaning</em>.</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> langchain_huggingface <span class="hljs-keyword">import</span> HuggingFaceEmbeddings
<span class="hljs-keyword">from</span> langchain_experimental.text_splitters <span class="hljs-keyword">import</span> SemanticChunker

embedding = HuggingFaceEmbeddings(model_name=<span class="hljs-string">'sentence-transformers/all-MiniLM-L6-v2'</span>)
splitter = SemanticChunker(embedding)
</code></pre>
<p>🧠 <strong>Use Case:</strong> Ideal for diverse data like news articles or mixed-topic content.</p>
<hr />
<h2 id="heading-3-vector-stores-the-memory-of-rag">💾 3. Vector Stores — The Memory of RAG</h2>
<p>Now comes the storage brain of the system — the <strong>Vector Store</strong>.<br />It turns your document chunks into embeddings and stores them for fast semantic search.</p>
<hr />
<h3 id="heading-a-chromadb-lightweight-amp-persistent">🧩 <strong>A. ChromaDB</strong> — Lightweight &amp; Persistent</h3>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> langchain_huggingface <span class="hljs-keyword">import</span> HuggingFaceEndpointEmbeddings
<span class="hljs-keyword">from</span> langchain.vectorstores <span class="hljs-keyword">import</span> Chroma

embeddings = HuggingFaceEndpointEmbeddings(model=<span class="hljs-string">"BAAI/bge-m3"</span>)
vector_store = Chroma(embedding_function=embeddings, persist_directory=<span class="hljs-string">'my_chroma_db'</span>)
</code></pre>
<p>🧠 <strong>Use Case:</strong> Ideal for small to medium RAG systems and local testing.</p>
<hr />
<h3 id="heading-b-faiss-for-speed-and-scale">⚡ <strong>B. FAISS</strong> — For Speed and Scale</h3>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> langchain_community.vectorstores <span class="hljs-keyword">import</span> FAISS
vectorstore = FAISS.from_documents(docs, embedding=embeddings)
results = vectorstore.similarity_search(<span class="hljs-string">"What is LangChain?"</span>, k=<span class="hljs-number">2</span>)
</code></pre>
<p>🧠 <strong>Use Case:</strong> Real-time applications like semantic search or chatbots.</p>
<hr />
<h2 id="heading-4-retrievers-the-bridge-between-storage-amp-llm">🔍 4. Retrievers — The Bridge Between Storage &amp; LLM</h2>
<p>Retrievers are what make RAG intelligent — they fetch the <em>right</em> data chunks when a user asks a question.</p>
<hr />
<h3 id="heading-a-similarity-search-retriever">🔹 <strong>A. Similarity Search Retriever</strong></h3>
<pre><code class="lang-python">retriever = vectorstore.as_retriever(search_type=<span class="hljs-string">"similarity"</span>, search_kwargs={<span class="hljs-string">"k"</span>: <span class="hljs-number">5</span>})
results = retriever.invoke(<span class="hljs-string">"Who is Virat Kohli?"</span>)
</code></pre>
<p>🧠 <strong>Use Case:</strong> Traditional RAG setups where accuracy matters most.</p>
<hr />
<h3 id="heading-b-mmr-retriever-diversity-relevance">🔸 <strong>B. MMR Retriever (Diversity + Relevance)</strong></h3>
<pre><code class="lang-python">retriever = vectorstore.as_retriever(search_type=<span class="hljs-string">"mmr"</span>, search_kwargs={<span class="hljs-string">"k"</span>: <span class="hljs-number">3</span>, <span class="hljs-string">"lambda_mult"</span>: <span class="hljs-number">0.5</span>})
</code></pre>
<p>🧠 <strong>Use Case:</strong> When you want results that are both <em>relevant and non-redundant</em>.</p>
<hr />
<h3 id="heading-c-multiquery-retriever">🌐 <strong>C. MultiQuery Retriever</strong></h3>
<p>Generates query variations for better recall.</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> langchain.retrievers.multi_query <span class="hljs-keyword">import</span> MultiQueryRetriever
retriever = MultiQueryRetriever.from_llm(retriever=vectorstore.as_retriever(), llm=model)
</code></pre>
<p>🧠 <strong>Use Case:</strong> When users ask vague or complex questions.</p>
<hr />
<h3 id="heading-d-wikipedia-retriever">📚 <strong>D. Wikipedia Retriever</strong></h3>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> langchain_community.retrievers <span class="hljs-keyword">import</span> WikipediaRetriever
retriever = WikipediaRetriever(top_k_results=<span class="hljs-number">2</span>, lang=<span class="hljs-string">'en'</span>)
docs = retriever.invoke(<span class="hljs-string">"Who founded SpaceX?"</span>)
</code></pre>
<p>🧠 <strong>Use Case:</strong> For fact-based or open-domain queries — great for experiments.</p>
<hr />
<h2 id="heading-5-building-the-complete-rag-pipeline">🔗 5. Building the Complete RAG Pipeline</h2>
<p>Finally, all these pieces come together into a single <strong>Retrieval-Augmented Generation pipeline</strong>.</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> langchain.chains <span class="hljs-keyword">import</span> RetrievalQA
<span class="hljs-keyword">from</span> langchain_community.document_loaders <span class="hljs-keyword">import</span> PyPDFLoader
<span class="hljs-keyword">from</span> langchain.text_splitter <span class="hljs-keyword">import</span> RecursiveCharacterTextSplitter
<span class="hljs-keyword">from</span> langchain.vectorstores <span class="hljs-keyword">import</span> Chroma

<span class="hljs-comment"># 1. Load data</span>
docs = PyPDFLoader(<span class="hljs-string">"document.pdf"</span>).load()

<span class="hljs-comment"># 2. Split into chunks</span>
splitter = RecursiveCharacterTextSplitter(chunk_size=<span class="hljs-number">500</span>, chunk_overlap=<span class="hljs-number">50</span>)
chunks = splitter.split_documents(docs)

<span class="hljs-comment"># 3. Create embeddings and store</span>
vectorstore = Chroma.from_documents(chunks, embeddings, persist_directory=<span class="hljs-string">'db'</span>)

<span class="hljs-comment"># 4. Create retriever</span>
retriever = vectorstore.as_retriever(search_kwargs={<span class="hljs-string">"k"</span>: <span class="hljs-number">3</span>})

<span class="hljs-comment"># 5. Build RAG chain</span>
qa_chain = RetrievalQA.from_chain_type(llm=model, retriever=retriever, return_source_documents=<span class="hljs-literal">True</span>)
result = qa_chain.invoke({<span class="hljs-string">"query"</span>: <span class="hljs-string">"What is this document about?"</span>})
</code></pre>
<p>And just like that — you’ve built your first <strong>RAG system</strong> 🧠💥</p>
<hr />
<h2 id="heading-my-takeaway">🧭 My Takeaway</h2>
<p>Day 12 gave me a full 360° view of how <strong>data moves through RAG pipelines</strong> — from raw documents to meaningful, retrievable knowledge.<br />This was the point where everything I’d learned about LLMs, embeddings, and parsing finally clicked together.</p>
<hr />
<h2 id="heading-whats-next">🔮 What’s Next?</h2>
<p>Up next is one of my most exciting mini-projects yet — <strong>“YouTube Chat”</strong>, where I’ll use LangChain to chat directly with YouTube videos using transcripts! 🎥🤖</p>
<p>So stay tuned — we’re about to make RAG truly <em>interactive</em>.</p>
]]></content:encoded></item><item><title><![CDATA[🧠 My Journey into Agentic    AI — Day 11: From Runnables to Chains in LangChain]]></title><description><![CDATA[After exploring structured outputs and parsers on Day 10, I stepped into one of the most exciting parts of LangChain — the Runnables and Chains ecosystem.
If you’ve ever wondered how AI pipelines actually run under the hood — how your prompts, models...]]></description><link>https://avadhootkamble24.hashnode.dev/my-journey-into-agentic-ai-day-11-from-runnables-to-chains-in-langchain</link><guid isPermaLink="true">https://avadhootkamble24.hashnode.dev/my-journey-into-agentic-ai-day-11-from-runnables-to-chains-in-langchain</guid><dc:creator><![CDATA[Avadhoot Kamble]]></dc:creator><pubDate>Fri, 17 Oct 2025 14:52:35 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1760712687993/59f077f8-cb05-4e3f-96b5-34a2c2b67082.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>After exploring <strong>structured outputs</strong> and <strong>parsers</strong> on Day 10, I stepped into one of the most exciting parts of LangChain — the <strong>Runnables and Chains</strong> ecosystem.</p>
<p>If you’ve ever wondered <em>how AI pipelines actually run under the hood</em> — how your prompts, models, and parsers connect together — this is where all of that comes to life.</p>
<p>Today was all about understanding how LangChain structures <strong>flow</strong>, <strong>logic</strong>, and <strong>connections</strong> between its building blocks.</p>
<hr />
<h2 id="heading-setting-the-stage-importing-essentials">⚙️ Setting the Stage — Importing Essentials</h2>
<p>Before I started experimenting, I ensured my environment was ready.<br />Here are the imports I used across all my runnable and chain examples:</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> langchain_openai <span class="hljs-keyword">import</span> ChatOpenAI
<span class="hljs-keyword">from</span> dotenv <span class="hljs-keyword">import</span> load_dotenv
<span class="hljs-keyword">from</span> langchain_core.prompts <span class="hljs-keyword">import</span> PromptTemplate
<span class="hljs-keyword">from</span> langchain_core.output_parsers <span class="hljs-keyword">import</span> StrOutputParser
<span class="hljs-keyword">from</span> langchain.schema.runnable <span class="hljs-keyword">import</span> (
    RunnableSequence,
    RunnableParallel,
    RunnablePassthrough,
    RunnableLambda,
    RunnableBranch
)
<span class="hljs-keyword">from</span> langchain.chains <span class="hljs-keyword">import</span> SimpleChain, SequentialChain, ParallelChain
<span class="hljs-keyword">import</span> os

load_dotenv()
</code></pre>
<p>With that done, I was ready to begin my deep dive.</p>
<hr />
<h2 id="heading-understanding-runnables-the-core-foundation">🧩 Understanding Runnables — The Core Foundation</h2>
<p><strong>Runnables</strong> define how data moves between each component in a LangChain pipeline.<br />They are like the <em>nervous system</em> — sending information step-by-step through prompts, models, and parsers.</p>
<p>You can think of them as a manual approach to building custom dataflows before moving to more abstracted versions — <strong>Chains</strong>.</p>
<hr />
<h3 id="heading-runnablesequence-building-step-by-step-pipelines">🔹 RunnableSequence — Building Step-by-Step Pipelines</h3>
<p>This was my first hands-on runnable type.<br />It allowed me to connect multiple components where each step’s output becomes the next step’s input.</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> langchain.schema.runnable <span class="hljs-keyword">import</span> RunnableSequence

prompt1 = PromptTemplate(
    template=<span class="hljs-string">"Generate a report on {topic}"</span>,
    input_variables=[<span class="hljs-string">"topic"</span>]
)

prompt2 = PromptTemplate(
    template=<span class="hljs-string">"Summarize the following report into key points:\n{text}"</span>,
    input_variables=[<span class="hljs-string">"text"</span>]
)

model = ChatOpenAI(model=os.getenv(<span class="hljs-string">"OPENROUTER_MODEL"</span>),
                   api_key=os.getenv(<span class="hljs-string">"OPENROUTER_API_KEY"</span>),
                   base_url=<span class="hljs-string">"https://openrouter.ai/api/v1"</span>)

parser = StrOutputParser()

sequence = RunnableSequence(first=prompt1, middle=[model, parser, prompt2, model, parser])
result = sequence.invoke({<span class="hljs-string">"topic"</span>: <span class="hljs-string">"Artificial Intelligence in Healthcare"</span>})

print(result)
</code></pre>
<p>This created a <strong>multi-step pipeline</strong> where a report was first generated and then summarized — showing how easily one can connect multiple logical stages.</p>
<hr />
<h3 id="heading-runnableparallel-running-tasks-simultaneously">⚖️ RunnableParallel — Running Tasks Simultaneously</h3>
<p>Sometimes, you don’t want to wait for one task to complete before starting another.<br />That’s where <code>RunnableParallel</code> shines — it executes multiple branches <em>at the same time</em> and returns all results together.</p>
<pre><code class="lang-python">prompt_notes = PromptTemplate(
    template=<span class="hljs-string">"Create quick notes from this paragraph:\n{text}"</span>,
    input_variables=[<span class="hljs-string">"text"</span>]
)

prompt_quiz = PromptTemplate(
    template=<span class="hljs-string">"Generate 3 quiz questions from this paragraph:\n{text}"</span>,
    input_variables=[<span class="hljs-string">"text"</span>]
)

parallel = RunnableParallel({
    <span class="hljs-string">"notes"</span>: RunnableSequence(first=prompt_notes, middle=[model, parser]),
    <span class="hljs-string">"quiz"</span>: RunnableSequence(first=prompt_quiz, middle=[model, parser])
})

text = <span class="hljs-string">"Reinforcement learning is a feedback-driven approach to machine learning."</span>
result = parallel.invoke({<span class="hljs-string">"text"</span>: text})

print(result)
</code></pre>
<p>This parallel structure was powerful — it helped me realize how models can <strong>multitask efficiently</strong>.</p>
<hr />
<h3 id="heading-runnablepassthrough-sending-inputs-as-is">🔁 RunnablePassthrough — Sending Inputs as Is</h3>
<p>This simple but useful runnable just passes the input forward.<br />I used it for debugging and maintaining context during pipeline testing.</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> langchain.schema.runnable <span class="hljs-keyword">import</span> RunnablePassthrough

passthrough = RunnablePassthrough()
print(passthrough.invoke(<span class="hljs-string">"Hello, Runnables!"</span>))
</code></pre>
<hr />
<h3 id="heading-runnablelambda-adding-custom-logic">⚡ RunnableLambda — Adding Custom Logic</h3>
<p>Sometimes you need small transformations — for example, formatting or cleaning the data before passing it ahead.<br />That’s where <code>RunnableLambda</code> came in handy.</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> langchain.schema.runnable <span class="hljs-keyword">import</span> RunnableLambda

to_upper = RunnableLambda(<span class="hljs-keyword">lambda</span> x: x.upper())
print(to_upper.invoke(<span class="hljs-string">"agentic ai"</span>))
</code></pre>
<hr />
<h3 id="heading-runnablebranch-bringing-conditional-logic">🌿 RunnableBranch — Bringing Conditional Logic</h3>
<p>This was one of the most exciting concepts — adding decision-making capability.<br />You can route data differently based on conditions, making workflows adaptive.</p>
<p>For instance, based on input sentiment, you can route text to either a summarizer or a sentiment analyzer model.</p>
<pre><code class="lang-python">tech_prompt = PromptTemplate(template=<span class="hljs-string">"Explain the technology behind {topic}."</span>, input_variables=[<span class="hljs-string">"topic"</span>])
nontech_prompt = PromptTemplate(template=<span class="hljs-string">"Give a short overview of {topic}."</span>, input_variables=[<span class="hljs-string">"topic"</span>])

branch = RunnableBranch(
    (<span class="hljs-keyword">lambda</span> x: <span class="hljs-string">"AI"</span> <span class="hljs-keyword">in</span> x[<span class="hljs-string">"topic"</span>], RunnableSequence(first=tech_prompt, middle=[model, parser])),
    (<span class="hljs-keyword">lambda</span> x: <span class="hljs-literal">True</span>, RunnableSequence(first=nontech_prompt, middle=[model, parser]))  <span class="hljs-comment"># default</span>
)

print(branch.invoke({<span class="hljs-string">"topic"</span>: <span class="hljs-string">"AI in healthcare"</span>}))
print(branch.invoke({<span class="hljs-string">"topic"</span>: <span class="hljs-string">"Global tourism"</span>}))
</code></pre>
<hr />
<h2 id="heading-from-runnables-to-chains">🔗 From Runnables to Chains</h2>
<p>Once I grasped Runnables, I moved to <strong>Chains</strong> — which are built on top of them.<br />Chains make the code <em>simpler and more readable</em> while maintaining the same power and flexibility.</p>
<p>If Runnables are the <em>manual gearbox</em>, Chains are the <em>automatic transmission</em> — smoother, faster, and easier to manage.</p>
<hr />
<h3 id="heading-simple-chain">🔹 Simple Chain</h3>
<p>The <strong>SimpleChain</strong> is where it all begins.<br />It connects a single input, a single model, and an output parser in a neat and easy way.</p>
<pre><code class="lang-python">prompt = PromptTemplate(template=<span class="hljs-string">"What are the key advantages of {topic}?"</span>, input_variables=[<span class="hljs-string">"topic"</span>])

simple_chain =prompt | model | parser)
</code></pre>
<p>It’s the most beginner-friendly way to execute a single model pipeline.</p>
<hr />
<h3 id="heading-sequential-chain">🔸 Sequential Chain</h3>
<p>The <strong>SequentialChain</strong> is similar to RunnableSequence but more structured and readable.<br />Each chain executes in order and passes its output to the next one.</p>
<pre><code class="lang-python">prompt1 = PromptTemplate(template=<span class="hljs-string">"Write a paragraph about {topic}."</span>, input_variables=[<span class="hljs-string">"topic"</span>])
prompt2 = PromptTemplate(template=<span class="hljs-string">"Summarize the following text:\n{text}"</span>, input_variables=[<span class="hljs-string">"text"</span>])

chain1 = prompt1| model| parser
chain2 = prompt2| model|parser

sequential_chain = chain1|chain2
</code></pre>
<p>This chain type is perfect for step-by-step transformations like text generation, cleaning, and summarization.</p>
<hr />
<h3 id="heading-parallel-chain">⚖️ Parallel Chain</h3>
<p>Parallel chains execute multiple sub-chains simultaneously and return combined results.<br />They’re useful when one input needs to produce multiple kinds of outputs.</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> langchain.chains <span class="hljs-keyword">import</span> RunnableParallel

prompt_a = PromptTemplate(template=<span class="hljs-string">"Summarize this:\n{text}"</span>, input_variables=[<span class="hljs-string">"text"</span>])
prompt_b = PromptTemplate(template=<span class="hljs-string">"Generate 3 questions from this text:\n{text}"</span>, input_variables=[<span class="hljs-string">"text"</span>])

chain_a = prompt_a |model| parser
chain_b = prompt_b|model|parser

parallel_chain = RunnableParallel( chain_a|chain_b)
</code></pre>
<hr />
<h3 id="heading-conditional-chain">🔀 Conditional Chain</h3>
<p>Conditional chains help route inputs based on specific criteria.<br />For example, if a topic is technical, send it to one model; otherwise, use another.</p>
<p>This kind of conditional flow makes AI workflows smarter and more adaptable.</p>
<pre><code class="lang-python">prompt_tech = PromptTemplate(template=<span class="hljs-string">"Write a technical summary of {topic}."</span>, input_variables=[<span class="hljs-string">"topic"</span>])
prompt_general = PromptTemplate(template=<span class="hljs-string">"Write a general summary of {topic}."</span>, input_variables=[<span class="hljs-string">"topic"</span>])

tech_chain = SimpleChain(prompt=prompt_tech, llm=model, output_parser=parser)
general_chain = SimpleChain(prompt=prompt_general, llm=model, output_parser=parser)

<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">route_topic</span>(<span class="hljs-params">input_data</span>):</span>
    <span class="hljs-keyword">return</span> <span class="hljs-string">"tech_chain"</span> <span class="hljs-keyword">if</span> <span class="hljs-string">"AI"</span> <span class="hljs-keyword">in</span> input_data[<span class="hljs-string">"topic"</span>] <span class="hljs-keyword">else</span> <span class="hljs-string">"general_chain"</span>

conditional_chain = ConditionalChain(
    input_key=<span class="hljs-string">"topic"</span>,
    condition_function=route_topic,
    chains={<span class="hljs-string">"tech_chain"</span>: tech_chain, <span class="hljs-string">"general_chain"</span>: general_chain}
)
</code></pre>
<hr />
<h3 id="heading-branch-chain">🌳 Branch Chain</h3>
<p>Finally, I learned about the <strong>BranchChain</strong>, where multiple paths can exist, and execution follows a branch based on predefined logic.<br />It’s like giving your chain a <em>decision tree</em> inside it.</p>
<pre><code class="lang-python">prompt_ai = PromptTemplate(template=<span class="hljs-string">"Provide a detailed explanation of {topic} in AI terms."</span>, input_variables=[<span class="hljs-string">"topic"</span>])
prompt_finance = PromptTemplate(template=<span class="hljs-string">"Explain {topic} with examples from finance."</span>, input_variables=[<span class="hljs-string">"topic"</span>])
prompt_default = PromptTemplate(template=<span class="hljs-string">"Give a brief description of {topic}."</span>, input_variables=[<span class="hljs-string">"topic"</span>])

ai_chain = SimpleChain(prompt=prompt_ai, llm=model, output_parser=parser)
finance_chain = SimpleChain(prompt=prompt_finance, llm=model, output_parser=parser)
default_chain = SimpleChain(prompt=prompt_default, llm=model, output_parser=parser)

<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">branch_logic</span>(<span class="hljs-params">inputs</span>):</span>
    topic = inputs[<span class="hljs-string">"topic"</span>].lower()
    <span class="hljs-keyword">if</span> <span class="hljs-string">"ai"</span> <span class="hljs-keyword">in</span> topic:
        <span class="hljs-keyword">return</span> <span class="hljs-string">"ai_chain"</span>
    <span class="hljs-keyword">elif</span> <span class="hljs-string">"finance"</span> <span class="hljs-keyword">in</span> topic:
        <span class="hljs-keyword">return</span> <span class="hljs-string">"finance_chain"</span>
    <span class="hljs-keyword">else</span>:
        <span class="hljs-keyword">return</span> <span class="hljs-string">"default_chain"</span>

branch_chain = BranchChain(branch_function=branch_logic, branches={
    <span class="hljs-string">"ai_chain"</span>: ai_chain,
    <span class="hljs-string">"finance_chain"</span>: finance_chain,
    <span class="hljs-string">"default_chain"</span>: default_chain
})

print(branch_chain.run({<span class="hljs-string">"topic"</span>: <span class="hljs-string">"AI in marketing"</span>}))
print(branch_chain.run({<span class="hljs-string">"topic"</span>: <span class="hljs-string">"Investment banking"</span>}))
print(branch_chain.run({<span class="hljs-string">"topic"</span>: <span class="hljs-string">"Climate change"</span>}))
</code></pre>
<hr />
<h2 id="heading-my-takeaway">💡 My Takeaway</h2>
<p>Day 11 was a real “aha!” moment for me.<br />I finally understood how <strong>LangChain manages flow</strong>, <strong>execution</strong>, and <strong>decision-making</strong>.</p>
<p>Runnables gave me raw control — allowing me to piece components together.<br />Chains added structure — turning that complexity into readable, reusable logic.</p>
<p>This balance between flexibility and simplicity makes LangChain truly special.</p>
<hr />
]]></content:encoded></item><item><title><![CDATA[🚀 My Agentic AI Journey – Day 10: Structured Outputs and Output Parsers in LangChain]]></title><description><![CDATA[After working with models and prompts in the previous days, I realized that while language models can generate amazing results, their outputs are often free-form text — not always easy for machines to read or integrate into workflows.
So, on Day 10, ...]]></description><link>https://avadhootkamble24.hashnode.dev/my-agentic-ai-journey-day-10-structured-outputs-and-output-parsers-in-langchain</link><guid isPermaLink="true">https://avadhootkamble24.hashnode.dev/my-agentic-ai-journey-day-10-structured-outputs-and-output-parsers-in-langchain</guid><category><![CDATA[OutputParsers]]></category><category><![CDATA[StructuredOutputs]]></category><category><![CDATA[agentic AI]]></category><category><![CDATA[agentic ai development]]></category><category><![CDATA[generative ai]]></category><category><![CDATA[langchain]]></category><category><![CDATA[LLM's ]]></category><category><![CDATA[AI Projects]]></category><category><![CDATA[Machine Learning]]></category><category><![CDATA[Deep Learning]]></category><category><![CDATA[opensourceai]]></category><category><![CDATA[huggingface]]></category><category><![CDATA[#PromptEngineering]]></category><category><![CDATA[Python]]></category><category><![CDATA[AI community]]></category><dc:creator><![CDATA[Avadhoot Kamble]]></dc:creator><pubDate>Fri, 10 Oct 2025 04:30:16 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1760020544159/10001253-fd61-4003-9404-a694fc815407.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>After working with <strong>models</strong> and <strong>prompts</strong> in the previous days, I realized that while language models can generate amazing results, their outputs are often free-form text — not always easy for machines to read or integrate into workflows.</p>
<p>So, on <strong>Day 10</strong>, I decided to solve that problem by learning about <strong>Structured Outputs</strong> and <strong>Output Parsers</strong> in LangChain — tools that make model outputs <strong>consistent, predictable, and machine-readable</strong>.</p>
<hr />
<h2 id="heading-why-structured-outputs-matter">🧩 Why Structured Outputs Matter</h2>
<p>When you’re building AI systems that connect to other applications — like dashboards, databases, or APIs — you can’t rely on loosely formatted text.<br />Structured outputs ensure the model’s responses follow <strong>a defined schema</strong> — such as JSON, Pydantic objects, or TypedDicts — so they can be parsed and used programmatically.</p>
<p>In simpler terms:</p>
<blockquote>
<p>“Structured Outputs turn AI responses from creative text into usable data.”</p>
</blockquote>
<hr />
<h2 id="heading-enforcing-structure-with-withstructuredoutput">🔹 Enforcing Structure with <code>with_structured_output</code></h2>
<p>LangChain provides a method called <code>with_structured_output</code> that binds a model’s output to a predefined schema.</p>
<p>I practiced this with <strong>three different approaches</strong>:</p>
<ol>
<li><p><strong>TypedDict</strong> – Lightweight Python typing for dictionaries.</p>
</li>
<li><p><strong>Pydantic BaseModel</strong> – Strict validation and type enforcement.</p>
</li>
<li><p><strong>Raw JSON Schema</strong> – Fully custom JSON structures for flexibility.</p>
</li>
</ol>
<p>Each method gave me a better understanding of how to enforce structure depending on project needs.</p>
<hr />
<h2 id="heading-designing-a-schema-the-review-example">🧱 Designing a Schema: The Review Example</h2>
<p>To understand this better, I designed a <strong>Review Schema</strong> that extracts:</p>
<pre><code class="lang-python">key_themes: list[str]=Field(description=<span class="hljs-string">'Write down all the key themes discussed in the review in a list'</span>)
summary:str=Field(description=<span class="hljs-string">'a brief overview of the review'</span>)
sentiment:Literal[<span class="hljs-string">'pos'</span>,<span class="hljs-string">'neg'</span>]= Field(description=<span class="hljs-string">'return sentiment of review either positive or negative'</span>)
pros:Optional[list[str]]=Field(default=<span class="hljs-literal">None</span>,description=<span class="hljs-string">'Write down all the pros inside the list'</span>)
cons:Optional[list[str]]=Field(default=<span class="hljs-literal">None</span>,description=<span class="hljs-string">'Write all the cons inside a list'</span>)
name:Optional[list[str]]=Field(description=<span class="hljs-string">'Write name of the reviewer'</span>)I added field descriptions to guide the model toward more accurate extraction.
</code></pre>
<p>I added <strong>field descriptions</strong> to guide the model toward more accurate extraction.</p>
<p>Example:</p>
<pre><code class="lang-python">Literal[<span class="hljs-string">'pos'</span>,<span class="hljs-string">'neg'</span>]= Field(description=<span class="hljs-string">'return sentiment of review either positive or negative'</span>)
</code></pre>
<p>However, my schema description mentioned “neutral,” while the enum only allowed “pos” or “neg.”<br />🔍 This mismatch taught me a key production lesson — <strong>schema descriptions must align with their definitions</strong> to avoid validation errors.</p>
<p>I also made <code>pros</code>, <code>cons</code>, and <code>name</code> <strong>optional fields</strong> to ensure the parser remained robust even when those values were missing in text.</p>
<hr />
<h2 id="heading-backend-portability-in-action">⚙️ Backend Portability in Action</h2>
<p>Another big learning moment was discovering that the <strong>structured output workflow is backend-agnostic</strong>.<br />I seamlessly swapped between:</p>
<ul>
<li><p><code>ChatOpenAI</code></p>
</li>
<li><p><code>ChatHuggingFace</code></p>
</li>
</ul>
<p>…and the same structured output logic worked perfectly.</p>
<p>This portability shows the true power of LangChain’s abstraction — one schema can run across multiple LLM backends without rewriting logic.</p>
<hr />
<h2 id="heading-hugging-face-structured-outputs">🧠 Hugging Face + Structured Outputs</h2>
<p>For experimentation, I used:</p>
<ul>
<li><p><strong>TinyLlama/TinyLlama-1.1B-Chat-v1.0</strong> via <code>HuggingFaceEndpoint</code></p>
</li>
<li><p><strong>google/gemma-2-2b-it</strong> for consistency testing across different parser patterns</p>
</li>
</ul>
<p>I also used <code>load_dotenv()</code> to keep environment variables (like API keys) out of the source code — a simple but essential best practice.</p>
<hr />
<h2 id="heading-the-operator-style-template-model-parser">🔄 The Operator Style: Template → Model → Parser</h2>
<p>One of my favorite learnings was how LangChain lets you <strong>compose runnable chains</strong> using the operator-style syntax:</p>
<pre><code class="lang-python">template | model | parser
</code></pre>
<p>This design makes your workflow clean and readable, returning <strong>Python-native structures</strong> directly.</p>
<p>I also learned to use <code>parser.get_format_instructions()</code> inside <strong>partial_variables</strong> to instruct the model exactly how to structure the JSON output — minimizing hallucinations and formatting errors.</p>
<hr />
<h2 id="heading-working-with-different-parsers">🧾 Working with Different Parsers</h2>
<p>Here’s what I practiced and compared:</p>
<h3 id="heading-1-jsonoutputparser">1. <strong>JsonOutputParser</strong></h3>
<ul>
<li><p>Converts free-form text into strict machine-readable JSON.</p>
</li>
<li><p>Eliminates the need for fragile regex post-processing.</p>
</li>
<li><p>Perfect for prompts like “List 5 facts about AI.”</p>
</li>
</ul>
<h3 id="heading-2-responseschema-structuredoutputparser">2. <strong>ResponseSchema + StructuredOutputParser</strong></h3>
<ul>
<li><p>Enforces named fields like <code>fact_1</code>, <code>fact_2</code>, etc.</p>
</li>
<li><p>Produces well-structured Python dictionaries for easy access.</p>
</li>
</ul>
<h3 id="heading-3-pydanticoutputparser">3. <strong>PydanticOutputParser</strong></h3>
<ul>
<li><p>Allows defining custom validation logic using Pydantic models.</p>
</li>
<li><p>I even added a condition to ensure <code>age &gt; 18</code> — a great exercise in constraint enforcement.</p>
</li>
</ul>
<h3 id="heading-4-stroutputparser">4. <strong>StrOutputParser</strong></h3>
<ul>
<li><p>Parses simple string outputs from models.</p>
</li>
<li><p>Helped me understand when <strong>plain strings</strong> suffice and when structured parsing is better.</p>
</li>
</ul>
<hr />
<h2 id="heading-retrieving-and-using-structured-results">🧩 Retrieving and Using Structured Results</h2>
<p>Once parsed, I could easily access individual elements like:</p>
<pre><code class="lang-python">print(result[<span class="hljs-string">"name"</span>])
</code></pre>
<p>This made working with model outputs feel just like handling any other Python data structure.</p>
<p>I also set Hugging Face’s task as <code>"text-generation"</code> consistently while creating endpoints — an important configuration step to ensure clean text-based results.</p>
<hr />
<h2 id="heading-best-practices-i-picked-up">💡 Best Practices I Picked Up</h2>
<ul>
<li><p>Use <code>with_structured_output</code> for reliability — it binds schema and parsing in one step.</p>
</li>
<li><p>Keep schema descriptions clear and consistent.</p>
</li>
<li><p>Use <strong>environment variables</strong> to protect sensitive data.</p>
</li>
<li><p>Prefer <strong>JSON or Pydantic parsers</strong> when you need non-tool-based structured data extraction.</p>
</li>
<li><p>Always validate the final structure before using it in downstream tasks.</p>
</li>
</ul>
<hr />
<h2 id="heading-key-takeaways-from-day-10">🔑 Key Takeaways from Day 10</h2>
<p>✔ Learned multiple approaches to enforce structured outputs using TypedDict, Pydantic, and JSON schema.<br />✔ Designed a robust Review schema and understood schema-description mismatches.<br />✔ Explored backend portability between OpenAI and Hugging Face.<br />✔ Practiced output parsing with Json, Pydantic, Structured, and String parsers.<br />✔ Built end-to-end runnable chains with <code>template | model | parser</code>.<br />✔ Ensured clean, machine-readable outputs ready for production use.</p>
<hr />
<h2 id="heading-whats-next">📌 What’s Next?</h2>
<p>Day 10 gave me a deeper understanding of how to make AI outputs <strong>structured, reliable, and production-ready</strong> — something every GenAI developer needs before building real-world systems.</p>
<p>Next, in <strong>Day 11</strong>, I’ll explore <strong>Runnables and Chains in LangChain</strong> ⚙️</p>
<p>I’ll dive into how these components allow developers to:</p>
<ul>
<li><p>Combine models, prompts, and parsers into modular pipelines.</p>
</li>
<li><p>Build flexible, maintainable workflows that can scale.</p>
</li>
<li><p>Link multiple steps — like input processing, model inference, and output parsing — into one smooth chain.</p>
</li>
</ul>
<p>This will take me one step closer to mastering the <strong>core building blocks of Agentic AI</strong>, where multiple reasoning and decision-making components work together seamlessly.</p>
<p>Stay tuned for <strong>Day 11</strong> — we’re moving from <em>structured outputs</em> to <em>structured thinking</em> 🚀</p>
]]></content:encoded></item><item><title><![CDATA[🚀 My Agentic AI Journey – Day 9: Models, Prompts, and My First Mini-Project]]></title><description><![CDATA[After spending my last few days learning about models, attention mechanisms, and transformers, Day 9 felt like a big leap forward. This was the day where I really started to connect theory with practical implementation using LangChain.
On Day 9, I ex...]]></description><link>https://avadhootkamble24.hashnode.dev/my-agentic-ai-journey-day-9-models-prompts-and-my-first-mini-project</link><guid isPermaLink="true">https://avadhootkamble24.hashnode.dev/my-agentic-ai-journey-day-9-models-prompts-and-my-first-mini-project</guid><dc:creator><![CDATA[Avadhoot Kamble]]></dc:creator><pubDate>Wed, 01 Oct 2025 06:54:01 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1759552723337/0a9a0d8f-88f7-4a37-8442-8d47eddd25ab.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>After spending my last few days learning about models, attention mechanisms, and transformers, <strong>Day 9</strong> felt like a big leap forward. This was the day where I really started to connect <strong>theory with practical implementation</strong> using LangChain.</p>
<p>On Day 9, I explored two of the most important components of LangChain:</p>
<ol>
<li><p><strong>Models</strong> – the core brains of the system.</p>
</li>
<li><p><strong>Prompts</strong> – the way we guide and control these brains.</p>
</li>
</ol>
<p>And to make my learning more exciting, I also built a <strong>mini project</strong> that uses prompts to summarize research papers. Let’s dive in.</p>
<hr />
<h2 id="heading-working-with-models-in-langchain">🔹 Working with Models in LangChain</h2>
<p>Models are at the heart of LangChain. They power everything — from chatbots to summarizers to advanced RAG pipelines. On Day 9, I learned about <strong>different categories of models</strong> and how LangChain makes it easy to switch between them.</p>
<hr />
<h3 id="heading-proprietary-vs-open-source-models">Proprietary vs. Open-Source Models</h3>
<ul>
<li><p><strong>Proprietary Models</strong>: OpenAI’s GPT, Anthropic’s Claude, Google’s Gemini.</p>
<ul>
<li><p>Require an API key and are often paid.</p>
</li>
<li><p>Highly optimized for accuracy and fluency (using RLHF and fine-tuning).</p>
</li>
<li><p>LangChain makes switching between providers as simple as changing the import class.</p>
</li>
</ul>
</li>
<li><p><strong>Open-Source Models</strong>: Hugging Face hosts models like <strong>LLaMA, Zephyr, TinyLlama</strong>.</p>
<ul>
<li><p>Free and customizable.</p>
</li>
<li><p>Can be run using Hugging Face Inference API or locally.</p>
</li>
<li><p>Running locally requires more hardware but gives full control.</p>
</li>
</ul>
</li>
</ul>
<p>As a student, I focused more on <strong>open-source models</strong> while still making sure I understood how to use proprietary ones.</p>
<hr />
<h3 id="heading-hugging-face-inference-api">Hugging Face Inference API</h3>
<p>I started by using Hugging Face’s Inference API with the <strong>Zephyr-7B-beta</strong> model.</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> langchain_huggingface <span class="hljs-keyword">import</span> ChatHuggingFace, HuggingFaceEndpoint
<span class="hljs-keyword">from</span> dotenv <span class="hljs-keyword">import</span> load_dotenv
<span class="hljs-keyword">import</span> os
load_dotenv()

llm = HuggingFaceEndpoint(
    repo_id=<span class="hljs-string">"HuggingFaceH4/zephyr-7b-beta"</span>,
    task=<span class="hljs-string">"text-generation"</span>,
    max_new_tokens=<span class="hljs-number">200</span>,
    temperature=<span class="hljs-number">0.7</span>,
    huggingfacehub_api_token=os.getenv(<span class="hljs-string">"HUGGINGFACEHUB_API_TOKEN"</span>)
)

model = ChatHuggingFace(llm=llm)
result = model.invoke(<span class="hljs-string">"What is the capital of India"</span>)
print(result.content)
</code></pre>
<p>✅ Output: <em>“New Delhi, but Mumbai is the largest city in terms of population…………………..”</em></p>
<p>🔎 <strong>Why this happens</strong>:<br />Unlike proprietary models (like GPT), many open-source models are <strong>trained on general datasets</strong> and may add <strong>extra context</strong> instead of giving a short, direct answer. This makes them useful for richer responses but sometimes less precise.</p>
<hr />
<h3 id="heading-running-models-locally">Running Models Locally</h3>
<p>Next, I tried running a smaller model (<strong>TinyLlama-1.1B-Chat</strong>) on my laptop:</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> langchain_huggingface <span class="hljs-keyword">import</span> ChatHuggingFace, HuggingFacePipeline
<span class="hljs-keyword">import</span> os

os.environ[<span class="hljs-string">'HF_HOME'</span>]=<span class="hljs-string">r"D:\Programming\GEN-AI\Campus x Gen AI with langchain\huggingface_cache"</span>

llm=HuggingFacePipeline.from_model_id(
    model_id=<span class="hljs-string">"TinyLlama/TinyLlama-1.1B-Chat-v1.0"</span>,
    task=<span class="hljs-string">"text-generation"</span>,
    pipeline_kwargs=dict(
        temperature=<span class="hljs-number">0.6</span>,
        max_new_tokens=<span class="hljs-number">100</span>
    )
)

model=ChatHuggingFace(llm=llm)
result=model.invoke(<span class="hljs-string">'What is capital of india? '</span>)
print(result.content)
</code></pre>
<p>✅ Output: <em>{</em></p>
<p>&lt;|user|&gt; What is capital of india?</p>
<p>&lt;|assistant|&gt; The capital of India is New Delhi, also known as "Lal Qila" or "Red Fort".</p>
<p>}</p>
<p>🔎 <strong>Observation</strong>:<br />Surprisingly, the locally run model gave a <strong>more precise and enriched answer</strong> compared to the Hugging Face API run. This shows that <strong>local fine-tuned models can sometimes provide contextually sharper results</strong> — though they may be slower and require more system resources.</p>
<hr />
<h3 id="heading-creating-embeddings-with-hugging-face">Creating Embeddings with Hugging Face</h3>
<p>Alongside LLMs, I also learned to create <strong>embeddings</strong>, which are vectors that represent the meaning of text.</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> langchain_huggingface <span class="hljs-keyword">import</span> HuggingFaceEmbeddings

embedding = HuggingFaceEmbeddings(model_name=<span class="hljs-string">'sentence-transformers/all-MiniLM-L6-v2'</span>)

doc = [
    <span class="hljs-string">'Delhi is capital of India'</span>,
    <span class="hljs-string">'Kolkatta is capital of India'</span>,
    <span class="hljs-string">'Paris is capital of France'</span>
]

vector = embedding.embed_documents(doc)
print(str(vector))
</code></pre>
<p>✅ Output: Dense vectors for each sentence.</p>
<p>This step helped me understand how embeddings allow AI systems to compare meanings beyond exact words — an essential part of building semantic search and RAG applications.</p>
<hr />
<h2 id="heading-working-with-prompts-in-langchain">🔹 Working with Prompts in LangChain</h2>
<p>Once I got comfortable with models, I moved on to <strong>Prompts</strong>.</p>
<p>Prompts are the way we “talk” to models, and LangChain gives us structured tools to manage them.</p>
<hr />
<h3 id="heading-structured-prompting">Structured Prompting</h3>
<p>Here’s what I learned:</p>
<ol>
<li><p><strong>Prompt Templates</strong> → Reusable text structures with placeholders.</p>
<ul>
<li>Example: <code>"Translate the following text into French: {text}"</code>.</li>
</ul>
</li>
<li><p><strong>Chat Prompt Templates</strong> → For conversations with role separation.</p>
<ul>
<li><p><strong>System Message</strong> → Defines AI’s role (e.g., “You are a helpful tutor”).</p>
</li>
<li><p><strong>Human Message</strong> → User’s input.</p>
</li>
<li><p><strong>AI Message</strong> → Model’s response.</p>
</li>
</ul>
</li>
<li><p><strong>Message Placeholders</strong> → Allow dynamic insertion of chat history or context (e.g., <code>{history}</code>).</p>
<ul>
<li>Super useful for chatbots and memory-based apps.</li>
</ul>
</li>
</ol>
<hr />
<h3 id="heading-example-simple-prompt">Example: Simple Prompt</h3>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> langchain_core.prompts <span class="hljs-keyword">import</span> PromptTemplate

template = PromptTemplate.from_template(<span class="hljs-string">"Translate the following text into French: {text}"</span>)

prompt = template.format(text=<span class="hljs-string">"I love learning AI with LangChain"</span>)
print(prompt)
</code></pre>
<p>✅ Output:</p>
<pre><code class="lang-plaintext">Translate the following text into French: I love learning AI with LangChain
</code></pre>
<hr />
<h3 id="heading-why-prompts-matter">Why Prompts Matter</h3>
<ul>
<li><p>They <strong>control how the AI behaves</strong>.</p>
</li>
<li><p>They can be <strong>reused and scaled</strong>.</p>
</li>
<li><p>Structured roles (System/Human/AI) make interactions more natural.</p>
</li>
<li><p>Placeholders make prompts <strong>dynamic and flexible</strong>.</p>
</li>
</ul>
<hr />
<h2 id="heading-my-mini-project-research-paper-summarizer">🛠️ My Mini Project: Research Paper Summarizer</h2>
<p>After learning about prompt templates, I built my first <strong>mini-project</strong> — a tool to summarize research papers 🎓.</p>
<p>Here’s what I did:</p>
<ol>
<li><p><strong>Created a prompt</strong> and saved it as a JSON file (<code>template.json</code>).</p>
<ul>
<li>This ensured the instructions were reusable.</li>
</ul>
</li>
<li><p><strong>Took user inputs</strong> (paper title, explanation style, summary length).</p>
</li>
<li><p><strong>Generated summaries</strong> with math details, analogies, and proper structure.</p>
</li>
</ol>
<h3 id="heading-example-prompt">Example Prompt</h3>
<pre><code class="lang-python">template= PromptTemplate(
    template=<span class="hljs-string">'''
Please summarize the research paper titled "{paper_input}" with the following specifications:
Explanation Style: {style_input}  
Explanation Length: {length_input}  
1. Mathematical Details:  
   - Include relevant mathematical equations if present in the paper.  
   - Explain the mathematical concepts using simple, intuitive code snippets where applicable.  
2. Analogies:  
   - Use relatable analogies to simplify complex ideas.  
If certain information is not available in the paper, respond with: "Insufficient information available" instead of guessing.  
Ensure the summary is clear, accurate, and aligned with the provided style and length.
'''</span>,
    input_variables=[<span class="hljs-string">'paper_input'</span>,<span class="hljs-string">'style_input'</span>,<span class="hljs-string">'length_input'</span>],
    validate_template=<span class="hljs-literal">True</span>
)

template.save(<span class="hljs-string">'template.json'</span>)
</code></pre>
<p>This project showed me how prompts can be <strong>reusable assets</strong> for building real-world GenAI applications.</p>
<hr />
<h3 id="heading-github-repository">🔹 GitHub Repository</h3>
<p>You can find the code for my project here 👇<br />👉 <a target="_blank" href="https://github.com/AvadhootKamble24/Generative-AI/tree/main/Research%20Paper%20Summarizer">GitHub Repository Link</a></p>
<hr />
<h2 id="heading-key-learnings-from-day-9">🔑 Key Learnings from Day 9</h2>
<ul>
<li><p>Learned how to integrate both <strong>proprietary and open-source models</strong> in LangChain.</p>
</li>
<li><p>Practiced with <strong>Hugging Face API</strong> and <strong>local models</strong>.</p>
</li>
<li><p>Generated <strong>embeddings</strong> for semantic tasks.</p>
</li>
<li><p>Explored <strong>prompt engineering</strong> with templates, roles, and placeholders.</p>
</li>
<li><p>Built my <strong>first mini-project</strong> with prompts (research paper summarizer).</p>
</li>
</ul>
<hr />
<h2 id="heading-whats-next">📌 What’s Next?</h2>
<p>Day 9 was packed with hands-on learning — from exploring models and embeddings to mastering prompts and even building my first mini-project. I can already see how these foundational skills are building me up toward real-world <strong>Agentic AI applications</strong>.</p>
<p>For <strong>Day 10</strong>, I’ll be diving into another powerful feature of LangChain:</p>
<p>🔹 <strong>Structured Outputs &amp; Parsers</strong></p>
<ul>
<li><p>How to make model outputs more predictable and machine-readable.</p>
</li>
<li><p>Using <strong>parsers</strong> to convert free-form text into structured formats like JSON or Pydantic objects.</p>
</li>
<li><p>Why structured outputs are essential for integrating LLMs into larger workflows and pipelines.</p>
</li>
</ul>
<p>This is going to be a big step in making my AI applications <strong>production-ready</strong> rather than just experiments.</p>
<p>So stay tuned for <strong>Day 10</strong> 🚀</p>
]]></content:encoded></item><item><title><![CDATA[🚀 My Agentic AI Journey – Day 8: Introduction to LangChain & Its Core Components]]></title><description><![CDATA[After spending my first seven days learning the foundations of NLP, RNNs, Attention, Transformers, LLMs, and Fine-Tuning, I felt ready to move one step further — towards the practical implementation of Generative AI.
On Day 8, I finally started explo...]]></description><link>https://avadhootkamble24.hashnode.dev/my-agentic-ai-journey-day-8-introduction-to-langchain-and-its-core-components</link><guid isPermaLink="true">https://avadhootkamble24.hashnode.dev/my-agentic-ai-journey-day-8-introduction-to-langchain-and-its-core-components</guid><dc:creator><![CDATA[Avadhoot Kamble]]></dc:creator><pubDate>Tue, 30 Sep 2025 04:35:30 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1759206786315/0f9cdf45-c5df-4462-b26a-7ef0481ec242.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>After spending my first seven days learning the <strong>foundations of NLP, RNNs, Attention, Transformers, LLMs, and Fine-Tuning</strong>, I felt ready to move one step further — towards the <strong>practical implementation of Generative AI</strong>.</p>
<p>On <strong>Day 8</strong>, I finally started exploring <strong>LangChain</strong> — a framework that is quickly becoming one of the most powerful tools for building real-world AI applications.</p>
<hr />
<h2 id="heading-what-is-langchain">🔹 What is LangChain?</h2>
<p>LangChain is an <strong>open-source framework</strong> designed to simplify the process of creating applications powered by <strong>Large Language Models (LLMs)</strong>.</p>
<p>Why is it so useful? Let’s take an example. Imagine you want to build a <strong>PDF chatbot</strong> that lets you “talk” to your documents. To make that possible, you’d need to:</p>
<ul>
<li><p>Load documents from a source.</p>
</li>
<li><p>Break them into smaller, manageable chunks.</p>
</li>
<li><p>Convert those chunks into embeddings.</p>
</li>
<li><p>Store embeddings in a database.</p>
</li>
<li><p>Perform semantic search to retrieve relevant pieces.</p>
</li>
<li><p>Send them to an LLM for response.</p>
</li>
</ul>
<p>Doing all this manually would be <strong>complex and time-consuming</strong>. This is where LangChain shines. It acts as the <strong>orchestrator</strong>, connecting all these parts seamlessly and giving developers a <strong>plug-and-play pipeline</strong> for LLM applications.</p>
<hr />
<h2 id="heading-why-langchain-matters-in-my-journey">🔹 Why LangChain Matters in My Journey</h2>
<p>For me, learning LangChain felt like crossing a bridge — from <strong>theory to practice</strong>. It showed me how the concepts I’ve been learning (like embeddings, vector databases, and RAG) fit together to actually <strong>build applications</strong>.</p>
<p>And the best part? LangChain is <strong>model-agnostic</strong>. That means I can switch between OpenAI, Anthropic, Google, or Hugging Face models without rewriting the core of my application.</p>
<hr />
<h2 id="heading-the-six-core-components-of-langchain">🔹 The Six Core Components of LangChain</h2>
<p>On Day 8, I studied LangChain’s six building blocks. These components make it modular, flexible, and extremely powerful.</p>
<h3 id="heading-1-models">1. <strong>Models</strong></h3>
<p>The foundation. LangChain standardizes communication with different <strong>language models</strong> and <strong>embedding models</strong>. No matter which provider you use, the interface stays consistent.</p>
<h3 id="heading-2-prompts">2. <strong>Prompts</strong></h3>
<p>I learned how <strong>prompts are central to guiding LLMs</strong>. LangChain lets you create:</p>
<ul>
<li><p><strong>Dynamic prompts</strong> with placeholders.</p>
</li>
<li><p><strong>Role-based prompts</strong> (e.g., “You are an experienced doctor”).</p>
</li>
<li><p><strong>Few-shot prompts</strong> to teach new tasks with examples.</p>
</li>
</ul>
<h3 id="heading-3-chains">3. <strong>Chains</strong></h3>
<p>The heart of LangChain. Chains let you connect tasks into a logical pipeline where <strong>the output of one step becomes the input of the next</strong>.</p>
<ul>
<li><p><strong>Sequential Chains</strong>: simple pipelines.</p>
</li>
<li><p><strong>Parallel Chains</strong>: run tasks simultaneously.</p>
</li>
<li><p><strong>Conditional Chains</strong>: change flow based on conditions.</p>
</li>
</ul>
<h3 id="heading-4-indexes">4. <strong>Indexes</strong></h3>
<p>Indexes let LLMs access external knowledge. They combine:</p>
<ul>
<li><p><strong>Document Loaders</strong> (to bring in data).</p>
</li>
<li><p><strong>Text Splitters</strong> (to chunk it).</p>
</li>
<li><p><strong>Vector Stores</strong> (to store embeddings).</p>
</li>
<li><p><strong>Retrievers</strong> (to fetch relevant chunks).</p>
</li>
</ul>
<p>This enables <strong>Retrieval-Augmented Generation (RAG)</strong> — something I had only read about earlier, but now started connecting with actual frameworks.</p>
<h3 id="heading-5-memory">5. <strong>Memory</strong></h3>
<p>Normally, LLMs are <strong>stateless</strong>. But LangChain adds <strong>memory</strong>, so models can “remember” past interactions and carry forward context. I explored different memory types like buffer memory, window memory, and summarizer-based memory.</p>
<h3 id="heading-6-agents">6. <strong>Agents</strong></h3>
<p>This was the most exciting part. Unlike normal chatbots, <strong>agents can take actions</strong>. They use reasoning + tools to complete tasks. For example, a LangChain agent could not only tell you flight prices but also <strong>book the flight</strong> using an API.</p>
<hr />
<h2 id="heading-applications-i-can-imagine-building">🔹 Applications I Can Imagine Building</h2>
<p>LangChain unlocked my imagination. Some use cases I now see clearly are:</p>
<ul>
<li><p><strong>Conversational Chatbots</strong> for support.</p>
</li>
<li><p><strong>AI Assistants</strong> trained on private documents.</p>
</li>
<li><p><strong>Research Summarizers</strong> to digest papers.</p>
</li>
<li><p><strong>Workflow Automations</strong> using LLMs + tools.</p>
</li>
<li><p><strong>AI Agents</strong> that don’t just answer — but act.</p>
</li>
</ul>
<hr />
<h2 id="heading-key-takeaways-from-day-8">✨ Key Takeaways from Day 8</h2>
<ul>
<li><p>LangChain is the <strong>bridge between theory and practice</strong> in Generative AI.</p>
</li>
<li><p>Its modular components (Models, Prompts, Chains, Indexes, Memory, Agents) give developers <strong>superpowers</strong>.</p>
</li>
<li><p>With LangChain, building <strong>scalable, production-ready AI apps</strong> becomes accessible.</p>
</li>
</ul>
<hr />
<h2 id="heading-whats-next-day-9-preview">🔮 What’s Next (Day 9 Preview)</h2>
<p>On <strong>Day 9</strong>, I’ll continue with LangChain and dive into its <strong>practical side</strong>. I’ll explore how to actually implement <strong>Chains, Memory, and Agents</strong> with small projects. The goal is to <strong>apply</strong> what I’ve learned and see these components come alive in action.</p>
<p>Stay tuned — the journey is now moving into <strong>hands-on GenAI development</strong> 🚀.</p>
]]></content:encoded></item><item><title><![CDATA[🚀 My Journey into Agentic AI – Day 7: Instruction-Tuned Models and Efficient Fine-Tuning]]></title><description><![CDATA[As I move forward on my path to Agentic AI, Day 7 was all about instruction-tuned models and how fine-tuning makes large language models more efficient, precise, and powerful.
🔹 Large Language Models (LLMs) vs Instruction-Tuned Models

LLMs (like GP...]]></description><link>https://avadhootkamble24.hashnode.dev/agentic-ai-journey-day-7-instruction-tuning-fine-tuning-lora-evaluation</link><guid isPermaLink="true">https://avadhootkamble24.hashnode.dev/agentic-ai-journey-day-7-instruction-tuning-fine-tuning-lora-evaluation</guid><category><![CDATA[Instruction Tuning]]></category><category><![CDATA[agentic AI]]></category><category><![CDATA[generative ai]]></category><category><![CDATA[Machine Learning]]></category><category><![CDATA[Deep Learning]]></category><category><![CDATA[AI Research]]></category><category><![CDATA[llm]]></category><dc:creator><![CDATA[Avadhoot Kamble]]></dc:creator><pubDate>Wed, 24 Sep 2025 15:36:03 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1758727961935/e00ec115-ea2d-422d-980b-a3f1ca882547.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>As I move forward on my path to Agentic AI, Day 7 was all about <strong>instruction-tuned models</strong> and how fine-tuning makes large language models more efficient, precise, and powerful.</p>
<h3 id="heading-large-language-models-llms-vs-instruction-tuned-models">🔹 Large Language Models (LLMs) vs Instruction-Tuned Models</h3>
<ul>
<li><p><strong>LLMs (like GPT-3, GPT-4):</strong> trained on massive datasets, good for general text generation.</p>
</li>
<li><p><strong>Instruction-Tuned Models:</strong> fine-tuned with supervised <em>instruction-response</em> datasets, making them better at following commands and solving specific tasks like summarization, translation, or coding.</p>
</li>
</ul>
<p>Some notable models: <strong>Flan-T5, Flan-PaLM, BloomZ</strong>.</p>
<h3 id="heading-fine-tuning-techniques">🔹 Fine-Tuning Techniques</h3>
<ul>
<li><p><strong>Full Fine-Tuning:</strong> updates all model parameters, leading to high task specialization but costly and risks <em>catastrophic forgetting</em>.</p>
</li>
<li><p><strong>Parameter-Efficient Fine-Tuning (PEFT):</strong> adapts models with minimal changes to parameters using <em>adapters</em>.</p>
</li>
<li><p><strong>LoRA (Low-Rank Adaptation):</strong> a smart way to fine-tune only a small fraction of parameters while maintaining performance.</p>
</li>
</ul>
<h3 id="heading-model-evaluation">🔹 Model Evaluation</h3>
<p>I learned about how models are evaluated:</p>
<ul>
<li><p><strong>Qualitative evaluation:</strong> human judgment for fluency &amp; relevance.</p>
</li>
<li><p><strong>Quantitative metrics:</strong></p>
<ul>
<li><p><strong>ROUGE</strong> (precision, recall, F1 on n-gram overlaps).</p>
</li>
<li><p><strong>BLEU &amp; METEOR</strong> for translation &amp; text generation tasks.</p>
</li>
</ul>
</li>
</ul>
<h3 id="heading-case-study-dialogue-summarization">🔹 Case Study: Dialogue Summarization</h3>
<p>Using <strong>Flan-T5</strong>, I explored prompt engineering methods (zero-shot, one-shot, few-shot). The results showed that while prompts help, <strong>fine-tuning or PEFT is necessary</strong> for high-quality outputs.</p>
<hr />
<h2 id="heading-key-takeaways-from-day-7">✨ Key Takeaways from Day 7</h2>
<ul>
<li><p>Instruction tuning makes LLMs <strong>task-focused and user-friendly</strong>.</p>
</li>
<li><p><strong>PEFT and LoRA</strong> are game changers for efficient fine-tuning.</p>
</li>
<li><p>Evaluation metrics like <strong>ROUGE, BLEU, METEOR</strong> are crucial to measure effectiveness.</p>
</li>
</ul>
<hr />
<h2 id="heading-whats-next-day-8-preview">🔮 What’s Next (Day 8 Preview)</h2>
<p>On <strong>Day 8</strong>, I’ll dive into <strong>LangChain</strong> — one of the most powerful frameworks for building real-world Generative AI applications.</p>
<p>Here’s what I’ll be exploring:</p>
<ul>
<li><p><strong>Introduction to LangChain</strong> – what it is and why it’s important in the GenAI ecosystem.</p>
</li>
<li><p><strong>Core Components of LangChain</strong>:</p>
<ul>
<li><p><strong>Prompt Templates</strong> – structuring and reusing prompts effectively.</p>
</li>
<li><p><strong>Chains</strong> – linking multiple LLM calls together.</p>
</li>
<li><p><strong>Memory</strong> – enabling models to retain context across interactions.</p>
</li>
<li><p><strong>Agents</strong> – allowing dynamic decision-making using tools.</p>
</li>
<li><p><strong>Toolkits &amp; Integrations</strong> – extending LangChain to databases, APIs, and more.</p>
</li>
</ul>
</li>
</ul>
<p>✨ Day 8 will be all about moving from <strong>theory to tools</strong>, learning how LangChain helps in building scalable, production-ready AI apps.</p>
]]></content:encoded></item><item><title><![CDATA[Day 6 – Hugging Face, LangChain, and RAG: Tools Shaping AI Products]]></title><description><![CDATA[Introduction
Hello everyone, welcome back to Day 6 of my journey toward mastering Agentic AI.On the previous days, I built my foundation by learning NLP, RNNs, Attention, and Transformers. Today, I shifted gears to explore something that sits at the ...]]></description><link>https://avadhootkamble24.hashnode.dev/day-6-hugging-face-langchain-and-rag-tools-shaping-ai-products</link><guid isPermaLink="true">https://avadhootkamble24.hashnode.dev/day-6-hugging-face-langchain-and-rag-tools-shaping-ai-products</guid><dc:creator><![CDATA[Avadhoot Kamble]]></dc:creator><pubDate>Mon, 22 Sep 2025 03:50:43 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1758511554170/03d6211c-c454-4acc-b975-4fbbd4b255e4.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-introduction">Introduction</h2>
<p>Hello everyone, welcome back to <strong>Day 6</strong> of my journey toward mastering <strong>Agentic AI</strong>.<br />On the previous days, I built my foundation by learning NLP, RNNs, Attention, and Transformers. Today, I shifted gears to explore something that sits at the <strong>intersection of AI research and product development</strong> — the <strong>Generative AI Product Life Cycle</strong>.</p>
<p>This was a new perspective for me — not just understanding how AI models work, but also how they’re <strong>taken from an idea to deployment</strong> in real-world applications. Alongside this, I also dived into supporting concepts like <strong>prompt engineering, Hugging Face, LangChain, and Retrieval-Augmented Generation (RAG)</strong>.</p>
<p>Here’s how my learning unfolded today 👇</p>
<hr />
<h2 id="heading-step-1-identify-the-use-case">🔑 Step 1: Identify the Use Case</h2>
<p>The <strong>first step</strong> in any Gen AI product is identifying the right <strong>use case</strong>.<br />Without a clear use case, even the most advanced models won’t deliver value.</p>
<p>Some common use cases I studied were:</p>
<ul>
<li><p><strong>Text Generation</strong> → blogs, articles, marketing content.</p>
</li>
<li><p><strong>Conversational AI</strong> → chatbots &amp; virtual assistants.</p>
</li>
<li><p><strong>Text Summarization</strong> → turning large documents into concise insights.</p>
</li>
<li><p><strong>Sentiment Analysis</strong> → understanding customer emotions in reviews.</p>
</li>
<li><p><strong>Translation &amp; TTS</strong> → breaking language barriers and enabling accessibility.</p>
</li>
<li><p><strong>Code Generation</strong> → helping developers with snippets.</p>
</li>
</ul>
<p>👉 The key takeaway here: <strong>the problem must be well-defined</strong> before moving to models.</p>
<hr />
<h2 id="heading-step-2-choosing-the-right-foundation-model">🔑 Step 2: Choosing the Right Foundation Model</h2>
<p>Once the use case is clear, the next challenge is <strong>choosing a model</strong>.<br />Here, I learned to compare:</p>
<ul>
<li><p><strong>Proprietary models</strong> (like GPT-4, Gemini) → optimized but costly &amp; closed.</p>
</li>
<li><p><strong>Open-source models</strong> (like LLaMA, Mistral) → flexible, customizable, but need resources.</p>
</li>
</ul>
<p>Also, the choice depends heavily on <strong>data type</strong>:</p>
<ul>
<li><p><strong>Text</strong> → GPT family, LLaMA.</p>
</li>
<li><p><strong>Image</strong> → DALL·E, Midjourney.</p>
</li>
<li><p><strong>Audio</strong> → Whisper.</p>
</li>
<li><p><strong>Multimodal</strong> → GPT-4 Turbo with Vision, GPT-4o.</p>
</li>
</ul>
<p>💡 Pro tip I picked up: <strong>Hugging Face LLM Leaderboard</strong> is a fantastic tool to explore and compare models.</p>
<hr />
<h2 id="heading-step-3-prompting-amp-tuning">🔑 Step 3: Prompting &amp; Tuning</h2>
<p>This step was <strong>super exciting</strong> because I’ve been practicing prompts myself.<br />There are three main techniques:</p>
<ul>
<li><p><strong>Prompt Engineering</strong> → crafting clear, specific prompts.</p>
</li>
<li><p><strong>Instruction Tuning</strong> → fine-tuning with datasets aligned to tasks.</p>
</li>
<li><p><strong>Fine-Tuning (Full or PEFT)</strong> → adapting large models efficiently without retraining everything.</p>
</li>
</ul>
<p>I also realized <strong>prompt engineering is an art</strong> 🎨. The clarity, context, and structure of the prompt make or break the result.</p>
<hr />
<h2 id="heading-step-4-evaluation">🔑 Step 4: Evaluation</h2>
<p>Even after tuning, the model must be <strong>tested rigorously</strong>.<br />Metrics include:</p>
<ul>
<li><p>Accuracy</p>
</li>
<li><p>Coherence</p>
</li>
<li><p>User satisfaction</p>
</li>
</ul>
<p>This step ensures the model doesn’t just work in theory but also in <strong>real-world conditions</strong>.</p>
<hr />
<h2 id="heading-step-5-deployment">🔑 Step 5: Deployment</h2>
<p>Finally, deployment! 🚀<br />This involves:</p>
<ul>
<li><p>Integrating the model into production.</p>
</li>
<li><p>Ensuring scalability &amp; monitoring.</p>
</li>
<li><p>Continuous improvements (since models can drift or degrade).</p>
</li>
</ul>
<hr />
<h2 id="heading-beyond-the-cycle-supporting-concepts-i-explored">Beyond the Cycle – Supporting Concepts I Explored</h2>
<h3 id="heading-hugging-face">🌟 Hugging Face</h3>
<p>A <strong>community hub for AI models</strong> where developers share, fine-tune, and explore models organized by tasks (text, vision, audio, multimodal). The concept of <strong>model cards</strong> impressed me — they provide transparency into training data, performance, and limitations.</p>
<h3 id="heading-prompt-engineering-in-action">🌟 Prompt Engineering in Action</h3>
<p>I explored real-world examples like:</p>
<ul>
<li><p>Summarization</p>
</li>
<li><p>Sentiment analysis</p>
</li>
<li><p>Automated ticketing systems</p>
</li>
<li><p>Chatbots</p>
</li>
<li><p>Even product descriptions</p>
</li>
</ul>
<p>It amazed me how <strong>changing just the wording of a prompt</strong> changes the entire output.</p>
<h3 id="heading-artificialanalysisaihttpartificialanalysisai">🌟 <a target="_blank" href="http://ArtificialAnalysis.ai">ArtificialAnalysis.ai</a></h3>
<p>A benchmarking site that compares models on <strong>quality, speed, cost, and coding ability</strong>. I learned GPT-4o leads in reasoning but Gemini 1.5 Flash is faster and cheaper — great insight for product decisions.</p>
<h3 id="heading-retrieval-augmented-generation-rag">🌟 Retrieval-Augmented Generation (RAG)</h3>
<p>RAG solves the limitation of static training by letting models <strong>retrieve external knowledge</strong> before generating answers.<br />It works through:</p>
<ol>
<li><p>Preparing &amp; chunking data</p>
</li>
<li><p>Indexing embeddings in a <strong>vector database</strong></p>
</li>
<li><p>Retrieving relevant chunks</p>
</li>
<li><p>Generating answers with enriched context</p>
</li>
</ol>
<p>This ensures models stay <strong>accurate and up-to-date</strong>.</p>
<h3 id="heading-langchain">🌟 LangChain</h3>
<p>A powerful <strong>framework to build LLM-powered apps</strong> with tools like:</p>
<ul>
<li><p>Prompt templates</p>
</li>
<li><p>Memory systems (buffer, summary, token)</p>
</li>
<li><p>Agents &amp; tools</p>
</li>
<li><p>Chains (sequential, router chains)</p>
</li>
</ul>
<p>I saw how LangChain helps create real-world apps like <strong>chatbots, Q&amp;A systems, and multi-step pipelines</strong>.</p>
<hr />
<h2 id="heading-key-takeaways-from-day-6">⚡ Key Takeaways from Day 6</h2>
<ol>
<li><p>Building AI products is not just about models — it’s about <strong>choosing use cases, models, and deployment strategies wisely</strong>.</p>
</li>
<li><p><strong>Prompt engineering and fine-tuning</strong> are essential skills for any AI practitioner.</p>
</li>
<li><p>Platforms like <strong>Hugging Face,</strong> <a target="_blank" href="http://ArtificialAnalysis.ai"><strong>ArtificialAnalysis.ai</strong></a><strong>, and LangChain</strong> are must-know tools for the AI ecosystem.</p>
</li>
<li><p><strong>RAG and vector databases</strong> open up possibilities to make AI systems more reliable and domain-specific.</p>
</li>
</ol>
<hr />
<h2 id="heading-whats-next-day-7-preview">🔮 What’s Next? (Day 7 Preview)</h2>
<p>On <strong>Day 7</strong>, I’ll continue exploring the <strong>Generative AI Product Lifecycle</strong>, this time focusing on <strong>fine-tuning and responsible AI</strong>. Some of the key areas I’ll cover include:</p>
<ul>
<li><p><strong>Instruction-Tuned and Fine-Tuned Models</strong> → how models are adapted to follow specific instructions.</p>
</li>
<li><p><strong>Full Fine-Tuning</strong> → retraining models with large datasets.</p>
</li>
<li><p><strong>Parameter-Efficient Fine-Tuning (PEFT)</strong> → making fine-tuning faster and lighter.</p>
</li>
<li><p><strong>LoRA (Low-Rank Adaptation)</strong> → a practical PEFT technique.</p>
</li>
<li><p><strong>Evaluation Techniques</strong> → ensuring tuned models perform well.</p>
</li>
<li><p><strong>Project Lifecycle Analysis</strong> → comparing Instruction Tuning, Fine-Tuning, and PEFT approaches.</p>
</li>
<li><p><strong>Limitations, Challenges, and Responsible AI</strong> → exploring biases, ethical issues, and risks.</p>
</li>
<li><p><strong>Environmental Concerns</strong> → the impact of training large models.</p>
</li>
</ul>
<p>Day 7 will help me understand how <strong>models move from general-purpose to highly specialized tools</strong> while balancing performance, efficiency, and responsibility.</p>
<hr />
<h2 id="heading-closing-thoughts">Closing Thoughts</h2>
<p>Today’s session was an eye-opener 🤯 — learning not just about models but also the <strong>ecosystem of tools and lifecycle stages that power real-world AI applications</strong>.</p>
<p>This journey is getting more exciting each day. Stay tuned for <strong>Day 7</strong>, and as always, I’d love to hear your <strong>suggestions, feedback, or resources</strong> that could help me learn better.</p>
]]></content:encoded></item><item><title><![CDATA[My Agentic AI Journey – Day 5: Exploring Large Language Models and Their Building Blocks 🚀]]></title><description><![CDATA[After four days of digging into NLP, RNNs, and the importance of Generative AI, today I finally reached one of the most exciting milestones of my journey: Large Language Models (LLMs). These are the engines behind modern Generative AI, and understand...]]></description><link>https://avadhootkamble24.hashnode.dev/my-agentic-ai-journey-day-5-exploring-large-language-models-and-their-building-blocks</link><guid isPermaLink="true">https://avadhootkamble24.hashnode.dev/my-agentic-ai-journey-day-5-exploring-large-language-models-and-their-building-blocks</guid><dc:creator><![CDATA[Avadhoot Kamble]]></dc:creator><pubDate>Wed, 17 Sep 2025 06:13:14 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1758088544223/c67e6d94-2dd6-4e7f-86a3-b83659c666bb.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>After four days of digging into NLP, RNNs, and the importance of Generative AI, today I finally reached one of the most exciting milestones of my journey: <strong>Large Language Models (LLMs)</strong>. These are the engines behind modern Generative AI, and understanding them felt like uncovering the DNA of today’s AI revolution.</p>
<p>Let me walk you through what I learned on <strong>Day 5</strong>.</p>
<h2 id="heading-introduction-to-llms">🔍 Introduction to LLMs</h2>
<p>I started with the basics—<strong>what are Large Language Models?</strong></p>
<p>LLMs are AI systems trained on massive datasets to predict the next word in a sequence. They learn grammar, semantics, and even real-world facts by processing billions of words. What makes them “large” are the <strong>billions of parameters</strong> they hold—internal variables fine-tuned during training to improve predictions.</p>
<p>Their capabilities blew me away:</p>
<ul>
<li><p>Generate essays, code, and poetry.</p>
</li>
<li><p>Translate languages.</p>
</li>
<li><p>Hold human-like conversations.</p>
</li>
<li><p>Power applications in business, education, and beyond.</p>
</li>
</ul>
<p>Of course, they come with challenges too—like environmental costs, bias, and ethical risks.</p>
<h2 id="heading-transformer-architecture-the-backbone">🏗️ Transformer Architecture – The Backbone</h2>
<p>The <strong>Transformer</strong> is the architecture that made LLMs possible. It relies on:</p>
<ul>
<li><p><strong>Tokenization</strong> → breaking text into tokens.</p>
</li>
<li><p><strong>Embeddings</strong> → turning tokens into vectors with meaning.</p>
</li>
<li><p><strong>Attention</strong> → letting the model focus on the most relevant parts of the input.</p>
</li>
</ul>
<p>This architecture is what allows LLMs to capture <strong>long-range context</strong> with speed and accuracy.</p>
<hr />
<h2 id="heading-why-transformers-took-over">📈 Why Transformers Took Over</h2>
<p>I then learned why <strong>Transformer models are trending everywhere</strong>:</p>
<ul>
<li><p><strong>Self-supervised learning</strong> makes them trainable on unlabeled data.</p>
</li>
<li><p><strong>Parallel processing</strong> speeds up training compared to RNNs.</p>
</li>
<li><p><strong>Scalability</strong> supports billions of parameters for complex tasks.</p>
</li>
<li><p><strong>Fine-tuning</strong> makes them adaptable to specific applications.</p>
</li>
</ul>
<p>No wonder every major AI model today—from GPT to BERT—relies on Transformers.</p>
<h2 id="heading-gpt-and-decoder-only-models">🔑 GPT and Decoder-Only Models</h2>
<p>Unlike the traditional encoder-decoder Transformer, <strong>GPT uses only the decoder</strong>.</p>
<ul>
<li><p>It relies on <strong>masked self-attention</strong>, predicting the next token without peeking ahead.</p>
</li>
<li><p>Simplicity makes it efficient and great for training on unlabeled text.</p>
</li>
<li><p>Surprisingly, it can still perform translation, summarization, and Q&amp;A—thanks to its strong autoregressive training.</p>
</li>
</ul>
<p>This was a big “aha!” moment for me: simplicity can be powerful.</p>
<hr />
<h2 id="heading-foundation-models-a-timeline-of-progress">🏛️ Foundation Models – A Timeline of Progress</h2>
<p>I came across the evolution of <strong>foundation models</strong>—large-scale pre-trained models adaptable to many tasks. Some highlights:</p>
<ul>
<li><p><strong>GPT-1 (2018):</strong> 117M parameters – the first step.</p>
</li>
<li><p><strong>BERT (2018):</strong> excelled at bidirectional understanding.</p>
</li>
<li><p><strong>GPT-2, GPT-3:</strong> scaling up to billions of parameters.</p>
</li>
<li><p><strong>BLOOM, LLaMA, Claude, Gemini, Mistral:</strong> pushing multilingual, ethical, and multimodal capabilities.</p>
</li>
<li><p><strong>GPT-4 and Claude 3:</strong> state-of-the-art, still evolving.</p>
</li>
</ul>
<p>Each model represents a leap in <strong>scale, performance, and application reach</strong>.</p>
<hr />
<h2 id="heading-llm-characteristics">⚙️ LLM Characteristics</h2>
<p>I explored the <strong>core traits</strong> of LLMs:</p>
<ul>
<li><p><strong>Versatile</strong> → handle translation, Q&amp;A, coding.</p>
</li>
<li><p><strong>Stateless</strong> → no memory between queries.</p>
</li>
<li><p><strong>Stochastic</strong> → outputs vary with randomness.</p>
</li>
<li><p><strong>Memorizing vs. Learning</strong> → they balance generalization with memorized knowledge.</p>
</li>
</ul>
<p>This helped me see why the same prompt can give different responses each time—it’s built into their design.</p>
<hr />
<h2 id="heading-emergent-abilities">🌱 Emergent Abilities</h2>
<p>A fascinating concept: <strong>emergent abilities</strong>.<br />These are skills that only appear in larger models—like better contextual understanding or creativity—even though smaller models can’t do them. They weren’t explicitly programmed but emerged as models scaled up.</p>
<p>It made me realize: scaling doesn’t just mean “more capacity,” it can unlock entirely new behaviors.</p>
<hr />
<h2 id="heading-openai-playground-experimenting-with-models">🎛️ OpenAI Playground – Experimenting with Models</h2>
<p>I discovered <strong>OpenAI Playground</strong>, a space where anyone can test LLMs with different parameters:</p>
<ul>
<li><p><strong>Temperature</strong> → controls randomness/creativity.</p>
</li>
<li><p><strong>Top-k vs Top-p sampling</strong> → balance between coherence and diversity.</p>
</li>
<li><p><strong>Max tokens</strong> → limit output length.</p>
</li>
</ul>
<p>This was exciting—it means we can <strong>shape outputs</strong> for specific needs, whether creativity or precision.</p>
<hr />
<h2 id="heading-real-world-example-microsoft-copilot">💡 Real-World Example: Microsoft Copilot</h2>
<p>I ended the day with <strong>Microsoft Copilot</strong>, an AI-powered assistant embedded into Microsoft tools. By adjusting parameters like temperature, Copilot can be:</p>
<ul>
<li><p><strong>Creative</strong> (for brainstorming).</p>
</li>
<li><p><strong>Balanced</strong> (for general productivity).</p>
</li>
<li><p><strong>Precise</strong> (for technical tasks).</p>
</li>
</ul>
<p>This showed me how LLMs are not just research experiments—they’re <strong>changing how we work every day</strong>.</p>
<hr />
<h2 id="heading-whats-next-day-6-preview">🔮 What’s Next? (Day 6 Preview)</h2>
<p>On <strong>Day 6</strong>, I’ll build on these concepts with <strong>hands-on applications of Generative AI and LLMs</strong>. Topics include:</p>
<ul>
<li><p>GenAI Project Lifecycle.</p>
</li>
<li><p>Identifying use cases.</p>
</li>
<li><p>Choosing foundation models/LLMs.</p>
</li>
<li><p>Prompt engineering &amp; optimization.</p>
</li>
<li><p>Tools like <strong>Hugging Face</strong>, <a target="_blank" href="http://ArtificialAnalysis.ai"><strong>ArtificialAnalysis.ai</strong></a>, and <strong>LangChain</strong>.</p>
</li>
<li><p>Advanced techniques like <strong>RAG (Retrieval Augmented Generation)</strong> and <strong>Vector Databases</strong>.</p>
</li>
<li><p>LangChain concepts: memory, chaining, and chunking strategies.</p>
</li>
</ul>
<p>Day 6 promises to be about <strong>making LLMs practical and project-ready</strong> 🚀.</p>
<hr />
<h2 id="heading-final-thoughts">✨ Final Thoughts</h2>
<p>Day 5 helped me tie together everything I’ve learned so far. I now see how Transformers and LLMs form the <strong>core infrastructure of modern AI</strong>, powering everything from chatbots to copilots.</p>
<p>It feels like I’ve moved from learning “how models work” to seeing <strong>why they matter in the real world</strong>.</p>
<p>👉 What do you think about the rise of LLMs? Do you see them as tools, partners, or something more?</p>
<p>Stay tuned—<strong>Day 6 is where theory meets application!</strong> 🚀</p>
]]></content:encoded></item><item><title><![CDATA[My Journey into Agentic AI – Day 4: From ANI to AGI and Beyond 🚀]]></title><description><![CDATA[After three insightful days of diving into NLP, RNNs, and the Attention Mechanism, I’m back with Day 4 of my Agentic AI learning journey. Today was a turning point, because instead of focusing only on technical details, I explored the big picture — w...]]></description><link>https://avadhootkamble24.hashnode.dev/my-journey-into-agentic-ai-day-4-from-ani-to-agi-and-beyond</link><guid isPermaLink="true">https://avadhootkamble24.hashnode.dev/my-journey-into-agentic-ai-day-4-from-ani-to-agi-and-beyond</guid><dc:creator><![CDATA[Avadhoot Kamble]]></dc:creator><pubDate>Mon, 15 Sep 2025 15:53:48 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1757951393467/c2c91b02-4db0-40d7-b5b3-d5ccdaaaa73d.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>After three insightful days of diving into NLP, RNNs, and the Attention Mechanism, I’m back with <strong>Day 4 of my Agentic AI learning journey</strong>. Today was a turning point, because instead of focusing only on technical details, I explored the <strong>big picture</strong> — why Generative AI is so prominent, how it connects to broader AI concepts, and how it’s reshaping industries.</p>
<p>This session really helped me frame <strong>where Agentic AI fits</strong> into the entire AI ecosystem. Let me walk you through what I learned.</p>
<hr />
<h2 id="heading-ani-vs-agi-narrow-vs-general-intelligence">🌟 ANI vs AGI – Narrow vs General Intelligence</h2>
<p>The journey started with a fundamental comparison:</p>
<ul>
<li><p><strong>Artificial Narrow Intelligence (ANI):</strong> This is where we are today. AI systems specialized for specific tasks — like spam filters, recommendation engines, or even GPT-4 when used for a particular purpose.</p>
</li>
<li><p><strong>Artificial General Intelligence (AGI):</strong> The holy grail of AI. A system that can perform <strong>any intellectual task like a human</strong>, showing reasoning, adaptability, and creativity across domains.</p>
</li>
</ul>
<p>And here’s the catch: <strong>Generative AI is acting as a bridge from ANI towards AGI</strong>. By producing human-like text, images, and even multimodal outputs, GenAI is showing early glimpses of what versatile, human-level intelligence might look like.</p>
<hr />
<h2 id="heading-ai-ml-dl-and-genai-untangling-the-layers">🔄 AI, ML, DL, and GenAI – Untangling the Layers</h2>
<p>The next concept cleared a lot of confusion for me. Often, AI-related terms are thrown around interchangeably, but there’s actually a clear <strong>hierarchy</strong>:</p>
<ol>
<li><p><strong>AI (Artificial Intelligence):</strong> The broadest field — making machines “think” like humans.</p>
</li>
<li><p><strong>ML (Machine Learning):</strong> A subset of AI, focused on algorithms that learn from data.</p>
</li>
<li><p><strong>DL (Deep Learning):</strong> A subset of ML that uses deep neural networks to uncover patterns from raw data.</p>
</li>
<li><p><strong>GenAI (Generative AI):</strong> A subset of DL, where models don’t just analyze but <strong>create new content</strong> — text, images, code, music, and more.</p>
</li>
</ol>
<p>This structure gave me clarity: <strong>Agentic AI will rely heavily on GenAI</strong>, since its decision-making depends on both understanding and generating content in real time.</p>
<hr />
<h2 id="heading-discriminative-vs-generative-ai">⚖️ Discriminative vs Generative AI</h2>
<p>I then explored two major approaches to AI:</p>
<ul>
<li><p><strong>Discriminative AI:</strong> Learns boundaries between classes to classify data. (e.g., spam vs. non-spam email).</p>
</li>
<li><p><strong>Generative AI:</strong> Learns the <strong>distribution of the data</strong> to generate new data similar to it (e.g., creating a new realistic paragraph of text or a synthetic image).</p>
</li>
</ul>
<p>This is where the magic lies. Discriminative AI helps machines “identify,” but <strong>Generative AI helps them “create.”</strong> Agentic AI needs both, but its ability to generate is what makes it autonomous and flexible.</p>
<hr />
<h2 id="heading-core-principle-representation-learning">🧠 Core Principle: Representation Learning</h2>
<p>This was my <strong>favorite part of today’s learning</strong>.</p>
<p>Generative AI works because of <strong>representation learning</strong> — the ability of models to automatically discover useful features from raw data. Instead of us manually crafting features, the model learns what’s important.</p>
<ul>
<li><p><strong>Encoders</strong> capture compressed, meaningful representations of input.</p>
</li>
<li><p><strong>Decoders</strong> reconstruct or generate output from those representations.</p>
</li>
</ul>
<p>Transformers, autoencoders, and VAEs are all examples of this encoder-decoder magic. Representation learning is what allows GenAI to be so good at tasks like translation, summarization, and even creating original art.</p>
<hr />
<h2 id="heading-real-world-applications-that-inspired-me">🖼️ Real-World Applications That Inspired Me</h2>
<p>By now, I was convinced of Generative AI’s potential. But what really struck me was its <strong>application power</strong> across industries:</p>
<ul>
<li><p><strong>Computer Vision:</strong> Image synthesis, style transfer, super-resolution imaging, video synthesis, and even 3D reconstruction.</p>
</li>
<li><p><strong>NLP:</strong> Text generation, summarization, translation, chatbots, and storytelling.</p>
</li>
<li><p><strong>Data Synthesis:</strong> Generating synthetic healthcare data, balancing datasets, anonymizing private information, and even simulating driving scenarios for autonomous vehicles.</p>
</li>
<li><p><strong>ML Pipeline:</strong> From data preparation to deployment, GenAI is reshaping how models are trained, validated, and monitored.</p>
</li>
<li><p><strong>Personalization:</strong> Hyper-tailored learning paths, product recommendations, and even individualized healthcare plans.</p>
</li>
</ul>
<p>I realized — <strong>Generative AI isn’t just an AI tool; it’s a creative partner.</strong></p>
<hr />
<h2 id="heading-the-bigger-picture-genai-and-the-gap-between-experts-amp-novices">⚡ The Bigger Picture – GenAI and the Gap Between Experts &amp; Novices</h2>
<p>One thought-provoking point was how GenAI may actually <strong>widen the gap between experts and novices</strong>. While it gives powerful tools to everyone, experts can use them with precision and domain knowledge — making them even more effective.</p>
<p>So while GenAI democratizes access, <strong>true expertise will always matter</strong>. This was a good reminder for me: building strong fundamentals in AI is just as important as using advanced tools.</p>
<hr />
<h2 id="heading-whats-next-day-5-preview">🔮 What’s Next? (Day 5 Preview)</h2>
<p>On <strong>Day 5</strong>, I’ll be diving deeper into the world of <strong>Large Language Models (LLMs)</strong> and their building blocks. The key topics I plan to cover include:</p>
<ul>
<li><p><strong>Large Language Models (LLMs):</strong> Pre-read and introduction.</p>
</li>
<li><p><strong>Transformer Architecture:</strong> Understanding why it’s the backbone of modern AI.</p>
</li>
<li><p><strong>Why Transformer Models are Trending?</strong></p>
</li>
<li><p><strong>GPT and Decoder-Only Models</strong> explained.</p>
</li>
<li><p><strong>Foundation Models:</strong> An overview of leading models shaping AI today.</p>
</li>
<li><p><strong>Characteristics of LLMs</strong> and what makes them powerful.</p>
</li>
<li><p><strong>Emergent Abilities:</strong> How new skills appear at scale.</p>
</li>
<li><p><strong>OpenAI Playground:</strong> Exploring and experimenting with models.</p>
</li>
<li><p><strong>Parameters in LLMs</strong> and their importance.</p>
</li>
<li><p><strong>Top-k vs. Top-p Sampling:</strong> Controlling randomness in outputs.</p>
</li>
<li><p><strong>Temperature and Probability Distribution:</strong> Impact on creativity and determinism.</p>
</li>
<li><p><strong>Microsoft Copilot:</strong> A real-world application of these concepts.</p>
</li>
</ul>
<p>This will be a <strong>big step forward</strong>, as I begin to understand not just the <strong>theory of LLMs</strong> but also their <strong>practical applications and limitations</strong>.</p>
<p>Stay tuned — Day 5 is where theory meets reality 🚀.</p>
<hr />
<h2 id="heading-final-thoughts">✨ Final Thoughts</h2>
<p>Today was less about math and more about <strong>connecting the dots</strong>. I understood not just what Generative AI is, but also <strong>why it matters</strong> and how it is accelerating the path toward Agentic AI.</p>
<p>It feels good to pause and reflect: Agentic AI isn’t some distant concept — it’s being built on the blocks of GenAI, representation learning, and the applications we’re already seeing around us.</p>
<p>👉 <strong>What do you think?</strong> Do you agree that Generative AI is the bridge from ANI to AGI? I’d love to hear your thoughts in the comments.</p>
<p>Stay tuned for more new projects and upcoming blogs on my GenAI learnings and experiments! 🚀</p>
]]></content:encoded></item><item><title><![CDATA[🌟 My Agentic AI Journey – Day 3: Diving into Attention Mechanisms and Transformers]]></title><description><![CDATA[After setting the foundation with NLP basics (Day 1) and RNNs & Sequential Models (Day 2), today I continued my journey by exploring one of the most powerful breakthroughs in AI—the Attention Mechanism and its role in Transformers.
This day felt like...]]></description><link>https://avadhootkamble24.hashnode.dev/agentic-ai-journey-day-3-attention-transformers</link><guid isPermaLink="true">https://avadhootkamble24.hashnode.dev/agentic-ai-journey-day-3-attention-transformers</guid><dc:creator><![CDATA[Avadhoot Kamble]]></dc:creator><pubDate>Sat, 23 Aug 2025 06:36:12 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1755930657809/473b93c8-dabb-48d3-b4f0-21aec56733b1.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>After setting the foundation with <strong>NLP basics (Day 1)</strong> and <strong>RNNs &amp; Sequential Models (Day 2)</strong>, today I continued my journey by exploring one of the most powerful breakthroughs in AI—<strong>the Attention Mechanism</strong> and its role in <strong>Transformers</strong>.</p>
<p>This day felt like a turning point, because attention is at the core of how today’s large language models (LLMs) work. Let me walk you through what I learned.</p>
<hr />
<h2 id="heading-what-is-the-attention-mechanism">🔎 What is the Attention Mechanism?</h2>
<p>The attention mechanism is a way for a model to <strong>focus on the most relevant parts of the input</strong> while processing sequences.<br />Instead of treating every word equally, attention allows the model to assign <em>different weights</em> to different words, just like how we humans focus on keywords in a sentence while skimming through text.</p>
<h3 id="heading-why-is-it-important">Why is it important?</h3>
<ul>
<li><p>It helps models capture <strong>long-range dependencies</strong> (e.g., connecting “Paris” and “France” even if they are far apart in a sentence).</p>
</li>
<li><p>It overcomes the <strong>limitations of RNNs</strong> like vanishing gradients.</p>
</li>
<li><p>It forms the backbone of modern architectures like <strong>Transformers</strong>.</p>
</li>
</ul>
<hr />
<h2 id="heading-introduction-to-transformers">⚡ Introduction to Transformers</h2>
<p>After attention, I learned about <strong>Transformers</strong>, a revolutionary architecture that replaced RNNs in NLP.<br />Transformers rely entirely on the <strong>attention mechanism</strong> instead of sequential recurrence, which makes them:</p>
<ul>
<li><p>Faster to train (parallel computation).</p>
</li>
<li><p>More powerful in capturing long-term dependencies.</p>
</li>
</ul>
<hr />
<h2 id="heading-types-of-attention-in-transformers">🧠 Types of Attention in Transformers</h2>
<h3 id="heading-1-self-attention">1. Self-Attention</h3>
<p>This mechanism allows each word in a sentence to look at <strong>other words in the same sentence</strong> to understand context.<br />For example:<br />In the sentence <em>“The dog chased its tail”</em>, the word <em>“its”</em> should attend more to <em>“dog”</em> rather than <em>“chased”</em>.</p>
<p>Self-attention does this by creating embeddings that are weighted combinations of all words in the sentence—this is what gives Transformers their power.</p>
<hr />
<h3 id="heading-2-multi-head-attention">2. Multi-Head Attention</h3>
<p>Self-attention alone is powerful, but <strong>multi-head attention</strong> takes it further.</p>
<ul>
<li><p>Instead of calculating attention once, it does it <strong>multiple times in parallel</strong> (multiple “heads”).</p>
</li>
<li><p>Each head captures <strong>different relationships</strong> (e.g., one may focus on grammar, another on semantics).</p>
</li>
<li><p>Finally, the results are combined, making the model more robust and context-aware.</p>
</li>
</ul>
<hr />
<h2 id="heading-positional-embeddings">📍 Positional Embeddings</h2>
<p>Since Transformers don’t process sequences step by step (like RNNs), they need a way to <strong>understand word order</strong>.<br />That’s where <strong>positional embeddings</strong> come in—they add information about the position of words in a sentence, so the model knows the difference between <em>“dog bites man”</em> and <em>“man bites dog.”</em></p>
<hr />
<h2 id="heading-embeddings-from-language-models">📖 Embeddings from Language Models</h2>
<p>I also explored <strong>embeddings created from language models</strong>, which capture not just word meanings but also their <strong>context</strong>.<br />For example, the word <em>“bank”</em> in <em>“river bank”</em> vs. <em>“savings bank”</em> gets different embeddings because of context.</p>
<hr />
<h2 id="heading-bidirectional-language-models">🔄 Bidirectional Language Models</h2>
<p>Unlike older models that read text left-to-right or right-to-left, <strong>bidirectional models</strong> (like BERT) look at the <strong>entire sentence in both directions</strong>.<br />This allows them to capture <strong>richer context</strong>, making them far better for understanding natural language.</p>
<hr />
<h2 id="heading-ulmfit-transfer-learning-in-nlp">🚀 ULMFiT – Transfer Learning in NLP</h2>
<p>One of the most fascinating things I learned was <strong>ULMFiT (Universal Language Model Fine-tuning)</strong>.<br />Here’s how it works:</p>
<ol>
<li><p>Train a language model on a large, general dataset (like Wikipedia).</p>
</li>
<li><p>Fine-tune it on a smaller, task-specific dataset (like movie reviews).</p>
</li>
<li><p>Get much better performance with less data and training time.</p>
</li>
</ol>
<p>This approach was a breakthrough in bringing <strong>transfer learning to NLP</strong>, just like ImageNet did for computer vision.</p>
<hr />
<h2 id="heading-task-specific-input-transformation">🛠️ Task-Specific Input Transformation</h2>
<p>Before training, inputs often need to be <strong>reshaped or reformatted</strong> depending on the downstream task—like classification, translation, or summarization.<br />This ensures that the embeddings are aligned with the problem at hand.</p>
<hr />
<h2 id="heading-subword-tokenization">🔡 Subword Tokenization</h2>
<p>Finally, I learned about <strong>subword tokenization</strong>, a clever technique to handle unknown or rare words.<br />For example, the word <em>“unhappiness”</em> might be split into: <em>“un” + “happi” + “ness”</em>.<br />This helps models deal with huge vocabularies while still understanding the meaning of complex or new words.</p>
<hr />
<h2 id="heading-a-sneak-peek-at-bert">🌟 A Sneak Peek at BERT</h2>
<p>My journey ended today with a quick introduction to <strong>BERT (Bidirectional Encoder Representations from Transformers)</strong>.<br />BERT uses <strong>self-attention, bidirectional context, and transfer learning</strong> to power some of the most advanced NLP applications we see today.<br />I can’t wait to dive deeper into it in the coming days.</p>
<hr />
<h2 id="heading-key-takeaways-from-day-3">✅ Key Takeaways from Day 3</h2>
<ul>
<li><p>Attention mechanisms allow models to focus on relevant parts of text.</p>
</li>
<li><p>Transformers use self-attention and multi-head attention to capture context effectively.</p>
</li>
<li><p>Positional embeddings solve the problem of word order in Transformers.</p>
</li>
<li><p>Bidirectional models and transfer learning (like ULMFiT) are game changers in NLP.</p>
</li>
<li><p>Subword tokenization makes models flexible and robust for real-world language.</p>
</li>
<li><p>BERT is the next big step I’ll be diving into.</p>
</li>
</ul>
<h2 id="heading-whats-next">📌 What’s Next?</h2>
<p>On <strong>Day 4</strong>, I’ll be shifting gears a little to build a stronger conceptual foundation for my Agentic AI journey. I’ll explore:</p>
<ul>
<li><p><strong>Why AI is so prominent today</strong> – understanding the driving factors behind its rise.</p>
</li>
<li><p><strong>ANI vs. AGI</strong> – differentiating between Artificial Narrow Intelligence and Artificial General Intelligence.</p>
</li>
<li><p><strong>AI, ML, DL, and GenAI</strong> – clarifying how these terms connect and differ.</p>
</li>
<li><p><strong>Discriminative vs. Generative Models</strong> – comparing how models classify vs. how they create.</p>
</li>
<li><p><strong>Core Principle: Representation Learning</strong> – the key idea behind how models learn meaningful patterns from data.</p>
</li>
<li><p><strong>Applications and Case Studies</strong> – real-world examples of how these concepts are being applied.</p>
</li>
</ul>
<p>This will set the stage for me to not only understand <em>how</em> models work but also <em>why</em> they matter in today’s world.</p>
<p>Stay tuned 🚀 — Day 4 will be about bridging the gap between technical depth and real-world impact.</p>
]]></content:encoded></item><item><title><![CDATA[🚀 My Agentic AI Journey – Day 2: Diving into Sequential Data, RNNs and Encoder-Decoder]]></title><description><![CDATA[After sharing my Day 1 learnings about NLP and word embeddings, I took the next step on my Agentic AI journey.
Day 2 was all about understanding Sequential Data and how machines process it. And trust me — this was where things started getting both tr...]]></description><link>https://avadhootkamble24.hashnode.dev/agentic-ai-journey-day-2-rnns-lstms-sequence-models</link><guid isPermaLink="true">https://avadhootkamble24.hashnode.dev/agentic-ai-journey-day-2-rnns-lstms-sequence-models</guid><dc:creator><![CDATA[Avadhoot Kamble]]></dc:creator><pubDate>Tue, 19 Aug 2025 08:00:22 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1755585490082/64bbd7ab-02ce-4b54-9473-c7529e4d0aca.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>After sharing my <strong>Day 1 learnings</strong> about NLP and word embeddings, I took the next step on my Agentic AI journey.</p>
<p>Day 2 was all about understanding <strong>Sequential Data</strong> and how machines process it. And trust me — this was where things started getting both tricky and fascinating!</p>
<hr />
<h2 id="heading-starting-point-what-is-sequential-data">🌱 Starting Point: What is Sequential Data?</h2>
<p>When we deal with text, audio, or time series data, we are not just looking at individual values but at values <strong>arranged in order</strong>. This order, or sequence, actually matters. For example:</p>
<ul>
<li><p>In language, “I am learning AI” means something different from “AI learning am I.”</p>
</li>
<li><p>In stock market data, today’s value depends on yesterday’s.</p>
</li>
</ul>
<p>This is <strong>sequential data</strong> — data where context and order are critical.</p>
<hr />
<h2 id="heading-why-not-use-a-simple-neural-network">❌ Why Not Use a Simple Neural Network?</h2>
<p>At first, I wondered, “Why can’t we just use a regular <strong>Multilayer Perceptron (MLP)</strong>?”<br />But soon I realized the issue — MLPs treat every input independently. They don’t remember the <strong>previous words, sounds, or numbers</strong>. For sequences, that memory is crucial.</p>
<p>This is where <strong>Recurrent Neural Networks (RNNs)</strong> come into play.</p>
<hr />
<h2 id="heading-enter-rnns-the-memory-of-neural-networks">🔄 Enter RNNs – The Memory of Neural Networks</h2>
<p>RNNs were designed to handle sequential data by introducing the concept of a <strong>hidden state</strong> that carries information from the past into the future.</p>
<p>I visualized this through the idea of <strong>“unrolling”</strong> the RNN — each word in a sentence is passed one by one, with memory from the previous step flowing into the next.</p>
<p>This was a game-changer: finally, a model that could “remember.”</p>
<hr />
<h2 id="heading-digging-deeper-types-of-rnns">🔎 Digging Deeper: Types of RNNs</h2>
<p>As I studied further, I discovered that there are <strong>variations of RNNs</strong> depending on cardinality (input-output relationships).</p>
<ul>
<li><p><strong>One-to-One:</strong> Simple classification.</p>
</li>
<li><p><strong>One-to-Many:</strong> For example, image → caption generation.</p>
</li>
<li><p><strong>Many-to-One:</strong> Sentiment analysis from text.</p>
</li>
<li><p><strong>Many-to-Many:</strong> Translation or video frame prediction.</p>
</li>
</ul>
<p>But soon, I also hit the limitations…</p>
<hr />
<h2 id="heading-the-problem-vanishing-amp-exploding-gradients">⚠️ The Problem: Vanishing &amp; Exploding Gradients</h2>
<p>While RNNs are powerful, they are not perfect. During training, as sequences get longer, they face two major issues:</p>
<ul>
<li><p><strong>Vanishing Gradient:</strong> The network forgets distant past information.</p>
</li>
<li><p><strong>Exploding Gradient:</strong> Training becomes unstable.</p>
</li>
</ul>
<p>This made me wonder — how do researchers solve this?</p>
<hr />
<h2 id="heading-smarter-rnns-lstm-amp-gru">🧠 Smarter RNNs: LSTM &amp; GRU</h2>
<p>That’s when I came across <strong>LSTMs (Long Short-Term Memory)</strong> and <strong>GRUs (Gated Recurrent Units)</strong>.</p>
<p>Both architectures use <strong>gates</strong> to decide what to keep, what to update, and what to forget. This helps them maintain <strong>long-term context</strong> in a sequence.</p>
<ul>
<li><p><strong>LSTMs</strong> have multiple gates (input, forget, output) to carefully control information flow.</p>
</li>
<li><p><strong>GRUs</strong> are simpler but effective, combining some gates into fewer steps for faster training.</p>
</li>
</ul>
<p>These models made me realize how <strong>memory management</strong> is critical in AI.</p>
<hr />
<h2 id="heading-going-further-stacked-amp-bidirectional-rnns">⬆️ Going Further: Stacked &amp; Bidirectional RNNs</h2>
<p>I also explored:</p>
<ul>
<li><p><strong>Stacked RNNs</strong>: Multiple layers of RNNs stacked on top of each other for more complex pattern learning.</p>
</li>
<li><p><strong>Bidirectional RNNs</strong>: These process sequences <strong>both forward and backward</strong>, capturing context from both sides of a sentence. This was especially fascinating for language tasks.</p>
</li>
</ul>
<hr />
<h2 id="heading-sequence-to-sequence-models-with-encoders-amp-decoders">🌍 Sequence-to-Sequence Models with Encoders &amp; Decoders</h2>
<p>As I progressed, I reached the <strong>encoder-decoder architecture</strong> — the backbone of machine translation.</p>
<p>Here’s how it works:</p>
<ul>
<li><p>The <strong>encoder</strong> reads the input sequence and compresses it into a <strong>context vector</strong>.</p>
</li>
<li><p>The <strong>decoder</strong> takes this vector and generates the output sequence.</p>
</li>
</ul>
<p>For example, translating <em>“Bonjour le monde” → “Hello world.”</em></p>
<p>I also learned about how <strong>LSTMs</strong> in encoders and decoders pass information, making translation possible.</p>
<hr />
<h2 id="heading-the-shortcomings-and-beam-search">⚠️ The Shortcomings and Beam Search</h2>
<p>Of course, this model wasn’t perfect. It sometimes lost accuracy on longer sentences. That’s where <strong>Beam Search</strong> comes in — instead of picking just the top prediction, it considers the <strong>top-N possible words</strong> at each step to improve translations.</p>
<p>Finally, models are evaluated using <strong>BLEU Score</strong>, which checks how close the translations are to human ones.</p>
<hr />
<h2 id="heading-wrapping-up-day-2">🎯 Wrapping Up Day 2</h2>
<p>Day 2 was a deep dive into how machines learn from sequences. From simple RNNs to LSTMs, GRUs, and encoder-decoder models, I learned that <strong>handling order and context</strong> is what makes AI capable of language understanding and translation.</p>
<hr />
<h2 id="heading-whats-next">🔜 What’s Next?</h2>
<p>For <strong>Day 3</strong>, I’ll be diving into the <strong>Attention Mechanism</strong> — a concept that revolutionized sequence models and paved the way for Transformers.</p>
<p>Stay tuned — the journey is just getting more exciting! 🚀</p>
<hr />
<p>👉 What do you think I should explore along with Attention?<br />Drop your suggestions — I’d love to learn with your guidance!</p>
]]></content:encoded></item><item><title><![CDATA[🚀 My Journey into Agentic AI: Day 1 — Laying the Foundation with NLP]]></title><description><![CDATA[It’s official — I’ve started my journey into the world of Agentic AI.
Agentic AI is one of the most exciting, fast-evolving fields in AI today, but it can also feel overwhelming. To avoid getting lost in the hype, I decided to start with the basics —...]]></description><link>https://avadhootkamble24.hashnode.dev/my-journey-into-agentic-ai-day-1-laying-the-foundation-with-nlp</link><guid isPermaLink="true">https://avadhootkamble24.hashnode.dev/my-journey-into-agentic-ai-day-1-laying-the-foundation-with-nlp</guid><category><![CDATA[agentic AI]]></category><category><![CDATA[generative ai]]></category><category><![CDATA[nlp]]></category><category><![CDATA[journey]]></category><category><![CDATA[Machine Learning]]></category><dc:creator><![CDATA[Avadhoot Kamble]]></dc:creator><pubDate>Mon, 18 Aug 2025 07:30:06 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1755323477294/3bb4b6b1-013e-4d24-95d9-2765515fbec5.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>It’s official — I’ve started my journey into the world of <strong>Agentic AI</strong>.</p>
<p>Agentic AI is one of the most exciting, fast-evolving fields in AI today, but it can also feel overwhelming. To avoid getting lost in the hype, I decided to start with the <strong>basics</strong> — the building blocks that make Agentic AI possible.</p>
<p>Through my research, I realized that <strong>Generative AI</strong> is the foundation, and at the heart of Generative AI lies <strong>Natural Language Processing (NLP)</strong>.</p>
<p>So, Day 1 of my journey was all about <strong>understanding NLP</strong>.</p>
<hr />
<h2 id="heading-what-i-explored-on-day-1">🔍 What I Explored on Day 1</h2>
<h3 id="heading-1-what-is-nlp-and-why-does-it-matter">1. <strong>What is NLP and Why Does It Matter?</strong></h3>
<p>I began by exploring what <strong>NLP</strong> (Natural Language Processing) is and where it is used. From auto-complete on our phones to chatbots, recommendation engines, and sentiment analysis — NLP is everywhere. Understanding this convinced me that this is the right foundation for Agentic AI.</p>
<hr />
<h3 id="heading-2-tokenization-amp-preprocessing">2. <strong>Tokenization &amp; Preprocessing</strong></h3>
<p>Next, I looked at how machines break down human language. Tokenization splits sentences into words, and techniques like <strong>stop word removal, stemming, and lemmatization</strong> help simplify the text while retaining meaning.</p>
<p>It felt like learning the grammar rules of a new language, but this time for computers.</p>
<hr />
<h3 id="heading-3-numericalizing-words">3. <strong>Numericalizing Words</strong></h3>
<p>Words alone can’t be fed into a machine, so I studied how they are converted into numbers.</p>
<ul>
<li><p><strong>One-hot encoding</strong></p>
</li>
<li><p><strong>CountVectorizer</strong></p>
</li>
<li><p><strong>TF-IDF vectorization</strong></p>
</li>
</ul>
<p>Among these, I found <strong>TF-IDF</strong> (Term Frequency–Inverse Document Frequency) more reliable because it reduces the importance of overly common words.</p>
<hr />
<h3 id="heading-4-word-embeddings">4. <strong>Word Embeddings</strong></h3>
<p>This was the most fascinating part of the day. Word embeddings transform words into vectors that capture meaning and relationships.</p>
<p>I explored <strong>Word2Vec</strong>, which itself has two methods:</p>
<ul>
<li><p><strong>CBOW (Continuous Bag-of-Words)</strong> — predicts a word based on its context</p>
</li>
<li><p><strong>Skip-gram</strong> — predicts the context from a word</p>
</li>
</ul>
<p>I also discovered <strong>Negative Sampling</strong>, a method that improves efficiency in training embeddings.</p>
<hr />
<h3 id="heading-5-properties-of-word-embeddings">5. <strong>Properties of Word Embeddings</strong></h3>
<p>Word embeddings aren’t just numbers; they capture relationships like:</p>
<ul>
<li><p><strong>Semantic similarity</strong> (king – man + woman = queen 👑)</p>
</li>
<li><p><strong>Compositionality</strong> (phrases built from word meanings)</p>
</li>
<li><p><strong>Compactness</strong> (smaller vector space yet meaningful)</p>
</li>
<li><p><strong>Context adaptation</strong> (meanings shift with context)</p>
</li>
</ul>
<p>It amazed me how mathematics and language come together in this way.</p>
<hr />
<h3 id="heading-6-the-embedding-matrix">6. <strong>The Embedding Matrix</strong></h3>
<p>Finally, I explored how embeddings are stored in an <strong>embedding matrix</strong> and how they can be visualized. Seeing clusters of related words together gave me a clear sense of why embeddings are such a powerful tool in AI.</p>
<hr />
<h2 id="heading-wrapping-up-day-1">🌱 Wrapping Up Day 1</h2>
<p>Day 1 was both <strong>challenging and exciting</strong>. I started with just a curiosity about Agentic AI, but by the end of the day, I realized how much depth there is even in the “basics.”</p>
<p>This foundation in <strong>NLP and word embeddings</strong> will serve as the base for everything I build next in my Agentic AI journey.</p>
<hr />
<h2 id="heading-over-to-you">🙌 Over to You</h2>
<p>This is just the beginning. On Day 2, I’ll continue exploring deeper concepts. But I’d love to hear from you:</p>
<p>👉 <strong>What do you think I should learn next to strengthen my path toward Agentic AI?</strong><br />Should I go deeper into embeddings, jump into Transformers, or start experimenting with hands-on Generative AI models?</p>
<p>I’m open to your suggestions! 🚀</p>
]]></content:encoded></item><item><title><![CDATA[Cleaning Airbnb Open Data – A Step-by-Step Case Study]]></title><description><![CDATA[📝 Introduction
It’s been a while since I last posted a blog, but I’m back — and this time with a fresh data cleaning project!
I wanted to work on something that wasn’t just a toy dataset but also gave me the chance to handle real-world messiness. So...]]></description><link>https://avadhootkamble24.hashnode.dev/cleaning-airbnb-open-data-a-step-by-step-case-study</link><guid isPermaLink="true">https://avadhootkamble24.hashnode.dev/cleaning-airbnb-open-data-a-step-by-step-case-study</guid><category><![CDATA[data cleaning ]]></category><category><![CDATA[pandas]]></category><category><![CDATA[Python]]></category><category><![CDATA[Data Science]]></category><category><![CDATA[airbnb]]></category><category><![CDATA[Case Study]]></category><category><![CDATA[kaggle]]></category><dc:creator><![CDATA[Avadhoot Kamble]]></dc:creator><pubDate>Thu, 14 Aug 2025 13:53:36 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/jo8pclRHmCI/upload/8e612863a93078f48edb7f77d6fba325.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3 id="heading-introduction">📝 <strong>Introduction</strong></h3>
<p>It’s been a while since I last posted a blog, but I’m back — and this time with a fresh <strong>data cleaning project</strong>!</p>
<p>I wanted to work on something that wasn’t just a toy dataset but also gave me the chance to handle real-world messiness. So, I picked the <strong>Airbnb Open Data</strong> from Kaggle.</p>
<p>The goal? <strong>Take messy raw data and turn it into something consistent, clean, and ready for analysis.</strong></p>
<p>When I first opened the dataset, I found:</p>
<ul>
<li><p>Unnecessary columns</p>
</li>
<li><p>Missing values</p>
</li>
<li><p>Inconsistent text formatting</p>
</li>
<li><p>Duplicate rows</p>
</li>
<li><p>Categorical values needing standardization</p>
</li>
<li><p>Price and service fee stored as messy strings</p>
</li>
</ul>
<p>This blog takes you through <strong>exactly what I did</strong>, step-by-step, so you can follow along.</p>
<hr />
<h3 id="heading-step-1-importing-and-understanding-the-data">📂 <strong>Step 1: Importing and Understanding the Data</strong></h3>
<p>I loaded the dataset into Pandas and did a quick scan:</p>
<pre><code class="lang-python"><span class="hljs-keyword">import</span> pandas <span class="hljs-keyword">as</span> pd
df = pd.read_csv(<span class="hljs-string">"Airbnb_Open_Data.csv"</span>)
df.head()
df.shape
df.info()
df.isnull().sum()
</code></pre>
<p>From this, I learned:</p>
<ul>
<li><p><strong>26 columns</strong> in total</p>
</li>
<li><p>Several columns with missing values</p>
</li>
<li><p>Some columns were clearly not useful for my analysis</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755177525012/502e9409-98f0-46dc-bc4b-9508c0bc472d.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-step-2-dropping-unnecessary-columns">🗑 <strong>Step 2: Dropping Unnecessary Columns</strong></h3>
<p>I removed extra fields like:</p>
<ul>
<li><p><code>reviews per month</code></p>
</li>
<li><p><code>review rate number</code></p>
</li>
<li><p><code>calculated host listings count</code></p>
</li>
<li><p><code>availability 365</code></p>
</li>
<li><p><code>house_rules</code></p>
</li>
<li><p><code>license</code></p>
</li>
</ul>
<pre><code class="lang-python">columns_to_drop = [<span class="hljs-string">'reviews per month'</span>, <span class="hljs-string">'review rate number'</span>,
                   <span class="hljs-string">'calculated host listings count'</span>, <span class="hljs-string">'availability 365'</span>,
                   <span class="hljs-string">'house_rules'</span>, <span class="hljs-string">'license'</span>]
df.drop(columns=columns_to_drop, inplace=<span class="hljs-literal">True</span>)
</code></pre>
<p>Columns before dropping unwanted columns</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755177719216/408d978d-be85-47b4-87e0-0867c28d509d.png" alt class="image--center mx-auto" /></p>
<p>Columns after dropping unwanted columns</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755177753139/0448ed98-af40-4d57-b778-5d2212121299.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-step-3-making-column-names-consistent">✏ <strong>Step 3: Making Column Names Consistent</strong></h3>
<p>To make my work easier, I converted all column names to lowercase:</p>
<pre><code class="lang-python">df.columns = [col.lower() <span class="hljs-keyword">for</span> col <span class="hljs-keyword">in</span> df.columns]
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755177818383/a24e4904-44e6-4697-807a-db5daaf788ec.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-step-4-removing-duplicate-rows">🔍 <strong>Step 4: Removing Duplicate Rows</strong></h3>
<pre><code class="lang-python">df.duplicated().sum()
df.drop_duplicates(inplace=<span class="hljs-literal">True</span>)
</code></pre>
<p>This ensured every listing was unique.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755177942493/8d548760-127a-4a76-9c7b-b484f935cb47.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-step-5-handling-missing-values">🧹 <strong>Step 5: Handling Missing Values</strong></h3>
<p>First, I dropped the <code>last review</code> column — too many missing values.<br />Then I removed all remaining rows with missing values:</p>
<pre><code class="lang-python">df.drop(columns=[<span class="hljs-string">"last review"</span>], inplace=<span class="hljs-literal">True</span>)
df.dropna(inplace=<span class="hljs-literal">True</span>)
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755178479748/2ef5883f-c4be-43bf-bb33-865a223c4bf2.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-step-6-standardizing-text-data">🔠 <strong>Step 6: Standardizing Text Data</strong></h3>
<p>The <code>host_identity_verified</code> column had mixed cases, so I converted all to uppercase:</p>
<pre><code class="lang-python">df[<span class="hljs-string">'host_identity_verified'</span>] = df[<span class="hljs-string">'host_identity_verified'</span>].str.upper()
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755178632526/e29f2097-84c8-42cf-a1b0-52375139492a.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-step-7-converting-boolean-to-numeric">🔄 <strong>Step 7: Converting Boolean to Numeric</strong></h3>
<p>The <code>instant_bookable</code> column had True/False values. I converted them into <code>1</code> and <code>0</code>:</p>
<pre><code class="lang-python">df[<span class="hljs-string">'instant_bookable'</span>] = df[<span class="hljs-string">'instant_bookable'</span>].apply(<span class="hljs-keyword">lambda</span> x: <span class="hljs-number">1</span> <span class="hljs-keyword">if</span> x==<span class="hljs-literal">True</span> <span class="hljs-keyword">else</span> <span class="hljs-number">0</span>)
</code></pre>
<hr />
<h3 id="heading-step-8-cleaning-price-and-service-fee">💵 <strong>Step 8: Cleaning Price and Service Fee</strong></h3>
<p>Both <code>price</code> and <code>service fee</code> were stored as strings with <code>$</code>, <code>,</code>, and spaces. I removed those characters and converted them to integers:</p>
<pre><code class="lang-python">to_remove = [<span class="hljs-string">'$'</span>, <span class="hljs-string">','</span>, <span class="hljs-string">' '</span>]
<span class="hljs-keyword">for</span> char <span class="hljs-keyword">in</span> to_remove:
    df[<span class="hljs-string">'price'</span>] = df[<span class="hljs-string">'price'</span>].str.replace(char, <span class="hljs-string">''</span>)
    df[<span class="hljs-string">'service fee'</span>] = df[<span class="hljs-string">'service fee'</span>].str.replace(char, <span class="hljs-string">''</span>)

df[<span class="hljs-string">'price'</span>] = df[<span class="hljs-string">'price'</span>].astype(int)
df[<span class="hljs-string">'service fee'</span>] = df[<span class="hljs-string">'service fee'</span>].astype(int)
</code></pre>
<h3 id="heading-step-9-resetting-index-and-saving">📦 <strong>Step 9: Resetting Index and Saving</strong></h3>
<pre><code class="lang-python">df.reset_index(drop=<span class="hljs-literal">True</span>, inplace=<span class="hljs-literal">True</span>)
df.to_csv(<span class="hljs-string">"clean_airbnb_data.csv"</span>, index=<span class="hljs-literal">False</span>)
</code></pre>
<hr />
<h3 id="heading-final-clean-dataset">✅ <strong>Final Clean Dataset</strong></h3>
<p>The final dataset was:</p>
<ul>
<li><p>Free of duplicates</p>
</li>
<li><p>Without missing values</p>
</li>
<li><p>Clean and standardized columns</p>
</li>
<li><p>Prices and service fees ready for numeric operations</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755178810831/64829e8e-9301-4790-99a5-d5eef6d8420d.png" alt class="image--center mx-auto" /></p>
<p>📂 <strong>You can find my project files on GitHub:</strong> <a target="_blank" href="https://github.com/AvadhootKamble24/Data-Cleaning-Projects"><em>GitHub Repo Link</em></a></p>
<p><strong>🔗Link to the dataset used in this</strong> <strong>project</strong>: <a target="_blank" href="https://www.kaggle.com/datasets/arianazmoudeh/airbnbopendata"><em>Airbnb Open Data</em></a></p>
<p>📢 <strong>Stay tuned!</strong><br />I’ll be sharing more new projects soon, and I’m also diving into <strong>Generative AI and projects</strong>, which I can’t wait to blog about next!</p>
]]></content:encoded></item><item><title><![CDATA[Cleaning Student Performance Data with Pandas – My First Practical Data Cleaning Case Study 📊🧹]]></title><description><![CDATA[Hey there 👋I’m Avadhoot Kamble, and this blog is a breakdown of one of my first real-world data cleaning projects using Pandas in Python.
I recently downloaded a dataset from Kaggle on student performance and decided to clean it thoroughly using onl...]]></description><link>https://avadhootkamble24.hashnode.dev/cleaning-student-performance-data-pandas</link><guid isPermaLink="true">https://avadhootkamble24.hashnode.dev/cleaning-student-performance-data-pandas</guid><dc:creator><![CDATA[Avadhoot Kamble]]></dc:creator><pubDate>Tue, 08 Jul 2025 08:15:54 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/aOC7TSLb1o8/upload/72c4b4b4360f782532df37585d7b67c7.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hey there 👋<br />I’m <strong>Avadhoot Kamble</strong>, and this blog is a breakdown of one of my first real-world data cleaning projects using <strong>Pandas</strong> in Python.</p>
<p>I recently downloaded a dataset from Kaggle on student performance and decided to <strong>clean it thoroughly</strong> using only code — no Excel this time! In this post, I’ll walk you through everything I did, step-by-step, including the challenges I faced and how I solved them.</p>
<p>Whether you're a beginner learning Pandas or someone curious about how data is cleaned before analysis or modeling, this post will give you a solid, realistic picture.</p>
<h2 id="heading-dataset-overview">📁 Dataset Overview</h2>
<p>The dataset I worked on contains student information — not just their test scores, but also family, education, and lifestyle-related features. Here’s what each column means:</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Column Name</td><td>Description</td></tr>
</thead>
<tbody>
<tr>
<td><code>Gender</code></td><td>Gender of the student (<code>Male</code>/<code>Female</code>)</td></tr>
<tr>
<td><code>EthnicGroup</code></td><td>Ethnic group (<code>Group A</code> to <code>Group E</code>)</td></tr>
<tr>
<td><code>ParentEduc</code></td><td>Parent's education background</td></tr>
<tr>
<td><code>LunchType</code></td><td>Type of school lunch (<code>Standard</code>, <code>Free/Reduced</code>)</td></tr>
<tr>
<td><code>TestPrep</code></td><td>Whether they completed test preparation</td></tr>
<tr>
<td><code>ParentMaritalStatus</code></td><td>Marital status of the parents</td></tr>
<tr>
<td><code>PracticeSport</code></td><td>How often they practice sports</td></tr>
<tr>
<td><code>IsFirstChild</code></td><td>Is this student the first child in the family? (<code>Yes</code>/<code>No</code>)</td></tr>
<tr>
<td><code>NrSiblings</code></td><td>Number of siblings</td></tr>
<tr>
<td><code>TransportMeans</code></td><td>Means of transport to school</td></tr>
<tr>
<td><code>WklyStudyHours</code></td><td>Weekly self-study hours</td></tr>
<tr>
<td><code>MathScore</code>, <code>ReadingScore</code>, <code>WritingScore</code></td><td>Academic scores (0–100)</td></tr>
</tbody>
</table>
</div><p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1751959967278/493455af-9a8c-4055-aede-a69a4e869328.png" alt="Raw dataset" class="image--center mx-auto" /></p>
<p>One weird thing I spotted was an <code>Unnamed: 0</code> column — probably an index from an earlier save. I dropped it immediately:</p>
<pre><code class="lang-python">data = data.drop(columns=[<span class="hljs-string">'Unnamed: 0'</span>])
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1751960147405/e5434ce2-0f72-460c-8006-6bbc9ef7beed.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-step-2-handling-null-values">🛠️ Step 2: Handling Null Values</h2>
<p>Several columns had missing values. Here’s how I tackled them:</p>
<h3 id="heading-ethnicgroup-amp-parenteduc">🔹 <code>EthnicGroup</code> &amp; <code>ParentEduc</code></h3>
<p>I filled their missing values using the <strong>most frequent value (mode)</strong>:</p>
<pre><code class="lang-python">data[<span class="hljs-string">'EthnicGroup'</span>] = data[<span class="hljs-string">'EthnicGroup'</span>].fillna(data[<span class="hljs-string">'EthnicGroup'</span>].mode()[<span class="hljs-number">0</span>])
data[<span class="hljs-string">'ParentEduc'</span>] = data[<span class="hljs-string">'ParentEduc'</span>].fillna(data[<span class="hljs-string">'ParentEduc'</span>].mode()[<span class="hljs-number">0</span>])
</code></pre>
<h3 id="heading-testprep-parentmaritalstatus-practicesport">🔹 <code>TestPrep</code>, <code>ParentMaritalStatus</code>, <code>PracticeSport</code></h3>
<p>I looped through these related columns and applied mode-filling as well:</p>
<pre><code class="lang-python">col_to_fill = [<span class="hljs-string">'TestPrep'</span>, <span class="hljs-string">'ParentMaritalStatus'</span>, <span class="hljs-string">'PracticeSport'</span>]
<span class="hljs-keyword">for</span> col <span class="hljs-keyword">in</span> col_to_fill:
    data[col] = data[col].fillna(data[col].mode()[<span class="hljs-number">0</span>])
</code></pre>
<h2 id="heading-step-3-fixing-isfirstchild-binary-encoding">🎯 Step 3: Fixing <code>IsFirstChild</code> (Binary Encoding)</h2>
<p>This column had <code>"yes"</code>/<code>"no"</code> values. I filled nulls with mode and mapped it to 1s and 0s for binary classification:</p>
<pre><code class="lang-python">data[<span class="hljs-string">'IsFirstChild'</span>] = data[<span class="hljs-string">'IsFirstChild'</span>].fillna(data[<span class="hljs-string">'IsFirstChild'</span>].mode()[<span class="hljs-number">0</span>])
data[<span class="hljs-string">'IsFirstChild'</span>] = data[<span class="hljs-string">'IsFirstChild'</span>].map({<span class="hljs-string">'yes'</span>: <span class="hljs-number">1</span>, <span class="hljs-string">'no'</span>: <span class="hljs-number">0</span>})
</code></pre>
<h2 id="heading-step-4-numerical-fixes-nrsiblings-wklystudyhours">📊 Step 4: Numerical Fixes – <code>NrSiblings</code>, <code>WklyStudyHours</code></h2>
<p>For <code>NrSiblings</code>, I filled nulls with the <strong>median</strong> and converted it to integer:</p>
<pre><code class="lang-python">data[<span class="hljs-string">'NrSiblings'</span>] = data[<span class="hljs-string">'NrSiblings'</span>].fillna(data[<span class="hljs-string">'NrSiblings'</span>].median())
data[<span class="hljs-string">'NrSiblings'</span>] = data[<span class="hljs-string">'NrSiblings'</span>].astype(<span class="hljs-string">'int64'</span>)
</code></pre>
<p>For <code>WklyStudyHours</code>, I:</p>
<ul>
<li><p>Removed spaces</p>
</li>
<li><p>Lowercased all entries</p>
</li>
<li><p>Mapped ranges (<code>&lt;5</code>, <code>5-10</code>, <code>&gt;10</code>) to numerical midpoints: 2.5, 7.5, 12.5</p>
</li>
<li><p>Filled any missing values with the <strong>median</strong></p>
</li>
</ul>
<pre><code class="lang-python">data[<span class="hljs-string">'WklyStudyHours'</span>] = data[<span class="hljs-string">'WklyStudyHours'</span>].str.replace(<span class="hljs-string">" "</span>, <span class="hljs-string">""</span>).str.lower()
data[<span class="hljs-string">'WklyStudyHours'</span>] = data[<span class="hljs-string">'WklyStudyHours'</span>].map({<span class="hljs-string">'&lt;5'</span>: <span class="hljs-number">2.5</span>, <span class="hljs-string">'5-10'</span>: <span class="hljs-number">7.5</span>, <span class="hljs-string">'&gt;10'</span>: <span class="hljs-number">12.5</span>})
data[<span class="hljs-string">'WklyStudyHours'</span>] = data[<span class="hljs-string">'WklyStudyHours'</span>].fillna(data[<span class="hljs-string">'WklyStudyHours'</span>].median())
</code></pre>
<p>Column “WklyStudyHours” before mapping:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1751960440732/cda575aa-093e-488b-b601-e799b4d73678.png" alt class="image--center mx-auto" /></p>
<p>Column “WklyStudyHours” after mapping:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1751960518990/8d263912-8851-448b-aa6a-68b71993f00d.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-step-5-categorical-cleaning-lowercasing-amp-trimming">✂️ Step 5: Categorical Cleaning – Lowercasing &amp; Trimming</h2>
<p>I applied <code>.str.strip().str.lower()</code> on a few selected columns to clean casing and whitespace:</p>
<pre><code class="lang-python">pythonCopyEditcol_to_clean = [<span class="hljs-string">'TestPrep'</span>, <span class="hljs-string">'Gender'</span>, <span class="hljs-string">'PracticeSport'</span>]
<span class="hljs-keyword">for</span> col <span class="hljs-keyword">in</span> col_to_clean:
    data[col] = data[col].str.strip().str.lower()
</code></pre>
<hr />
<h2 id="heading-step-6-checking-for-outliers-in-score-columns">🔎 Step 6: Checking for Outliers in Score Columns</h2>
<p>Before finalizing the dataset, I wanted to make sure there were <strong>no unusual or invalid scores</strong> in the three academic columns: <code>MathScore</code>, <code>ReadingScore</code>, and <code>WritingScore</code>.</p>
<p>I used the <code>.unique()</code> function to inspect the values in each column:</p>
<pre><code class="lang-python">data[<span class="hljs-string">'ReadingScore'</span>].unique() <span class="hljs-comment">#checking for outliers</span>
data[<span class="hljs-string">'MathScore'</span>].unique()
data[<span class="hljs-string">'WritingScore'</span>].unique()
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1751961055070/8e49e3a1-99e3-480a-afc3-afdcc1e01714.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-step-7-removing-duplicates">🧹 Step 7: Removing Duplicates</h2>
<p>Finally, I checked for duplicate rows and dropped them if any were found:</p>
<pre><code class="lang-python">pythonCopyEditdata.duplicated().sum()
data = data.drop_duplicates()
</code></pre>
<hr />
<h2 id="heading-final-step-exporting-cleaned-dataset">💾 Final Step: Exporting Cleaned Dataset</h2>
<p>Once everything looked clean and consistent, I saved the dataset:</p>
<pre><code class="lang-python">pythonCopyEditdata.to_csv(<span class="hljs-string">"Cleaned student exam data.csv"</span>, index=<span class="hljs-literal">False</span>)
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1751961402630/3fcd1b7a-a1c0-4395-8914-8cd5a6329371.png" alt class="image--center mx-auto" /></p>
<p>✅ Done! I now had a cleaned, structured dataset ready for EDA or modeling.</p>
<h2 id="heading-what-i-learned-from-this-project">💡 What I Learned from This Project</h2>
<ul>
<li><p><strong>Real data isn’t clean</strong> — even well-structured datasets need attention.</p>
</li>
<li><p><strong>Pandas is powerful</strong> — chaining small functions (<code>.map()</code>, <code>.fillna()</code>, <code>.str.strip()</code>) creates big improvements.</p>
</li>
<li><p><strong>Data cleaning is decision-making</strong> — context matters when choosing between median, mode, or dropping.</p>
</li>
</ul>
<h2 id="heading-whats-next">🚀 What’s Next?</h2>
<p>This was my first real experience cleaning a dataset using only code. Next, I’ll be working on:</p>
<ul>
<li><p>🔎 <strong>Exploratory Data Analysis</strong> with Pandas and Seaborn</p>
</li>
<li><p>📈 Visualizations comparing scores by gender, lunch type, parental education</p>
</li>
<li><p>🤖 My first <strong>machine learning project</strong>: predicting test outcomes</p>
</li>
</ul>
<h2 id="heading-project-files-on-github">📂 Project Files on GitHub</h2>
<p>You can find the full project here, including:</p>
<ul>
<li><p>The <strong>Jupyter Notebook</strong> (<code>StudentsExamScores.ipynb</code>)</p>
</li>
<li><p>The <strong>Raw and Cleaned CSVs</strong></p>
</li>
</ul>
<p>🔗 <a target="_blank" href="https://github.com/AvadhootKamble24/Data-Cleaning-Projects/tree/main/Student%20Exam%20Data">View the Project on GitHub</a></p>
<h2 id="heading-lets-connect">🙌 Let’s Connect</h2>
<p>If you're on a similar path or want to share tips, feedback, or connect — I’d love to hear from you!</p>
<ul>
<li><p>💻 <a target="_blank" href="https://github.com/AvadhootKamble24">GitHub – Projects</a></p>
</li>
<li><p>🌐 <a target="_blank" href="https://linkedin.com/in/avadhootkamble">LinkedIn – Say hi</a></p>
</li>
<li><p>📝 <a target="_blank" href="https://avadhootkamble24.hashnode.dev">More Blogs on Hashnode</a></p>
</li>
</ul>
<p>Thanks for reading 🙏</p>
<hr />
<p>#Pandas #Python #DataCleaning #DataScience #KaggleDataset #LearningInPublic #BeginnerProjects #JupyterNotebook #PortfolioProject</p>
]]></content:encoded></item><item><title><![CDATA[How to Clean Real Datasets Using Excel: A Data Analytics Starter Guide 🚀]]></title><description><![CDATA[Hey there! I'm Avadhoot Kamble, a recent graduate in Artificial Intelligence and Data Science Engineering, and this is the story of how I started my journey into data analytics — not with complex models or advanced tools, but by doing something simpl...]]></description><link>https://avadhootkamble24.hashnode.dev/excel-data-cleaning-beginner-projects</link><guid isPermaLink="true">https://avadhootkamble24.hashnode.dev/excel-data-cleaning-beginner-projects</guid><dc:creator><![CDATA[Avadhoot Kamble]]></dc:creator><pubDate>Mon, 07 Jul 2025 07:38:15 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1751874163114/285aca32-6fca-496e-b9f4-05e997e23570.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hey there! I'm <strong>Avadhoot Kamble</strong>, a recent graduate in Artificial Intelligence and Data Science Engineering, and this is the story of how I started my journey into data analytics — not with complex models or advanced tools, but by doing something simple, real, and essential: <strong>cleaning messy, real-world datasets</strong> in Excel.</p>
<p>This blog is about how I worked on two datasets, faced real problems, and used basic but powerful Excel techniques to bring structure and clarity to the chaos.</p>
<h2 id="heading-dataset-1-us-presidents-understanding-the-dataset">📁 Dataset 1: US Presidents – Understanding the Dataset</h2>
<p>The first dataset I tackled was about <strong>U.S. Presidents</strong> — a historic, structured list of who held office, when, and under which political party.</p>
<p>Here are the key columns and what they represent:</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Column Name</td><td>Description</td></tr>
</thead>
<tbody>
<tr>
<td><code>President</code></td><td>Full name of the U.S. president</td></tr>
<tr>
<td><code>Party</code></td><td>Political party they belonged to</td></tr>
<tr>
<td><code>Term Start</code></td><td>When their presidency began</td></tr>
<tr>
<td><code>Term End</code></td><td>When it ended</td></tr>
<tr>
<td><code>Vice President</code></td><td>Their VP during the term</td></tr>
<tr>
<td><code>prior</code></td><td>A mysterious, irrelevant column (you’ll see what I did with it)</td></tr>
</tbody>
</table>
</div><p>When I opened the dataset, it looked fairly clean on the surface. But as I examined it, I started spotting subtle inconsistencies:</p>
<ul>
<li><p>Some president names were in <strong>all caps</strong>, some in <strong>lowercase</strong>, and some a mix.</p>
</li>
<li><p>Political party names had multiple <strong>spellings or formats</strong>.</p>
</li>
<li><p>Several cells had <strong>extra white spaces</strong>.</p>
</li>
<li><p>There was an odd column called <code>prior</code> which clearly didn’t belong.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1751870778638/ad090ede-d8be-47cd-bc7c-b08e91e61659.png" alt="President raw data" class="image--center mx-auto" /></p>
<h2 id="heading-how-i-cleaned-the-us-president-dataset">🧹 How I Cleaned the US President Dataset</h2>
<h3 id="heading-step-1-remove-duplicates">🔁 Step 1: Remove Duplicates</h3>
<p>I started by checking for duplicate rows using the <strong>Remove Duplicates</strong> function from Excel's ribbon. Even a small historical dataset can have redundant entries!</p>
<h3 id="heading-step-2-fix-the-name-formatting">🧼 Step 2: Fix the Name Formatting</h3>
<p>Next, I applied the <code>PROPER()</code> function to the <code>President</code> column. This automatically converted entries like <code>george washington</code> or <code>GEORGE WASHINGTON</code> into the clean and proper format: <code>George Washington</code>.</p>
<h3 id="heading-step-3-standardize-the-party-column">🧠 Step 3: Standardize the Party Column</h3>
<p>I applied filters to the <code>Party</code> column and found variations of the same political party, like <code>democrat</code>, <code>Democratic</code>, and even misspelled ones like <code>Democrattic</code>. I corrected them manually to ensure consistency.</p>
<h3 id="heading-step-4-clean-white-spaces-and-format-other-columns">✂️ Step 4: Clean White Spaces and Format Other Columns</h3>
<p>To fix other formatting issues, I combined <code>TRIM()</code> with <code>PROPER()</code> in most text columns. This removed unwanted spaces and ensured each word started with a capital letter.</p>
<h3 id="heading-step-5-convert-dates-to-proper-format">🗓️ Step 5: Convert Dates to Proper Format</h3>
<p>The <code>date updated</code> and <code>date created</code> columns were formatted as text. I converted them to date format using Excel’s built-in tools for cleaner sorting and analysis.</p>
<h3 id="heading-step-6-delete-the-useless-column">🗑️ Step 6: Delete the Useless Column</h3>
<p>Lastly, I deleted the <code>prior</code>column — it had no value to the dataset.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1751871074116/eeba65d6-0b1a-43e7-84c7-090e084d5fbe.png" alt="President Clean Data" class="image--center mx-auto" /></p>
<h2 id="heading-dataset-2-client-transactions-understanding-the-dataset">📁 Dataset 2: Client Transactions – Understanding the Dataset</h2>
<p>Next, I worked on a business-focused dataset that tracked <strong>client transactions</strong>. This was more practical and closer to real-world business use cases.</p>
<p>Here are the key columns:</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Column Name</td><td>Description</td></tr>
</thead>
<tbody>
<tr>
<td><code>Client</code></td><td>Client company names (often had extra notes in parentheses)</td></tr>
<tr>
<td><code>Contact</code></td><td>Person of contact for each client</td></tr>
<tr>
<td><code>Department_Region</code></td><td>Combined info: department and region separated by <code>_</code></td></tr>
<tr>
<td><code>Revenue</code></td><td>Revenue from that client</td></tr>
<tr>
<td><code>Profit</code></td><td>Profit earned</td></tr>
<tr>
<td><code>Payment</code></td><td>Payment status/value (some blanks)</td></tr>
<tr>
<td><code>Profit Margin</code></td><td>A calculated field — <code>Revenue / Profit</code> (some errors present)</td></tr>
</tbody>
</table>
</div><p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1751873702521/3b45b9b5-70fb-46c8-b807-a2c6573bcb12.png" alt="Client transacton raw data" class="image--center mx-auto" /></p>
<h2 id="heading-how-i-cleaned-the-client-transactions-dataset">🧹 How I Cleaned the Client Transactions Dataset</h2>
<h3 id="heading-step-1-resize-and-explore">📐 Step 1: Resize and Explore</h3>
<p>Before doing anything, I auto-resized all columns and rows. A clearer view helps with cleaner work.</p>
<h3 id="heading-step-2-clean-the-client-column">🧾 Step 2: Clean the Client Column</h3>
<p>The <code>Client</code> column had values like “XYZ Corp (inactive)”. I removed everything inside parentheses, then used the <code>LOWER()</code> function to standardize names in lowercase. I did this in a new column, pasted the cleaned values as <strong>values only</strong>, and replaced the original.</p>
<h3 id="heading-step-3-clean-the-contact-names">👤 Step 3: Clean the Contact Names</h3>
<p>The <code>Contact</code> column was inconsistent too. I used <code>TRIM()</code> and <code>PROPER()</code> to clean spacing issues and convert all names to proper case (e.g., <code>John Doe</code>).</p>
<h3 id="heading-step-4-split-the-department-and-region">🏢 Step 4: Split the Department and Region</h3>
<p>The <code>Department_Region</code> column combined two values, like “Finance_West”. I used <strong>Text to Columns</strong> with <code>_</code> as the delimiter and split them into two new columns: <strong>Department</strong> and <strong>Region</strong>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1751871529096/16143cb4-f589-40b8-aad5-4cd7f94e182e.png" alt="Text to Columns and cleaned Contact column" class="image--center mx-auto" /></p>
<h3 id="heading-step-5-remove-duplicates">❌ Step 5: Remove Duplicates</h3>
<p>I used the <strong>Remove Duplicates</strong> tool to clean any repeated rows that were sneaking in.</p>
<h3 id="heading-step-6-fill-missing-payments">📭 Step 6: Fill Missing Payments</h3>
<p>Several entries in the <code>Payment</code> column were blank. I selected them using “Go to Special” → “Blanks” and filled them with <code>"NA"</code> using <code>Ctrl + Enter</code>.</p>
<h3 id="heading-step-7-fix-errors-in-profit-margin">💡 Step 7: Fix Errors in Profit Margin</h3>
<p>Some cells in the <code>Profit Margin</code> column had errors (due to zero or missing values in the formula). I used:</p>
<pre><code class="lang-excel">=<span class="hljs-built_in">IFERROR</span>(Revenue / Profit, <span class="hljs-string">"NA"</span>)
</code></pre>
<p>to catch those and keep the sheet error-free.</p>
<h3 id="heading-step-8-final-touches">🎨 Step 8: Final Touches</h3>
<p>I formatted all headers and added some color to improve readability.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1751871838380/c89f8d15-efef-4e33-8f13-28a53f7a6d98.png" alt=" Final cleaned client transaction dataset" class="image--center mx-auto" /></p>
<h2 id="heading-what-i-learned-from-these-projects">💡 What I Learned from These Projects</h2>
<p>These may have been simple projects, but they taught me big lessons:</p>
<ul>
<li><p><strong>Data cleaning is not glamorous, but it’s crucial.</strong> Without it, no analysis is trustworthy.</p>
</li>
<li><p><strong>Excel is underrated.</strong> It’s packed with powerful functions that are more than enough for beginner and intermediate cleaning tasks.</p>
</li>
<li><p><strong>Details matter.</strong> Whether it's a spelling mistake, a space, or a duplicate row — these small issues cause big problems later in the pipeline.</p>
</li>
</ul>
<p>But most importantly, I learned that <strong>even basic tools can teach deep lessons</strong> about working with real data.</p>
<hr />
<h2 id="heading-whats-next">🚀 What’s Next?</h2>
<p>Now that I’ve started with Excel, I’m stepping into the world of <strong>Pandas and Python</strong>. 🐍<br />I’ve already started a project where I’m cleaning a more complex dataset using:</p>
<ul>
<li><p><code>dropna()</code>, <code>fillna()</code></p>
</li>
<li><p>Regex for text patterns</p>
</li>
<li><p><code>.apply()</code> for column transformations</p>
</li>
<li><p>Handling missing and inconsistent values with scripts</p>
</li>
</ul>
<p>In my next blog, I’ll walk you through that project too — and compare the experience of cleaning data in <strong>Excel vs Python</strong>.</p>
<hr />
<h2 id="heading-lets-connect">🙌 Let’s Connect</h2>
<p>Thanks for reading! If you’re also starting out in data science or just curious about how real-world data cleaning looks, I’d love to connect.</p>
<p>Follow my journey here and across platforms:</p>
<ul>
<li><p>💻 <a target="_blank" href="https://github.com/AvadhootKamble24">GitHub – Code &amp; Projects</a></p>
</li>
<li><p>🌐 <a target="_blank" href="https://linkedin.com/in/avadhootkamble">LinkedIn – Let’s Connect</a></p>
</li>
</ul>
<p>Let’s keep learning — and cleaning — one dataset at a time!</p>
<hr />
<p>#Excel #DataCleaning #DataAnalytics #LearningInPublic #MSExcel #BeginnerProjects #DataScience #Python #Pandas #BloggingJourney #PortfolioProject</p>
]]></content:encoded></item><item><title><![CDATA[🚀Kicking Off My Data Science Journey: Exploring Data Engineering, ML & More]]></title><description><![CDATA[Hey everyone 👋I’m Avadhoot Kamble, an enthusiastic learner and aspiring data professional. I’m excited to share that I’m officially starting my blogging journey to document and showcase my learning, growth, and projects across the fields of Data Sci...]]></description><link>https://avadhootkamble24.hashnode.dev/kicking-off-my-data-science-journey</link><guid isPermaLink="true">https://avadhootkamble24.hashnode.dev/kicking-off-my-data-science-journey</guid><dc:creator><![CDATA[Avadhoot Kamble]]></dc:creator><pubDate>Wed, 02 Jul 2025 06:12:00 GMT</pubDate><content:encoded><![CDATA[<p>Hey everyone 👋<br />I’m <strong>Avadhoot Kamble</strong>, an enthusiastic learner and aspiring data professional. I’m excited to share that I’m officially starting my <strong>blogging journey</strong> to document and showcase my learning, growth, and projects across the fields of <strong>Data Science</strong>, <strong>Data Engineering</strong>, <strong>Machine Learning</strong>, and <strong>Deep Learning</strong>.</p>
<h2 id="heading-who-am-i">🧠 Who Am I?</h2>
<p>I’ve recently completed my <strong>Bachelor’s degree in Artificial Intelligence and Data Science Engineering</strong> from Zeal College of Engineering and Research, Pune with a <strong>CGPA of 8.27</strong>.</p>
<p>Throughout my academic journey, I’ve had the chance to work on a range of projects and internships that sparked my passion for working with data, building models, and solving real-world problems.</p>
<p>Here are a few highlights from my experience:</p>
<ul>
<li><p>🧠 Trained and fine-tuned models like <strong>VGG16, VGG19+LSTM, CNN+RNN</strong> for image classification tasks</p>
</li>
<li><p>📊 Built <strong>interactive dashboards</strong> using Tableau for HR and e-commerce data</p>
</li>
<li><p>🛠️ Annotated datasets and trained <strong>YOLO models</strong> for real-time object detection</p>
</li>
<li><p>💡 Worked on <strong>predictive modeling and automation workflows</strong> for real-world use cases</p>
</li>
</ul>
<p>Explore some of my featured projects:</p>
<ul>
<li><p><a target="_blank" href="https://github.com/AvadhootKamble24/American-Sign-Language-Recognition-Application.git">ASL Recognition using YOLO</a></p>
</li>
<li><p><a target="_blank" href="https://github.com/AvadhootKamble24/Plant-Leaf-Classification">Medicinal Plant Classification</a></p>
</li>
<li><p><a target="_blank" href="https://github.com/AvadhootKamble24/ML-Projects/tree/main/House-price-prediction">House Price Prediction (Regression)</a></p>
</li>
<li><p><a target="_blank" href="https://public.tableau.com/app/profile/avadhoot.kamble">Tableau Dashboards</a></p>
</li>
</ul>
<h2 id="heading-why-im-starting-this-blog">🎯 Why I’m Starting This Blog</h2>
<p>My goal isn’t limited to one title like “data engineer” or “ML engineer.” I want to <strong>explore the entire data ecosystem</strong> — from handling raw data to building intelligent models.<br />That includes:</p>
<ul>
<li><p>📌 <strong>Data Engineering</strong> – Building pipelines, working with databases, and automating workflows</p>
</li>
<li><p>📊 <strong>Data Analysis</strong> – Visualizing and making sense of data using tools like SQL, Pandas, and Tableau</p>
</li>
<li><p>🧠 <strong>Machine Learning &amp; Deep Learning</strong> – Creating models that solve real problems</p>
</li>
</ul>
<p>Through this blog, I want to:</p>
<ul>
<li><p>Share my <strong>learning journey</strong> in a transparent and structured way</p>
</li>
<li><p>Showcase <strong>projects, code, and dashboards</strong> I build</p>
</li>
<li><p>Connect with learners, mentors, and recruiters</p>
</li>
<li><p>Help others who are starting their own path in data science</p>
</li>
</ul>
<h2 id="heading-what-youll-find-in-my-future-posts">✍️ What You’ll Find in My Future Posts</h2>
<p>I’ll be sharing:</p>
<ul>
<li><p>🧪 Step-by-step breakdowns of ML/DL projects I build</p>
</li>
<li><p>🔧 My experiments and workflows in data engineering</p>
</li>
<li><p>🧩 Learnings and insights from data analysis case studies</p>
</li>
<li><p>📘 Tips, tutorials, and roadmaps from a learner’s perspective</p>
</li>
</ul>
<p>If you’re learning too — or just curious about this space — I hope my posts will inspire and help you grow alongside me.</p>
<h2 id="heading-stay-connected">🔗 Stay Connected</h2>
<p>This is just the beginning.<br />Stay tuned for upcoming blogs where I’ll dive deep into <strong>how I learn, what I build</strong>, and <strong>how I accelerate my growth</strong> in the world of data.</p>
<p>Follow my journey:</p>
<ul>
<li><p>💻 <a target="_blank" href="https://github.com/AvadhootKamble24">GitHub – Code &amp; Projects</a></p>
</li>
<li><p>🌐 <a target="_blank" href="https://linkedin.com/in/avadhootkamble">LinkedIn – Let’s Connect</a></p>
</li>
</ul>
<p>Thanks for reading — and welcome to my journey 🚀</p>
<hr />
<p>#DataScience #MachineLearning #DeepLearning #DataEngineering #DataAnalytics #LearningInPublic #DSA #Python #SQL #HashnodeBlog #AI #MLProjects</p>
]]></content:encoded></item></channel></rss>