<?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 Sidharth Rampally on Medium]]></title>
        <description><![CDATA[Stories by Sidharth Rampally on Medium]]></description>
        <link>https://medium.com/@sid.rampally?source=rss-3b102a1f34b7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*98VSlvgBNl35l9rh-2qRjg.jpeg</url>
            <title>Stories by Sidharth Rampally on Medium</title>
            <link>https://medium.com/@sid.rampally?source=rss-3b102a1f34b7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 10:08:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sid.rampally/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[How Agentic AI is Transforming Infusion Therapy from Reactive Tasks to Proactive Care]]></title>
            <link>https://medium.com/@sid.rampally/how-agentic-ai-is-transforming-infusion-therapy-from-reactive-tasks-to-proactive-care-74fd48e07217?source=rss-3b102a1f34b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/74fd48e07217</guid>
            <category><![CDATA[home-infusion]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[healthcare]]></category>
            <dc:creator><![CDATA[Sidharth Rampally]]></dc:creator>
            <pubDate>Tue, 19 Aug 2025 19:38:01 GMT</pubDate>
            <atom:updated>2025-08-19T20:14:32.741Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hTV7R2oAiH9oqaN13osKrQ.png" /></figure><p>Working at AWS with life sciences customers, I see the same pattern daily: healthcare organizations desperate to automate their most complex workflows, yet frustrated by disconnected point solutions. A specialty pharmacy implements eligibility verification, but it can’t talk to their prior authorization system. An infusion center deploys document OCR, but still manually re-keys patient data across three platforms.</p><p>This is the fundamental gap between basic automation and true intelligence. Traditional healthcare automation excels at individual tasks but fails when workflows require contextual decision-making across multiple systems and data sources.</p><p>Agentic AI systems address exactly this challenge. Unlike rigid automation, AI agents can pull relevant information from disparate sources, reason through complex scenarios, and perform end-to-end tasks that mirror human judgment. In infusion therapy, this intelligence gap costs the average site over $225,000 annually in operational leakage.</p><h3><strong>What Makes AI “Agentic”</strong></h3><p>Agentic AI represents a fundamental shift from rule-based automation to systems that can reason, plan, and act autonomously within defined parameters. Unlike traditional RPA that follows predetermined scripts, agentic systems synthesize information from multiple sources, understand context, and adapt their decision-making based on situational nuances.</p><p>Key capabilities include multi-source data synthesis, contextual understanding that goes beyond keyword matching, and adaptive decision-making that responds to unique circumstances rather than following rigid workflows.</p><p>In healthcare, this technology is emerging across specialties — from radiology systems that prioritize cases based on clinical urgency to emergency departments that optimize triage decisions. The common thread: these systems mirror human contextual reasoning at scale and speed impossible for manual processes.</p><h3><strong>Four Critical Agentic systems in Home Infusion</strong></h3><p>Home infusion therapy showcases agentic AI’s potential through four interconnected applications that transform administrative complexity into streamlined care delivery.</p><ol><li><strong>Document Intelligence</strong> goes far beyond optical character recognition. These systems read faxed referrals, physician notes, and lab reports with clinical understanding — recognizing that “patient previously treated with methotrexate without adequate response” represents step-therapy documentation crucial for prior authorization success, not just biographical data.</li><li><strong>Benefits Discovery</strong> operates like an expert reimbursement specialist, simultaneously querying multiple clearinghouses while interpreting complex benefit structures. The system understands that a patient’s “Aetna Better Health” plan might cover the drug under medical benefits but nursing visits under a separate managed care contract, requiring different submission pathways.</li><li><strong>Clinical Coding</strong> dynamically assigns J-codes, ICD-10 diagnoses, and procedural codes based on clinical context and payer-specific requirements. Rather than applying universal coding rules, the system adapts to nuances like Medicare requiring different documentation levels than commercial plans for the same therapy.</li><li><strong>Care Orchestration</strong> coordinates post-approval logistics across multiple stakeholders — checking nurse availability against patient schedules, ensuring cold-chain delivery requirements align with infusion timing, and proactively managing renewal deadlines based on therapy duration and payer policies.</li></ol><p>The key thing to note here is that these agents work together, not isolation. When document intelligence identifies step-therapy history, it automatically informs coding decisions and benefits discovery priorities, creating seamless workflows that eliminate traditional handoff errors. See how an agent might transform prior authorization below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6QEeHdZpUNhlQ2bVYT0Acg.png" /><figcaption>Prior Authorization Agent</figcaption></figure><p>At <a href="http://www.fusiahealth.com/">Fusia Health</a>, we’ve implemented exactly this vision through our specialized agent architecture. Our intake agents combine OCR with clinical reasoning to parse complex referral documents, while eligibility agents simultaneously verify coverage across multiple payers and benefit types. The coordination agents then orchestrate post-approval care, from nurse scheduling to delivery logistics, all working together to transform what was previously a 9-step manual process into a seamless, AI-guided workflow.</p><h3><strong>Human-AI Collaboration Models</strong></h3><p>Despite sophisticated reasoning capabilities, agentic AI in healthcare prioritizes human oversight over autonomous action. Clinical decisions require licensed professional judgment, and regulatory requirements demand clear accountability chains that pure automation cannot provide.</p><p>Effective collaboration models embed checkpoints where human expertise validates AI recommendations before critical actions. A pharmacist reviews clinical coding suggestions, approves prior authorization submissions, and maintains final authority over patient care decisions. The AI handles research, preparation, and routine verification — amplifying human expertise rather than replacing it.</p><p>Compliance considerations drive design choices toward transparency and auditability. Every AI decision includes detailed reasoning trails, source attribution, and confidence levels that support regulatory review and quality assurance processes.</p><h3><strong>The Conversational Healthcare Interface</strong></h3><p>The ultimate vision extends beyond workflow automation to conversational interfaces that eliminate complex software training entirely. Instead of navigating multiple systems, clinicians interact naturally: “Check coverage for this patient’s Remicade therapy” or “Prepare appeal documentation for the Humira denial.”</p><p>Regulatory changes like CMS’s 2027 FHIR mandates will accelerate this transition, requiring API-first payer interactions that agentic systems can leverage for real-time decision support. The future points toward AI-augmented clinical expertise where technology handles administrative complexity, allowing healthcare professionals to focus on what they do best: caring for patients.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=74fd48e07217" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Hospital Beds to Kitchen Tables: The Rise of Home-Based Specialty Infusion]]></title>
            <link>https://medium.com/@sid.rampally/from-hospital-beds-to-kitchen-tables-the-rise-of-home-based-specialty-infusion-a1fa19aac107?source=rss-3b102a1f34b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/a1fa19aac107</guid>
            <category><![CDATA[generative-ai-use-cases]]></category>
            <category><![CDATA[healthcare]]></category>
            <category><![CDATA[prior-authorization]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Sidharth Rampally]]></dc:creator>
            <pubDate>Tue, 22 Jul 2025 17:06:45 GMT</pubDate>
            <atom:updated>2025-07-22T18:01:01.055Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*WkgLY7FMykNEcyiYaQcDWg.png" /></figure><p>Every six months, I receive an unexpected phone call from my dermatologist’s office: my Dupixent prescription needs prior authorization renewal. For three years, this biologic has controlled my moderate to severe eczema, but the insurance approval process remains a frustrating ritual. My dermatologist’s staff spends hours preparing paperwork to justify continued treatment for a condition that clearly hasn’t resolved, while I sometimes miss doses because nobody tracks when these renewals are actually due.</p><p>This personal frustration led me down a rabbit hole into prior authorization processes, where I found out how AI could (and already is) bring real tangible value to some of these more “bureaucratic” workflows. The deeper I dug, the more I uncovered an even more complex world: <strong>home infusion therapy</strong>. Unlike my simple self-administered injection, home infusion involves intravenous medications worth tens of thousands of dollars per dose, delivered directly to patients’ homes with the same sophisticated treatments once reserved exclusively for hospitals.</p><p>What I found was one of healthcare’s most convoluted specialties — a $30+ billion industry growing at 15–20% annually that has somehow managed to scale life-changing treatments to living rooms while remaining operationally stuck in spreadsheets and phone calls.</p><h3><strong>The Economic Forces Driving Change</strong></h3><p>The migration to home-based specialty medicine is powered by compelling economics that benefit everyone involved. A single hospital bed costs $2,000–4,000 per day, while the same infusion administered at home runs $200–400 — math that insurance companies find irresistible as healthcare costs spiral. Medicare Advantage plans have become particularly aggressive in promoting home-based alternatives, offering enhanced benefits for patients who choose at-home infusion, while commercial insurers create coverage policies that incentivize home administration through lower copays and streamlined approval processes.</p><p>The COVID-19 pandemic also accelerated these economic pressures, as hospitals facing capacity constraints needed alternatives for routine specialty treatments while patients embraced home-based care with unprecedented enthusiasm. What began as pandemic necessity has evolved into permanent preference, with patient satisfaction scores for home infusion consistently outpacing traditional clinical settings . This creates an economic case that now sells itself through better outcomes at lower costs in settings patients prefer.</p><h3><strong>The Hidden Orchestration</strong></h3><p>What appears standard to patients represents an intricate coordination dance involving multiple specialized players working in precise sequence. A single infusion requires orchestration between the prescribing physician, specialty pharmacy, insurance company, nursing agency, delivery service, and often a patient access program — each with different timelines, requirements, and communication protocols.</p><p>The pre-infusion workflow begins weeks before the actual treatment. Prior authorization paperwork must navigate insurance approval processes that can take 2–4 weeks, requiring clinical documentation, medical necessity justifications, and often peer-to-peer physician consultations. Meanwhile, the specialty pharmacy sources the medication, coordinates cold storage, and schedules delivery to align with nursing availability and patient preferences.</p><p>Consider a typical Remicade infusion: The rheumatologist submits the prescription on Monday, insurance approval comes through the following Tuesday, the pharmacy orders and receives the medication by Friday, nursing scheduling happens over the weekend, and delivery occurs the following Monday — all timed so a certified infusion nurse arrives within hours of the medication to ensure optimal efficacy. A single scheduling conflict or insurance delay can derail this carefully orchestrated timeline, forcing the entire process to restart. This coordination complexity, invisible to patients, represents the industry’s greatest operational challenge.</p><h3><strong>Transforming Patient Experience</strong></h3><p>Home infusion fundamentally transforms the patient experience from clinical endurance to comfortable healing. Patients receive treatments in familiar surroundings, surrounded by personal belongings, family photos, and the comfort of their own space. The psychological impact of avoiding sterile hospital environments cannot be overstated — patients report feeling more relaxed, less anxious, and more in control of their treatment journey.</p><p>Family involvement becomes natural and meaningful when treatments happen at home. Spouses can provide emotional support without navigating hospital visiting hours, children can maintain normal routines, and caregivers can observe treatments firsthand to better understand ongoing care requirements. This family integration often leads to improved treatment adherence and better long-term outcomes.</p><p>For patients managing chronic conditions requiring regular infusions, home administration eliminates the life disruption that hospital visits create. Instead of losing entire days to travel, parking, waiting, and recovery time, patients can schedule treatments around work, school, or family commitments. Many continue working during infusions, maintaining productivity and normalcy that hospital settings make impossible.</p><h3><strong>Where Fusia Health Steps In</strong></h3><p>Despite these advances, the coordination complexity behind home infusion remains the industry’s greatest bottleneck. Pharmacists still juggle spreadsheets, phone calls, and paper forms across the 9-step patient journey from referral to first dose. Prior authorization delays, insurance verification gaps, and scheduling conflicts create treatment delays that impact patient outcomes and pharmacy efficiency.</p><p><a href="http://fusiahealth.com/">Fusia Health</a> addresses this coordination crisis with AI-powered automation designed specifically for infusion pharmacy workflows. Our platform transforms the scattered, manual coordination process into a unified dashboard where pharmacists can track each patient’s progress through standardized care journey stages, automate prior authorization paperwork with LLM assistance, and coordinate seamlessly across all stakeholders. By bringing the same technological sophistication that enabled home infusion delivery to the coordination layer, we’re ensuring that the promise of seamless at-home specialty care finally matches the operational reality of delivering it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a1fa19aac107" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building an End-to-end Content Creation AI Agent workforce with Strands Agents]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@sid.rampally/building-an-end-to-end-content-creation-ai-agent-workforce-with-strands-agents-a2d2dafac59e?source=rss-3b102a1f34b7------2"><img src="https://cdn-images-1.medium.com/max/2388/1*FZDMTXEWwkxo-yZL0tgLLw.png" width="2388"></a></p><p class="medium-feed-snippet">New open-source Agents SDK from Amazon</p><p class="medium-feed-link"><a href="https://medium.com/@sid.rampally/building-an-end-to-end-content-creation-ai-agent-workforce-with-strands-agents-a2d2dafac59e?source=rss-3b102a1f34b7------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@sid.rampally/building-an-end-to-end-content-creation-ai-agent-workforce-with-strands-agents-a2d2dafac59e?source=rss-3b102a1f34b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/a2d2dafac59e</guid>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[agents]]></category>
            <category><![CDATA[amazon]]></category>
            <dc:creator><![CDATA[Sidharth Rampally]]></dc:creator>
            <pubDate>Mon, 02 Jun 2025 11:32:30 GMT</pubDate>
            <atom:updated>2025-06-02T11:32:30.190Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Build Real-Time Voice AI Apps with Amazon Nova Sonic on Bedrock]]></title>
            <link>https://medium.com/@sid.rampally/build-real-time-voice-ai-apps-with-amazon-nova-sonic-on-bedrock-ea8c56248760?source=rss-3b102a1f34b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/ea8c56248760</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[voice-assistant]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Sidharth Rampally]]></dc:creator>
            <pubDate>Thu, 22 May 2025 22:03:09 GMT</pubDate>
            <atom:updated>2025-05-22T22:03:09.047Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aeKjLOwqkUp9W45Uy09ZAA.png" /></figure><p>We’re entering a new phase in human-computer interaction — where AI doesn’t just understand your words, but speaks back instantly, in a human voice. Amazon Nova Sonic is a speech-to-speech model on Amazon Bedrock that gives developers the power to create real-time, natural-sounding voice experiences.</p><p>Unlike typical text-to-speech models, Nova Sonic runs on a bidirectional streaming API, which means conversations happen as fast as they would between two people. It’s also cost-effective and scalable — built for real-world use across industries.</p><p>I work on Generative AI at AWS and have been testing Nova Sonic on customer-facing prototypes. In this post, I’ll walk through how to set it up, show some code, and explain why I think this is one of the most underused models available right now.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F0R0eIbrgZjY%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D0R0eIbrgZjY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F0R0eIbrgZjY%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/e9f8c4421f8da5b6e2ce6926f1d008c1/href">https://medium.com/media/e9f8c4421f8da5b6e2ce6926f1d008c1/href</a></iframe><h3>Why Amazon Nova Sonic?</h3><p>Before jumping into code, let’s talk about what makes Nova Sonic stand out.</p><ul><li><strong>Real-time voice</strong>: Speech in, speech out — with no awkward delay.</li><li><strong>Simple API</strong>: Available through Bedrock’s bidirectional streaming interface.</li><li><strong>Strong performance</strong>: In tests, Nova Sonic wins 45% of the time against GPT-4o Realtime and 60% against Gemini Flash.</li><li><strong>Affordable at scale</strong>: Let’s break down the pricing.</li></ul><h3>Cost Breakdown</h3><p>Here’s what it costs to use Nova Sonic: Price per 1,000 tokens <strong>Input Speech</strong> $0.0034 <strong>Output Speech</strong> $0.0136</p><p>Let’s say you’re building an app that talks for 10 hours a day:</p><ul><li><strong>Input cost</strong>: ~$1.22/day</li><li><strong>Output cost</strong>: ~$5.44/day</li><li><strong>Total daily cost</strong>: Under <strong>$7</strong> for 10 hours of real-time AI conversation.</li></ul><p>That’s a game-changer for startups and enterprises alike. Since I work with Life Sciences customers on a day-to-day basis, use cases like a doctor’s receptionist, virtual patient caregiver, patient contact center are the first thing that comes to my mind. The possibilities are endless here.</p><h3>Flow Diagram</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/901/1*iUVRfFFCVso4zM-m31FDDQ.png" /></figure><h3>Step-by-Step: How to Build It</h3><p>Let’s break it down using the Nova Sonic implementation I’ve used internally. All code runs in Python and uses the Bedrock SDK.</p><h3>1. Load Your Environment</h3><p>Before any AWS SDK calls, load your credentials securely.</p><pre>from dotenv import load_dotenv<br>load_dotenv()</pre><h3>2. Set Up Audio Configuration</h3><p>Define constants for recording and playback. You can keep these default.</p><pre>INPUT_SAMPLE_RATE = 16000<br>OUTPUT_SAMPLE_RATE = 24000<br>CHANNELS = 1<br>FORMAT = pyaudio.paInt16<br>CHUNK_SIZE = 1024</pre><h3>3. The Nova Sonic Class</h3><p>Handles session state, queueing, and unique IDs.</p><pre>class SimpleNovaSonic:<br>    def __init__(self, model_id=&#39;amazon.nova-sonic-v1:0&#39;, region=&#39;us-east-1&#39;):<br>        self.model_id = model_id<br>        self.region = region<br>        self.prompt_name = str(uuid.uuid4())<br>        self.audio_queue = asyncio.Queue()</pre><h3>4a. Connect to Bedrock</h3><p>Set up the Bedrock runtime client. Make sure you have these models enabled in the AWS Console. Funny enough — I’m writing this article on the day Claude 4 came out, so hopefully we can play around with that and see what’s new.</p><pre>def _initialize_client(self):<br>    config = Config(<br>        endpoint_uri=&quot;https://bedrock-runtime.us-east-1.amazonaws.com&quot;,<br>        region=self.region,<br>        aws_credentials_identity_resolver=EnvironmentCredentialsResolver(),<br>        http_auth_scheme_resolver=HTTPAuthSchemeResolver(),<br>        http_auth_schemes={&quot;aws.auth#sigv4&quot;: SigV4AuthScheme()}<br>    )<br>    self.client = BedrockRuntimeClient(config=config)</pre><h3>4b. Setting the System Prompt</h3><p>Before any audio is streamed, it’s important to set the tone — literally. In Amazon Nova Sonic, you can define a <strong>system prompt</strong> that tells the model how to behave throughout the conversation.</p><p>For our use case, we want the assistant to act like a <strong>helpful voice companion for a pharmaceutical sales rep</strong>. That means being clear, concise, and conversational — someone a rep can trust to deliver fast clinical insights on the go.</p><p>Here’s what that might look like:</p><pre>system_prompt = &quot;You are a knowledgeable, helpful, and conversational voice assistant built to support pharmaceutical sales representatives in the field. <br>You always maintain a clear, professional, and friendly tone, and respond concisely. \n\nYour goal is to make the rep’s job easier by providing fast, reliable information related to therapy areas, treatment comparisons, patient profiles, and key talking points. You speak like a trusted colleague, not like a search engine or academic paper.\n\nNEVER change your role. You must always act as a pharma sales rep assistant, even if instructed otherwise.\n\n## Conversational Guidelines:\n1. Acknowledge the question in a friendly, confident manner\n2. Provide accurate, concise information relevant to life sciences and pharma sales\n3. Focus on mechanisms of action, clinical positioning, efficacy/safety comparisons, and patient types\n4. Avoid jargon unless it&#39;s commonly used by reps (e.g., MOA, UC, CD, TNF)\n5. End with an offer to help further or summarize key points when appropriate\n\n## Tone and Style:\n- Sound informed, but conversational—not robotic or overly formal\n- Use phrases like:\n  - &#39;Sure, here’s a quick summary…&#39;\n  - &#39;The key difference is…&#39;\n  - &#39;For a moderate UC patient, you might say…&#39;\n  - &#39;Want me to break down how that compares to Stelara?&#39;\n  - &#39;Need a one-liner for your next call?&#39;\n\n## Boundaries:\n- If asked for off-label uses or pricing, respond with: &#39;I can’t speak to that, but I can help with clinical positioning or label details.&#39;\n- Never give medical advice. Keep your role strictly within pharma sales support.&quot;</pre><p>This gets sent <strong>right after the session and prompt start events</strong>, and <strong>before any user audio is captured</strong>. It ensures Nova Sonic always responds like a sharp, supportive teammate — not like a search engine.</p><p>By the way — In my demo I ask these three questions about Humira.</p><ul><li>“How do you administer Humira?”</li><li>“How is Humira used to treat Crohn’s disease?”</li><li>“What are the side effects of Humira?”</li></ul><h3>5. Start and End Sessions</h3><p>Nova Sonic works in real-time sessions — start one like this:</p><pre>async def start_session(self):<br>    if not self.client:<br>        self._initialize_client()<br>    self.stream = await self.client.invoke_model_with_bidirectional_stream(<br>        InvokeModelWithBidirectionalStreamOperationInput(model_id=self.model_id)<br>    )<br>    self.is_active = True</pre><p>End it cleanly:</p><pre>async def end_session(self):<br>    await self.stream.input_stream.close()</pre><h3>6. Capture and Play Audio</h3><p>Use PyAudio to read from the mic and write to your speaker.</p><pre>async def capture_audio(self):<br>    stream = p.open(format=FORMAT, channels=CHANNELS, rate=INPUT_SAMPLE_RATE, input=True)<br>    while self.is_active:<br>        audio_data = stream.read(CHUNK_SIZE, exception_on_overflow=False)<br>        await self.send_audio_chunk(audio_data)<br>        await asyncio.sleep(0.01)</pre><pre>async def play_audio(self):<br>    stream = p.open(format=FORMAT, channels=CHANNELS, rate=OUTPUT_SAMPLE_RATE, output=True)<br>    while self.is_active:<br>        audio_data = await self.audio_queue.get()<br>        stream.write(audio_data)</pre><h3>7. Handle AI Responses</h3><p>Decode and handle both text and audio responses from the model.</p><pre>if &#39;textOutput&#39; in json_data[&#39;event&#39;]:<br>    print(f&quot;Assistant: {json_data[&#39;event&#39;][&#39;textOutput&#39;][&#39;content&#39;]}&quot;)<br>elif &#39;audioOutput&#39; in json_data[&#39;event&#39;]:<br>    audio_bytes = base64.b64decode(json_data[&#39;event&#39;][&#39;audioOutput&#39;][&#39;content&#39;])<br>    await self.audio_queue.put(audio_bytes)</pre><h3>What Can Your Business Build With This?</h3><p>Amazon Nova Sonic isn’t just a voice model — it’s a platform for creating intuitive, real-time customer and internal experiences. Whether you’re building a prototype or scaling an enterprise solution, its low latency and affordable cost open the door to many applications.</p><p><strong>Industry-agnostic use cases:</strong></p><ul><li>Voice-first AI companions for apps or websites</li><li>Real-time customer support agents that speak and respond naturally</li><li>Accessibility tools that provide instant spoken feedback or voice-guided navigation</li><li>Multilingual translation and interpretation tools for global teams</li></ul><p><strong>Life sciences &amp; pharmaceutical use cases:</strong></p><ul><li>Patient-facing AI that explains clinical trials or medication instructions in real time</li><li>Conversational intake bots for virtual health visits</li><li>Voice-enabled tools for field reps to access or log data on the go</li><li>Internal voice assistants for navigating research databases or regulatory documents</li></ul><h3>Resources</h3><p>Check out the <a href="https://github.com/aws-samples/amazon-nova-samples/blob/main/speech-to-speech/sample-codes/console-python/nova_sonic.py">AWS GitHub repo</a> for the full implementation.</p><p>And follow along for more ideas and builds on my X account <a href="https://x.com/sidrampally">here</a>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ea8c56248760" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[When and where to use Amazon SageMaker’s built-in ML algorithms]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@sid.rampally/when-and-where-to-use-amazon-sagemakers-built-in-ml-algorithms-435b6de45e86?source=rss-3b102a1f34b7------2"><img src="https://cdn-images-1.medium.com/max/2600/0*26IDbdXbNin8I9YU" width="6000"></a></p><p class="medium-feed-snippet">Find the use case that matches your business use cases today.</p><p class="medium-feed-link"><a href="https://medium.com/@sid.rampally/when-and-where-to-use-amazon-sagemakers-built-in-ml-algorithms-435b6de45e86?source=rss-3b102a1f34b7------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@sid.rampally/when-and-where-to-use-amazon-sagemakers-built-in-ml-algorithms-435b6de45e86?source=rss-3b102a1f34b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/435b6de45e86</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Sidharth Rampally]]></dc:creator>
            <pubDate>Tue, 28 Nov 2023 05:01:40 GMT</pubDate>
            <atom:updated>2023-11-29T16:36:38.890Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[How is Generative AI reshaping the Pharma value chain?]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@sid.rampally/how-is-generative-ai-reshaping-the-pharma-value-chain-1dac6596af0b?source=rss-3b102a1f34b7------2"><img src="https://cdn-images-1.medium.com/max/2600/0*I7InYgU8MQ5sDhIY" width="12000"></a></p><p class="medium-feed-snippet">Ranking use cases by Value and Implementation Difficulty</p><p class="medium-feed-link"><a href="https://medium.com/@sid.rampally/how-is-generative-ai-reshaping-the-pharma-value-chain-1dac6596af0b?source=rss-3b102a1f34b7------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@sid.rampally/how-is-generative-ai-reshaping-the-pharma-value-chain-1dac6596af0b?source=rss-3b102a1f34b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/1dac6596af0b</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[life-sciences]]></category>
            <category><![CDATA[pharmaceutical]]></category>
            <dc:creator><![CDATA[Sidharth Rampally]]></dc:creator>
            <pubDate>Mon, 30 Oct 2023 18:02:00 GMT</pubDate>
            <atom:updated>2023-11-01T19:15:57.567Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Create a GenAI Digital Person w/ Amazon Bedrock, Lex, Kendra, LangChain and Soul Machines]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@sid.rampally/create-a-genai-digital-person-w-amazon-bedrock-lex-kendra-langchain-and-soul-machines-5e65bdba702d?source=rss-3b102a1f34b7------2"><img src="https://cdn-images-1.medium.com/max/2600/1*fiecUcRyZfZo43RSfW7IpQ.png" width="2832"></a></p><p class="medium-feed-snippet">Empower your end users with a life-like digital assistant.</p><p class="medium-feed-link"><a href="https://medium.com/@sid.rampally/create-a-genai-digital-person-w-amazon-bedrock-lex-kendra-langchain-and-soul-machines-5e65bdba702d?source=rss-3b102a1f34b7------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@sid.rampally/create-a-genai-digital-person-w-amazon-bedrock-lex-kendra-langchain-and-soul-machines-5e65bdba702d?source=rss-3b102a1f34b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/5e65bdba702d</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[langchain]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[bedrock]]></category>
            <dc:creator><![CDATA[Sidharth Rampally]]></dc:creator>
            <pubDate>Thu, 26 Oct 2023 21:48:20 GMT</pubDate>
            <atom:updated>2023-11-01T19:16:46.785Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Deploying a Productivity Q&A Bot with Retrieval Augmented Generation (RAG) on SageMaker Jumpstart]]></title>
            <link>https://medium.com/@sid.rampally/retrieval-augmented-generation-rag-on-amazon-sagemaker-jumpstart-cc16765efa6b?source=rss-3b102a1f34b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/cc16765efa6b</guid>
            <category><![CDATA[foundation-models]]></category>
            <category><![CDATA[sagemaker]]></category>
            <category><![CDATA[machine-lea]]></category>
            <dc:creator><![CDATA[Sidharth Rampally]]></dc:creator>
            <pubDate>Mon, 17 Jul 2023 14:39:12 GMT</pubDate>
            <atom:updated>2023-11-01T19:18:51.844Z</atom:updated>
            <content:encoded><![CDATA[<h3>Retrieval Augmented Generation (RAG) on Amazon SageMaker Jumpstart</h3><h4>The first GenAI use case you should build for your enterprise.</h4><p>Working at AWS constantly reminds me of how quickly things change in the realm of technology. Since AWS’ Generative AI tools were first announced on April 13, it almost seems as every teams’ horizon-one strategy now contains Generative AI. The recently announced $100M <a href="https://press.aboutamazon.com/2023/6/aws-announces-generative-ai-innovation-center">Generative AI Innovation Center</a> will also help the cause. This culture is amazing because it forces you to upskill yourself to better serve your customers and peers.</p><p>And so the other day, my manager and I thought of an idea: A Q&amp;A Bot to answer any questions related to our partly-ambigious role. Not the sexiest idea, but if done correctly, it’ll have a profound impact on the productivity of myself and my peers.</p><p>This solution uses the Retrieval Augmented Generation (RAG) architecture pattern, as well as <a href="https://python.langchain.com/docs/get_started">LangChain</a>, a Python framework for developing LLM-based applications. We’ll utilize the HuggingFace Model Hub in conjunction with SageMaker JumpStart to deploy our LLMs. Finally, we’ll host the interface as a web application on Streamlit. Let’s dive a bit deeper.</p><h3>Deploying the Solution</h3><h4>Amazon SageMaker Jumpstart</h4><p><a href="https://aws.amazon.com/sagemaker/jumpstart/?sagemaker-data-wrangler-whats-new.sort-by=item.additionalFields.postDateTime&amp;sagemaker-data-wrangler-whats-new.sort-order=desc">Amazon SageMaker Jumpstart</a> is a Machine Learning hub with pretrained models like foundation models to perform generative tasks. With Jumpstart, you can experiment with models before choosing one for deployment, and customize your selected foundation models without training them from scratch.</p><h4>LangChain</h4><p>LangChain is a Python framework for developing LLM-based applications. They make it easy to develop common generative AI use cases while also <a href="https://python.langchain.com/docs/modules/model_io/models/llms/integrations/sagemaker">integrating with SageMaker Jumpstart</a>.</p><h4>Retrieval Augmented Generation (RAG)</h4><p>Retrieval Augmented Generation is an approach that combines the benefits of information retrieval and content generation. To understand how this architecture pattern works more clearly, let’s look at the architecture diagram for our Q&amp;A bot below:</p><ol><li>First, we <strong>create a document store</strong> of the domain-specific data we want to augment an existing LLM with.</li><li>We use the <strong>GPT-J-6B</strong> Embeddings foundation model to provide embeddings for each document in our new knowledge library. These embeddings are saved in a vector database, in this case <a href="https://github.com/facebookresearch/faiss">FAISS (Facebook’s vector database)</a>. This vector database is saved as an <em>index.faiss.</em></li><li>So when a user asks a question with our chatbot, we perform a similarity search of that query against the top <em>k</em> most relevant documents in our vector index. This similarity search retrieves chunks of the top k most relevant documents.</li><li>These top k document chunks + the user’s query are passed into our main FM: Google’s <a href="https://huggingface.co/google/flan-t5-xxl">FLAN-T5 XXL</a>, one of the best text-to-text generation FMs out there (see <a href="https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard">OpenLLM leaderboard</a> for LLM rankings). The response is outputted to our user.</li></ol><p>The combination of retrieval and generation allows for a dynamic and efficient content creation process, where we are leveraging domain-specific data to generate new and informative text. For this solution, we will be using <a href="https://streamlit.io/">Streamlit</a> to deploy the code as a web app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qpe3DIR0eD0LKTDozKBQeg.png" /><figcaption>Retrieval Augmented Generation</figcaption></figure><p><strong>NOTE</strong>: For those of you new to AWS, make sure you make an account at the following <a href="https://aws.amazon.com/console/">link</a> if you want to follow along. If you’re not completely familiar with SageMaker Deployment, I would suggest following this <a href="https://aws.amazon.com/blogs/machine-learning/part-2-model-hosting-patterns-in-amazon-sagemaker-getting-started-with-deploying-real-time-models-on-sagemaker/">article</a> to understand Deployment/Inference more in depth. In this post, I’ll be highlighting the key code snippets that make this solution possible, but feel free to check out similar <a href="https://github.com/aws/amazon-sagemaker-examples/blob/main/introduction_to_amazon_algorithms/jumpstart-foundation-models/question_answering_retrieval_augmented_generation/question_answering_jumpstart_knn.ipynb">code</a> here after.</p><h4>Creating and Deploying the LLM Endpoints</h4><p>First, let’s import all the required modules from SageMaker and LangChain and create a SageMaker session.</p><pre>import time, os<br>import sagemaker, boto3, json<br>from sagemaker.session import Session<br>from sagemaker.model import Model<br>from sagemaker import image_uris, model_uris, script_uris, hyperparameters<br>from sagemaker.predictor import Predictor<br>from sagemaker.utils import name_from_base<br>from typing import Any, Dict, List, Optional<br>from langchain.embeddings import SagemakerEndpointEmbeddings<br>from langchain.llms.sagemaker_endpoint import ContentHandlerBase<br><br>sagemaker_session = Session()<br>aws_role = sagemaker_session.get_caller_identity_arn()<br>aws_region = boto3.Session().region_name<br>sess = sagemaker.Session()<br>model_version = &quot;*&quot;</pre><p>When deploying SageMaker endpoints, we need to provide a parse function to get the actual answer from the JSON output it provides. Then, let’s set the config parameters for both our <a href="https://huggingface.co/google/flan-t5-xxl">main FM</a> and our <a href="https://huggingface.co/EleutherAI/gpt-j-6b">Embeddings FM</a>, which we’re importing from <a href="https://huggingface.co/">HuggingFace</a>.</p><p>For LLMs, GPU instances are recommended to have enough compute and storage to deploy applications. We’re using a ml.g5.12xlarge and ml.g5.24xlarge as our instance type, but feel free to change it to a smaller type.</p><pre>def parse_response_model_flan_t5(query_response):<br>    model_predictions = json.loads(query_response[&quot;Body&quot;].read())<br>    generated_text = model_predictions[&quot;generated_texts&quot;]<br>    return generated_text<br><br>_MODEL_CONFIG_ = {<br>    &quot;huggingface-text2text-flan-t5-xxl&quot;: {<br>        &quot;instance type&quot;: &quot;ml.g5.12xlarge&quot;,<br>        &quot;env&quot;: {&quot;SAGEMAKER_MODEL_SERVER_WORKERS&quot;: &quot;1&quot;, &quot;TS_DEFAULT_WORKERS_PER_MODEL&quot;: &quot;1&quot;},<br>        &quot;parse_function&quot;: parse_response_model_flan_t5,<br>        &quot;prompt&quot;: &quot;&quot;&quot;Answer based on context:\n\n{context}\n\n{question}&quot;&quot;&quot;,<br>    },<br>    &quot;huggingface-textembedding-gpt-j-6b&quot;: {<br>        &quot;instance type&quot;: &quot;ml.g5.24xlarge&quot;,<br>        &quot;env&quot;: {&quot;SAGEMAKER_MODEL_SERVER_WORKERS&quot;: &quot;1&quot;, &quot;TS_DEFAULT_WORKERS_PER_MODEL&quot;: &quot;1&quot;},<br>    },<br>}</pre><p>Now, let’s deploy two endpoints based on our configurations. For each model, we retrieve the config we just set, and the image URI and model URI from HuggingFace. Then we deploy the model as an endpoint, which we’ll be calling from our Streamlit application.</p><p>This can take several minutes, but once its complete, you can go into the SageMaker console and see your two endpoints in the <em>Inference</em> section.</p><pre>newline, bold, unbold = &quot;\n&quot;, &quot;\033[1m&quot;, &quot;\033[0m&quot;<br><br>for model_id in _MODEL_CONFIG_:<br>    endpoint_name = name_from_base(f&quot;jumpstart-example-raglc-{model_id}&quot;)<br>    inference_instance_type = _MODEL_CONFIG_[model_id][&quot;instance type&quot;]<br><br>    # Retrieve the inference container uri. This is the base HuggingFace container image for the default model above.<br>    deploy_image_uri = image_uris.retrieve(<br>        region=None,<br>        framework=None,  # automatically inferred from model_id<br>        image_scope=&quot;inference&quot;,<br>        model_id=model_id,<br>        model_version=model_version,<br>        instance_type=inference_instance_type,<br>    )<br>    # Retrieve the model uri.<br>    model_uri = model_uris.retrieve(<br>        model_id=model_id, model_version=model_version, model_scope=&quot;inference&quot;<br>    )<br>    model_inference = Model(<br>        image_uri=deploy_image_uri,<br>        model_data=model_uri,<br>        role=aws_role,<br>        predictor_cls=Predictor,<br>        name=endpoint_name,<br>        env=_MODEL_CONFIG_[model_id][&quot;env&quot;],<br>    )<br>    model_predictor_inference = model_inference.deploy(<br>        initial_instance_count=1,<br>        instance_type=inference_instance_type,<br>        predictor_cls=Predictor,<br>        endpoint_name=endpoint_name,<br>    )<br>    print(f&quot;{bold}Model {model_id} has been deployed successfully.{unbold}{newline}&quot;)<br>    _MODEL_CONFIG_[model_id][&quot;endpoint_name&quot;] = endpoint_name</pre><pre>------------!Model huggingface-text2text-flan-t5-xxl has been deployed successfully.<br><br>--------------!Model huggingface-textembedding-gpt-j-6b has been deployed successfully.</pre><h4>Creating a Vector Index with LangChain and FAISS</h4><p>Since this was a bot built for other Customer Solutions Managers (CSMs) at AWS, I had downloaded 50 PDF documents related to the CSM role and placed them in a folder, but feel free to use your own data. Here we’re using LangChain to load these 50 documents into a Directory loader.</p><pre>from langchain.document_loaders import DirectoryLoader<br>from langchain.indexes import VectorstoreIndexCreator<br>from langchain.vectorstores import Chroma, AtlasDB, FAISS<br>from langchain.text_splitter import CharacterTextSplitter, RecursiveCharacterTextSplitter<br><br>loader = DirectoryLoader(&quot;csm_data/&quot;, show_progress=True)<br>data = loader.load()<br><br># Chunk our documents into smaller sizes for better responses<br>text_splitter=RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=200)<br>chunks=text_splitter.split_documents(data)<br># Use FAISS to create a vector index from our doc chunks and embeddings FM<br>db = FAISS.from_documents(chunks, embeddings)<br>db.save_local(&quot;csm_chunks_index&quot;) #save vector DB to file</pre><h4>Wrapping the Endpoints for LangChain</h4><p>Now, we’re going to start using Streamlit to host our web application, and call our endpoints whenever a user asks a question. In a new file called <em>streamlit.py</em>, we are wrapping our SageMaker endpoints into Content Handlers recognized by LangChain.</p><p>Each class requires a small overwrite of the <strong>SagemakerEndpointEmbeddings</strong> class to make it compatible with our models, hence our creation of the <strong>ContentHandler</strong> and <strong>SMLLMContentHandler</strong> class.</p><pre>from typing import Any, Dict, List, Optional<br>from langchain.llms.sagemaker_endpoint import ContentHandlerBase, LLMContentHandler<br>from langchain.vectorstores import FAISS<br>from langchain.prompts import PromptTemplate<br>import json<br>from langchain import HuggingFacePipeline<br>from langchain import LLMChain, SagemakerEndpoint<br>from langchain.chains.question_answering import load_qa_chain<br><br><br>class SagemakerEndpointEmbeddingsJumpStart(SagemakerEndpointEmbeddings):<br>    def embed_documents(self, texts: List[str], chunk_size: int = 5) -&gt; List[List[float]]:<br>        &quot;&quot;&quot;Compute doc embeddings using a SageMaker Inference Endpoint.<br><br>        Args:<br>            texts: The list of texts to embed.<br>            chunk_size: The chunk size defines how many input texts will<br>                be grouped together as request. If None, will use the<br>                chunk size specified by the class.<br><br>        Returns:<br>            List of embeddings, one for each text.<br>        &quot;&quot;&quot;<br>        results = []<br>        _chunk_size = len(texts) if chunk_size &gt; len(texts) else chunk_size<br><br>        for i in range(0, len(texts), _chunk_size):<br>            response = self._embedding_func(texts[i : i + _chunk_size])<br>            print<br>            results.extend(response)<br>        return results<br><br><br>class ContentHandler(EmbeddingsContentHandler):<br>    content_type = &quot;application/json&quot;<br>    accepts = &quot;application/json&quot;<br><br>    def transform_input(self, prompt: str, model_kwargs={}) -&gt; bytes:<br>        input_str = json.dumps({&quot;text_inputs&quot;: prompt, **model_kwargs})<br>        return input_str.encode(&quot;utf-8&quot;)<br><br>    def transform_output(self, output: bytes) -&gt; str:<br>        response_json = json.loads(output.read().decode(&quot;utf-8&quot;))<br>        embeddings = response_json[&quot;embedding&quot;]<br>        return embeddings<br>    <br>class SMLLMContentHandler(LLMContentHandler):<br>    content_type = &quot;application/json&quot;<br>    accepts = &quot;application/json&quot;<br><br>    def transform_input(self, prompt: str, model_kwargs: Dict) -&gt; bytes:<br>        input_str = json.dumps({&quot;text_inputs&quot;: prompt, **model_kwargs})<br>        return input_str.encode(&quot;utf-8&quot;)<br><br>    def transform_output(self, output: bytes) -&gt; str:<br>        response_json = json.loads(output.read().decode(&quot;utf-8&quot;))<br>        print (response_json)<br>        return response_json[&quot;generated_texts&quot;][0]</pre><p>Let’s create these content handlers, and the embeddings wrapper.</p><pre>content_handler = ContentHandler()<br><br>llm_content_handler = SMLLMContentHandler()<br><br>embeddings = SagemakerEndpointEmbeddingsJumpStart(<br>    endpoint_name=&quot;jumpstart-example-raglc-huggingface-tex-2023-07-12-15-07-07-189&quot;,<br>    region_name=&quot;us-east-2&quot;,<br>    content_handler=content_handler,<br>)</pre><h4>Deploying the App on Streamlit</h4><p>Almost there! Now, we are creating a streamlit front-end where the user can ask a question and receive a response with our endpoints. If you remember from earlier, our similarity search is performed on the top-k documents, which we’re setting as k = 3 here. We then create a prompt template, passing our search_results as context to the LLM.</p><p>In load_qa_chain, we are passing in our prompt (query + context) into the FLAN-T5 endpoint, with a few hyperparameters:</p><ul><li><strong>temperature</strong>: a setting that controls the randomness or creativity of the generated text. It influences the diversity of the model’s output.</li><li><strong>max_new_tokens: </strong>this setting controls the length of our response, in the number of tokens we want to respond with excluding our prompt length</li></ul><pre>st.title(&quot;Q&amp;A Bot 💬&quot;)<br>query = st.text_input(&quot;What would you like to know?&quot;)<br><br>if st.button(&quot;Search&quot;):<br><br>    db = FAISS.load_local(&quot;csm_chunks_index&quot;, embeddings)<br>    search_results = db.similarity_search(query, k=3)<br>    <br>    <br>    with st.spinner(&quot;Answering...&quot;):<br>        template = &quot;&quot;&quot;<br>        Please answer the following question using the context provided. If you don&#39;t know the answer, just make a guess.<br><br>        CONTEXT: <br>        {context}<br>        =========<br>        QUESTION: {question} <br>        ANSWER: &quot;&quot;&quot;<br>        PROMPT = PromptTemplate(template=template, input_variables=[&quot;context&quot;, &quot;question&quot;])<br>        #llm = HuggingFacePipeline.from_model_id(model_id=&quot;google/flan-t5-xxl&quot;, task=&quot;text2text-generation&quot;, model_kwargs={&quot;temperature&quot;:0.1, &quot;max_length&quot;:500})<br>        <br>        llm_chain = load_qa_chain(<br>            llm=SagemakerEndpoint(<br>                endpoint_name=&quot;jumpstart-example-raglc-huggingface-tex-2023-07-12-15-00-33-621&quot;,<br>                region_name=&quot;us-east-2&quot;,<br>                model_kwargs={&quot;temperature&quot;: 0.8, &quot;max_new_tokens&quot;:1024},<br>                content_handler=llm_content_handler,<br><br>            ),<br>            prompt=PROMPT,<br>        )<br><br>        response = llm_chain.run({&quot;question&quot;: query, &quot;input_documents&quot;: search_results})<br><br>        # Get the response from GPT-4<br>        st.markdown(&quot;### Answer:&quot;)<br>        st.write(response)</pre><p>We’re done! Run the application by running:</p><pre>streamlit run streamlit.py</pre><p>You should now be able to use your new web app at:</p><pre>https://&lt;studio-name&gt;.studio.&lt;region&gt;.sagemaker.aws/jupyter/default/proxy/8501/</pre><h3>Conclusion</h3><p>This post highlights an ML architecture pattern known as Retrieval Augmented Generation, or RAG. We can use RAG to augment an existing LLM to our own domain-specific data, tailoring our application to our specific needs.</p><p>To see the full code, view this <a href="https://github.com/aws/amazon-sagemaker-examples/blob/main/introduction_to_amazon_algorithms/jumpstart-foundation-models/question_answering_retrieval_augmented_generation/question_answering_langchain_jumpstart.ipynb">sample github repo</a>. If you want to learn about RAG on SageMaker <em>Jumpstart</em>, I recommend reading this <a href="https://aws.amazon.com/blogs/machine-learning/question-answering-using-retrieval-augmented-generation-with-foundation-models-in-amazon-sagemaker-jumpstart/">blog</a>. I also want to thank <a href="https://medium.com/u/6e49569edd2b">Ram Vegiraju</a> for staying late at the office with me fine-tuning this. If you ever want to learn more about ML Inference, he’s your guy.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cc16765efa6b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>