<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Gautam Singh on Medium]]></title>
        <description><![CDATA[Stories by Gautam Singh on Medium]]></description>
        <link>https://medium.com/@gautamsingh139?source=rss-dee5052d79cb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*PBEAbPXMsfPLZ4hDQm_3rQ.jpeg</url>
            <title>Stories by Gautam Singh on Medium</title>
            <link>https://medium.com/@gautamsingh139?source=rss-dee5052d79cb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 20:50:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gautamsingh139/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A Practical Framework for Testing LLM and RAG Systems]]></title>
            <link>https://medium.com/@gautamsingh139/a-practical-framework-for-testing-llm-and-rag-systems-787673dc32e8?source=rss-dee5052d79cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/787673dc32e8</guid>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Gautam Singh]]></dc:creator>
            <pubDate>Thu, 11 Jun 2026 09:38:10 GMT</pubDate>
            <atom:updated>2026-06-11T09:38:10.655Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*dDUZ0MT5Z3OMMWo3.jpeg" /></figure><p>Most people misunderstand why evaluating LLM and RAG systems is hard.</p><p>It’s not because AI is complex.<br>It’s because𝐨𝐮𝐫 𝐨𝐥𝐝 𝐭𝐞𝐬𝐭𝐢𝐧𝐠 𝐚𝐬𝐬𝐮𝐦𝐩𝐭𝐢𝐨𝐧𝐬 𝐛𝐫𝐞𝐚𝐤.</p><p>Traditional QA assumes:<br>• Deterministic inputs<br>• Predictable outputs<br>• Clear expected results</p><p>LLMs break all three.</p><p>That’s the problem DeepEval is designed to solve.</p><p>What is DeepEval</p><p>DeepEval is an 𝐞𝐯𝐚𝐥𝐮𝐚𝐭𝐢𝐨𝐧 𝐟𝐫𝐚𝐦𝐞𝐰𝐨𝐫𝐤, not an observability tool and not a chatbot wrapper.</p><p>Its job is simple but non-negotiable:<br>Turn subjective AI outputs into𝐨𝐛𝐣𝐞𝐜𝐭𝐢𝐯𝐞, 𝐭𝐞𝐬𝐭𝐚𝐛𝐥𝐞 𝐬𝐢𝐠𝐧𝐚𝐥𝐬.</p><p>It does this by:<br>• Treating LLM responses as 𝐚𝐫𝐭𝐢𝐟𝐚𝐜𝐭𝐬 𝐭𝐨 𝐛𝐞 𝐞𝐯𝐚𝐥𝐮𝐚𝐭𝐞𝐝<br>• Using structured metrics instead of text matching<br>• Applying repeatable evaluation logic you can run in CI</p><p>In QA terms:<br>DeepEval replaces “looks fine to me” with 𝐚𝐬𝐬𝐞𝐫𝐭𝐢𝐨𝐧𝐬.</p><p>The real problem with RAG systems</p><p>RAG failures are rarely model failures.</p><p>They usually happen in one of these layers:</p><p>1. Retrieval layer<br>Wrong documents fetched, partial context, noisy chunks</p><p>2. Prompt layer<br>Prompt encourages guessing instead of grounding</p><p>3. Generation layer<br>Model blends real context with invented facts</p><p>4. Evaluation layer<br>Nobody checks if the output is actually valid</p><p>DeepEval doesn’t guess where things went wrong.<br>It 𝐢𝐬𝐨𝐥𝐚𝐭𝐞𝐬 𝐭𝐡𝐞 𝐟𝐚𝐢𝐥𝐮𝐫𝐞 𝐦𝐨𝐝𝐞.</p><p>DeepEval’s metric design</p><p>DeepEval doesn’t use one vague “accuracy” score.<br>It decomposes quality into orthogonal metrics.</p><p>1. Answer Relevancy</p><p>Checks whether the response actually answers the user question.</p><p>This catches:<br>• Long but useless answers<br>• Overly generic responses<br>• Hallucinated tangents</p><p>This is critical for chatbots that sound confident but say nothing.</p><p>2. Faithfulness</p><p>This is the most important RAG metric.</p><p>Faithfulness asks:<br>Is every claim in the answer 𝐬𝐮𝐩𝐩𝐨𝐫𝐭𝐞𝐝 𝐛𝐲 𝐭𝐡𝐞 𝐫𝐞𝐭𝐫𝐢𝐞𝐯𝐞𝐝 𝐜𝐨𝐧𝐭𝐞𝐱𝐭?</p><p>If the model invents even one unsupported fact, the score drops.</p><p>This is how DeepEval detects hallucinations without needing ground truth.</p><p>3. Context Precision</p><p>Measures how much of the retrieved context was actually useful.</p><p>Low precision means:<br>• Too many irrelevant chunks<br>• Poor chunking strategy<br>• Weak embedding similarity</p><p>This is a retrieval quality problem, not a model problem.</p><p>4. Context Recall</p><p>Measures whether the retrieved context was sufficient to answer the question.</p><p>Low recall means:<br>• Missing documents<br>• Over-aggressive filtering<br>• Bad retrieval parameters</p><p>Together, precision + recall give QA teams 𝐡𝐚𝐫𝐝 𝐞𝐯𝐢𝐝𝐞𝐧𝐜𝐞 of retrieval issues.</p><h3>Get Bharat Varshney’s stories in your inbox</h3><p>Join Medium for free to get updates from this writer.</p><p>Subscribe</p><p>Remember me for faster sign in</p><p>5. Correctness (when ground truth exists)</p><p>When you do have expected answers, DeepEval can validate factual accuracy.</p><p>This is useful for:<br>• Knowledge base Q&amp;A<br>• Internal policy bots<br>• Compliance-heavy domains</p><p>The “𝐋𝐋𝐌 𝐚𝐬 𝐚 𝐣𝐮𝐝𝐠𝐞” concept (and why it’s not reckless)</p><p>Many teams panic when they hear this.</p><p>Here’s the thing:</p><p>DeepEval doesn’t blindly trust another LLM.<br>It uses controlled evaluation prompts with strict criteria.</p><p>Key safeguards:<br>• Deterministic temperature settings<br>• Explicit scoring rubrics<br>• Repeatable evaluation runs</p><p>You’re not asking the model:<br>Is this good?</p><p>You’re asking:<br>Does this answer meet these specific constraints?</p><p>That’s a huge difference.</p><p>How QA teams actually use DeepEval in practice</p><p>This is where it gets real.</p><p>Regression testing for AI</p><p>Change a prompt?<br>Update embeddings?<br>Switch vector DB?</p><p>DeepEval catches quality regressions **before production**.</p><p>Same mindset as API regression testing.</p><p>Quality gates in CI</p><p>You can define rules like:<br>• Faithfulness score must be ≥ 0.8<br>• Relevancy must not drop below baseline<br>• No hallucination flags allowed</p><p>Fail the build if AI quality degrades.</p><p>That’s real QA control.</p><p>Model benchmarking</p><p>Compare:<br>• GPT vs Claude<br>• OpenAI vs open-source<br>• Old model vs new model</p><p>Using the same test set and metrics.</p><p>No opinions. Just data.</p><p>Risk-based AI testing</p><p>Not all answers need to be perfect.</p><p>DeepEval allows you to:<br>• Accept lower scores for casual chat<br>• Enforce strict thresholds for legal, healthcare, finance</p><p>QA finally gets risk classification for AI outputs.</p><p>What DeepEval changes for QA mindset</p><p>This is the biggest shift.</p><p>QA stops testing:<br>What did the model say?</p><p>QA starts testing:<br>• Did it stay grounded?<br>• Did it retrieve the right knowledge?<br>• Did it exceed acceptable risk?<br>• Did quality regress over time?</p><p>AI testing becomes 𝐬𝐲𝐬𝐭𝐞𝐦 𝐯𝐚𝐥𝐢𝐝𝐚𝐭𝐢𝐨𝐧, not sentence review.</p><p>The uncomfortable truth</p><p>If you’re shipping LLM or RAG systems without DeepEval or something similar:</p><p>You are not testing AI.<br>You are𝐡𝐨𝐩𝐢𝐧𝐠.</p><p>Hope is not a strategy.<br>Especially in production.</p><p>QA folks, what’s been harder for you so far: testing retrieval or controlling hallucinations?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=787673dc32e8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Future of QA Won’t Be Manual vs Automation. It Will Be Human + AI Agents Working Together.]]></title>
            <link>https://medium.com/@gautamsingh139/the-future-of-qa-wont-be-manual-vs-automation-it-will-be-human-ai-agents-working-together-019eab7c1c11?source=rss-dee5052d79cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/019eab7c1c11</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[agents]]></category>
            <dc:creator><![CDATA[Gautam Singh]]></dc:creator>
            <pubDate>Thu, 11 Jun 2026 09:33:08 GMT</pubDate>
            <atom:updated>2026-06-11T09:33:29.646Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*V0df6YH5LZZt3eHL.jpeg" /></figure><p>This architecture completely changed how I think about the future of Quality Engineering.</p><p>For years, most QA workflows looked like this:</p><p>Requirement → Test Case → Automation → Bug Report → Manual Analysis</p><p>But now?</p><p>AI is transforming QA into an intelligent, connected, continuously learning ecosystem.</p><p>And honestly… this shift is far bigger than just “AI generating test cases.”</p><p>━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</p><p>The most interesting part of this architecture is how everything is connected together.</p><p>The system continuously gathers context from:<br>✅ Jira stories &amp; defects<br>✅ GitHub PRs &amp; commits<br>✅ Jenkins pipelines<br>✅ APIs &amp; webhooks<br>✅ Product documentation<br>✅ Previous test executions<br>✅ Defect history<br>✅ Runbooks &amp; schemas<br>✅ Test repositories<br>✅ ReportPortal results</p><p>This is where RAG becomes extremely powerful.</p><p>Instead of generating generic responses, the system retrieves:<br>✔️ previous failures<br>✔️ historical executions<br>✔️ impacted modules<br>✔️ similar defects<br>✔️ flaky patterns<br>✔️ product knowledge</p><p>before making testing decisions.</p><p>That alone makes the entire QA process smarter and more contextual.</p><p>━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</p><p>Then comes the Multi-Agent QA System.</p><p>This honestly feels like the future of software testing.</p><p>Instead of one AI trying to do everything…</p><p>multiple specialized agents collaborate together like a real QA team.</p><p>🔹 Test Analyst Agent<br>Understands requirements, business flows, risks, and impacted areas</p><p>🔹 Test Designer Agent<br>Creates test cases, scenarios, edge cases, and test data strategies</p><p>🔹 Test Executor Agent<br>Executes UI, API, integration, DB, and chaos testing using frameworks like Playwright</p><p>🔹 Defect Analyst Agent<br>Analyzes failures, logs, traces, screenshots, and root causes</p><p>🔹 Quality Advisor Agent<br>Provides release insights, quality scoring, recommendations, and deployment risks</p><p>And above all of them…</p><p>there is a Supervisor / Router Agent.</p><p>This orchestration layer decides:<br>➡️ which agent should execute<br>➡️ what context should be shared<br>➡️ which LLM should be used<br>➡️ how workflows continue<br>➡️ when human approval is needed</p><p>This is where LangGraph becomes incredibly important.</p><p>Because real QA systems are:<br>✔️ stateful<br>✔️ dynamic<br>✔️ event-driven<br>✔️ collaborative<br>✔️ non-linear</p><p>━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</p><p>Another powerful part of this ecosystem:<br>MCP Servers</p><p>Using Model Context Protocol, agents can securely interact with:<br>✅ Jira<br>✅ GitHub<br>✅ Jenkins<br>✅ Slack<br>✅ Email<br>✅ Databases<br>✅ File systems<br>✅ Internal enterprise tools</p><p>This is where AI moves beyond being just a chatbot.</p><p>It becomes an operational engineering system.</p><p>━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</p><p>The observability and guardrails layer is equally important.</p><p>Most AI demos ignore this completely.</p><p>But real enterprise AI systems need:<br>✔️ logs<br>✔️ traces<br>✔️ metrics<br>✔️ hallucination detection<br>✔️ schema validation<br>✔️ checkpointing<br>✔️ approval workflows<br>✔️ human-in-the-loop validation<br>✔️ memory persistence</p><p>Without these controls, autonomous systems become risky very quickly.</p><p>━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</p><p>The execution layer is also evolving.</p><p>AI is not replacing testing frameworks.</p><p>It is orchestrating them intelligently.</p><p>Underneath, execution still happens through:<br>✅ Playwright<br>✅ API testing<br>✅ GraphQL testing<br>✅ database validation<br>✅ CI/CD quality gates<br>✅ cloud infrastructure<br>✅ chaos engineering</p><p>But now AI coordinates the entire quality lifecycle.</p><p>━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</p><p>💡 The most exciting part?</p><p>The feedback loop.</p><p>Every execution result, flaky failure, production issue, and defect pattern feeds back into the system.</p><p>Meaning the ecosystem continuously becomes:<br>✔️ smarter<br>✔️ more predictive<br>✔️ more contextual<br>✔️ more autonomous<br>✔️ more risk-aware</p><p>This is no longer static automation.</p><p>This is intelligent Quality Engineering.</p><p>━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</p><p>And honestly…</p><p>this changes the future role of QA Engineers completely.</p><p>The future QA Engineer may spend less time:<br>❌ writing repetitive scripts<br>❌ manually triaging failures<br>❌ maintaining unstable frameworks<br>❌ preparing endless reports</p><p>And more time:<br>✅ designing intelligent workflows<br>✅ validating AI decisions<br>✅ improving quality strategy<br>✅ building trustworthy systems<br>✅ engineering reliability at scale<br>✅ combining QA expertise with AI systems</p><p>QA is no longer just testing software.</p><p>QA is becoming the intelligence layer of software delivery.</p><p>And the teams that understand this shift early will lead the future of engineering.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=019eab7c1c11" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[10 AI Tools That Can Replace an Entire Development Team]]></title>
            <link>https://medium.com/@gautamsingh139/10-ai-tools-that-can-replace-an-entire-development-team-5a3c25fd3c1d?source=rss-dee5052d79cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a3c25fd3c1d</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[developer-tools]]></category>
            <category><![CDATA[developer]]></category>
            <dc:creator><![CDATA[Gautam Singh]]></dc:creator>
            <pubDate>Fri, 15 May 2026 09:40:37 GMT</pubDate>
            <atom:updated>2026-05-15T09:40:37.567Z</atom:updated>
            <content:encoded><![CDATA[<p>In today’s fast-paced tech world, speed and efficiency matter more than ever. What if you could launch a complete software product without hiring an entire development team? Sounds wild, right? Thanks to modern AI tools, this is more realistic than ever.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*Gvemi8tdowqsxiPe.png" /></figure><p>Whether you’re a solo founder, indie hacker, or just curious about the future of development — these <strong>10 powerful AI tools</strong> can help you do everything from coding to deployment, almost <em>single-handedly</em>.</p><h3>1. <a href="https://github.com/features/copilot">GitHub Copilot</a> — The AI Pair Programmer</h3><p>This is your co-pilot in the coding cockpit.<br>GitHub Copilot auto-suggests entire lines and functions in real-time, based on your coding patterns and comments.</p><ul><li>Supports major languages like Python, JavaScript, TypeScript, and more.</li><li>Built on OpenAI Codex.</li><li>Boosts productivity by up to 55% for some devs!</li></ul><h3>2. <a href="https://openai.com/chatgpt">ChatGPT (Pro + Code Interpreter)</a> — Your AI Tech Lead</h3><p>With GPT-4 and the Code Interpreter, ChatGPT becomes your:</p><ul><li>Debugging assistant</li><li>Code explainer</li><li>Python runner</li><li>Architecture advisor</li></ul><p>Just describe what you need — and it’ll guide you, build code, and even optimize it!</p><h3>3. Developer AI The Autonomous Developer</h3><p>the world’s first <em>fully autonomous</em> AI software engineer.<br>It can:</p><ul><li>Plan and build apps end-to-end</li><li>Use developer tools</li><li>Write and test code</li><li>Even push to GitHub!</li></ul><p>It’s not public yet, but it’s a peek into the future.</p><h3>4. Replit Ghostwriter — Full-Stack Code Companion</h3><p>Coding inside Replit? Ghostwriter is your AI assistant that:</p><ul><li>Writes boilerplate code</li><li>Helps fix bugs</li><li>Suggests improvements</li><li>Works with web, backend, and even game dev</li></ul><p>Perfect for startups and weekend projects!</p><h3>5. <a href="https://www.tabnine.com/">Tabnine</a> — Smart Code Completion</h3><p>Tabnine is built to predict your code like magic.<br>It uses AI to:</p><ul><li>Autocomplete lines</li><li>Speed up dev work</li><li>Learn from your own codebase</li><li>Integrate with VS Code, IntelliJ, and others</li></ul><h3>6. <a href="https://www.codium.ai/">CodiumAI</a> — AI Test Generator &amp; Reviewer</h3><p>Testing is boring? Not anymore. CodiumAI auto-generates <strong>meaningful unit tests</strong> as you write code. <br>Plus, it:</p><ul><li>Highlights risky code</li><li>Provides test suggestions</li><li>Works inside your IDE</li></ul><p>Perfect for clean, bug-free releases.</p><h3>7. <a href="https://mutable.ai/">Mutable.ai</a> — AI for Refactoring</h3><p>Code looking like spaghetti? <br>Mutable.ai cleans, refactors, and organizes your code using AI. It also:</p><ul><li>Converts comments to functions</li><li>Suggests efficient alternatives</li><li>Works with VS Code</li></ul><h3>8. <a href="https://agpt.co/">AutoGPT</a> — Autonomous Project Executor</h3><p>AutoGPT is an experimental open-source tool that chains GPT-4 thoughts to complete multi-step tasks.</p><ul><li>Ideal for automation workflows</li><li>Can browse, plan, and write code</li><li>Executes with minimal human input</li></ul><p>Warning: It’s powerful, but needs smart prompting!</p><h3>9. Cody by Sourcegraph — Codebase Navigator</h3><p>Cody is like your personal AI code librarian. <br>It:</p><ul><li>Reads your entire codebase</li><li>Explains how parts work</li><li>Answers technical queries contextually</li><li>Supercharges large team productivity</li></ul><h3>10. <a href="https://www.evosuite.org/">EvoSuite</a> — Auto Test Generator for Java</h3><p>If you’re working with Java, EvoSuite will:</p><ul><li>Generate JUnit tests automatically</li><li>Improve test coverage</li><li>Find edge cases and bugs early</li></ul><p>Great for legacy codebases or speeding up testing cycles.</p><h3>Final Thoughts: AI + You = Superpowers</h3><p>AI tools may not fully replace human development teams yet — but they dramatically increase what a single developer can achieve.</p><p>From coding and debugging to testing and deployment, AI is becoming the ultimate productivity multiplier for modern developers.</p><p>The future of software development isn’t AI vs humans.</p><p>It’s AI + Humans building faster together.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a3c25fd3c1d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“AI and Machine Learning: Transforming Everyday Life”]]></title>
            <link>https://medium.com/@gautamsingh139/ai-and-machine-learning-transforming-everyday-life-d1a4fa775475?source=rss-dee5052d79cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/d1a4fa775475</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Gautam Singh]]></dc:creator>
            <pubDate>Sun, 26 Apr 2026 22:31:01 GMT</pubDate>
            <atom:updated>2026-04-27T05:51:28.036Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/736/0*2QIiWR70puSa783J.jpeg" /></figure><h3>Introduction</h3><p>Artificial Intelligence (AI) and Machine Learning (ML) are no longer just futuristic concepts; they have become pivotal elements in our daily lives. From personalizing our online experiences to transforming entire industries, these technologies are reshaping the way we interact with the world. AI involves creating systems capable of performing tasks that typically require human intelligence, while ML focuses on algorithms that allow computers to learn and adapt from experience. As these technologies continue to evolve, their applications are expanding across various domains, driving innovation and efficiency. This blog explores twelve key areas where AI and ML are making significant impacts, detailing their applications and implications for our everyday experiences.</p><p>AI and Machine Learning in Everyday Life: Applications and Implications:-</p><h3>Index:-</h3><ol><li>🤖 AI in Customer Service: Chatbots and Virtual Assistants</li><li>🛒 Machine Learning in E-Commerce: Personalization and Targeted Marketing</li><li>🎓 AI in Education: Adaptive Learning Platforms and Intelligent Tutoring Systems</li><li>🚗 AI and ML in Transportation: Autonomous Vehicles and Traffic Management</li><li>🗣️ Voice Recognition Technology: Enhancements and Applications</li><li>🌾 AI in Agriculture: Precision Farming and Crop Monitoring</li><li>💹 AI in Finance: Algorithmic Trading and Risk Assessment</li><li>🎨 Machine Learning for Content Creation: From Music to Writing</li><li>🏥 AI in Healthcare Diagnostics: Imaging and Predictive Analytics</li><li>🧠 AI and Mental Health: Applications in Therapy and Support</li><li>⚖️ Ethical AI Development: Guidelines and Best Practices</li><li>🔮 Future Trends in AI and Machine Learning: What to Expect in the Next Decade</li><li>⚖️ Merits and Demerits</li><li>❓ FAQs</li></ol><h3>AI in Customer Service: Chatbots and Virtual Assistants</h3><p>AI has revolutionized customer service with the advent of chatbots and virtual assistants. These AI-driven tools use natural language processing (NLP) to understand and respond to customer inquiries, offering support 24/7. Chatbots handle routine questions and tasks, freeing human agents to tackle more complex issues. Virtual assistants like Siri, Alexa, and Google Assistant further enhance user interaction by performing tasks such as setting reminders, playing music, and providing real-time information. The efficiency and availability of these AI tools significantly improve customer satisfaction and operational efficiency.</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/0*d9AJ-3e8JlKwVDcz.jpeg" /></figure><h3>Machine Learning in E-Commerce: Personalization and Targeted Marketing</h3><p>Machine learning has transformed e-commerce by enabling advanced personalization and targeted marketing strategies. ML algorithms analyze customer behavior, preferences, and purchase history to provide tailored product recommendations. This personalization enhances the shopping experience, making it more relevant and engaging for users. Additionally, ML models are used to optimize ad targeting, ensuring that advertisements reach the most appropriate audience. These advancements help businesses increase conversion rates and customer loyalty while driving more effective marketing campaigns.</p><h3>AI in Education: Adaptive Learning Platforms and Intelligent Tutoring Systems</h3><p>In the education sector, AI is enhancing learning through adaptive learning platforms and intelligent tutoring systems. Adaptive learning technology adjusts educational content and resources based on individual student performance and needs, providing a customized learning experience. Intelligent tutoring systems offer personalized guidance and feedback, helping students grasp difficult concepts and improve their academic performance. These AI-driven tools support diverse learning styles and pace, making education more effective and inclusive.</p><h3>AI and ML in Transportation: Autonomous Vehicles and Traffic Management</h3><p>AI and ML are revolutionizing transportation through advancements in autonomous vehicles and smart traffic management systems. Autonomous vehicles use AI to process data from sensors and cameras, enabling them to navigate roads, avoid obstacles, and make real-time driving decisions. In parallel, smart traffic management systems utilize ML algorithms to optimize traffic flow, reduce congestion, and enhance road safety. These innovations promise to make transportation more efficient, safer, and environmentally friendly.</p><h3>Voice Recognition Technology: Enhancements and Applications</h3><p>Voice recognition technology has seen significant advancements due to AI, making it more accurate and versatile. Modern voice recognition systems can transcribe spoken language with high precision, enabling applications such as voice-controlled devices and transcription services. This technology is used in virtual assistants, customer service automation, and accessibility tools for individuals with disabilities. Improved voice recognition enhances user interaction with technology and supports a wide range of applications across different industries.</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/0*f1ufFej1CT9Otx9j.jpeg" /></figure><h3>AI in Agriculture: Precision Farming and Crop Monitoring</h3><p>AI is transforming agriculture through precision farming and crop monitoring techniques. AI-driven systems analyze data from sensors, drones, and satellites to monitor crop health, optimize resource usage, and improve yield predictions. Precision farming techniques enable farmers to apply water, fertilizers, and pesticides more efficiently, reducing waste and environmental impact. These AI applications enhance agricultural productivity, sustainability, and food security.</p><h3>AI in Finance: Algorithmic Trading and Risk Assessment</h3><p>In the finance industry, AI is used for algorithmic trading and risk assessment. AI algorithms analyze vast amounts of financial data to make high-speed trading decisions and identify profitable opportunities. Machine learning models are also employed to assess and manage financial risks by detecting anomalies and predicting potential issues. These AI applications improve the accuracy of financial forecasts and enhance decision-making processes in the financial sector.</p><h3>Machine Learning for Content Creation: From Music to Writing</h3><p>Machine learning is making significant strides in content creation, including music composition and writing. AI algorithms can generate original music by learning from existing compositions and creating new melodies and arrangements. In writing, ML models assist in generating text, drafting articles, and even creating poetry. These technologies provide creative support and expand the possibilities for content creators, enabling the generation of diverse and innovative content.</p><h3>AI in Healthcare Diagnostics: Imaging and Predictive Analytics</h3><p>AI is enhancing healthcare diagnostics through advanced imaging techniques and predictive analytics. AI-powered imaging systems analyze medical scans to detect abnormalities and assist in diagnosing conditions with greater accuracy. Predictive analytics use ML algorithms to identify patterns and predict health outcomes, enabling early intervention and personalized treatment plans. These AI applications improve diagnostic accuracy and patient care, leading to better health outcomes.</p><h3>AI and Mental Health: Applications in Therapy and Support</h3><p>AI is increasingly being used in mental health applications to provide support and therapy. Virtual therapy platforms leverage AI to offer counseling and therapeutic services, making mental health support more accessible. AI-powered mood tracking tools monitor emotional states and provide personalized recommendations for managing mental well-being. These technologies enhance mental health care by offering convenient and tailored support options.</p><h3>Ethical AI Development: Guidelines and Best Practices</h3><p>As AI technologies advance, ethical considerations become crucial. Developing guidelines and best practices for ethical AI involves addressing issues such as bias, fairness, and transparency. Ensuring that AI systems are designed and implemented in a way that promotes fairness and accountability is essential to building trust and minimizing negative impacts. Ethical AI development involves creating frameworks that guide responsible use and address potential ethical dilemmas.</p><h3>Future Trends in AI and Machine Learning: What to Expect in the Next Decade</h3><p>Looking forward, AI and machine learning are expected to continue evolving and influencing various aspects of society. Future trends include advancements in AI models that enhance capabilities and accuracy, increased integration of AI across different industries, and ongoing development in AI ethics and regulation. These trends will drive innovation and shape the future landscape of technology, impacting how we live, work, and interact with the world.</p><h3>Merits and Demerits</h3><h3>Merits:</h3><ul><li><strong>Efficiency and Automation:</strong> AI and ML automate repetitive tasks and enhance decision-making, increasing productivity and efficiency across various sectors.</li><li><strong>Personalization:</strong> These technologies provide personalized experiences, from tailored recommendations in e-commerce to adaptive learning in education.</li><li><strong>Enhanced Accuracy:</strong> AI improves diagnostic accuracy in healthcare and financial predictions, leading to better outcomes and more informed decisions.</li><li><strong>Innovation:</strong> AI drives innovation by enabling new applications and technologies, fostering progress and development in numerous fields.</li></ul><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/0*6-nCnpd_M2Kkgkp5.jpeg" /></figure><h3>Demerits:</h3><ul><li><strong>Privacy Concerns:</strong> The extensive data collection required by AI systems raises privacy issues and potential risks of data breaches.</li><li><strong>Bias and Fairness:</strong> AI systems can perpetuate biases present in training data, leading to unfair outcomes and ethical concerns.</li><li><strong>Job Displacement:</strong> Automation driven by AI may result in job losses in certain industries, necessitating adaptation and reskilling of the workforce.</li><li><strong>Ethical Challenges:</strong> The development and deployment of AI pose ethical questions about decision-making, accountability, and the responsible use of technology.</li></ul><h3>FAQs</h3><p><strong>1. What is the difference between AI and machine learning?</strong><br>AI refers to the broad concept of machines performing tasks that require human intelligence, such as problem-solving and reasoning. Machine learning is a subset of AI that involves algorithms allowing computers to learn from and make predictions based on data.</p><p><strong>2. How does AI improve customer service?</strong><br>AI enhances customer service through chatbots and virtual assistants that provide instant, accurate responses to inquiries, handle routine tasks, and support human agents with complex issues, improving overall customer experience.</p><p><strong>3. Can AI enhance educational outcomes?</strong><br>Yes, AI enhances educational outcomes by offering adaptive learning platforms that customize content to individual student needs and intelligent tutoring systems that provide personalized guidance and feedback.</p><p><strong>4. What are the ethical concerns related to AI?</strong><br>Ethical concerns include privacy issues, bias in AI systems, fairness in decision-making, and accountability for AI-driven actions. Addressing these concerns is essential for responsible AI development and deployment.</p><p><strong>5. How does AI impact the job market?</strong><br>AI can lead to job displacement in some sectors due to automation but also creates new job opportunities and requires reskilling in emerging fields, influencing the job market and workforce dynamics.</p><p><strong>6. What are some future trends in AI and machine learning?</strong><br>Future trends include advancements in AI models, greater integration across industries, and developments in AI ethics and regulation, which will shape the future of technology and its applications.</p><p><strong>7. How is AI used in healthcare?</strong><br>AI improves healthcare through advanced imaging techniques for accurate diagnostics and predictive analytics for early detection and personalized treatment, enhancing patient care and health outcomes.</p><p><strong>8. What are the benefits of machine learning in e-commerce?</strong><br>Machine learning benefits e-commerce by providing personalized shopping experiences, optimizing ad targeting, and increasing customer engagement through tailored recommendations and marketing strategies.</p><p><strong>9. How does AI contribute to financial services?</strong><br>AI contributes to financial services by enabling algorithmic trading, detecting fraud, assessing risk, and improving decision-making processes through analysis of vast amounts of financial data.</p><p><strong>10. What role does AI play in mental health?</strong><br>AI supports mental health through virtual therapy platforms, mood tracking tools, and personalized recommendations, making mental health care more accessible and tailored to individual needs.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d1a4fa775475" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AI Engineering & Solution Architecture]]></title>
            <link>https://medium.com/@gautamsingh139/ai-engineering-solution-architecture-67086f739b26?source=rss-dee5052d79cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/67086f739b26</guid>
            <category><![CDATA[ai-engineering]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[llm-agent]]></category>
            <dc:creator><![CDATA[Gautam Singh]]></dc:creator>
            <pubDate>Fri, 17 Apr 2026 05:12:51 GMT</pubDate>
            <atom:updated>2026-04-17T05:12:51.641Z</atom:updated>
            <content:encoded><![CDATA[<p>A handpicked list of resources to <strong>future-proof your IT career</strong> with the two most in-demand skills: <strong>AI Engineering</strong> &amp; <strong>Solution Architecture</strong></p><h3>AI Courses</h3><ul><li>Microsoft Learn Azure AI Fundamentals: <a href="https://learn.microsoft.com/en-us/certifications/azure-ai-fundamentals/"><em>Link</em></a></li><li>Machine Learning by Andrew Ng: <a href="https://www.coursera.org/learn/machine-learning"><em>Link</em></a></li><li>FreeCodeCamp Machine Learning with Python: <a href="https://www.youtube.com/watch?v=7eh4d6sabA0"><em>Link</em></a></li><li>Google Cloud Generative AI Learning Path: <a href="https://cloud.google.com/learn/training/generative-ai"><em>Link</em></a></li></ul><h3>AI Tools and Documentations</h3><ul><li>Azure AI Services: <a href="https://learn.microsoft.com/en-us/azure/ai-services/"><em>Link</em></a></li><li>Hugging Face Transformers &amp; Models Hub: <a href="https://huggingface.co/docs"><em>Link</em></a></li><li>OpenAI API Docs: <a href="https://platform.openai.com/docs/"><em>Link</em></a></li><li>TensorFlow Tutorials: <a href="https://www.tensorflow.org/tutorials"><em>Link</em></a></li><li>PyTorch Tutorials: <a href="https://pytorch.org/tutorials/"><em>Link</em></a></li></ul><h3>System design and Architecture Resources</h3><ul><li>Microsoft Azure Architecture Center: <a href="https://learn.microsoft.com/en-us/azure/architecture/"><em>Link</em></a></li><li>Google Cloud Architecture Framework: <a href="https://cloud.google.com/architecture/framework"><em>Link</em></a></li><li>AWS Well-Architected Framework: <a href="https://aws.amazon.com/architecture/well-architected/"><em>Link</em></a></li><li>System Design Primer (GitHub): <a href="https://github.com/donnemartin/system-design-primer"><em>Link</em></a></li></ul><h3>General tips</h3><ol><li>Pick one learning path (don’t try everything at once).</li><li>Build projects and apply AI to real-world use cases.</li><li>Learn architecture and scale your projects securely.</li><li>Share your progress on LinkedIn i.e. build your portfolio.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67086f739b26" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[6-Month AI Engineer Roadmap]]></title>
            <link>https://medium.com/@gautamsingh139/6-month-ai-engineer-roadmap-b5a9a81badd0?source=rss-dee5052d79cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5a9a81badd0</guid>
            <category><![CDATA[llm-agent]]></category>
            <category><![CDATA[ai-engineering]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Gautam Singh]]></dc:creator>
            <pubDate>Mon, 13 Apr 2026 10:02:12 GMT</pubDate>
            <atom:updated>2026-04-13T10:02:12.838Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>Pace:</em></strong><em> ~10–12 hrs/week for students, ~6–8 hrs/week for professionals</em></p><h3>MONTH 1: Python, Git &amp; Engineering Basics</h3><h3>Week 1: Python Fundamentals</h3><ul><li>Learn variables, data types, conditionals, and loops in Python.</li><li>Understand how Python executes code line by line.</li><li>Write simple programs to build logic and confidence.</li><li>Practice reading and understanding error messages.</li></ul><p><strong>Build:</strong> Basic calculator, number guessing game.</p><h3>Week 2: Functions &amp; Data Structures</h3><ul><li>Learn functions, arguments, return values, and scope.</li><li>Work with lists, dictionaries, tuples, and sets.</li><li>Learn why reusable functions matter.</li><li>Start writing cleaner, readable code.</li></ul><p><strong>Build:</strong> Student marks analyzer, to-do list app.</p><h3>Week 3: Writing Real Python Code</h3><ul><li>Learn modules, imports, and basic file handling.</li><li>Understand exceptions and error handling.</li><li>Learn debugging techniques instead of trial-and-error.</li><li>Write scripts that automate small tasks.</li></ul><p><strong>Build:</strong> File organizer or CSV processing script.</p><h3>Week 4: Git, GitHub &amp; Collaboration</h3><ul><li>Learn what version control is and why it matters.</li><li>Practice git add, commit, push, pull, and branching.</li><li>Create a GitHub repository and write a proper README.</li><li>Understand how engineers collaborate using Git.</li></ul><p><strong>Build:</strong> Push all Month-1 projects to GitHub.</p><h3>MONTH 2: Data, Text &amp; Embeddings Foundations</h3><h3>Week 5: Data Handling with Pandas</h3><ul><li>Learn how to load CSV and Excel files using Pandas.</li><li>Filter, sort, and group data.</li><li>Understand datasets and columns conceptually.</li><li>Practice exploratory data analysis.</li></ul><p><strong>Build:</strong> Analyze a small real dataset.</p><h3>Week 6: Data Cleaning &amp; Preparation</h3><ul><li>Handle missing values and duplicates.</li><li>Learn basic feature engineering.</li><li>Understand why clean data matters more than models.</li><li>Learn scaling and normalization intuition.</li></ul><p><strong>Build:</strong> Clean and prepare a messy dataset.</p><h3>Week 7: Text Processing Basics</h3><ul><li>Understand unstructured text data.</li><li>Learn tokenization, stopwords, stemming, and lemmatization.</li><li>Practice basic NLP preprocessing pipelines.</li><li>Learn why raw text cannot be used directly.</li></ul><p><strong>Build:</strong> Text cleaning pipeline.</p><h3>Week 8: Embeddings &amp; Similarity</h3><ul><li>Learn what embeddings are and why they work.</li><li>Understand cosine similarity intuitively.</li><li>Generate embeddings using APIs or libraries.</li><li>Perform semantic similarity search.</li></ul><p><strong>Build:</strong> Text similarity search tool.</p><h3>MONTH 3: Machine Learning Foundations</h3><h3>Week 9: ML Basics &amp; Problem Framing</h3><ul><li>Learn what Machine Learning is and what it is not.</li><li>Understand supervised vs unsupervised learning.</li><li>Learn training vs testing data.</li><li>Understand common ML use cases.</li></ul><p><strong>Build:</strong> ML problem definition document.</p><h3>Week 10: Core ML Models</h3><ul><li>Learn linear regression and logistic regression.</li><li>Understand KNN and decision trees intuitively.</li><li>Learn when to use which model.</li><li>Train simple models using scikit-learn.</li></ul><p><strong>Build:</strong> House price or classification model.</p><h3>Week 11: Model Evaluation</h3><ul><li>Learn accuracy, precision, recall, and F1 score.</li><li>Understand confusion matrices.</li><li>Learn cross-validation conceptually.</li><li>Analyze model failures.</li></ul><p><strong>Build:</strong> Model evaluation report.</p><h3>Week 12: ML Best Practices</h3><ul><li>Understand overfitting and underfitting.</li><li>Learn bias-variance tradeoff.</li><li>Learn basic hyperparameter tuning.</li><li>Build an end-to-end ML pipeline.</li></ul><p><strong>Build:</strong> Final ML mini-project.</p><h3>MONTH 4: Generative AI &amp; Prompt Engineering</h3><h3>Week 13: LLM Fundamentals</h3><ul><li>Learn how LLMs work at a high level.</li><li>Understand tokens, context windows, and inference.</li><li>Learn limitations of LLMs.</li></ul><p><strong>Build:</strong> Simple chatbot.</p><h3>Week 14: Prompt Engineering</h3><ul><li>Learn role-based prompting and few-shot examples.</li><li>Practice structured outputs.</li><li>Learn prompt iteration techniques.</li></ul><p><strong>Build:</strong> Prompt-based summarizer.</p><h3>Week 15: Using GenAI APIs</h3><ul><li>Learn OpenAI and Hugging Face API basics.</li><li>Handle responses and errors.</li><li>Learn rate limits and cost basics.</li></ul><p><strong>Build:</strong> Resume reviewer or content generator.</p><h3>Week 16: Responsible AI</h3><ul><li>Learn hallucinations and bias.</li><li>Understand prompt injection attacks.</li><li>Learn safe prompting and guardrails.</li></ul><p><strong>Build:</strong> Safer chatbot with constraints.</p><h3>MONTH 5: RAG, Vector Stores &amp; Frameworks</h3><h3>Week 17: RAG Fundamentals</h3><ul><li>Understand why RAG exists.</li><li>Learn RAG architecture components.</li><li>Understand chunking strategies.</li></ul><p><strong>Build:</strong> Document chunking pipeline.</p><h3>Week 18: Vector Databases</h3><ul><li>Learn how vectors are stored and searched.</li><li>Perform similarity queries.</li></ul><p><strong>Build:</strong> Vector search system.</p><h3>Week 19: Building RAG Systems</h3><ul><li>Combine retrieval with generation.</li><li>Learn context injection techniques.</li><li>Evaluate retrieval quality.</li></ul><p><strong>Build:</strong> Document Q&amp;A bot.</p><h3>Week 20: AI Frameworks &amp; Agents</h3><ul><li>Learn LangChain and Semantic Kernel basics.</li><li>Understand agent concepts.</li><li>Explore SmolAgents, CrewAI, Bot Framework.</li></ul><p><strong>Build:</strong> Multi-step AI workflow.</p><h3>MONTH 6: Agentic Systems, Production &amp; Capstone</h3><h3>Week 21: Agentic Workflows</h3><ul><li>Learn agent planning and reasoning.</li><li>Understand tool calling.</li><li>Learn when agents are unnecessary.</li></ul><p><strong>Build:</strong> Agent-driven task automation.</p><h3>Week 22: Evaluation &amp; Optimization</h3><ul><li>Learn how to evaluate LLM outputs.</li><li>Understand cost, latency, and token usage.</li><li>Learn caching and optimization strategies.</li></ul><p><strong>Build:</strong> Evaluation &amp; cost analysis report.</p><h3>Week 23: Production Readiness</h3><ul><li>Learn logging, monitoring, and prompt versioning.</li><li>Understand deployment basics.</li><li>Learn responsible AI practices.</li></ul><p><strong>Build:</strong> Production-ready AI service.</p><h3>Week 24: Capstone Project</h3><ul><li>Design and build a complete AI system.</li><li>Write clean documentation and README.</li><li>Create architecture diagrams.</li><li>Record demo and explain tradeoffs.</li></ul><p><strong>Build:</strong> Final AI Engineer capstone.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b5a9a81badd0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build Agentic RAG Using LangGraph: A Complete Guide for Intelligent AI Systems]]></title>
            <link>https://medium.com/@gautamsingh139/build-agentic-rag-using-langgraph-a-complete-guide-for-intelligent-ai-systems-fca30c745276?source=rss-dee5052d79cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/fca30c745276</guid>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[llm-agent]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <dc:creator><![CDATA[Gautam Singh]]></dc:creator>
            <pubDate>Fri, 27 Mar 2026 06:40:55 GMT</pubDate>
            <atom:updated>2026-03-27T06:40:55.681Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*sgFlHU1T0yDxK0Tj.png" /><figcaption>Traditional RAG vs Agentic RAG</figcaption></figure><p>In the real world, this doesn’t happen. When building a RAG (Retrieval-Augmented Generation) system, users will inevitably ask questions that are “out of syllabus,” meaning they are not covered by the system’s knowledge base. You can’t ask users to not ask such questions.</p><p>To handle this, you build an <strong>Agentic RAG system</strong> — one that can recognize when a question isn’t in the knowledge base and autonomously perform a web search or other actions to provide a reliable answer.</p><h3>Introduction</h3><p><strong>Retrieval-Augmented Generation (RAG)</strong> has transformed the way we build AI applications by combining the strengths of <strong>information retrieval</strong> and <strong>large language models (LLMs)</strong>.<br>In a RAG system, instead of feeding an entire large dataset directly into an LLM, the model retrieves the most <strong>relevant pieces of information (context)</strong> from an external knowledge base or document store in response to a user query. These retrieved chunks are then provided to the LLM to generate a grounded and context-aware response.</p><p>The effectiveness of a RAG system primarily depends on two key factors: <strong>speed</strong> and <strong>accuracy</strong>.<br>Both are influenced by variables such as <strong>embedding dimensionality</strong>, <strong>indexing method</strong>, and the <strong>complexity of the system’s architecture</strong>.</p><p>In this article, we will explore an emerging RAG architecture known as <strong>Agentic RAG</strong>, and compare it with traditional (or “vanilla”) RAG systems. We’ll also demonstrate the differences through <strong>practical code examples</strong>.</p><h3>Traditional RAG System vs Agentic RAG</h3><p><strong>Traditional RAG</strong> (Retrieval-Augmented Generation) follows a fixed “retrieve then generate” flow — it just grabs info from a set source and answers.</p><p><strong>Agentic RAG</strong> uses autonomous AI agents that actively decide what to retrieve, how, when and from which sources (like web, vector-dbs). It plans multi-step searches, adapts queries on the fly and reaches to the better answer in an iterative manner.</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*BpGqIJmWLVJ5F04M.png" /><figcaption>Traditional RAG vs Agentic RAG</figcaption></figure><p><strong>Where does a traditional RAG fail?</strong></p><p>Traditional RAG fails areas which demand adaptability and deeper reasoning across multiple knowledge base sources. Below are the key limitations of traditional RAG systems:</p><ul><li><strong>Single-Pass Retrieval:</strong> Performs one-time retrieval, missing multi-hop reasoning and deeper contextual links.</li><li><strong>Irrelevant Retrieval &amp; Hallucination:</strong> Retrieves semantically similar but contextually wrong data, causing factual errors.</li><li><strong>Static &amp; Non-Adaptive:</strong> Lacks dynamic retrieval or refinement based on user intent, feedback, or evolving context.</li><li><strong>Scalability Limits:</strong> Constrained by context windows, poor large-scale aggregation, and high computational overhead.</li></ul><p><strong>Let’s now start implementing Agentic RAG using LangGraph and ChromaDB and SerperAPI (WebSearch).</strong></p><h3>Problem Statement</h3><p><strong>Problem:</strong> How can we design a retrieval-augmented generation system that dynamically selects the most appropriate knowledge source, validates retrieved information, and produces grounded, context-aware responses in high-stakes domains like healthcare and medical devices?</p><p><strong>Proposed Solution:</strong> Introduce an <strong>agentic RAG pipeline</strong> where a lightweight routing agent chooses among multiple retrieval sources (Q&amp;A dataset, device manuals, or web search), checks relevance of retrieved context, and only then generates answers using an LLM. This approach aims to improve <strong>accuracy, flexibility, and reliability</strong> compared to traditional RAG systems.</p><h3>Techstack</h3><ul><li>Python</li><li>LangGraph</li><li>LangChain</li><li>Chroma DB</li><li>SerperAPI (websearch)</li><li>OpenAI API (LLM)</li></ul><h3>Importing the required Modules</h3><pre>import pandas as pd<br>import numpy as np<br>import json<br>import re<br>from typing import List, Dict, Any, Tuple<br>import faiss<br>from sentence_transformers import SentenceTransformer<br>from openai import OpenAI<br>import time<br>from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score<br>import seaborn as sns<br>from dotenv import load_dotenv<br>import openai<br>import os<br>from langchain_community.utilities import GoogleSerperAPIWrapper<br># ✅ Load environment variables<br>load_dotenv()<br>openai_api_key = os.getenv(&quot;OPEN_AI_KEY&quot;)<br>SERPER_API_KEY = os.getenv(&quot;SERPER_API_KEY&quot;)</pre><h3>Load the Data</h3><p>Two CSV datasets are used in the experiments (both sampled down to 500 rows for quick iteration):</p><h3>Medical Questions &amp; Answer Dataset</h3><p>A comprehensive medical question-and-answer dataset. We sample 500 rows and combines each row into a single `combined_text` field like: `Question: … Answer: … Type: …`.</p><p>Source: <a href="https://www.kaggle.com/datasets/thedevastator/comprehensive-medical-q-a-dataset">Kaggle</a></p><pre>## Data 1: reading the Comprehensive Medical Q&amp;A Dataset<br>df_qa = pd.read_csv(&quot;medical_q_n_a.csv&quot;)<br>## Data has 16407 rows, hence we will sample 500 rows for experimentation<br>df_qa = df_qa.sample(500, random_state=0).reset_index(drop=True)<br>print(df_qa.shape)<br>df_qa.head()</pre><pre># Preparing the Dataframe for Vector DB by combining the Text<br>df_qa[&#39;combined_text&#39;] = (<br>    &quot;Question: &quot; + df_qa[&#39;Question&#39;].astype(str) + &quot;. &quot; +<br>    &quot;Answer: &quot; + df_qa[&#39;Answer&#39;].astype(str) + &quot;. &quot; +<br>    &quot;Type: &quot; + df_qa[&#39;qtype&#39;].astype(str) + &quot;. &quot;<br>)<br>df_qa.head()</pre><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*XMWxAUL9iF8YS5Hg.png" /></figure><p>First 5 rows of Medical Question &amp; Answer Dataset</p><h3>Medical Device Manual Dataset</h3><p>This contains medical device manuals and metadata. We sample 500 rows and creates `combined_text` like: `Device Name: … Model: … Manufacturer: … Indications: … Contraindications: …`.</p><p>Source: <a href="https://www.kaggle.com/datasets/pratyushpuri/global-medical-device-manuals-dataset-2025">Kaggle</a></p><pre>## Data 2: reading the Medical Device Manuals Dataset<br>df_medical_device = pd.read_csv(&quot;medical_device_manuals_dataset.csv&quot;)<br>print(df_medical_device.shape)<br>## Data has 2694 rows, hence we will sample 500 rows for experimentation<br>df_medical_device = df_medical_device.sample(500, random_state=0).reset_index(drop=True)<br>print(df_medical_device.shape)</pre><pre># Preparing the Dataframe for Vector DB by combining the Text<br>df_medical_device[&#39;combined_text&#39;] = (<br>    &quot;Device Name: &quot; + df_medical_device[&#39;Device_Name&#39;].astype(str) + &quot;. &quot; +<br>    &quot;Model: &quot; + df_medical_device[&#39;Model_Number&#39;].astype(str) + &quot;. &quot; +<br>    &quot;Manufacturer: &quot; + df_medical_device[&#39;Manufacturer&#39;].astype(str) + &quot;. &quot; +<br>    &quot;Indications: &quot; + df_medical_device[&#39;Indications_for_Use&#39;].astype(str) + &quot;. &quot; +<br>    &quot;Contraindications: &quot; + df_medical_device[&#39;Contraindications&#39;].fillna(&#39;None&#39;).astype(str)<br>)<br>df_medical_device.head()</pre><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*kQBPwLN8RdTzg6uk.png" /></figure><p>First 5 rows of the Medical Device Manual Dataset</p><h3>Setting Up Vector Store (Chroma DB)</h3><h3>Creating ChromaDB Client</h3><p>We create ChromDB client using chromadb library.</p><pre>import chromadb<br># Setting up the Chromadb<br>client = chromadb.PersistentClient(path=&quot;./chroma_db&quot;)</pre><h3>Creating the Collections</h3><p>We will create two collections, one for device manual dataset and one for Q&amp;A Dataset</p><p>Think of collections like tables in the database. For each source we will create one table.</p><p>(If you are new to ChromaDB, please refer to my other article <a href="https://medium.com/@alphaiterations/chromadb-end-to-end-tutorial-c18202fa66a2">here</a> which explains about ChromaDB basics and implementation)</p><p><strong>Collection 1: For Medical Q&amp;A Dataset</strong></p><p>We will create a new collection “medical_q_n_a” and add data to it.</p><pre># Collection 1 for medical Q&amp;A Dataset<br>collection1 = client.get_or_create_collection(name=&quot;medical_q_n_a&quot;)</pre><pre># Add data to collection<br># here the chroma db will use default embeddings (sentence transformers)<br>collection1.add(<br>    documents=df_qa[&#39;combined_text&#39;].tolist(),<br>    metadatas=df_qa.to_dict(orient=&quot;records&quot;),<br>    ids=df_qa.index.astype(str).tolist(),<br>)<br># quick check<br>query = &quot;What are the treatments for Kawasaki disease ?&quot;<br>results = collection1.query(query_texts=[query],<br>    n_results=3<br>)<br>print(results)</pre><p>Output:</p><pre>{&#39;ids&#39;: [[&#39;1&#39;, &#39;393&#39;, &#39;60&#39;]],<br> &#39;embeddings&#39;: None,<br> &#39;documents&#39;: [[&quot;Question: What are the treatments for Kawasaki disease ?. Answer: These resources address the diagnosis or management of Kawasaki disease:  - Cincinnati Children&#39;s Hospital Medical Center  - Genetic Testing Registry: Acute febrile mucocutaneous lymph node syndrome  - National Heart, Lung, and Blood Institute: How is Kawasaki Disease Treated?   These resources from MedlinePlus offer information about the diagnosis and management of various health conditions:  - Diagnostic Tests  - Drug Therapy  - Surgery and Rehabilitation  - Genetic Counseling   - Palliative Care. Type: treatment. &quot;,<br>   &#39;Question: What are the treatments for Krabbe Disease ?. Answer: There is no cure for Krabbe disease. Results of a very small clinical trial of children with infantile Krabbe disease found that children who received umbilical cord blood stem cells from unrelated donors prior to symptom onset developed with little neurological impairment. Bone marrow transplantation may help some people. Generally, treatment for the disorder is symptomatic and supportive. Physical therapy may help maintain or increase muscle tone and circulation.. Type: treatment. &#39;,<br>   &#39;Question: What are the treatments for Ehlers-Danlos syndrome, progeroid type ?. Answer: How might Ehlers-Danlos syndrome progeroid type be treated? Individuals with Ehlers-Danlos Syndrome progeroid type can benefit from a variety of treatments depending on their symptoms. Affected children with weak muscle tone and delayed development might benefit from physiotherapy to improve muscle strength and coordination. Affected individuals with joint pain might benefit from anti-inflammatory drugs. Lifestyle changes or precautions during exercise or intense physical activity may be advised to reduce the chance of accidents to the skin and bone. It is recommended that affected individuals discuss treatment options with their healthcare provider.. Type: treatment. &#39;]],<br> &#39;uris&#39;: None,<br> &#39;included&#39;: [&#39;metadatas&#39;, &#39;documents&#39;, &#39;distances&#39;],<br> &#39;data&#39;: None,<br> &#39;metadatas&#39;: [[{&#39;qtype&#39;: &#39;treatment&#39;,<br>    &#39;combined_text&#39;: &quot;Question: What are the treatments for Kawasaki disease ?. Answer: These resources address the diagnosis or management of Kawasaki disease:  - Cincinnati Children&#39;s Hospital Medical Center  - Genetic Testing Registry: Acute febrile mucocutaneous lymph node syndrome  - National Heart, Lung, and Blood Institute: How is Kawasaki Disease Treated?   These resources from MedlinePlus offer information about the diagnosis and management of various health conditions:  - Diagnostic Tests  - Drug Therapy  - Surgery and Rehabilitation  - Genetic Counseling   - Palliative Care. Type: treatment. &quot;,<br>    &#39;Answer&#39;: &quot;These resources address the diagnosis or management of Kawasaki disease:  - Cincinnati Children&#39;s Hospital Medical Center  - Genetic Testing Registry: Acute febrile mucocutaneous lymph node syndrome  - National Heart, Lung, and Blood Institute: How is Kawasaki Disease Treated?   These resources from MedlinePlus offer information about the diagnosis and management of various health conditions:  - Diagnostic Tests  - Drug Therapy  - Surgery and Rehabilitation  - Genetic Counseling   - Palliative Care&quot;,<br>    &#39;Question&#39;: &#39;What are the treatments for Kawasaki disease ?&#39;},<br>   {&#39;qtype&#39;: &#39;treatment&#39;,<br>    &#39;combined_text&#39;: &#39;Question: What are the treatments for Krabbe Disease ?. Answer: There is no cure for Krabbe disease. Results of a very small clinical trial of children with infantile Krabbe disease found that children who received umbilical cord blood stem cells from unrelated donors prior to symptom onset developed with little neurological impairment. Bone marrow transplantation may help some people. Generally, treatment for the disorder is symptomatic and supportive. Physical therapy may help maintain or increase muscle tone and circulation.. Type: treatment. &#39;,<br>    &#39;Answer&#39;: &#39;There is no cure for Krabbe disease. Results of a very small clinical trial of children with infantile Krabbe disease found that children who received umbilical cord blood stem cells from unrelated donors prior to symptom onset developed with little neurological impairment. Bone marrow transplantation may help some people. Generally, treatment for the disorder is symptomatic and supportive. Physical therapy may help maintain or increase muscle tone and circulation.&#39;,<br>    &#39;Question&#39;: &#39;What are the treatments for Krabbe Disease ?&#39;},<br>   {&#39;Question&#39;: &#39;What are the treatments for Ehlers-Danlos syndrome, progeroid type ?&#39;,<br>    &#39;qtype&#39;: &#39;treatment&#39;,<br>    &#39;Answer&#39;: &#39;How might Ehlers-Danlos syndrome progeroid type be treated? Individuals with Ehlers-Danlos Syndrome progeroid type can benefit from a variety of treatments depending on their symptoms. Affected children with weak muscle tone and delayed development might benefit from physiotherapy to improve muscle strength and coordination. Affected individuals with joint pain might benefit from anti-inflammatory drugs. Lifestyle changes or precautions during exercise or intense physical activity may be advised to reduce the chance of accidents to the skin and bone. It is recommended that affected individuals discuss treatment options with their healthcare provider.&#39;,<br>    &#39;combined_text&#39;: &#39;Question: What are the treatments for Ehlers-Danlos syndrome, progeroid type ?. Answer: How might Ehlers-Danlos syndrome progeroid type be treated? Individuals with Ehlers-Danlos Syndrome progeroid type can benefit from a variety of treatments depending on their symptoms. Affected children with weak muscle tone and delayed development might benefit from physiotherapy to improve muscle strength and coordination. Affected individuals with joint pain might benefit from anti-inflammatory drugs. Lifestyle changes or precautions during exercise or intense physical activity may be advised to reduce the chance of accidents to the skin and bone. It is recommended that affected individuals discuss treatment options with their healthcare provider.. Type: treatment. &#39;}]],<br> &#39;distances&#39;: [[0.4760013818740845, 0.9692587852478027, 1.0237324237823486]]}</pre><p><strong>Collection 2: For Medical Device Manual Dataset</strong></p><p>We create a new collection called “medical_device_manual” and then add data to it.</p><pre>collection2 = client.get_or_create_collection(name=&quot;medical_device_manual&quot;)<br># Add data to collection<br># here the chroma db will use default embeddings (sentence transformers)<br>collection2.add(<br>    documents=df_medical_device[&#39;combined_text&#39;].tolist(),<br>    metadatas=df_medical_device.to_dict(orient=&quot;records&quot;),<br>    ids=df_medical_device.index.astype(str).tolist(),<br>)<br># quick check<br>query = &quot;Which devices are suitable for neonatal patients?&quot;</pre><pre>results = collection2.query(query_texts=[query],<br>    n_results=5<br>)<br>print(results)</pre><p>Output</p><pre>{<br>  &quot;ids&quot;: [[&quot;218&quot;, &quot;149&quot;, &quot;235&quot;]],<br>  &quot;embeddings&quot;: null,<br>  &quot;documents&quot;: [[&quot;Device Name: Pacemaker. Model: JOH663. Manufacturer: Johnson &amp; Johnson. Indications: Designed for catheterization support in neonatal intensive care environments.. Contraindications: Avoid use in patients with cardiac devices or cochlear implants. Not suitable for chemical exposure areas.&quot;,<br>                 &quot;Device Name: Infusion Pump. Model: Model 7800. Manufacturer: Intuitive Surgical. Indications: Designed for joint replacement support in neonatal intensive care environments.. Contraindications: Not recommended for use in geriatric patients or those with hepatic dysfunction.&quot;,<br>                 &quot;Device Name: Anesthesia Machine. Model: STR623. Manufacturer: Stryker. Indications: Designed for tissue biopsy support in neonatal intensive care environments.. Contraindications: Do not use in combination with sedatives or oxygen therapy modalities.&quot;]],<br>  &quot;uris&quot;: null,<br>  &quot;included&quot;: [&quot;metadatas&quot;, &quot;documents&quot;, &quot;distances&quot;],<br>  &quot;data&quot;: null,<br>  &quot;metadatas&quot;: [[{&quot;Manufacturer&quot;: &quot;Johnson &amp; Johnson&quot;, &quot;Number_of_Cautions&quot;: 10, &quot;Model_Number&quot;: &quot;JOH663&quot;, &quot;combined_text&quot;: &quot;Device Name: Pacemaker. Model: JOH663. Manufacturer: Johnson &amp; Johnson. Indications: Designed for catheterization support in neonatal intensive care environments.. Contraindications: Avoid use in patients with cardiac devices or cochlear implants. Not suitable for chemical exposure areas.&quot;, &quot;Indications_for_Use&quot;: &quot;Designed for catheterization support in neonatal intensive care environments.&quot;, &quot;Device_Name&quot;: &quot;Pacemaker&quot;, &quot;Manual_Version&quot;: &quot;2021-01-A&quot;, &quot;Device_Class&quot;: &quot;Class II&quot;, &quot;Number_of_Warnings&quot;: 10, &quot;Sterilization_Method&quot;: &quot;Not Applicable&quot;, &quot;Device_Weight_kg&quot;: 0.06, &quot;Publication_Date&quot;: &quot;2023-09-27&quot;, &quot;Regulatory_Approval_ID&quot;: &quot;H148086&quot;, &quot;Patient_Population&quot;: &quot;Adult (18-65)&quot;, &quot;Contraindications&quot;: &quot;Avoid use in patients with cardiac devices or cochlear implants. Not suitable for chemical exposure areas.&quot;, &quot;Max_Operating_Temperature_C&quot;: 39.0},<br>                     {&quot;Device_Class&quot;: &quot;Class IIb&quot;, &quot;Indications_for_Use&quot;: &quot;Designed for joint replacement support in neonatal intensive care environments.&quot;, &quot;Device_Lifetime_Years&quot;: 12.0, &quot;Device_Name&quot;: &quot;Infusion Pump&quot;, &quot;Max_Operating_Temperature_C&quot;: 31.0, &quot;Manual_Version&quot;: &quot;2020-05-S&quot;, &quot;Model_Number&quot;: &quot;Model 7800&quot;, &quot;Number_of_Warnings&quot;: 8, &quot;Manufacturer&quot;: &quot;Intuitive Surgical&quot;, &quot;Sterilization_Method&quot;: &quot;Dry Heat&quot;, &quot;Contraindications&quot;: &quot;Not recommended for use in geriatric patients or those with hepatic dysfunction.&quot;, &quot;Device_Weight_kg&quot;: 2.83, &quot;Patient_Population&quot;: &quot;Adult and Pediatric&quot;, &quot;Number_of_Cautions&quot;: 18, &quot;combined_text&quot;: &quot;Device Name: Infusion Pump. Model: Model 7800. Manufacturer: Intuitive Surgical. Indications: Designed for joint replacement support in neonatal intensive care environments.. Contraindications: Not recommended for use in geriatric patients or those with hepatic dysfunction.&quot;, &quot;Regulatory_Approval_ID&quot;: &quot;PMDA-473669&quot;, &quot;Publication_Date&quot;: &quot;2024-01-21&quot;},<br>                     {&quot;Max_Operating_Temperature_C&quot;: 31.0, &quot;combined_text&quot;: &quot;Device Name: Anesthesia Machine. Model: STR623. Manufacturer: Stryker. Indications: Designed for tissue biopsy support in neonatal intensive care environments.. Contraindications: Do not use in combination with sedatives or oxygen therapy modalities.&quot;, &quot;Manual_Version&quot;: &quot;Rev. 5.6&quot;, &quot;Number_of_Cautions&quot;: 17, &quot;Publication_Date&quot;: &quot;2017-09-04&quot;, &quot;Contraindications&quot;: &quot;Do not use in combination with sedatives or oxygen therapy modalities.&quot;, &quot;Regulatory_Approval_ID&quot;: &quot;BLA811783&quot;, &quot;Sterilization_Method&quot;: &quot;Not Applicable&quot;, &quot;Patient_Population&quot;: &quot;Geriatric&quot;, &quot;Number_of_Warnings&quot;: 16, &quot;Device_Name&quot;: &quot;Anesthesia Machine&quot;, &quot;Device_Weight_kg&quot;: 51.65, &quot;Device_Class&quot;: &quot;Class I&quot;, &quot;Indications_for_Use&quot;: &quot;Designed for tissue biopsy support in neonatal intensive care environments.&quot;, &quot;Manufacturer&quot;: &quot;Stryker&quot;, &quot;Model_Number&quot;: &quot;STR623&quot;, &quot;Device_Lifetime_Years&quot;: 14.0}]],<br>  &quot;distances&quot;: [[1.0503746271133423, 1.0830397605895996, 1.0891238451004028]]<br>}</pre><h3>Setting Up WebSearch API:</h3><p>We use serperAPI for webserach (Google Search). It’s free tier provides 2500 free websearch API. It gives google search results for a given query in 1–2 seconds.</p><p>You can find more details about it and get your API key from <a href="https://serper.dev/">here</a></p><pre>from langchain_community.utilities import GoogleSerperAPIWrapper<br>from dotenv import load_dotenv<br>load_dotenv()<br>SERPER_API_KEY = os.getenv(&quot;SERPER_API_KEY&quot;)</pre><pre>search = GoogleSerperAPIWrapper()<br># testing the google search API<br>search.run(query=&quot;What are the various vaccines of COVID-19&quot;)</pre><p>Output:</p><pre>&quot;Different types of COVID-19 vaccines: How they work · mRNA vaccine · mRNA vaccine · Messenger RNA (mRNA) vaccine · Viral vector vaccine · Viral vector vaccine ... First introduced in December 2020, the original COVID mRNA vaccines from both Pfizer and Moderna protected against the original SARS-CoV-2 virus ... Currently, there are two types of COVID-19 vaccines for use in the United States: mRNA, and protein subunit vaccines. None of these vaccines can ... On this page, you will find infographics to explain how different types of vaccines work, including the Pfizer/BioNTech vaccine, the Moderna vaccine and the ... Types of COVID-19 vaccines. Two types of COVID-19 vaccines are recommended for use in the United States: mRNA vaccines. Moderna COVID-19 Vaccine ... List of COVID-19 vaccine authorizations · Contents · Overview maps · Oxford–AstraZeneca · Pfizer–BioNTech · Janssen · Moderna · Sinopharm BIBP · Sputnik V. WHO recommends a simplified single-dose regime for primary immunization for most COVID-19 vaccines which would improve acceptance and uptake and provide ... Find information and answers to your questions about the COVID-19 vaccine, including scheduling, kid&#39;s shots, boosters, additional doses, records and more. The California Department of Public Health is dedicated to optimizing the health and well-being of Californians. Find out how the COVID-19 vaccines work, how many doses are needed, possible side effects and who shouldn&#39;t get the vaccine.&quot;</pre><h3>Setting Up OpenAI API client:</h3><p>We will use gpt-5-nano model from Open AI API for this experiment.</p><p>I chose this model as my experiment is very small and less complex. My prompts are very simple. In real world scenario, you might want to use higher models (gpt-5-mini / gpt-5).</p><p>Refer below code:</p><pre>from openai import OpenAI<br>from dotenv import load_dotenv<br>load_dotenv()<br>openai_api_key = os.getenv(&quot;OPEN_AI_KEY&quot;)<br>def get_llm_response(prompt: str) -&gt; str:<br>    &quot;&quot;&quot;Function to get response from LLM&quot;&quot;&quot;<br>    from openai import OpenAI<br>    client_llm = OpenAI(api_key=openai_api_key)<br>    response = client_llm.chat.completions.create(<br>        model=&quot;gpt-5-nano&quot;,<br>        messages=[{&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: prompt}]<br>    )<br>    return response.choices[0].message.content</pre><pre>## testing the LLM response<br>prompt = &quot;Explain the theory of relativity in simple terms in 30 words&quot;<br>response = get_llm_response(prompt)<br>print(response)</pre><pre>Relativity says physics laws work for observers, with no preferred frame, and nothing travels faster than light. Time and space bend with motion and gravity, equating mass and energy fundamentally.</pre><p>The fielding is set now. Let’s go for our RAG implementation. First we will build a Traditional RAG using first source (medical Q&amp;A) and then we will move to Agentic RAG.</p><h3>Simple RAG- Code Implementation</h3><p>In this simple RAG, the flow is as follows:</p><p><strong>Query → Retrieve → Prompt Building (Augment) → Generate</strong></p><p>The flow is implemented using LangGraph’s StateGraph with three nodes (steps):</p><p>1. <strong>Retriever</strong>: run a similarity query against the `medical_q_n_a` collection and join the top documents into a single context string.</p><p>2. <strong>PromptBuilder</strong>: create a simple RAG prompt that injects the retrieved context and the user question, with a length constraint.</p><p>3. <strong>LLM</strong>: call `get_llm_response(prompt)` and save the model output in the workflow state.</p><pre>from typing import Literal<br>from langgraph.graph import StateGraph,MessagesState, START, END<br>from openai import OpenAI<br>from typing_extensions import TypedDict<br>from typing import List</pre><pre># === Define workflow node functions ===<br>def retrieve_context(state):<br>    &quot;&quot;&quot;Retrieve top documents from ChromaDB based on query.&quot;&quot;&quot;<br>    print(&quot;---RETRIEVING CONTEXT---&quot;)<br>    query = state[&quot;query&quot;] # last user message<br>    results = collection1.query(query_texts=[query], n_results=3)<br>    context = &quot;\n&quot;.join(results[&quot;documents&quot;][0])<br>    #state[&quot;query&quot;] = query<br>    state[&quot;context&quot;] = context<br>    print(context)<br>    # Save context in the state for later nodes<br>    return state<br>def build_prompt(state):<br>    &quot;&quot;&quot;Construct the RAG-style prompt.&quot;&quot;&quot;<br>    print(&quot;---AUGMENT (BUILDING PROMPT)---&quot;)<br>    query = state[&quot;query&quot;]<br>    context = state[&quot;context&quot;]<br>    prompt = f&quot;&quot;&quot;<br>            Answer the following question using the context below.<br>            Context:<br>            {context}<br>            Question: {query}<br>            please limit your answer in 50 words.<br>            &quot;&quot;&quot;<br>    <br>    state[&quot;prompt&quot;] = prompt<br>    print(prompt)<br>    return state<br>def call_llm(state):<br>    &quot;&quot;&quot;Call your existing LLM function.&quot;&quot;&quot;<br>    print(&quot;---GENERATE (CALLING LLM)---&quot;)<br>    prompt = state[&quot;prompt&quot;]<br>    answer = get_llm_response(prompt)<br>    state[&quot;response&quot;] = answer<br>    return state<br># === Build the workflow ===<br>## Define the state structure<br>class GraphState(TypedDict):<br>    query : str<br>    prompt : str<br>    context : List[str]<br>    response : str<br>    <br>workflow = StateGraph(GraphState)<br># Add nodes<br>workflow.add_node(&quot;Retriever&quot;, retrieve_context)<br>workflow.add_node(&quot;Augment&quot;, build_prompt)<br>workflow.add_node(&quot;Generate&quot;, call_llm)<br># Define edges<br>workflow.add_edge(START, &quot;Retriever&quot;)<br>workflow.add_edge(&quot;Retriever&quot;, &quot;Augment&quot;)<br>workflow.add_edge(&quot;Augment&quot;, &quot;Generate&quot;)<br>workflow.add_edge(&quot;Generate&quot;, END)<br># Compile agent<br>rag_agent = workflow.compile()<br># === Run it ===<br>from IPython.display import Image, display<br>display(Image(rag_agent.get_graph().draw_mermaid_png()))</pre><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/0*FLFkSiIjt0uwXoND.png" /></figure><p>Simple RAG (Image by Author)</p><p>Testing the Simple RAG:</p><pre>input_state = {&quot;query&quot;: &quot;What are the treatments for Kawasaki disease ?&quot;}<br>from pprint import pprint<br>for step in rag_agent.stream(input_state):<br>    for key, value in step.items():<br>        pprint(f&quot;Finished running: {key}:&quot;)<br>pprint(value[&quot;response&quot;])</pre><p>Output:</p><pre>---RETRIEVING CONTEXT---<br>Question: What are the treatments for Kawasaki disease ?. Answer: These resources address the diagnosis or management of Kawasaki disease:  - Cincinnati Children&#39;s Hospital Medical Center  - Genetic Testing Registry: Acute febrile mucocutaneous lymph node syndrome  - National Heart, Lung, and Blood Institute: How is Kawasaki Disease Treated?   These resources from MedlinePlus offer information about the diagnosis and management of various health conditions:  - Diagnostic Tests  - Drug Therapy  - Surgery and Rehabilitation  - Genetic Counseling   - Palliative Care. Type: treatment. <br>Question: What are the treatments for Krabbe Disease ?. Answer: There is no cure for Krabbe disease. Results of a very small clinical trial of children with infantile Krabbe disease found that children who received umbilical cord blood stem cells from unrelated donors prior to symptom onset developed with little neurological impairment. Bone marrow transplantation may help some people. Generally, treatment for the disorder is symptomatic and supportive. Physical therapy may help maintain or increase muscle tone and circulation.. Type: treatment. <br>Question: What are the treatments for Ehlers-Danlos syndrome, progeroid type ?. Answer: How might Ehlers-Danlos syndrome progeroid type be treated? Individuals with Ehlers-Danlos Syndrome progeroid type can benefit from a variety of treatments depending on their symptoms. Affected children with weak muscle tone and delayed development might benefit from physiotherapy to improve muscle strength and coordination. Affected individuals with joint pain might benefit from anti-inflammatory drugs. Lifestyle changes or precautions during exercise or intense physical activity may be advised to reduce the chance of accidents to the skin and bone. It is recommended that affected individuals discuss treatment options with their healthcare provider.. Type: treatment. <br>&#39;Finished running: Retriever:&#39;<br>---AUGMENT (BUILDING PROMPT)---<br>Answer the following question using the context below.<br>            Context:<br>            Question: What are the treatments for Kawasaki disease ?. Answer: These resources address the diagnosis or management of Kawasaki disease:  - Cincinnati Children&#39;s Hospital Medical Center  - Genetic Testing Registry: Acute febrile mucocutaneous lymph node syndrome  - National Heart, Lung, and Blood Institute: How is Kawasaki Disease Treated?   These resources from MedlinePlus offer information about the diagnosis and management of various health conditions:  - Diagnostic Tests  - Drug Therapy  - Surgery and Rehabilitation  - Genetic Counseling   - Palliative Care. Type: treatment. <br>Question: What are the treatments for Krabbe Disease ?. Answer: There is no cure for Krabbe disease. Results of a very small clinical trial of children with infantile Krabbe disease found that children who received umbilical cord blood stem cells from unrelated donors prior to symptom onset developed with little neurological impairment. Bone marrow transplantation may help some people. Generally, treatment for the disorder is symptomatic and supportive. Physical therapy may help maintain or increase muscle tone and circulation.. Type: treatment. <br>Question: What are the treatments for Ehlers-Danlos syndrome, progeroid type ?. Answer: How might Ehlers-Danlos syndrome progeroid type be treated? Individuals with Ehlers-Danlos Syndrome progeroid type can benefit from a variety of treatments depending on their symptoms. Affected children with weak muscle tone and delayed development might benefit from physiotherapy to improve muscle strength and coordination. Affected individuals with joint pain might benefit from anti-inflammatory drugs. Lifestyle changes or precautions during exercise or intense physical activity may be advised to reduce the chance of accidents to the skin and bone. It is recommended that affected individuals discuss treatment options with their healthcare provider.. Type: treatment. <br>            Question: What are the treatments for Kawasaki disease ?<br>            please limit your answer in 50 words.<br>            <br>&#39;Finished running: Augment:&#39;<br>---GENERATE (CALLING LLM)---<br>&#39;Finished running: Generate:&#39;<br>(&#39;Kawasaki disease is treated mainly with intravenous immunoglobulin (IVIG) &#39;<br> &#39;and high-dose aspirin to reduce inflammation and prevent coronary artery &#39;<br> &#39;aneurysms. If fever recurs or IVIG resistance occurs, additional treatments &#39;<br> &#39;(repeat IVIG, steroids) may be considered; ongoing monitoring with &#39;<br> &#39;echocardiograms is recommended.&#39;)</pre><p>Fair and Simple right. But what if someone asks out of syllabus question!!</p><p>Yes, the system fails miserably.</p><p>Don’t worry, we have a Agentic RAG as our saviour.</p><h3>Agentic RAG- Code Implementation</h3><p>The core idea: instead of always using the same retriever, use a small routing agent that decides among multiple retrieval options and then validates the retrieved context for relevance.</p><p>The flow is as follows:</p><p><strong>query → Router (Source Selection) → Retrieval → Relevance Checker → if relevant: Generate, if not relevant: Go to WebSearch → End</strong></p><p>These are implemented using LangGraph’s StateGraph nodes. The conditions are implemented using “conditional_edge”.</p><p>Below are the key nodes:</p><p><strong>1.</strong> <strong>Router node</strong>: constructs a short decision prompt and asks the LLM to return one of three labels: `Retrieve_QnA`, `Retrieve_Device`, or `Web_Search`.</p><p><strong>2. Retriever nodes</strong>: one for the Q&amp;A Chroma collection, one for the device manuals Chroma collection, and one for the web search API. Each returns a context string and sets a `source` label.</p><p><strong>3.</strong> <strong>Relevance checker</strong>: asks the LLM whether the retrieved context is relevant (answer should be `Yes` or `No`).</p><p><strong>4. Conditional routing</strong>: if relevance is `Yes`, continue to prompt building and LLM. If `No`, fall back to `Web_Search` and re-run the relevance check; the flow limits iterations to a maximum of 3 attempts.</p><p>The agentic flow composes these nodes into a StateGraph with conditional edges.</p><pre>from typing import Literal<br>from langgraph.graph import StateGraph,MessagesState, START, END<br>from openai import OpenAI<br>from typing_extensions import TypedDict<br>from typing import List</pre><pre># === Define workflow node functions ===<br>def retrieve_context_q_n_a(state):<br>    &quot;&quot;&quot;Retrieve top documents from ChromaDB Collection 1 (Medical Q&amp;A Data) based on query.&quot;&quot;&quot;<br>    print(&quot;---RETRIEVING CONTEXT---&quot;)<br>    query = state[&quot;query&quot;] # last user message<br>    results = collection1.query(query_texts=[query], n_results=3)<br>    context = &quot;\n&quot;.join(results[&quot;documents&quot;][0])<br>    state[&quot;context&quot;] = context<br>    state[&quot;source&quot;] = &quot;Medical Q&amp;A Collection&quot;<br>    print(context)<br>    # Save context in the state for later nodes<br>    return state<br># === Define workflow node functions ===<br>def retrieve_context_medical_device(state):<br>    &quot;&quot;&quot;Retrieve top documents from ChromaDB Collection 2 (Medical Device Manuals Data) based on query.&quot;&quot;&quot;<br>    print(&quot;---RETRIEVING CONTEXT---&quot;)<br>    query = state[&quot;query&quot;] # last user message<br>    results = collection2.query(query_texts=[query], n_results=3)<br>    context = &quot;\n&quot;.join(results[&quot;documents&quot;][0])<br>    state[&quot;context&quot;] = context<br>    state[&quot;source&quot;] = &quot;Medical Device Manual&quot;<br>    print(context)<br>    # Save context in the state for later nodes<br>    return state<br>def web_search(state):<br>    &quot;&quot;&quot;Perform web search using Google Serper API.&quot;&quot;&quot;<br>    print(&quot;---PERFORMING WEB SEARCH---&quot;)<br>    query = state[&quot;query&quot;]<br>    search_results = search.run(query=query)<br>    state[&quot;context&quot;] = search_results<br>    state[&quot;source&quot;] = &quot;Web Search&quot;<br>    print(search_results)<br>    return state<br>def router(state: GraphState) -&gt; Literal[<br>    &quot;Retrieve_QnA&quot;, &quot;Retrieve_Device&quot;, &quot;Web_Search&quot;<br>]:<br>    &quot;&quot;&quot;Agentic router: decides which retrieval method to use.&quot;&quot;&quot;<br>    query = state[&quot;query&quot;]<br>    # A lightweight decision LLM - you can replace this with GPT-4o-mini, etc.<br>    decision_prompt = f&quot;&quot;&quot;<br>    You are a routing agent. Based on the user query, decide where to look for information.<br>    Options:<br>    - Retrieve_QnA: if it&#39;s about general medical knowledge, symptoms, or treatment.<br>    - Retrieve_Device: if it&#39;s about medical devices, manuals, or instructions.<br>    - Web_Search: if it&#39;s about recent news, brand names, or external data.<br>    Query: &quot;{query}&quot;<br>    Respond ONLY with one of: Retrieve_QnA, Retrieve_Device, Web_Search<br>    &quot;&quot;&quot;<br>    router_decision = get_llm_response(decision_prompt).strip()<br>    print(f&quot;---ROUTER DECISION: {router_decision}---&quot;)<br>    print(router_decision)<br>    state[&quot;source&quot;] = router_decision<br>    return state<br># Define the routing function for the conditional edge<br>def route_decision(state: GraphState) -&gt; str:<br>    return state[&quot;source&quot;]</pre><pre>def build_prompt(state):<br>    &quot;&quot;&quot;Construct the RAG-style prompt.&quot;&quot;&quot;<br>    print(&quot;---AUGMENT (BUILDING GENERATIVE PROMPT)---&quot;)<br>    query = state[&quot;query&quot;]<br>    context = state[&quot;context&quot;]<br>    prompt = f&quot;&quot;&quot;<br>            Answer the following question using the context below.<br>            Context:<br>            {context}<br>            Question: {query}<br>            please limit your answer in 50 words.<br>            &quot;&quot;&quot;<br>    <br>    state[&quot;prompt&quot;] = prompt<br>    print(prompt)<br>    return state</pre><pre>def call_llm(state):<br>    &quot;&quot;&quot;Call your existing LLM function.&quot;&quot;&quot;<br>    print(&quot;---GENERATE (CALLING LLM)---&quot;)<br>    prompt = state[&quot;prompt&quot;]<br>    answer = get_llm_response(prompt)<br>    state[&quot;response&quot;] = answer<br>    return state</pre><pre>def check_context_relevance(state):<br>    &quot;&quot;&quot;Determine whether to retrieved context is relevant or not.&quot;&quot;&quot;<br>    print(&quot;---CONTEXT RELEVANCE CHECKER---&quot;)<br>    query = state[&quot;query&quot;]<br>    context = state[&quot;context&quot;]<br>    relevance_prompt = f&quot;&quot;&quot;<br>            Check the below context if the context is relevent to the user query or.<br>            ####<br>            Context:<br>            {context}<br>            ####<br>            User Query: {query}<br>            Options:<br>            - Yes: if the context is relevant.<br>            - No: if the context is not relevant.<br>            Please answer with only &#39;Yes&#39; or &#39;No&#39;.<br>            &quot;&quot;&quot;<br>    relevance_decision_value = get_llm_response(relevance_prompt).strip()<br>    print(f&quot;---RELEVANCE DECISION: {relevance_decision_value}---&quot;)<br>    state[&quot;is_relevant&quot;] = relevance_decision_value<br>    return state<br># Define the check_context_relevance function for the conditional edge<br>def relevance_decision(state: GraphState) -&gt; str:<br>    iteration_count = state.get(&quot;iteration_count&quot;, 0)<br>    iteration_count += 1<br>    state[&quot;iteration_count&quot;] = iteration_count<br>    ## Limiting to max 3 iterations<br>    if iteration_count &gt;= 3:<br>        print(&quot;---MAX ITERATIONS REACHED, FORCING &#39;Yes&#39;---&quot;)<br>        state[&quot;is_relevant&quot;] = &quot;Yes&quot;<br>    return state[&quot;is_relevant&quot;]</pre><pre># === Build the workflow ===<br>## Define the state structure<br>class GraphState(TypedDict):<br>    query: str<br>    context: str<br>    prompt: str<br>    response: str<br>    source: str  # Which retriever/tool was used<br>    is_relevant: str<br>    iteration_count: int<br>    <br>workflow = StateGraph(GraphState)<br># Add nodes<br>workflow.add_node(&quot;Router&quot;, router)<br>workflow.add_node(&quot;Retrieve_QnA&quot;, retrieve_context_q_n_a)<br>workflow.add_node(&quot;Retrieve_Device&quot;, retrieve_context_medical_device)<br>workflow.add_node(&quot;Web_Search&quot;, web_search)<br>workflow.add_node(&quot;Relevance_Checker&quot;, check_context_relevance)<br>workflow.add_node(&quot;Augment&quot;, build_prompt)<br>workflow.add_node(&quot;Generate&quot;, call_llm)<br># Define edges<br>workflow.add_edge(START, &quot;Router&quot;)<br>workflow.add_conditional_edges(<br>    &quot;Router&quot;,<br>    route_decision,  # this function decides the path dynamically<br>    {<br>        &quot;Retrieve_QnA&quot;: &quot;Retrieve_QnA&quot;,<br>        &quot;Retrieve_Device&quot;: &quot;Retrieve_Device&quot;,<br>        &quot;Web_Search&quot;: &quot;Web_Search&quot;,<br>    }<br>)<br>workflow.add_edge(&quot;Retrieve_QnA&quot;, &quot;Relevance_Checker&quot;)<br>workflow.add_edge(&quot;Retrieve_Device&quot;, &quot;Relevance_Checker&quot;)<br>workflow.add_edge(&quot;Web_Search&quot;, &quot;Relevance_Checker&quot;)<br>workflow.add_conditional_edges(<br>    &quot;Relevance_Checker&quot;,<br>    relevance_decision,  # this function decides the path dynamically<br>    {<br>        &quot;Yes&quot;: &quot;Augment&quot;,<br>        &quot;No&quot;: &quot;Web_Search&quot;,<br>    }<br>)<br>workflow.add_edge(&quot;Augment&quot;, &quot;Generate&quot;)<br>workflow.add_edge(&quot;Generate&quot;, END)</pre><pre># Compile the dynamic RAG agent<br>agentic_rag = workflow.compile()</pre><pre># ===================================<br># ===  Visualize Workflow (Optional) ===<br># ===================================</pre><pre># === Run it ===<br>from IPython.display import Image, display<br>display(Image(agentic_rag.get_graph().draw_mermaid_png()))</pre><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*ryNHG5YMakx78tb0.png" /></figure><p>Agentic RAG (Image by Author)</p><p><strong>Test 1: (Question related to Medical Q&amp;A Dataset)</strong></p><pre>input_state = {&quot;query&quot;: &quot;What are the treatments for Kawasaki disease ?&quot;}<br>from pprint import pprint<br>for step in agentic_rag.stream(input_state):<br>    for key, value in step.items():<br>        pprint(f&quot;Finished running: {key}:&quot;)<br>pprint(value[&quot;response&quot;])</pre><pre>---ROUTER DECISION: Retrieve_QnA---<br>Retrieve_QnA<br>&#39;Finished running: Router:&#39;<br>---RETRIEVING CONTEXT---<br>Question: What are the treatments for Kawasaki disease ?. Answer: These resources address the diagnosis or management of Kawasaki disease:  - Cincinnati Children&#39;s Hospital Medical Center  - Genetic Testing Registry: Acute febrile mucocutaneous lymph node syndrome  - National Heart, Lung, and Blood Institute: How is Kawasaki Disease Treated?   These resources from MedlinePlus offer information about the diagnosis and management of various health conditions:  - Diagnostic Tests  - Drug Therapy  - Surgery and Rehabilitation  - Genetic Counseling   - Palliative Care. Type: treatment. <br>Question: What are the treatments for Krabbe Disease ?. Answer: There is no cure for Krabbe disease. Results of a very small clinical trial of children with infantile Krabbe disease found that children who received umbilical cord blood stem cells from unrelated donors prior to symptom onset developed with little neurological impairment. Bone marrow transplantation may help some people. Generally, treatment for the disorder is symptomatic and supportive. Physical therapy may help maintain or increase muscle tone and circulation.. Type: treatment. <br>Question: What are the treatments for Ehlers-Danlos syndrome, progeroid type ?. Answer: How might Ehlers-Danlos syndrome progeroid type be treated? Individuals with Ehlers-Danlos Syndrome progeroid type can benefit from a variety of treatments depending on their symptoms. Affected children with weak muscle tone and delayed development might benefit from physiotherapy to improve muscle strength and coordination. Affected individuals with joint pain might benefit from anti-inflammatory drugs. Lifestyle changes or precautions during exercise or intense physical activity may be advised to reduce the chance of accidents to the skin and bone. It is recommended that affected individuals discuss treatment options with their healthcare provider.. Type: treatment. <br>&#39;Finished running: Retrieve_QnA:&#39;<br>---CONTEXT RELEVANCE CHECKER---<br>---RELEVANCE DECISION: Yes---<br>&#39;Finished running: Relevance_Checker:&#39;<br>---AUGMENT (BUILDING GENERATIVE PROMPT)---<br>Answer the following question using the context below.<br>            Context:<br>            Question: What are the treatments for Kawasaki disease ?. Answer: These resources address the diagnosis or management of Kawasaki disease:  - Cincinnati Children&#39;s Hospital Medical Center  - Genetic Testing Registry: Acute febrile mucocutaneous lymph node syndrome  - National Heart, Lung, and Blood Institute: How is Kawasaki Disease Treated?   These resources from MedlinePlus offer information about the diagnosis and management of various health conditions:  - Diagnostic Tests  - Drug Therapy  - Surgery and Rehabilitation  - Genetic Counseling   - Palliative Care. Type: treatment. <br>Question: What are the treatments for Krabbe Disease ?. Answer: There is no cure for Krabbe disease. Results of a very small clinical trial of children with infantile Krabbe disease found that children who received umbilical cord blood stem cells from unrelated donors prior to symptom onset developed with little neurological impairment. Bone marrow transplantation may help some people. Generally, treatment for the disorder is symptomatic and supportive. Physical therapy may help maintain or increase muscle tone and circulation.. Type: treatment. <br>Question: What are the treatments for Ehlers-Danlos syndrome, progeroid type ?. Answer: How might Ehlers-Danlos syndrome progeroid type be treated? Individuals with Ehlers-Danlos Syndrome progeroid type can benefit from a variety of treatments depending on their symptoms. Affected children with weak muscle tone and delayed development might benefit from physiotherapy to improve muscle strength and coordination. Affected individuals with joint pain might benefit from anti-inflammatory drugs. Lifestyle changes or precautions during exercise or intense physical activity may be advised to reduce the chance of accidents to the skin and bone. It is recommended that affected individuals discuss treatment options with their healthcare provider.. Type: treatment. <br>            Question: What are the treatments for Kawasaki disease ?<br>            please limit your answer in 50 words.<br>            <br>&#39;Finished running: Augment:&#39;<br>---GENERATE (CALLING LLM)---<br>&#39;Finished running: Generate:&#39;<br>(&#39;Primary treatment for Kawasaki disease is intravenous immunoglobulin (IVIG) &#39;<br> &#39;given once, with high-dose aspirin during the acute phase to reduce &#39;<br> &#39;inflammation and risk of coronary artery involvement. Afterward, continue &#39;<br> &#39;low-dose aspirin for several weeks to months, with regular echocardiograms &#39;<br> &#39;to monitor the heart; additional therapy if IVIG-resistant.&#39;)</pre><p><strong>Test 2: (Question related to Medical Device Manual Dataset)</strong></p><pre>input_state = {&quot;query&quot;: &quot;What are the usage of Dialysis Machine Device?&quot;}<br>from pprint import pprint<br>for step in agentic_rag.stream(input_state):<br>    for key, value in step.items():<br>        pprint(f&quot;Finished running: {key}:&quot;)<br>pprint(value[&quot;response&quot;])</pre><pre>---ROUTER DECISION: Retrieve_Device---<br>Retrieve_Device<br>&#39;Finished running: Router:&#39;<br>---RETRIEVING CONTEXT---<br>Device Name: Dialysis Machine. Model: Model 1703. Manufacturer: Edwards Lifesciences. Indications: Used for intraoperative measurement monitoring during complex oncological surgeries.. Contraindications: Not recommended in presence of peripheral vascular disease or at open wounds locations.<br>Device Name: Dialysis Machine. Model: Plus593. Manufacturer: Siemens Healthineers. Indications: Used for emergency tissue biopsy in acute diabetes situations requiring immediate care.. Contraindications: None<br>Device Name: Dialysis Machine. Model: Max384. Manufacturer: BioMérieux. Indications: Designed for continuous monitoring assistance in geriatric care facilities for elderly patients.. Contraindications: Avoid use if patient has cardiomyopathy or is receiving radioactive materials.<br>&#39;Finished running: Retrieve_Device:&#39;<br>---CONTEXT RELEVANCE CHECKER---<br>---RELEVANCE DECISION: Yes---<br>&#39;Finished running: Relevance_Checker:&#39;<br>---AUGMENT (BUILDING GENERATIVE PROMPT)---<br>Answer the following question using the context below.<br>            Context:<br>            Device Name: Dialysis Machine. Model: Model 1703. Manufacturer: Edwards Lifesciences. Indications: Used for intraoperative measurement monitoring during complex oncological surgeries.. Contraindications: Not recommended in presence of peripheral vascular disease or at open wounds locations.<br>Device Name: Dialysis Machine. Model: Plus593. Manufacturer: Siemens Healthineers. Indications: Used for emergency tissue biopsy in acute diabetes situations requiring immediate care.. Contraindications: None<br>Device Name: Dialysis Machine. Model: Max384. Manufacturer: BioMérieux. Indications: Designed for continuous monitoring assistance in geriatric care facilities for elderly patients.. Contraindications: Avoid use if patient has cardiomyopathy or is receiving radioactive materials.<br>            Question: What are the usage of Dialysis Machine Device?<br>            please limit your answer in 50 words.<br>            <br>&#39;Finished running: Augment:&#39;<br>---GENERATE (CALLING LLM)---<br>&#39;Finished running: Generate:&#39;<br>(&#39;Dialysis Machine devices have these uses:\n&#39;<br> &#39;- Model 1703 (Edwards Lifesciences): intraoperative measurement monitoring &#39;<br> &#39;during complex oncological surgeries.\n&#39;<br> &#39;- Model Plus593 (Siemens Healthineers): emergency tissue biopsy in acute &#39;<br> &#39;diabetes situations requiring immediate care.\n&#39;<br> &#39;- Model Max384 (BioMérieux): continuous monitoring assistance in geriatric &#39;<br> &#39;care facilities for elderly patients.&#39;)</pre><p><strong>Test 3: (Out of Syllabus Question for WebSearch)</strong></p><pre>input_state = {&quot;query&quot;: &quot;What&#39;s the export duty on medical tablets on India by USA in 2025?&quot;}<br>from pprint import pprint<br>for step in agentic_rag.stream(input_state):<br>    for key, value in step.items():<br>        pprint(f&quot;Finished running: {key}:&quot;)<br>pprint(value[&quot;response&quot;])</pre><pre>---ROUTER DECISION: Web_Search---<br>Web_Search<br>&#39;Finished running: Router:&#39;<br>---PERFORMING WEB SEARCH---<br>Here&#39;s a detailed analysis of what a 100% tariff on medicines exported from India to the U.S. might imply — both for the Indian pharma sector ... DGCI&amp;S statistics reveal India&#39;s pharmaceutical formulation exports to the US reached $9.8 billion in FY2025, representing 39.8% of its total ... From August 27, 2025, the US tariff on India will increase up to 50 percent, among the steepest measures under the Trump administration. Trump has already slapped 50 per cent tariffs on Indian imports, which also includes a 25 per cent &#39;penalty&#39; for continued purchase of ... The U.S. ended the $800 de minimis exemption on August 29, 2025. Learn how the new import rules affect prescription medicines, ... U.S President Donald Trump&#39;s move to impose 100% tariffs on patented, branded drugs are expected to have a limited impact on India&#39;s pharma ... This is estimated to Rs. 85,011 crore in FY 2025. India&#39;s 1/3rd of pharma exports revenue was by the United States in 2024 which stood at USD 30 ... A 100% import tax would make Indian drugs substantially less competitive potentially leading to lost market share falling sales and shrinking margins. President Donald Trump announced Thursday that brand-name or patented pharmaceutical products will be subject to a 100% tariff starting ... India exported $3.6 billion ( ₹31,626 crore) worth of pharmaceutical products to the US in 2024, and another $3.7 billion ( ₹32,505 crore) in ...<br>&#39;Finished running: Web_Search:&#39;<br>---CONTEXT RELEVANCE CHECKER---<br>---RELEVANCE DECISION: Yes---<br>&#39;Finished running: Relevance_Checker:&#39;<br>---BUILDING PROMPT---<br>Answer the following question using the context below.<br>            Context:<br>            Here&#39;s a detailed analysis of what a 100% tariff on medicines exported from India to the U.S. might imply - both for the Indian pharma sector ... DGCI&amp;S statistics reveal India&#39;s pharmaceutical formulation exports to the US reached $9.8 billion in FY2025, representing 39.8% of its total ... From August 27, 2025, the US tariff on India will increase up to 50 percent, among the steepest measures under the Trump administration. Trump has already slapped 50 per cent tariffs on Indian imports, which also includes a 25 per cent &#39;penalty&#39; for continued purchase of ... The U.S. ended the $800 de minimis exemption on August 29, 2025. Learn how the new import rules affect prescription medicines, ... U.S President Donald Trump&#39;s move to impose 100% tariffs on patented, branded drugs are expected to have a limited impact on India&#39;s pharma ... This is estimated to Rs. 85,011 crore in FY 2025. India&#39;s 1/3rd of pharma exports revenue was by the United States in 2024 which stood at USD 30 ... A 100% import tax would make Indian drugs substantially less competitive potentially leading to lost market share falling sales and shrinking margins. President Donald Trump announced Thursday that brand-name or patented pharmaceutical products will be subject to a 100% tariff starting ... India exported $3.6 billion ( ₹31,626 crore) worth of pharmaceutical products to the US in 2024, and another $3.7 billion ( ₹32,505 crore) in ...<br>            Question: What&#39;s the export duty on medical tablets on India by USA in 2025?<br>            please limit your answer in 50 words.<br>            <br>&#39;Finished running: PromptBuilder:&#39;<br>---CALLING LLM---<br>&#39;Finished running: LLM:&#39;<br>(&#39;100% tariff. The context indicates that in 2025 the U.S. imposed a 100% &#39;<br> &#39;tariff on Indian medicines, including patented/branded drugs.&#39;)</pre><p><strong>Test 4: Trick Question (Question appearing to be related to Q&amp;A dataset but not available in the Q&amp;A dataset).</strong></p><p>Here the RAG Agent first thinks that the question is from Q&amp;A dataset but then it determines the retrieved chunks are not relevant then it goes to websearch API.</p><pre>input_state = {&quot;query&quot;: &quot;What are medicines/treatment for COVID?&quot;}<br>from pprint import pprint<br>for step in agentic_rag.stream(input_state):<br>    for key, value in step.items():<br>        pprint(f&quot;Finished running: {key}:&quot;)<br>pprint(value[&quot;response&quot;])</pre><pre>---ROUTER DECISION: Retrieve_QnA---<br>Retrieve_QnA<br>&#39;Finished running: Router:&#39;<br>---RETRIEVING CONTEXT---<br>Question: What are the treatments for Acanthamoeba - Granulomatous Amebic Encephalitis (GAE); Keratitis ?. Answer: Early diagnosis is essential for effective treatment of Acanthamoeba keratitis. Several prescription eye medications are available for treatment. However, the infection can be difficult to treat. The best treatment regimen for each patient should be determined by an eye doctor. If you suspect your eye may be infected with Acanthamoeba, see an eye doctor immediately.<br>    <br>Skin infections that are caused by Acanthamoeba but have not spread to the central nervous system can be successfully treated. Because this is a serious infection and the people affected typically have weakened immune systems, early diagnosis offers the best chance at cure.<br>    <br>Most cases of brain and spinal cord infection with Acanthamoeba (Granulomatous Amebic Encephalitis) are fatal.. Type: treatment. <br>Question: What are the treatments for Sarcoidosis ?. Answer: What treatment is available for sarcoidosis? The treatment of sarcoidosis depends on :  the symptoms present the severity of the symptoms whether any vital organs (e.g., your lungs, eyes, heart, or brain) are affected how the organ is affected. Some organs must be treated, regardless of your symptoms. Others may not need to be treated. Usually, if a patient doesn&#39;t have symptoms, he or she doesn&#39;t need treatment, and probably will recover in time. Currently, the drug that is most commonly used to treat sarcoidosis is prednisone.  When a patient&#39;s condition gets worse when taking prednisone or when the side effects of prednisone are severe in the patient, a doctor may prescribe other drugs. Most of these other drugs reduce inflammation by suppressing the immune system. These other drugs include: hydroxychloroquine (Plaquenil), methotrexate, azathioprine (Imuran), and cyclophosphamide (Cytoxan). Researchers continue to look for new and better treatments for sarcoidosis. Anti-tumor necrosis factor drugs and antibiotics are currently being studied. More detailed information about the treatment of sarcoidosis can be found at the following links: https://www.stopsarcoidosis.org/awareness/treatment-options/ http://emedicine.medscape.com/article/301914-treatment#showall. Type: treatment. <br>Question: What are the treatments for CADASIL ?. Answer: There is no treatment to halt this genetic disorder. Individuals are given supportive care. Migraine headaches may be treated by different drugs and a daily aspirin may reduce stroke and heart attack risk. Drug therapy for depression may be given. Affected individuals who smoke should quit as it can increase the risk of stroke in CADASIL. Other stroke risk factors such as hypertension, hyperlipidemia, diabetes, blood clotting disorders and obstructive sleep apnea also should be aggressively treated... Type: treatment. <br>&#39;Finished running: Retrieve_QnA:&#39;<br>---CONTEXT RELEVANCE CHECKER---<br>---RELEVANCE DECISION: No---<br>&#39;Finished running: Relevance_Checker:&#39;<br>---PERFORMING WEB SEARCH---<br>FDA has authorized or approved several antiviral medications used to treat mild to moderate COVID-19 in people who are more likely to get very sick. These medicines keep mild illness from getting worse. They can include nirmatrelvir-ritonavir (Paxlovid), remdesivir (Veklury) or molnupiravir ... The treatments available for people at the highest risk of becoming seriously ill from COVID-19 are: Nirmatrelvir plus ritonavir, and molnupiravir are ... Take an over-the-counter medicine such as acetaminophen or ibuprofen. These can be used as a fever reducer or to treat headache, sore throat or body aches. Oral antiviral drugs authorized for treatment of COVID-19 · Paxlovid · Lagevrio (also called molnupiravir). These medications stop the virus ... by SS Jean · 2020 · Cited by 94 — Remdesivir, teicoplanin, hydroxychloroquine (not in combination with azithromycin), and ivermectin might be effective antiviral drugs and are deemed promising ... Oral antivirals are a pill taken by mouth for the treatment of COVID-19 in certain people. They are available by prescription only. The oral ... PAXLOVID is a prescription medicine used to treat mild-to-moderate coronavirus disease 2019 (COVID‑19) in adults who are at high risk for progression to severe ... For certain hospitalized adults with COVID-19, the FDA has also approved Olumiant (baricitinib) and Actemra (tocilizumab). Under certain ... PaxlovidQuizMolnupiravirRemdesivirHospital medicationsPreventative medicationsCurrently unavailablePipeline medications ...<br>&#39;Finished running: Web_Search:&#39;<br>---CONTEXT RELEVANCE CHECKER---<br>---RELEVANCE DECISION: Yes---<br>&#39;Finished running: Relevance_Checker:&#39;<br>---BUILDING PROMPT---<br>Answer the following question using the context below.<br>            Context:<br>            FDA has authorized or approved several antiviral medications used to treat mild to moderate COVID-19 in people who are more likely to get very sick. These medicines keep mild illness from getting worse. They can include nirmatrelvir-ritonavir (Paxlovid), remdesivir (Veklury) or molnupiravir ... The treatments available for people at the highest risk of becoming seriously ill from COVID-19 are: Nirmatrelvir plus ritonavir, and molnupiravir are ... Take an over-the-counter medicine such as acetaminophen or ibuprofen. These can be used as a fever reducer or to treat headache, sore throat or body aches. Oral antiviral drugs authorized for treatment of COVID-19 · Paxlovid · Lagevrio (also called molnupiravir). These medications stop the virus ... by SS Jean · 2020 · Cited by 94 - Remdesivir, teicoplanin, hydroxychloroquine (not in combination with azithromycin), and ivermectin might be effective antiviral drugs and are deemed promising ... Oral antivirals are a pill taken by mouth for the treatment of COVID-19 in certain people. They are available by prescription only. The oral ... PAXLOVID is a prescription medicine used to treat mild-to-moderate coronavirus disease 2019 (COVID‑19) in adults who are at high risk for progression to severe ... For certain hospitalized adults with COVID-19, the FDA has also approved Olumiant (baricitinib) and Actemra (tocilizumab). Under certain ... PaxlovidQuizMolnupiravirRemdesivirHospital medicationsPreventative medicationsCurrently unavailablePipeline medications ...<br>            Question: What are medicines/treatment for COVID?<br>            please limit your answer in 50 words.<br>            <br>&#39;Finished running: PromptBuilder:&#39;<br>---CALLING LLM---<br>&#39;Finished running: LLM:&#39;<br>(&#39;Medicines include oral antivirals Paxlovid (nirmatrelvir–ritonavir) and &#39;<br> &#39;Lagevrio (molnupiravir); the IV antiviral remdesivir; and, for some &#39;<br> &#39;hospitalized patients, baricitinib (Olumiant) and tocilizumab (Actemra). &#39;<br> &#39;Over-the-counter fever/pain relief like acetaminophen or ibuprofen can help &#39;<br> &#39;with symptoms.&#39;)</pre><h3>Closing Remarks</h3><p>This article is a practical, experiment-focused exploration of RAG and agentic RAG for medical content. It demonstrates how a tiny routing agent and conditional workflows can make RAG systems more flexible and context-aware while keeping iteration costs bounded.</p><p><strong>Agentic RAG</strong> represents an evolution of traditional RAG — adding a layer of reasoning and decision-making that makes retrieval workflows more adaptive and context-aware.<br>Even with lightweight tools and small datasets, it’s possible to design a system that intelligently routes queries, validates its own results, and produces grounded, auditable answers — a crucial step toward reliable AI.</p><p>If you want to show some love, please take a moment to <strong>follow me on</strong></p><p>You can also subscribe to our <strong>weekly newsletter</strong>.</p><p>And before you go, don’t forget to <strong>clap</strong> and <strong>follow</strong> the writer️!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fca30c745276" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Are AI Companions Replacing Human Relationships ?]]></title>
            <link>https://medium.com/@gautamsingh139/are-ai-companions-replacing-human-relationships-ef0de4ea102f?source=rss-dee5052d79cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef0de4ea102f</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Gautam Singh]]></dc:creator>
            <pubDate>Fri, 22 Aug 2025 07:08:44 GMT</pubDate>
            <atom:updated>2025-08-22T07:13:20.663Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Are AI Companions Replacing Human Relationships ?</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*MgrAsq45ZtKvbcZM" /></figure><p>The New Digital Relationships of 2025</p><p>Technology has always been about connection. First, it was letters and telephones. Then social media platforms like Facebook, Instagram, and WhatsApp redefined how we stay in touch. Now, in 2025, a new wave of technology is quietly shaping our lives: AI companions.</p><ul><li>From students in India preparing for exams to working professionals seeking productivity hacks, AI . companions are no longer science fiction — they’re everyday digital partners. But with convenience also come new questions: Are we depending too much on them? Could AI companions reshape human relationships, even love?</li></ul><p>Let’s break it down.</p><h3>1. Everyday Use Cases of AI Companions</h3><p>Study Helpers for Students: Many college students now rely on AI tutors to explain concepts, generate practice questions, or summarize books. Instead of waiting for coaching classes, they can get instant, personalized guidance.</p><p>Workplace Productivity: AI tools schedule meetings, draft emails, generate reports, and even code. For IT students, this means faster project building and real-world skill practice.</p><p>Mental Health &amp; Well-being: Some apps provide AI “listeners” that check in daily, ask about your feelings, and encourage positive habits. While not a replacement for therapists, they give comfort during lonely or stressful moments.</p><p>Creative Collaboration: Writers, musicians, and designers are experimenting with AI as creative partners — whether for generating lyrics, coding websites, or sketching design ideas.</p><h3>2. AI in Relationships</h3><p>Here’s where it gets interesting. AI companions aren’t just assistants anymore — they’re being designed to mimic emotional connection.</p><p>Romantic AI Companions: Apps like Replika or Character AI allow people to create an “AI partner” that remembers conversations, adapts to moods, and expresses affection. For some, this is fun roleplay. For others, it fills an emotional gap.</p><p>Friendship &amp; Loneliness: In metro cities like Mumbai or Bangalore, where student life can feel isolating, AI friends act as 24/7 listeners. They don’t judge, don’t interrupt, and always respond with empathy.</p><p><strong><em>Real-Life Cases:-</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*b5h9kxPFS15ryAx8" /></figure><h3>A student in Delhi said his AI companion helped him stay motivated during exam prep, even sending encouraging “good luck” texts.</h3><h3>A working woman in Pune shared that her AI “partner” reminded her to eat on time, reducing her stress during late-night shifts.</h3><p>But this also raises tough questions: if someone invests more time in AI than in real human connections, will relationships suffer?</p><h3>3. Benefits of AI Companions</h3><p>Accessibility: Anyone with a smartphone can have one.</p><p>Non-judgmental: You can express feelings freely without fear.</p><p>Consistency: They’re always available, unlike busy friends or partners.</p><p>Skill-Building: AI can guide students in coding, languages, or communication practice.</p><h3>4. Risks &amp; Challenges</h3><p>Emotional Dependence: Students or young professionals may start preferring AI over human interaction.</p><p>Privacy Issues: Conversations with AI are stored on servers — raising questions about data safety.</p><p>Reality vs. Illusion: Falling “in love” with an AI might sound futuristic, but it’s happening. The danger is forgetting that the emotions are simulated, not real.</p><p>Cultural Impact: In India, where family and social bonds are strong, reliance on AI companions could slowly shift social norms.</p><h3>5. The Balanced Path</h3><p>AI companions are here to stay. But instead of replacing relationships, they should complement them. A healthy approach is:</p><p>Use AI for productivity, learning, and casual companionship.</p><p>Maintain real connections with friends, family, and partners.</p><p>Treat AI as a tool, not a replacement for human emotions.</p><h3>Final Thoughts 💡</h3><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*k-J_VkC5BHu7_gwA" /></figure><p>AI companions are not “taking over” in a hostile way, but they are blending into our daily routines — from assignments and coding projects to late-night chats when you feel alone.</p><p>Love and friendship with AI might sound strange, but in a fast-moving digital society, they reflect a deep human need: connection. The challenge for students, professionals, and society at large is to find balance — embracing AI’s help without letting it replace what makes us truly human.</p><p>In 2025, the question is not “Will AI companions take over?” but rather “How will we choose to live with them?”</p><blockquote>Follow Me</blockquote><blockquote>Linkedin :- <a href="https://www.linkedin.com/in/gautamsingh139/">https://www.linkedin.com/in/gautamsingh139/</a></blockquote><blockquote>Github :- <a href="https://github.com/gautamsingh139">https://github.com/gautamsingh139</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef0de4ea102f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>