<?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 Arun Prasad on Medium]]></title>
        <description><![CDATA[Stories by Arun Prasad on Medium]]></description>
        <link>https://medium.com/@arundona?source=rss-8ee45bb69987------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*lYy32-YtYFPYlphQ</url>
            <title>Stories by Arun Prasad on Medium</title>
            <link>https://medium.com/@arundona?source=rss-8ee45bb69987------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 19:52:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@arundona/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[AI Search Doesn’t Have a Rank. It Has Five Axes.]]></title>
            <link>https://medium.com/@arundona/ai-search-doesnt-have-a-rank-it-has-five-axes-e6a5a069193a?source=rss-8ee45bb69987------2</link>
            <guid isPermaLink="false">https://medium.com/p/e6a5a069193a</guid>
            <category><![CDATA[seo-tips]]></category>
            <category><![CDATA[aeo]]></category>
            <category><![CDATA[ai-search]]></category>
            <category><![CDATA[seo]]></category>
            <dc:creator><![CDATA[Arun Prasad]]></dc:creator>
            <pubDate>Thu, 16 Jul 2026 11:34:59 GMT</pubDate>
            <atom:updated>2026-07-16T11:34:59.510Z</atom:updated>
            <content:encoded><![CDATA[<p><em>For many queries, ChatGPT now responds with a sorted comparison grid, a superlative for each brand, a shortlist, an offer to personalise and, increasingly an ad in the free tier account.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*HamONgNazFg7iWGBN1Xx3w.png" /></figure><h3>I ran 32 insurance queries through ChatGPT. Brands are being sorted into cells and no single number can tell you how you’re doing.</h3><p>I ran a batch of ordinary Australian consumer insurance queries through ChatGPT. They are buying intent queries which consumers type when they’re about to make a decision.</p><p>These queries included seven categories (car, home, life, pet, motorcycle, travel, roadside assistance) across three intent framings each: <em>best X</em>, <em>best value X</em>, <em>cheap X</em>.</p><p>What surprised me was the shape of the default response from ChatGPT. ChatGPT is not responding with a list of brands and links, instead it now provides sorted comparison grid, each brand is categorised across different perspectives, followed by offer to personalise advise and, increasingly an ad in the free tier account.</p><p>This combination is a new competitive surface which forces CMO’s to shift how they think of measuring success in AI Search. The biggest shift is this: there is no rank to climb, instead there are five separate axes which move independently. The biggest challenge is that brands can improve on one while going backwards on another without noticing.</p><h3>1. The format is intent-gated</h3><p>If I had tested only one phrasing, I would have missed this finding.</p><ul><li>“Best X” and “best value X” → a table. ChatGPT responds with a comparison grid with multiple columns. The columns are almost identical every time and include , the brand, a <em>“Best for”</em> cell, a strengths cell, and a <em>“Things to watch” / “Potential downside”</em> cell.</li><li>“Cheap X” → no table. The ChatGPT response is a flat bulleted list of four brands with price tips. It does not have “Best for” assignments or superlatives.</li><li>One run of <em>“best motorcycle insurance”</em> returned a third thing entirely. ChatGPT responded with a card deck. It had each brand in its own panel with a pill label e.g. <em>Best for enthusiasts &amp; modified bikes</em>, <em>Best all-round comprehensive cover</em>, <em>Best for price-conscious riders</em>.</li></ul><p>The format is an indication that the table appears when the model has framed the task as choosing between named brands. The bullet list appears when it has framed the task as finding a low number.</p><p>Based on the job, ChatGPT adjusts both response format and brand positioning. We also see that ChatGPT understands the nuance of Value Vs Price, which makes it important for brands to disentangle value positioning from a price based positioning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jfQ94IGFf9xZ0drcIiGA6A.png" /></figure><h3>2. The single axis is gone</h3><p>Traditional search had one axis: rank. Brands would measure their rank within ten positions; it was a a single ladder to climb and every SEO decision could be scored against a single question — did the brand’s clickable link go up?</p><p>AI search has no ladder. It’s replaced with a grid with named cells, and a brand’s standing is the sum of five independent measures:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A_Rjx9gulEWqiVlhJy-WJw.png" /></figure><p>These are not five derived views of one metric but five different metrics, and the critical property is that they move independently.</p><p>You can hold a strong slot but have almost no coverage. You can have total presence but with a liability that quietly kills conversion. You can have zero organic standing and buy your way onto the screen through an ad.</p><p>Which means the single “AI visibility score” that most tools sell you , one number, up or down is an average across five axes that point in different directions, and averaging them destroys the only information you could have acted on.</p><h3>3. Four brands, five axes, four completely different problems</h3><p>Here is what the same dataset looks like when you score it properly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*19jG1dF7_QpGERQW9jeKIQ.png" /></figure><p>The picture emerges when you read across the rows and compare their brand position.</p><p>Allianz has an excellent slot, <em>comprehensive cover</em>, which is essentially uncontested. It also has coverage of one framing out of three. It has been excluded from every price led conversation in car insurance. A single visibility score would show Allianz as “present and healthy.” The axes show a brand that is invisible two-thirds along the Coverage axes.</p><p>Bingle is the inverse: narrow presence, one category, but it <em>owns</em> its cell so completely that no one is competing for it. That is not a weak position but a defensible one. A dashboard optimising for mention volume would tell Bingle to broaden. That would be the wrong advice if the C-level is focused on category ownership by dominating through “lowest premiums” brand message.</p><p>1Cover scores zero on axes 1 through 4 in travel insurance but appears on screen anyway, twice, because it bought the fifth axis. Every organic travel winner is there; 1Cover is not. It purchased adjacency to an answer it could not earn.</p><p>Budget Direct is the only brand scoring on all five. I will share more on that below.</p><p>We now see four brands with four genuinely different strategies.</p><p>Traditional SEO ranking or a simple AEO mentions number would not guide any of the brands on what they should do next.</p><h3>4. The axes you’re scored on vs. the levers that move them</h3><p>The are worth separating, because CMOs keep being sold by AEO tools that the two as if they are the same thing.</p><p>The levers that drive the outcomes along the five axes are different.</p><ul><li>Attribute vocabulary : the model sorts on attributes, so it needs attributes. Brand messaging like <em>“We’re on your side”</em> sorts into nothing. <em>Flood cover. Agreed value. No age-based excess. Riding gear cover.</em>, help ChatGPT sort/categorise. This is the lever that decides the outcome for Slot.</li><li>The citation supply chain : Finder, Canstar, CHOICE, Mozo, Reddit. This is the lever that moves Presence and Liability.</li><li>Intent-side content : whether your brand is described in price language anywhere at all. This is the lever that moves Coverage.</li><li>Paid Ad : the lever that moves Door.</li></ul><h3>5. Changing one word changes the competitive landscape</h3><p>For the same category, three different phrasings will paint three different competitive landscapes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YaFT_fNecxbkUtpUquPyPQ.png" /></figure><p>ING and Coles exist only in the <em>cheap</em> universe. Allianz and the motoring clubs only in <em>best</em>. ROLLiN’ surfaces only under <em>best value</em>.</p><p>In this case we are considering the Axes 3, Coverage. Brands also have to measure the how they stack up in Axes 4, Liability , to assess whether it is decreasing their probability of getting chosen by the consumer.</p><h3>6. Every AI recommendation ships with a pre-loaded objection</h3><p>Axis 4. Every brand in every table gets a liability assigned to it, unprompted:</p><ul><li>Bingle — <em>fewer extras, less personalised service</em></li><li>Youi — <em>often more expensive for average drivers; quotes require a phone call</em></li><li>Allianz — <em>usually costs more</em></li><li>Budget Direct — <em>check annual benefit limits and excess options</em></li><li>Pet Insurance Australia — <em>premiums vary significantly by breed and age</em></li><li>QBE (motorcycle) — <em>no roadside assistance option</em></li></ul><p>The table format in ChatGPT delivers symmetry to the consumer; a strengths column implies a weaknesses and it is filled in the ChatGPT response either in an adjacent column or further down in the response.</p><p>Brands now have to face the challenge of monitoring and measuring the impact of a machine generated objection sitting beside their brand name, delivered to a purchase-intent consumer, before they have visited a single brand website page.</p><p>Objection handling which used to live on a brands landing page now surfaces in a comparison grid cell which brands don’t control, sourced from material they may have not read.</p><p>Brands have spent three years learning to manage zero-click. This is now an additional challenge since perception is being shaped before the consumer meets the brands message. If left unaudited and unmanaged, this stale liability compounds to get re-cited, re-summarised, and hardens into what the model simply <em>knows</em> about the brand.</p><h3>7. The ads have arrived and now there are two doors</h3><p>Axis 5 is the newest.</p><p>In the second batch, fourteen of nineteen answers carried a sponsored unit below the response. Budget Direct in most. TAL under life insurance. 1Cover under travel.</p><p>A brand bought its way into a category it had lost. The organic travel table lists ReadySet, Zoom, Insure4Less, Tick, Fast Cover, Southern Cross and InsureandGo. 1Cover appears in none of them but appears twice in the ad slot.</p><p>One brand holds both doors. Budget Direct sits <em>in the organic table</em> and <em>in the ad unit underneath it</em>. Its now in the same screen through both earned and paid position.</p><p>The targeting is currently loose. Budget Direct’s car insurance creative ran beneath a pet insurance answer and a motorcycle answer. This is less precision placement than buying category wide presence and letting relevance sort itself out. It could also mean that Budget Direct has identified an arbitrage window in ad costs across Google and ChatGPT for the target audience. At Somantra we anticipate that this arbitrage will close as more brands find the surface and bid the slots up.</p><p>One caveat worth stating plainly: the ad-bearing batch was run on a free-tier account. This has a sharp implication for ICP (Ideal Customer Profile) modelling: whether your customer is on a free or paid plan determines whether they see a commercial layer at all.</p><h3>8. Third Party Topic Authorities can be the kingmakers</h3><p>In travel insurance it isn’t subtle. Nearly every organic winner is justified with the same credential: <em>“Winner of Finder’s 2026 Best Comprehensive Travel Insurance award.” “Awarded Best Value International Travel Insurance by Finder.” “Winner of Finder’s 2026 Best Domestic Travel Insurance award.”</em></p><p>In that category, a third party topic authority, the Finder awards list is not <em>evidence for</em> the ranking. It effectively is the ranking.</p><p>Across both batches, the citations were overwhelmingly Finder, Canstar, CHOICE, Mozo, Reddit , not insurer websites. Your comparison-site profile and your awards submissions are now distribution infrastructure, not just marketing hygiene.</p><h3>9. The case study: Budget Direct scores on all five</h3><p>One brand appeared in every category tested and across all three intent framings.</p><p>It’s recurring slot is some variant of <em>value</em> or <em>lower premiums</em> and carries a consistent liability (<em>claims experience more mixed than premium brands</em>).</p><p>It is not the strongest brand in any of these categories but it is the most legible brand with clear brand positioning for AI Search. It has been so consistently described as <em>the value option</em> across the entire third-party corpus that the model reaches for it by reflex in every category, at every price framing. Budget Direct then reinforces this by buying the ad slot underneath.</p><p>That is not a keyword strategy but a positioning strategy, executed with enough persistence that a machine learned it and it is now compounding across seven product lines the brand never had to win individually.</p><h3>What CMOs should actually do to win in AI Search.</h3><p>1. Stop asking “how visible are we?” Start asking five questions. Presence, slot, coverage, liability, door. One number averages them into meaninglessness.</p><p>2. Pick your cell and make it undeniable. Not “best.” Decide which <em>Best for</em> you intend to own, and make sure the vocabulary of that cell attaches to your name, repeatedly, in the corpus the model reads.</p><p>3. Test every intent framing. Best, best value, cheap, cheapest, comparison, quotes, discount. AI Search is a conversational experience for consumers allowing them to express a richer and varied set of intents. You cannot measure your brand position accurately unless you model the diverse intents of your customers.</p><p>4. Audit your liability line. What do the models say is wrong with you, and where did they get it? Some will be true and fixable. Some will be a stale artefact from a 2023 review. The second is worth correcting at source.</p><p>5. Work the citation supply chain. Finder, Canstar, CHOICE, Mozo and the awards. In some categories the award list <em>is</em> the ranking. Awards are now a distribution channel. Identify third party publishers who are topic authorities for your customers.</p><p>6. Price the second door. The ad slot is live in AU insurance, targeting is loose, and at least one brand is using it to buy presence it could not earn. It is currently cheap and it is currently working. [ <em>We are not paid by ChatGPT to promote their platform</em> ]</p><h3>One honest caveat</h3><p>Model outputs are probabilistic. I ran <em>“best motorcycle insurance Australia”</em> twice and got two different layouts- a table one time, a card deck the other.</p><p>A brand that appears in five of ten runs is in a genuinely different position from one that appears in ten of ten, and you cannot tell those apart from a single screenshot. Every axis above is a distribution, not a fact.</p><p>If you’re not sampling systematically, you are not measuring but simply collecting anecdotes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e6a5a069193a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How AI Search Engines Guide You to a Decision]]></title>
            <link>https://medium.com/@arundona/how-ai-search-engines-guide-you-to-a-decision-9dadc0b1ef11?source=rss-8ee45bb69987------2</link>
            <guid isPermaLink="false">https://medium.com/p/9dadc0b1ef11</guid>
            <category><![CDATA[ai-search-engine]]></category>
            <category><![CDATA[ai-search-optimization]]></category>
            <category><![CDATA[geo]]></category>
            <category><![CDATA[aeo]]></category>
            <category><![CDATA[ai-search]]></category>
            <dc:creator><![CDATA[Arun Prasad]]></dc:creator>
            <pubDate>Sat, 07 Mar 2026 21:13:53 GMT</pubDate>
            <atom:updated>2026-03-07T21:13:53.942Z</atom:updated>
            <content:encoded><![CDATA[<h3>Step-by-step breakdown of the Advisory Narrative , the hidden structure that turns a search query into a trusted buying journey.</h3><figure><img alt="AI does not search , it guides" src="https://cdn-images-1.medium.com/max/1024/1*Ajd-56gN9TO-qj2FGPPoYw.png" /></figure><blockquote>Traditional search engines hand you a list of links and leave you to figure it out. AI search engines do something fundamentally different by acting as advisors. They don’t just retrieve information but go further by sequencing it as guidance, walking you through <strong>a structured narrative that progressively builds confidence until you are ready to act.</strong></blockquote><p>The following conversation is a real exchange on ChatGPT about buying a used Nissan X-Trail in Northern Sydney, Australia. It is a textbook example of this <strong>Advisory Narrative</strong> in action. Let’s break it down stage by stage.</p><h4>Stage One · The Opening Query</h4><h3>Establish Expertise</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SlYWgItyH-xh7YhBznE1AA.png" /></figure><blockquote>Notice what just happened: the user asked “what do you suggest?” and the AI’s very first sentence wasn’t a list but a <strong>strategic reframe</strong> by stating “search on private-seller marketplaces, not dealer sites.” This positions the AI not as a search tool, but as an expert guide who already knows the landscape better than you do.</blockquote><h4>Stage Two · Market Orientation</h4><h3>Map the Landscape Before They Browse</h3><p>Before the user opens a single listing, the AI constructs a <strong>mental model of the entire market</strong>. It maps three platforms, gives example prices, names specific suburbs, and provides real example listings with approximate prices. Without having to do a single search themselves, the user now understands the shape of the market, the price ranges, where to look, and what’s realistic.</p><p>This is a critical <strong>advisory technique:</strong> <strong>orient before you direct</strong>. A good financial advisor first explain the market conditions before telling you which stock to buy. The AI does the same here, giving the user confidence that the eventual recommendation will be grounded in real-world context.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8PmOpgL0sNntem3MF8IwrQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_ngJt4ryVnk-VZWg_LhDpg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PSGps4HnX1NgKnvPyMNrUA.png" /></figure><h4>Stage Three · Recommendation</h4><h3>Narrow to a Specific Target — Unprompted</h3><p>Here’s where the AI moves from informing to <strong>advising</strong>. Without being asked, it prescribes a specific vehicle configuration with a target spec sheet including year, trim, engine, mileage, price range, and even preferred number of previous owners. This transforms the user from a passive browser into an <strong>active decision-maker with clear criteria</strong>. They now know exactly what they’re looking for.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4j-QNXBDaAOWFShtQuKbXA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_g8q6NC-Gva3v8sHu5iSKg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KUTds4Hjlnky40_AVAqY9g.png" /></figure><blockquote>The phrase “If I were buying today” is a masterclass in <strong>advisory framing</strong>. It creates personal stakes and mild urgency, while making the recommendation feel human and considered rather than algorithmic. This is how trusted advisors speak with personal conviction, not just data.</blockquote><h4>Stage Four · Risk Intelligence</h4><h3>Layer Risk Warnings to Build Trust</h3><p>After the user’s follow-up question (“find the best deal under $20K and avoid years with issues”), the AI doesn’t restart the conversation instead it <strong>layers new intelligence onto the existing framework</strong>. The risk matrix (years to avoid, specific technical faults) deepens the advisory relationship. Now the AI isn’t just a recommender but also a <strong>protector</strong>, helping the user avoid costly mistakes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qZSA5fbTjjR0m5TwaluuLw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GCcZFT6NZKJyEOfk8vagzg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J4pGtmfeFVJTFh2voxtpEw.png" /></figure><p>The pre-purchase checklist is a particularly powerful advisory device. It reduces buyer anxiety by converting abstract risk (“what if something’s wrong with it?”) into a <strong>concrete, actionable protocol</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6z-45D6kayJVH4SY9LUiUQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o62-8i4QpYr30Kl_ljbCmw.png" /></figure><h4>Stage Five · The Next Step Offer</h4><h3>Pre-empt the Next Question &amp; Keep the Journey Moving</h3><p>At the end of <em>both</em> responses, the AI offers a structured menu of next steps. This is not accidental but a deliberate technique to <strong>guide the user’s next move</strong> rather than leave them to wander off. It anticipates what a well-advised buyer would logically want to know next, and surfaces those options explicitly. The conversation becomes a <strong>progressive journey</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6uN9GAUAS9EA8EZDvf5D0A.png" /></figure><blockquote>This continuation offer is the AI equivalent of a good advisor saying “Here’s where we are and here’s where we can go next.”<strong> It keeps the user inside the advisory conversation rather than returning to a blank search box. </strong>The journey has momentum, direction, and a sense of being guided by someone who knows the destination.</blockquote><h3>The Advisory Narrative Formula</h3><p>The AI follows a repeatable, six-part <strong>advisory arc </strong>that mirrors how a trusted human professional would guide a client:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*SSb_PH1B-zWprWvIJVMC2w.png" /></figure><p>This structure is structurally identical to how a mortgage broker, financial planner, or experienced real estate agent guides a client, except it is delivered instantly, at scale, and personalised to the exact query.</p><h3>The AI Doesn’t Search.It <em>Guides.</em></h3><p>The real power of AI search engines isn’t in finding information but in <strong>sequencing information as advice</strong>. By the end of this conversation, the user doesn’t just have data. They have a target, a shortlist, a risk checklist, and a clear path forward. They’ve been advised and guided in a conversation not responded to a search.</p><h3>That’s the Advisory Narrative. And it’s changing what it means to search for anything.</h3><p>Contact <a href="https://www.somantra.ai/contact-somantra">Somantra</a> if you want to know how brands are leveraging advisory narrative framework to grow brand mindhare on AI Search Engines.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9dadc0b1ef11" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Before you deploy AI agents , read this to avoid future headaches.]]></title>
            <link>https://medium.com/@arundona/before-you-deploy-ai-agents-read-this-to-avoid-future-headaches-a9636ce81459?source=rss-8ee45bb69987------2</link>
            <guid isPermaLink="false">https://medium.com/p/a9636ce81459</guid>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Arun Prasad]]></dc:creator>
            <pubDate>Tue, 10 Jun 2025 07:34:47 GMT</pubDate>
            <atom:updated>2025-06-10T07:34:47.481Z</atom:updated>
            <content:encoded><![CDATA[<h3>Before you deploy AI agents , read this to avoid future headaches.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eWCklsOe-gNNvP9c4o6Jng.png" /></figure><p>Ever wonder what really slows down AI agents? It’s not some sci-fi glitch but the everyday headaches — slow response times, unexpected glitches, and those pesky biases hiding under the hood. These and other issues show that real AI work is messier than the flawless demos we usually see.</p><p>Let’s peek inside the world of AI agents, where latency and data quality play starring roles. You’ll find practical tips to ease deployment pains and maybe even learn to appreciate the quirks your digital assistant throws your way.</p><h3>Taming Latency in AI Agent Systems</h3><p>Ever found yourself stuck starring at a spinning wheel, waiting for something to load? We’ve all wasted time there. Now multiply that frustration when it’s your AI agent, held up because it’s waiting on data. Speed matters more than just convenience here; it’s essential for AI to work effectively. No one wants slow smart systems spoiling the whole show.</p><p>Imagine an AI agent responsible for managing delivery trucks — it’s supposed to optimize routes in real-time but slows down because the traffic data isn’t arriving fast enough. Or think of a security system designed to catch threats immediately — if it’s delayed, critical alerts slip through. Developers feel the pinch too when their clever code gets throttled by sluggish data flows.</p><p>So how do we deal with this maddening wait? It boils down to a few key strategies that keep the AI moving:</p><h4>Upgrading Infrastructure and Putting Data Close</h4><p>It’s not just about having faster servers and stronger networks. Smart data placement matters hugely — you want data stored close to the place it’s used, not stuck halfway around the world. The type of agent also affects this. Large language models or deep-learning frameworks need powerful GPUs or specialized hardware to run smoothly, while simpler rule-driven agents often manage fine on standard CPUs. Picking the right setup depends on what the agent needs and how much data it handles.</p><p>Cloud platforms like AWS, Azure, and Google Cloud make it easier to scale agent processing on the fly, while tools like Docker and Kubernetes help you deploy AI agents consistently across various environments.</p><h4>Streamlining Data Pipelines for Speed and Accuracy</h4><p>Data pipelines need to be clean, fast, and focused on what matters most. AI agents collect telemetry data, spot inefficiencies, and suggest ways to improve how systems run. Platforms like Apache Kafka can handle millions of events every second, and services such as AWS Kinesis or Azure Stream Analytics enable real-time streams of data. This setup can tie directly into machine learning tools — for example, AWS Kinesis integrates with SageMaker for on-the-fly model training and deployment.</p><h4>Designing for Scalability and Constant Monitoring</h4><p>Scalability isn’t just jargon — it’s a necessity. As AI agents spread through more teams, the infrastructure must stretch without breaking down. Cloud-based data systems let you grow without dumping big sums upfront, giving you room to adjust quickly when demand spikes.</p><p>Tools designed for observability of AI agents identify glitches the moment they pop up, keeping latency low and giving teams a heads-up before things go wrong.</p><h4>Keeping Data Safe by Following the Rules</h4><p>With data flowing nonstop, privacy and security aren’t optional. Regulations evolve constantly, meaning teams must guard against leaks of sensitive info — whether it’s customer data, proprietary details, or inside info about the AI itself. This calls for clear privacy notices, easy opt-outs for users, and quick responses to privacy requests.</p><p>Companies should bake privacy right into design, run regular audits, and actively manage user consent. Following these keeps data safe and builds trust — the last thing any AI project can afford to lose.</p><p>Understanding this matters more than ever because AI isn’t a gimmick anymore; it’s a vital part of how organizations operate. Plus, data volumes are exploding, meaning any lag can ripple through whole systems quite badly. We’ll explore measuring and improving latency even more in upcoming sections — after all, what you track, you improve.</p><h3>How to Overcome Integration Challenges in AI Agent Systems</h3><p>Running into integration problems is one of the most common reasons AI agent projects hit roadblocks — not hardware failures or algorithms gone wild, but simply fitting the new tech into what’s already in place. It’s like dropping a cutting-edge engine into an old car; without adjusting the surrounding parts, you’re likely to face some serious compatibility headaches. If AI agents don’t smoothly mesh with existing processes and systems, workflows can quickly turn chaotic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Uk4mIqMrEBY-pUnSChlDsA.jpeg" /></figure><h4>Addressing Legacy System Hurdles</h4><p>Legacy systems, often the backbone of many organizations, tend to be the biggest sticking point. They’re the seasoned veterans of your IT environment — with protocols and data formats that newer systems don’t easily speak to. No wonder integrating AI agents in an enterprise can feel like using an ancient map to navigate a modern city. Sometimes these older setups lack necessary APIs or throw out data in inconsistent chunks, leading to frustrating gaps in communication.</p><p>To tackle this, companies typically invest in modernising platforms or add middleware that acts like a translator between the old and new. Additionally, some AI agents incorporate preprocessing capabilities, which automatically spot and handle sketchy data before it is used.</p><h4>Making APIs Play Nice</h4><p>Moving beyond legacy systems, a poorly documented or incompatible API is like trying to build furniture without clear instructions — packing a ton of unexpected delays and puzzling headaches into your integration. Choosing the right system architecture that aligns with your company’s goals is critical here.</p><p>Depending on your needs, teams might use orchestration platforms designed to manage multiple AI agents cooperating seamlessly with existing enterprise applications. Some prefer building agents in-house with tools like LangChain or AutoGPT. Whichever route you pick, keeping your architecture modular and scalable saves lots of headaches down the road — like planting a garden where there’s plenty of space left for new growth rather than crowding every plant together.</p><h4>Breaking Down Data Silos</h4><p>Isolated data compartments — or “data silos” — limit how effective AI agents can be. Imagine chunks of your company’s important info trapped on separate islands with no bridges; the agents can’t access the rich, comprehensive data they need to deliver true value. Organisations that invest in centralised data pipelines, modular APIs, and scalable compute environments put themselves miles ahead when it comes to expanding AI use across the business.</p><p>That’s often the secret behind a more insightful and functional AI agent setup.</p><h4>Navigating the Human Side of Things</h4><p>New tech, especially something as disruptive as AI agents, naturally faces some resistance. People might hesitate handing over responsibilities or trust to automated systems. To win them over, you’ve got to back the tech with reliable data inputs and flexible infrastructure — it’s the solid foundation nobody argues with.</p><p>Clear, open communication and thoughtful change management play a huge role in helping teams adjust their workflows and buy into the new way forward. AI agent success doesn’t come from code alone; it’s equally about organizational readiness.</p><h4>Running Pilots to Test the Waters</h4><p>Before committing big resources, running pilot projects allows you to observe AI agents in a controlled spot. It’s the equivalent of a test drive, giving you insights into unforeseen integration challenges and rare edge cases you might’ve missed initially.</p><p>Gathering both performance data and user feedback early helps refine the system before full deployment. This preliminary step can save serious time and cost later on.</p><p>Ultimately, smooth AI integration requires deep technical insight plus careful planning around people, processes, and existing tools. Combining these areas will ensure your AI agents aren’t just intelligent but truly fit into how your business operates.</p><h3>Tips for Successfully Deploying AI Agents Without Headaches</h3><p>Getting AI agents up and running is far more than just setting up software. It means careful planning and making sure everything keeps working well after launch. Here are some practical takeaways that can help you avoid common pitfalls and keep your AI integration smooth.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wvtSTW_p0omiVh9f51t_zg.jpeg" /></figure><h4>Make Data Quality Your Top Priority</h4><p>Messy or mislabeled data is a surefire way to derail AI agents and miss worthwhile opportunities. Putting effort into tidying and standardizing your data sets lays the groundwork for better accuracy and smooth operations. That means paying close attention to consistent labeling, organized formatting, and keeping your data current.</p><p>Getting your data right lessens bias, supercharges effectiveness, and dodges costly mistakes.</p><p>We have covered this in detail in our blog <a href="https://www.aiwhispr.com/post/why-top-quality-data-is-crucial-for-ai-success">“Why top quality data is crucial for AI success”</a></p><h4>Foster Collaboration Across Teams</h4><p>Many AI projects get stuck because tech teams build in a bubble, disconnected from the day-to-day users. Make sure staff across departments — especially those who will actually use the AI — are part of the process early on. That way, IT, business leads, and frontline workers stay in sync, and assumptions get tested before code hits production.</p><h4>Keep a Close Eye on AI Systems After Launch</h4><p>AI agents aren’t “set it and forget it” tools. They need continuous care — tweaking, monitoring, retraining, and constant <a href="http://support.ai/">support.AI</a> agents require maintenance and updates just like any evolving system.</p><p>Plan to regularly review the AI performance, manage version control carefully, and test changes in a sandbox before rolling them out.</p><h4>Build Strong Support Within Your Organization</h4><p>AI tools won’t deliver their full value if people don’t trust or rely on them. Clear communication, showcasing measurable benefits, and inviting feedback help teams accept and integrate AI agents into their daily work.</p><p>An AI agent’s impact hinges on user adoption and how much they trust it, not just raw performance numbers. Focus on building that trust gradually. Celebrating small wins shows value, which then attracts further enthusiasm and commitment to AI adoption.</p><h3>Conclusion</h3><p>As AI agents get woven deeper into company system, you have to think beyond the initial launch of the AI agent and plan for good data, teamwork across departments, and keeping tabs on your AI model and AI agent performance.</p><p><em>This article is a collaborative effort of the AIEngineering team at </em><a href="https://www.aiwhispr.com/"><em>https://www.aiwhispr.com</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a9636ce81459" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Human Insight Is the Secret Behind AI’s Success]]></title>
            <link>https://medium.com/@arundona/why-human-insight-is-the-secret-behind-ais-success-907881823899?source=rss-8ee45bb69987------2</link>
            <guid isPermaLink="false">https://medium.com/p/907881823899</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[machine-learning-ai]]></category>
            <category><![CDATA[ai-safe]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Arun Prasad]]></dc:creator>
            <pubDate>Sun, 08 Jun 2025 18:03:53 GMT</pubDate>
            <atom:updated>2025-06-08T18:03:53.145Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YJvQHgD_ZgYuuR8p9wjKlQ.jpeg" /></figure><p>AI is changing so much around us, but it’s far from a solo player. Behind every smart AI system, people are the ones who shape how it learns and works.</p><blockquote><em>Humans pick and prepare the data, step in when AI makes mistakes, and help keep it fair and responsible. It’s really this human touch that brings AI to life.</em></blockquote><p>People are key to making AI reliable, ethical, and useful — their role keeps the whole system honest and aligned with what we care about.</p><h3>How Human Input Shapes AI Learning and Decisions</h3><p>It’s easy to assume AI runs on endless data with no help, but the truth is more down-to-earth. AI depends heavily on humans — not just to feed it data but to carefully guide what it learns and how it performs. It’s the human touch in selecting, preparing, and constantly reviewing data that helps AI behave as intended and avoids costly mistakes. The question is: how do we make sure this process works well?</p><h4>The Human Role in Data Preparation and Curation</h4><p>Data is essentially the diet AI consumes to learn from, but without proper preparation, that diet can be unbalanced or harmful. Humans start by choosing the right sources, then cleaning and labeling the data so AI understands what it’s looking at. This includes:</p><ul><li><strong>Labeling:</strong> Carefully tagging data points so the AI gets clear signals during training.</li><li><strong>Verification:</strong> Double-checking data accuracy to avoid feeding in mistakes or irrelevant information.</li><li><strong>Validation:</strong> Ensuring that the data truly fits the AI’s purpose and use case.</li></ul><p>This kind of groundwork is vital. AI systems learn from past information, including all its hidden biases and flaws, meaning any sloppy data handling can skew results.</p><h4>When Poor Data Handling Leads to Trouble</h4><p>Mistakes during data collection or labeling don’t just cause glitches; they can introduce serious risks. For example, an AI system used by a company to screen candidates might unintentionally favor certain groups over others due to historical bias in the training data — undermining fairness and trust. To guard against this, continuous model audits and diverse data sets are a must.</p><p>Technologies like<a href="https://www.ibm.com/think/topics/explainable-ai#:~:text=Explainable%20artificial%20intelligence%20(XAI)%20is,expected%20impact%20and%20potential%20biases."> Explainable AI (XAI)</a> are also gaining ground, helping make AI decisions clearer and more open to scrutiny, which is critical when AI choices affect people’s lives.</p><h4>Why Human Oversight Still Matters</h4><p>Despite the hype around AI, machines aren’t infallible. They lack common sense and context, which people naturally bring. Human experts play an irreplaceable role in spotting issues that an AI might miss — things like ethical pitfalls, strange behaviors, or potential security vulnerabilities.</p><p>”Trusted insiders,” combining human judgment with AI tools, form a safety net by constantly checking and balancing AI decisions. These insiders use simulations and exercises to build the soft skills and analytical mindset needed to outthink AI’s blind spots and keep systems on track.</p><p>In a nutshell, human expertise and intuition aren’t optional extras — they are necessary anchors making AI safer and more reliable.</p><h3>Tackling AI Bias with Human Oversight and Careful Dataset Checks</h3><p>AI is often seen as purely objective, but it’s only as neutral as the data it learns from — and that data comes from humans. Bias easily sneaks in, and understanding its roots is essential to make AI fair and dependable. Remember, AI doesn’t create bias from thin air; it magnifies what’s already there in society.</p><h4>Where Bias Comes From in AI Data</h4><p>Bias can creep into the system through several paths, including:</p><ul><li><strong>Incomplete Data:</strong> When the dataset misses groups or experiences, it leads to results that don’t represent everyone fairly, often neglecting women and marginalized voices.</li><li><strong>Lack of Diversity:</strong> Training data that’s too uniform means AI won’t reflect the variety of people it serves.</li><li><strong>False Connections:</strong> AI might spot patterns that aren’t really there, causing skewed predictions.</li><li><strong>Misaligned Comparisons:</strong> Using unequal or mismatched data comparisons causes unfair biases in decisions.</li><li><strong>Human Blind Spots:</strong> Everyone brings unconscious biases, and these can slip into the development process, influencing the AI’s behavior unintentionally.</li></ul><h4>Examples That Show Bias Matters</h4><p>The impact of AI bias isn’t hypothetical — it’s messy and real across industries. For instance:</p><p><strong>Hiring Tools:</strong> Amazon once used an AI recruiting system that downgraded resumes mentioning “women’s” (like “women’s chess club”) because it had been trained on a male-biased hiring history. This led to unfairly penalizing female candidates and highlighted the risk AI can reinforce past mistakes rather than fix them.</p><p><strong>Facial Recognition:</strong> Studies like those by <a href="https://www.ieai.sot.tum.de/fair-enough/">Buolamwini &amp; Gebru (2018)</a> revealed that many facial recognition AIs fail more often on women and people of color, pressing tech companies to rethink their approaches.</p><p><strong>Healthcare Algorithms:</strong> An algorithm used by UnitedHealth’s NaviHealth recommended stopping post-acute care for an elderly patient prematurely, overlooking complex health needs common in seniors. Such cases underline why AI needs transparency and people double-checking its advice.</p><h4>Tools that Help Spot and Fix Bias</h4><p>Thanks to growing awareness, several useful tools help catch and reduce biases in AI before harm happens:</p><ul><li><strong>Google’s What-If Tool:</strong> Offers a user-friendly way to test model fairness against different groups and scenarios.</li><li><a href="https://datasciencepublicpolicy.org/our-work/tools-guides/aequitas/"><strong>Aequitas</strong></a><strong>:</strong> Designed to find disparities across demographics, ideal for public sector applications.</li><li><strong>Amazon SageMaker Clarify:</strong> Gives businesses tools to analyze and counteract bias, while explaining model decisions.</li><li><strong>Microsoft Fairlearn:</strong> This open-source Python toolkit blends well with ML frameworks to assess and improve AI fairness.</li><li><strong>IBM AI Fairness 360:</strong> Another open-source Python toolkit that helps spot and mitigate bias across industries.</li><li><strong>Credo AI:</strong> Focuses on regulatory compliance and fairness benchmarks important in sensitive fields like lending or hiring.</li></ul><h4>Why We Can’t Skip Human Involvement</h4><p>None of these tools is a silver bullet. Humans have to stay involved to ensure AI decisions are right and ethical. This means:</p><ul><li><strong>Building Ethical Feedback Loops:</strong> Continuously monitoring and tweaking algorithms based on clear ethics standards.</li><li><strong>Applying Counterfactual Fairness:</strong> Testing if the AI would treat someone the same if biasing attributes were different.</li><li><strong>Keeping Things Transparent:</strong> Using techniques like <a href="https://www.ibm.com/think/topics/explainable-ai#:~:text=Explainable%20artificial%20intelligence%20(XAI)%20is,expected%20impact%20and%20potential%20biases.">Explainable AI (XAI)</a> to help people understand how AI reaches decisions.</li><li><strong>Welcoming Real Feedback:</strong> Making the AI’s process clear so outside observers can spot issues and suggest fixes.</li><li><strong>Maintaining Human-in-the-Loop Systems:</strong> Having experts provide direct input to refine AI behavior and correct mistakes in real time.</li></ul><h3>The Ethical Compass Guiding AI Towards Reliable and Fair Results</h3><p>In today’s fast-moving tech world, AI without some guardrails can feel like a ship adrift. Getting AI to behave ethically isn’t just a matter of algorithms or data, it’s about building trust that these systems will do right by people. That’s why having a solid ethical compass matters — to steer AI toward results that are clear, fair, and accountable.</p><p>Behind the scenes, a team of human curators and ethicists work like the conscience of AI. They make sure the technology lines up with the values and expectations of society, constantly checking for biases AI might miss or goals that don’t quite fit human needs.</p><p>Building responsible AI means having clear rules and strong governance guiding its use. This includes:</p><ul><li><strong>Transparency</strong>: It’s not enough for AI to just decide — we need to understand <em>why</em> it made a choice. That’s where<a href="https://www.ibm.com/think/topics/explainable-ai#:~:text=Explainable%20artificial%20intelligence%20(XAI)%20is,expected%20impact%20and%20potential%20biases.">Explainable AI (XAI) </a>comes into play, making AI decisions easier to follow and question.</li><li><strong>Accountability</strong>: When things go wrong, there have to be clear ways for people to step in, fix mistakes, and learn from them.</li><li><strong>Fairness</strong>: AI should avoid reinforcing old biases. As <a href="https://www.humanrightsresearch.org/post/harnessing-technology-to-safeguard-human-rights-ai-big-data-and-accountability">humanrightsresearch.org</a> points out, fairness depends a lot on quality data and how it’s prepared.</li></ul><p>On a bigger scale, laws like the EU’s AI Act and America’s AI Bill of Rights reflect a growing push for safeguarding rights and safety when it comes to AI. These frameworks are shaping how we develop and roll out AI technologies responsibly.</p><p>What really works best is treating AI and humans as partners. AI can handle heavy data sorting, but humans add the crucial touch of judgment and ethics. This combination keeps AI grounded and accountable. Transparency in this process not only keeps systems honest but also builds much-needed trust with people.</p><h3>Human-in-the-Loop in AI: Real-World Examples That Show Why It Matters</h3><p>AI is changing how we work and live, but it isn’t perfect. Often, the smartest algorithms stumble without someone looking over their shoulder. These real stories illustrate how human judgment spots AI mistakes and helps fix them, proving why we can’t just leave AI to do its thing alone.</p><h4>How Human Insight Fixes AI Bias</h4><p>Bias in AI isn’t just an abstract problem — it can shape who gets hired, who gets judged unfairly, or who faces unwanted suspicion. Take Amazon’s recruiting tool as a classic example. Trained on mostly male hiring data, it started penalizing resumes that mentioned women’s activities, even when those gendered words were removed. It demonstrates how AI can quietly reinforce old stereotypes unless humans step in to adjust the course.</p><h4>Where the Human Touch Boosts AI Performance</h4><p>AI algorithms manage huge heaps of data, but they sometimes miss what a human eye wouldn’t. Consider the healthcare sector, where an algorithm recommended stopping coverage for a patient too soon, ignoring complex health needs that only a doctor could see. Such mistakes highlight the importance of transparency and a human check on AI decisions. If there were nobody to vet these automated calls, the consequences could be severe.</p><p>As Michael Choma says, “We need to remember that computers learn from us.” AI doesn’t create bias on its own — it mirrors the world it sees. Speech recognition systems struggling with non-American accents or education tools that misjudge non-native speakers all reflect that human experience shapes AI outputs. That’s why setting up Human-in-the-Loop setups isn’t just technical — it’s deeply ethical.</p><p>Imagine people needing to change the way they speak just so AI understands them. For many, this isn’t an option. Human judgment can offer solutions in these edge cases, helping steer AI toward fairness and accuracy.</p><blockquote><em>As AI keeps evolving fast, what stands out is how much it needs people’s judgment and care to work well. From carefully handling data to thinking through ethical questions, AI’s strengths come down to human guidance.</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=907881823899" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pivoting from RAG to fine-tuning]]></title>
            <link>https://medium.com/@arundona/pivoting-from-rag-to-fine-tuning-accb36f3a79c?source=rss-8ee45bb69987------2</link>
            <guid isPermaLink="false">https://medium.com/p/accb36f3a79c</guid>
            <category><![CDATA[semantic-search]]></category>
            <category><![CDATA[fine-tuning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[retrieval-augmented]]></category>
            <dc:creator><![CDATA[Arun Prasad]]></dc:creator>
            <pubDate>Mon, 07 Oct 2024 03:42:11 GMT</pubDate>
            <atom:updated>2024-10-07T03:42:11.145Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FbO2KUz9QKNkHTsSxGuHiw.png" /></figure><p>Over the last 6 months we gradually pivoted from a traditional RAG (retrieval augmented generation) which used out-of-box models to fine-tuning models in our RAG implementations. It is primarily driven by the demand from our customers to deliver highly accurate, safe and secure AI in professional industry use cases.</p><p>Our initial traditional RAG implementations for industry use cases requiring domain expertise, suffered from hallucination and low accuracy. Zero-shot , few-shot and longer prompts were not helping in highly specialised domains.</p><p>To give some client context, our customers are primarily in cybersecurity assessment and audit, healthcare, legal, and finance. There were 5 common threads across their uses cases :</p><ol><li>requires extracting, understanding and taking action from long form documents (+20,000 words per document),</li><li>apply a regulatory , industry standards lens in their internal and external workflows that leverage AI,</li><li>AI should have domain expertise — it should generate text that displays nuances and style, demonstrates knowledge, that a domain or industry practitioner would highlight in complex scenarios,</li><li>high accuracy is a Day 1 requirement; by accuracy I mean being factual, be able to suggest prescriptive actions to an end user, similar to a domain specialist,</li><li>safety , human alignment is a Day 1 requirement.</li></ol><p>Traditional RAG helped us prove the potential to customers how AI can drive efficiencies in extracting information from long form documents; but hallucinations and low accuracy led to loss of trust in AI.</p><p>To understand this problem, we built our own benchmarks to evaluate both embedding(encoder) models and the GenAI (decoder) models specific to each use case.</p><h3>Why we had to fine-tune embedding models</h3><p>During benchmarking, we realised that embedding models have bias in information representation. They have been trained on generally available data and miss out domain specific relationships, representations. UMAP, PCA analysis of word and sentence embeddings helped us build a mechanism to understand this internal relationship, representation.</p><p>Fine-tuning the embedding model for a domain instantly improved the search results for the domain specific queries, thereby increasing the accuracy of the RAG pipeline. A good overview for this is :</p><p><a href="https://www.sbert.net/docs/sentence_transformer/training_overview.html">Training Overview - Sentence Transformers documentation</a></p><h3>Why we had to fine-tune GenAI models</h3><p>Our experience with both closed, open source GenAI models was that they lack deep expertise in behaving, responding like a domain specialist. This might be simply because these models have been trained on generally available data.</p><p>Fine-tuning with datasets provided by domain experts and practitioners helped us increase the model accuracy on domain-specific tasks, thereby improving its ability to handle specialized queries and providing step-by-step solutions to the end user. We found traditional RLHF (reinforced learning by human feedback) as the most effective mechanism to improve accuracy. Creating training datasets takes effort , however it pays for itself by giving you a competetive edge and efficiency improvements.</p><h3>Conclusion</h3><p>Don’t shy away from fine tuning your embedding or GenAI models. This can be the fastest, lowest-risk approach to delivering highly accurate, safe and secure AI.</p><p>While this blog covers mainly accuracy through fine-tuning, I will cover AI safety and security in another blog.</p><p>To know more about us visit <a href="https://www.aiwhispr.com/">https://www.aiwhispr.com</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=accb36f3a79c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Open AI 3'rd gen embedding models — what’s driving the improvements?]]></title>
            <link>https://medium.com/@arundona/open-ai-3rd-gen-embedding-models-whats-driving-the-improvements-4c23b88751f1?source=rss-8ee45bb69987------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c23b88751f1</guid>
            <category><![CDATA[retrieval-augmented]]></category>
            <category><![CDATA[vector-embeddings]]></category>
            <category><![CDATA[word-embeddings]]></category>
            <category><![CDATA[openai]]></category>
            <category><![CDATA[semantic-search]]></category>
            <dc:creator><![CDATA[Arun Prasad]]></dc:creator>
            <pubDate>Thu, 21 Mar 2024 11:53:51 GMT</pubDate>
            <atom:updated>2024-03-21T11:56:18.977Z</atom:updated>
            <content:encoded><![CDATA[<h3>Open AI 3&#39;rd gen embedding models — what’s driving the improvements?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*38chDpl5cVvYOmahVz2avw.png" /></figure><p>The bedrock of semantic search is the vector embedding. The effectiveness of the vector embedding to capture (i) the concepts in the content , (ii) similarity and relationships between words, has an outsized impact on the final result of a RAG pipeline.</p><p>A typical RAG pipeline depends on semantic search to discover relevant content from a corpus, which then serves as context in the prompt input for the large language model. Hence choosing your embedding model is as important choosing the large language model for summarization in RAG.</p><p>In this blog I will share my experience in comparing Open AI’s previous generation text-embedding-ada-002(released Dec’2022) embedding model vs their 3&#39;rd generation embedding model, text-embedding-3-small (released Jan’2024)</p><p>Detailed walkthrough of the benchmark tests run by OpenAI is available <a href="https://openai.com/blog/new-embedding-models-and-api-updates">https://openai.com/blog/new-embedding-models-and-api-updates</a></p><p>The main highlights are</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h0UOW22P005NurTMoAt6Fg.png" /><figcaption>Open AI embedding models — high level comparison</figcaption></figure><ul><li>Pricing for text-embedding-3-small has been reduced by 5X compared to text-embedding-ada-002, from a price per 1k tokens of $0.0001 to $0.00002</li><li>Comparing text-embedding-ada-002 to text-embedding-3-small, the average score on a commonly used benchmark for multi-language retrieval (<a href="https://github.com/project-miracl/miracl">MIRACL</a>) has increased from 31.4% to 44.0%, while the average score on a commonly used benchmark for English tasks (<a href="https://github.com/embeddings-benchmark/mteb">MTEB</a>) has increased from 61.0% to 62.3%.</li><li>text-embedding-3-large is OpenAI’s new best performing model. Comparing text-embedding-ada-002 to text-embedding-3-large: on MIRACL, the average score has increased from 31.4% to 54.9%, while on MTEB, the average score has increased from 61.0% to 64.6%.</li></ul><p>The remaining part of this blog describes my attempt to understand what is driving improvement in text-embedding-3-small over text-embedding-ada-002 , while keeping the number of dimensions (1536) unchanged.</p><p>I used the Kaggle dataset for BBC news archive of 2000+ stories across 5 categories — sports, politics, business, entertainment, tech for my tests.</p><h3>Pooling layer in embeddings</h3><p>A pooling layer in the embedding model aggregates token-level embeddings into sentence(text chunk)level embedding generating a single representation for it. Sentence embeddings are trained to capture knowledge of the meaning of a sequence of tokens as a whole<strong> </strong>rather than the individual tokens. A typical RAG pipeline that processes documents, stores the sentence (text-chunk) level embedding in the vector database. During semantic search, the cosine distance i calculates between the query embedding and the text chunk embedding.A lower cosine distance means higher similarity.</p><p>You can read more about pooling layer in the <a href="https://blog.ml6.eu/the-art-of-pooling-embeddings-c56575114cf8">blog</a> by <a href="https://medium.com/@mathias.leys?source=post_page-----c56575114cf8--------------------------------">Mathias Leys</a></p><p>You can read the <a href="https://medium.com/@sudhiryelikar/understanding-similarity-or-semantic-search-and-vector-databases-5f9a5ba98acb">blog</a> by <a href="https://medium.com/@sudhiryelikar?source=post_page-----5f9a5ba98acb--------------------------------">Sudhir Yelikar</a> for a walkthrough of how cosine distance is used for semantic search.</p><h3>Cosine distance scores — interesting results</h3><p>I used pgvector to store the embeddings and calculate cosine distance scores for semantic search using text-embedding-ada-002 , text-embedding-3-small. As mentioned earlier, a lower cosine distance score is correlated to a higher semantic similarity to the query.</p><p>We found that the search results using text-embedding-3-small were of better quality, showing higher relevance to the query. Below are top-3 search results for a query “What is the impact of inflation on the economy”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3HrWnJm1ux3ca6D1ISnUbQ.png" /><figcaption>Results for query “What is the impact of inflation on the economy?”</figcaption></figure><p>Cosine distance scores from semantic search using text-embedding-3-small embeddings were higher compared to text-embedding-ada-002. At first glance , this goes against the general trend of lower cosine scores correlated to better results ; however I had to remind myself that I am comparing two different models. Each model could have used the vector space differently to capture inter-relationships between concepts, words.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4ow0OMcYzbpcVUfDH84Cng.png" /><figcaption>Cosine similarity scores for search results</figcaption></figure><p>The PCA map visualization tool in <a href="https://github.com/prasaar/aiwhispr">AIWhispr</a> showed that the 2 models are significantly different in their representation of concepts, inter-relationships between words.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6o-zK4fjgFpMRzbVXiSqFg.png" /><figcaption>PCA map of the words in the same document — top rank search result of the query “What is the impact of inflation on the economy” on a corpus of 2000+ new stories from BBC (Kaggle dataset)</figcaption></figure><p>It’s immediately visible that text-embedding-3-small uses the vector space over a wider range Vs text-embedding-ada-002.</p><p>For the example shown above , the x-axis range for test-embedding-3-small range is -0.3 to 0.4 (range:8 units) while text-embedding-ada-002 range is -0.1 to 0.1 (range:2 units). Similary for y-axis text-embedding-3-small range is -0.2 to 0.2 (range:4 units) vs text-embedding-ada-002 range of -0.1 to 0.1(range:2 units).</p><h3>Word embeddings</h3><p>If two words share a similar context, such as ‘chair’ and ‘table’, then their proximity in the embedding space will be close. Conversely, words with dissimilar contexts will be positioned further away from each other in this space. Visualizing word embeddings using dimensionality reduction e.g. PCA helps us measure the embedding models effectiveness in capturing the base level relationship between words.</p><p>By using this technique I was able to further dive into undertsanding how text-embedding-3-small has used the same number of dimension (1536) to capture, represent a better relationship between words.</p><p>I ran a semantic search for the query “Why is Rugby so important for the UK and Irish population”. I knew that there was no direct or close match for this in the news story dataset; the idea was to check the efficacy of the model to help surface news stories in the context of a particular sport that is popular across countries which are geographically close.</p><p>The top ranked seach result was the same for both embedding models :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x5zJlEgQAhmvkpTGad4zdw.png" /><figcaption>Results for query “Why is Rugby so important for UK and Irish population?”</figcaption></figure><p>I then used AIWhispr tool for PCA visualization and dive further into inspecting certain words in the document.</p><h3>Comparing embedding model effectiveness to capture context of countries ,family names</h3><p>I noticed that in text-embedding-ada-002 the words ireland and irish were far. The model was clustering the countries (ireland, scotland, england). The word Scotland was closer to Ireland in the PCA map, compared to Irish family names (O’Connor, O’Driscolls).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3wvwHAmTG4Zk9eJRQGSSfQ.png" /></figure><p>When compared, text-embedding-3–small displayed a better use of the space in the PCA map to cluster countries while manging to keep related words like “irish”, and family names from ireland close to “ireland”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ni8iVYWFWZM7GgDCOx6YGA.png" /></figure><p>A visual comparision of the PCA map for the word embeddings created by the 2 models shows that text-embedding-3-small has used a larger space range to it’s benefit, adjusting the effective relative distance between words to capture more context (e.g. family names common in a country )</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oTUkFqBPKrrdgmaiSqpd9A.png" /><figcaption>PCA map of the words in the same document — top rank search result of the query “Why is Rugby so important for UK and Irish population” on a corpus of 2000+ new stories from BBC (Kaggle dataset)</figcaption></figure><p>I did 100+ tests and it was clear in all of them that relative distance between words in text-embedding-3-small PCA map is a better represenation of the relationship between words, when compared to a PCA map create using text-embedding-ada-002.</p><p>Another example is for a news article from business category for the word “worries”, “fears”, , “pressure” ; in an economic context these words are closely related. The excerpt of the article is as below</p><blockquote><em>US data sparks inflation </em><strong><em>worries</em></strong><em> Wholesale prices in the US rose at the fastest rate in more than six years in January according to government data.New figures show the Labor Department producer price index PPI rose by 0.3 in line with forecasts.But core producer prices which exclude food and energy costs surged by 0.8 the biggest rise since December 1998 increasing inflationary concerns.In contrast the University of Michigan barometer of US retail consumer confidence showed a slight dip.The universitys index of consumer spending fell to 94.2 in early February from 95.5 in January which could indicate a fall in retail spending by the US public.The mixed set of data on Friday led to volatile early Wall Street trade as the Dow Jones Standard and Poors500 and Nasdaq swung between positive and negative territory.The economic figures come on the back of increased </em><strong><em>fears</em></strong><em> that the Federal Reserve chairman may be about to raise interest rates in order to stifle any inflationary </em><strong><em>pressures</em></strong><em>.</em></blockquote><p>In the PCA map created using text-embedding-ada-002, the word “pressure” is positioned far away from the words “worries”, “fears”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Og8N8wWdo9tsbRcE8BElgA.png" /></figure><p>In the PCA map created using text-embedding-3-small, the word “pressure” is positioned relative closer to the words “worries”, “fears” thereby representing the concept and relationship much better.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aChAd4Hmu2ac4bMYb7VLTg.png" /></figure><p><strong>Conclusion</strong></p><p>OpenAI’s 3&#39;rd generation embedding model text-gen-3-small offers significant performance gains over text-embedding-ada-002. In most cases you should see improved semantic search results by simply migrating from your current ada-002 embedding to the new 3-small. If you are processing significant content volumes for vector embeddings, then the 5x cheaper price of text-embedding-3-small offers significant cost savings.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c23b88751f1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting up a vector embedding pipeline with AIWhispr, Bert and Qdrant on MacOS.]]></title>
            <link>https://medium.com/@arundona/setting-up-a-vector-embedding-pipeline-with-aiwhispr-bert-and-qdrant-on-macos-27b515fb320e?source=rss-8ee45bb69987------2</link>
            <guid isPermaLink="false">https://medium.com/p/27b515fb320e</guid>
            <category><![CDATA[vector-database]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[semantic-search]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[qdrant]]></category>
            <dc:creator><![CDATA[Arun Prasad]]></dc:creator>
            <pubDate>Thu, 02 Nov 2023 01:02:07 GMT</pubDate>
            <atom:updated>2023-11-02T01:02:07.658Z</atom:updated>
            <content:encoded><![CDATA[<p>This blog shows how to setup a vector embedding pipeline using <a href="https://github.com/prasaar/aiwhispr">AIWhispr</a> , SBert sentence transformer model, Qdrant vector database. This will enable semantic search over 2000+ news stories from BBC whose vector embeddings are created using SBert <em>all-mpnet-base-v2</em> model; the vector embeddings and extracted text is stored in Qdrant vector database, the pipeline is configured and executed using <a href="https://github.com/prasaar/aiwhispr">AIWhispr</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*neYyZzCle4Xv2YUlspQcog.png" /></figure><h3>Installing Qdrant on MacOS</h3><p>Use Docker to install Qdrant vector database on MacOS. If you don’t have Docker installed yet, then follow the instructions on <a href="https://docs.docker.com/desktop/install/mac-install/">https://docs.docker.com/desktop/install/mac-install/</a> to install the Docker Desktop. Run the following commands for docker-based installation and configuration of qdrant.</p><pre>docker pull qdrant/qdrant</pre><p>Create a separate directory to store vector database files</p><pre>mkdir $HOME/storage<br>mkdir $HOME/storage/vectordb<br>mkdir $HOME/storage/vectordb/qdrant</pre><p>Setup API based authentication for Qdrant installation by specifying an api key in a configuration file</p><pre>cd $HOME/storage/vectordb/<br>echo &quot;service:&quot; &gt; qdrant_custom_config.yaml<br>echo &quot;   api_key: api_key&quot; &gt;&gt; qdrant_custom_config.yaml</pre><p>Run the Qdrant service</p><pre>docker run -d -p 6333:6333   \<br>-v $HOME/storage/vectordb/qdrant_custom_config.yaml:/qdrant/config/custom_config.yaml \<br>-v $HOME/storage/vectordb/qdrant:/qdrant/storage \<br>qdrant/qdrant \<br> ./qdrant --config-path config/custom_config.yaml</pre><h3>Setup AIWhispr</h3><p>Clone the latest version of AIWhispr from <a href="https://github.com/prasaar/aiwhispr">https://github.com/prasaar/aiwhispr</a></p><h4>Setup e<a href="https://github.com/prasaar/aiwhispr#environment-variables">nvironment variables</a></h4><p>AIWHISPR_HOME_DIR environment variable should be the full path to aiwhispr directory.</p><p>AIWHISPR_LOG_LEVEL environment variable can be set to DEBUG / INFO / WARNING / ERROR</p><pre>AIWHISPR_HOME=/&lt;installpath&gt;/aiwhispr <br>AIWHISPR_LOG_LEVEL=DEBUG <br>export AIWHISPR_HOME <br>export AIWHISPR_LOG_LEVEL</pre><h4>Install Python Packages</h4><p>Run the following command</p><pre>$AIWHISPR_HOME/shell/install_python_packages.sh</pre><p>If uwsgi install is failing then ensure you have gcc, python-dev , python3-dev installed.</p><pre>sudo apt-get install gcc <br>sudo apt install python-dev<br>sudo apt install python3-dev<br>pip3 install uwsgi</pre><h4>Configure vector embedding pipeline</h4><p>AIWhispr comes with a streamlit app to help you get started.</p><p>Run the streamlit app</p><pre>cd $AIWHISPR_HOME/python/streamlit<br>streamlit run ./Configure_Content_Site.py &amp;</pre><p>There are 3 steps to configure the pipeline to index your content for semantic search.</p><ul><li>Configure Content Site : Provide details of the storage location that hosts your content (files).</li><li>Configure Vector DB : Provide connection details of your Vector DB in which the vector embeddings of your content will be stored.</li><li>Configure LLM Service : Provide the large language model details (SBert/OpenAI) which will be used to encode your content into vector embeddings.</li></ul><p>You should see the first step of your configuration. Specify a distinct unique name for this vector embedding pipeline configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-8aIV-CtJe4J0iZ1dJZPVg.png" /></figure><p>Click on the button<strong> “Use This Content Site Config” </strong>and proceed to the next step to configure vector database connection by clicking on <strong>“Configure Vector Db” </strong>in left sidebar.</p><p>Now select Qdrant vector database and specify the API Key for Qdrant you had configured earlier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OtYiisF5q21kfXtsv-njUQ.png" /></figure><p>Click on the button <strong>“Use This Vector Db Config” </strong>and then move to the next step by clicking on <strong>“Configure LLM Service” </strong>in the left sidebar.</p><p>Select S-Bert model; the default model used is <em>all-mpnet-base-v2</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qxg_kp69GbzRMEHrdNQoQw.png" /></figure><p>Click on the button <strong>“Use This LLM Service Config” </strong>to create the final version of your vector embedding pipeline configuration file.</p><p>The contents of the configuration file and its location on your machine will be displayed.</p><p>You can test this configuration by clicking on <strong>“Test Config File” </strong>in the left sidebar.</p><h3>Test the vector embedding pipeline configuration</h3><p>You should now see a message that shows the location of your vector embedding pipeline configuration file and a button “Test Configfile”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PIZigvc8dhBfrp8BDli4bA.png" /></figure><p>Clicking on the button will start the process which will test the pipeline configuration by</p><ul><li>connecting to the storage location</li><li>connecting to the vector database</li><li>encoding a sample query using the LLM Service</li></ul><p>You should see “<strong>NO ERRORS</strong>” message at the end of the logs which informs you that this pipeline configuration is correct.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qhuawxbUmB-G8DCRfhWmNQ.jpeg" /><figcaption>Testing the AIWhispr configuration</figcaption></figure><h3>Run the configured vector embedding pipeline</h3><p>Click on “<strong>Run Indexing process</strong>” in the left sidebar to start the pipeline. You should see a <strong>“Start Indexing” </strong>button in the main section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*op6xaJPu74U3Fli97EmPhg.png" /><figcaption>Start Indexing</figcaption></figure><p>Click on this button to start the pipeline.</p><p>The logs are updated every 15 seconds.<strong><em> The default example indexes 2000+ BBC news stories which takes approximately 20 minutes on Apple M1(8GB RAM). </em>Don’t navigate away from this page while the indexing process is running</strong> i.e. while the Streamlit “Running” status is displayed on the top right. The logs will look like :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JRGIuRu8KHBFuZH0fC1iuA.png" /><figcaption>Fig: Run indexing logs</figcaption></figure><p>You can also check if the indexing process is running on your machine</p><pre>ps -ef | grep python3 | grep index_content_site.py </pre><p>When this pipeline has completed, you should see</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rtdBwc8fhW1hpdnSl6CWLw.png" /></figure><h3>Semantic Search</h3><p>You can now run semantic search queries.</p><p>A semantic plot that displays the cosine distance, and a top 3 PCA analysis, for the search results is also displayed along with the text search results.</p><p>Type a query “<em>The impact of inflation on British economy</em>” and the search results will be displayed based on semantic search. Please note that the content is from new stories between the years 2002–2004 ( <em>almost 20 years earlier</em>)</p><p><strong>Screen Snapshots:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bNU1NY-4y_cC6l3mK-Djrw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qkdW4Uw8sT4kS9-VxTbyfw.png" /></figure><p>You can also navigate the PCA Map for a selected search result by clicking on the search result.</p><p><strong>Screen Snapshot:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dpHig-vjK6b37t5oEELF7g.png" /><figcaption>PCA Map for unique words in the search result</figcaption></figure><p>I hope this helps you set up your semantic search pipeline.</p><p>If you have any questions or feedback then please do reach out at contact@aiwhispr.com.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=27b515fb320e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Visualizing semantic search results and word embeddings]]></title>
            <link>https://medium.com/@arundona/visualizing-semantic-search-results-and-word-embeddings-46e5797dd3cd?source=rss-8ee45bb69987------2</link>
            <guid isPermaLink="false">https://medium.com/p/46e5797dd3cd</guid>
            <category><![CDATA[vector-embeddings]]></category>
            <category><![CDATA[vector-database]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[semantic-search]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Arun Prasad]]></dc:creator>
            <pubDate>Wed, 11 Oct 2023 10:39:44 GMT</pubDate>
            <atom:updated>2023-10-11T10:39:44.560Z</atom:updated>
            <content:encoded><![CDATA[<p>Visualizing the cosine distance of semantic search results and the PCA map of word embeddings is a powerful mechanism to understand how the large language model has captured semantic relationships.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*48uIq-iI9qxx2xE1IUICWg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*JtKQWNy11X7K1HNqQn7x-w.gif" /><figcaption>PCA Map of word embeddings for a search result</figcaption></figure><p>It can also be leveraged to assess the quality of your document repository i.e. does your repository have relevant content for your search queries?</p><p>For example, employees could be searching for “<em>how do I apply for parental leave</em>” on your internal HR procedure documents Wiki site and see multiple search results. How do you objectively assess that documentation available on your Wiki site clearly answers the employee&#39;s query?</p><p>This is a practical, real-world challenge when implementing semantic search and retrieval-augmented-generation (RAG), the results of which are highly dependent on the quality of your content.</p><p>In such scenarios, we benefit by enabling teams who manage the internal document repository to objectively assess content quality. They can proactively run search queries and visually evaluate similarity scores (<em>e.g. cosine distance</em>) of the search results with cosine distance plots. A low similarity score (<em>high cosine distance</em>) would signal them to create new content or improve existing content.</p><p>In other cases, low-quality semantic search results could point to the LLM requiring fine-tuning. A PCA Map of the word embeddings is a powerful mechanism to visualize the effectiveness of the trained LLM. We expect related words to be clustered.</p><p><a href="https://github.com/prasaar/aiwhispr">AIWhispr</a> is a free, open-source, no/low code tool to automate vector embedding pipelines for semantic search. A simple configuration drives the pipeline for reading files, extracting text, and creating vector embeddings to store them in a vector database.</p><p>AIWhispr</p><ul><li>is easy to install.</li><li>simple to configure.</li><li>delivers fast semantic responses to search queries.</li><li>can handle multiple file formats (txt,csv, pdf, docx,pptx, docx) stored on AWS S3, Azure Blob Containers, Google Cloud Storage, and local directory path.</li><li>supports multiple vector databases (Qdrant,Weaviate,Milvus,Typesense)</li><li>displays the semantic plot and PCA map for the word embeddings.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*roNXTXIRgjwSUWWU4qQgXQ.gif" /></figure><p>I hope you can try out AIWhispr for your vector embedding pipelines. You can download AIWhispr from <a href="https://github.com/prasaar/aiwhispr">https://github.com/prasaar/aiwhispr</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=46e5797dd3cd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Adding a module in AIWhispr : support semantic search for files in a new cloud storage.]]></title>
            <link>https://medium.com/@arundona/adding-a-module-in-aiwhispr-support-semantic-search-for-files-in-a-new-cloud-storage-e2414c11aa3d?source=rss-8ee45bb69987------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2414c11aa3d</guid>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[vector-database]]></category>
            <category><![CDATA[google-cloud-storage]]></category>
            <category><![CDATA[semantic-search]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Arun Prasad]]></dc:creator>
            <pubDate>Sun, 03 Sep 2023 02:39:05 GMT</pubDate>
            <atom:updated>2023-09-03T02:46:27.391Z</atom:updated>
            <content:encoded><![CDATA[<h3>Adding a module in AIWhispr to support semantic search for files in a new cloud storage.</h3><p>My <a href="https://medium.com/@arundona/overview-of-aiwhispr-design-to-drive-semantic-search-using-configs-3755ab9bde85%20ins">earlier blog</a> provided an overview of the modular design approach in AIWhispr that activates a no/low-code , configuration driven semantic search engine.</p><p>In the spirit of open source, we want to ensure that users, collaborators of AIWhispr are enabled to add their own custom modules. Open Source for AIWhispr does not mean just putting the source code out there , but also to share practical examples of how to add your own custom module.</p><p>Below is a code walkthrough of the module added to support reading, indexing of files stored on Google Cloud Storage for semantic search.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qDMMUi240oGzJNq4IdyXbA.png" /></figure><p><strong>1. Edit: python/common_objects/aiwhisprBaseClasses.py</strong></p><p>Support for Google storage authentication configurations is added in the <em>siteAuth</em> class.</p><pre>class siteAuth:<br>....<br>def __init__(self,auth_type:str,**kwargs):<br>....   <br>match self.auth_type<br>....   <br>  case &#39;google-cred-key&#39;:                <br>.....<br>     self.google_cred_path = kwargs[&#39;google_cred_path&#39;]<br>     self.google_project_id = kwargs[&#39;google_project_id&#39;]<br>     self.google_storage_api_key = kwargs[&#39;google_storage_api_key&#39;]<br>.....</pre><p>Corresponding [content-site-auth] section in the config file</p><pre>[content-site-auth] <br>authtype=google-cred-key <br>google-cred-path=&lt;/path/to/google/credential/file.json&gt; <br>google-project-id=&lt;project-id-to which-google-storage-is-billed&gt; <br>google-storage-api-key=&lt;api-key-to-access-google-storage&gt;</pre><ul><li><em>**Note the the configurations use dash “-” separator while the python variable names use underscore “_”</em></li></ul><p>We also edit the baseClass <em>srcContentSite.pickle_me() </em>function<em> </em>for these new variables to be pickled. The pickled contentSite object is used by the spawned indexing processes.</p><pre>class srcContentSite:<br>....<br> def pickle_me(self):<br>....<br>   self.self_description[&#39;site_auth&#39;][&#39;google_cred_path&#39;] = self.site_auth.google_cred_path<br>   self.self_description[&#39;site_auth&#39;][&#39;google_project_id&#39;] = self.site_auth.google_project_id<br>   self.self_description[&#39;site_auth&#39;][&#39;google_storage_api_key&#39;] = self.site_auth.google_storage_api_key  </pre><p><strong>2. Edit: python/common-functions/index_content_site_for_config.py</strong></p><p>This python module reads the config file. The below code snippet adds support for reading Google Cloud Storage Access authentication configurations from the config file. It then instantiates the <em>siteAuth</em> object.</p><pre>match src_type:<br>....<br> case &#39;google-cloud&#39;:<br>....<br>    match auth_type:<br>      case &#39;google-cred-key&#39;:<br>        google_cred_path = config.get(&#39;content-site-auth&#39;,&#39;google-cred-path&#39;)<br>        google_project_id = config.get(&#39;content-site-auth&#39;,&#39;google-project-id&#39;)<br>        google_storage_api_key = config.get(&#39;content-site-auth&#39;,&#39;google-storage-api-key&#39;)<br>        logger.debug(&#39;google_cred_path : %s google_project_id : %s google_storage_api_key: %s&#39;, google_cred_path, google_project_id, google_storage_api_key)<br>        if(len(google_cred_path) == 0 or len(google_project_id) == 0 or len(google_storage_api_key) == 0):<br>         logger.error(&#39;Could not read google-cred-path, google-project-id, google-storage-api-key&#39;)<br>        else:<br>         site_auth=siteAuth(auth_type=auth_type, <br>                        google_cred_path=google_cred_path ,<br>                        google_project_id=google_project_id,<br>                        google_storage_api_key=google_storage_api_key<br>                        )<br>  ....                 </pre><p>[content-site] section in the config file would define <em>srctype=google-cloud</em></p><pre>[content-site]<br>srctype=google-cloud<br>....</pre><p><strong>3. Add : python/common-objects/googleBlobDownloader.py</strong></p><p>This class is added to handle downloading of files from Google Cloud Storage</p><pre># Imports the Google Cloud client library<br>from google.cloud import storage<br>from google.oauth2.service_account import Credentials<br><br><br>class googleBlobDownloader(object):<br><br>    # &lt;Snippet_download_blob_file&gt;<br>    def download_blob_to_file(self, storage_client: storage.Client, bucket_name:str, blob_flat_name:str, download_file_name:str):<br>        <br>        bucket = storage_client.bucket(bucket)<br>        blob = bucket.blob(blob_flat_name)<br>        blob.download_to_filename(download_file_name)</pre><p><strong>4. Add: python/content-site/googleContentSite.py</strong></p><p>A new class is added to orchestrate reading of files from Google Cloud storage and indexing them for semantic search. The existing <a href="http://azurecontentsite.py/"><em>azureContentSite.py</em></a><em> </em>is used as a starting point. The changes are minimal and limited to Google Cloud related operations to list contents of the bucket and download the files.</p><pre># Import the Google Cloud client library and newly added googleBlobDownloader<br>from google.cloud import storage<br>from google.oauth2.service_account import Credentials<br><br>from googleBlobDownloader import googleBlobDownloader</pre><p>The init pattern is similar to other cloud sources (AWS S3, Azure )</p><pre>class createContentSite(srcContentSite):<br>            <br>    downloader:googleBlobDownloader<br><br>    def __init__(self,content_site_name:str,<br>                 src_path:str,<br>                 src_path_for_results:str,<br>                 working_directory:str,<br>                 index_log_directory:str,<br>                 site_auth:siteAuth,<br>                 vector_db:vectorDb,<br>                 llm_service:baseLlmService, <br>                 do_not_read_dir_list:list = [], <br>                 do_not_read_file_list:list = []):<br>       srcContentSite.__init__(self,content_site_name=content_site_name,<br>                               src_type=&quot;google-cloud&quot;,<br>                               src_path=src_path,<br>                               src_path_for_results=src_path_for_results,<br>                               working_directory=working_directory,<br>                               index_log_directory=index_log_directory,<br>                               site_auth=site_auth,<br>                               vector_db=vector_db, <br>                               llm_service = llm_service, <br>                               do_not_read_dir_list=do_not_read_dir_list,<br>                               do_not_read_file_list=do_not_read_file_list)<br>       self.bucket_name = src_path.split(&#39;/&#39;)[2]<br>       self.downloader = googleBlobDownloader()<br>       self.logger = logging.getLogger(__name__)</pre><p>The function <em>connect_to_content_site() </em>will contain the steps to connect to Google Cloud.</p><p>Its uses the authentication variables in the <em>self.site_auth</em> to instantiate a Google Cloud connection object and assign it to the variable <em>storage_client</em></p><pre>def connect_to_content_site(self):<br>   # Connect to Google Cloud<br>   # Create the StorageClient object<br>   match self.site_auth.auth_type:<br>     case &quot;google-cred-key&quot;:<br>       self.logger.info(&#39;Connecting to Google Cloud using Credentials and Key&#39;)<br>       self.google_creds =  Credentials.from_service_account_file(<br>       self.site_auth.google_cred_path<br>       )<br>       self.storage_client = storage.Client( <br>       client_options={&quot;api_key&quot;:  self.site_auth.google_storage_api_key, <br>                       &quot;quota_project_id&quot;: self.site_auth.google_project_id } , <br>                        credentials=self.google_creds<br>                                )<br>     case other:<br>       self.logger.error(&#39;No authentication provided for Google Cloud connection&#39;)</pre><p>The index() function contains the steps to read each object metadata</p><pre># List the blobs in the container<br>        blob_list = self.storage_client.list_blobs(self.bucket_name)<br>        bucket = self.storage_client.bucket(self.bucket_name)<br>        for blob in blob_list:<br>            blob_metadata = bucket.get_blob(blob.name)<br>            #Insert this list in the index database<br>            #Get metadata for each file<br>            content_file_suffix = pathlib.PurePath(blob.name).suffix          <br>            content_index_flag = &#39;N&#39; #default<br>            content_path = blob_metadata.name<br>            content_type = blob_metadata.content_type<br>            content_last_modified_date = blob_metadata.updated<br>            content_creation_date = content_last_modified_date<br>            content_uniq_id_src = blob_metadata.etag<br>            content_tags_from_src = &#39;&#39;<br>            content_size = blob_metadata.size<br>            content_processed_status = &quot;N&quot;</pre><p>The index_from_list() function is used by each spawned indexing process. <em>site_auth </em>, <em>contentSite</em> instantiation and <em>downloader.download_blob_to_file function </em>arguments reflect google cloud storage related parameters.</p><pre>.....<br>site_auth= siteAuth( auth_type=self_description[&#39;site_auth&#39;][&#39;auth_type&#39;],<br>   google_cred_path=self_description[&#39;site_auth&#39;][&#39;google_cred_path&#39;],<br>   google_storage_api_key=self_description[&#39;site_auth&#39;][&#39;google_storage_api_key&#39;],<br>   google_project_id=self_description[&#39;site_auth&#39;][&#39;google_project_id&#39;]<br>                                )<br>.....   <br>contentSite = initializeContentSite.initialize(content_site_module=&#39;googleContentSite&#39;,<br>.....<br>contentSite.downloader.download_blob_to_file(contentSite.storage_client, contentSite.bucket_name, content_path, download_file_path) <br>.....</pre><p>That’s it, we are ready to index files on Google Cloud storage for semantic search in AIWhispr. The modules for the language model, vector database in the semantic search engine remain untouched</p><p>To know more about how to get started with your first no-code, semantic search engine, visit the github page at <a href="https://github.com/prasaar/aiwhispr">https://github.com/prasaar/aiwhispr</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2414c11aa3d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Overview of AIWhispr design to drive semantic search using configs.]]></title>
            <link>https://blog.gopenai.com/overview-of-aiwhispr-design-to-drive-semantic-search-using-configs-3755ab9bde85?source=rss-8ee45bb69987------2</link>
            <guid isPermaLink="false">https://medium.com/p/3755ab9bde85</guid>
            <category><![CDATA[sbert]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[vector-database]]></category>
            <category><![CDATA[semantic-search]]></category>
            <category><![CDATA[large-language-models]]></category>
            <dc:creator><![CDATA[Arun Prasad]]></dc:creator>
            <pubDate>Fri, 01 Sep 2023 12:05:51 GMT</pubDate>
            <atom:updated>2023-09-02T11:23:44.993Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://github.com/prasaar/aiwhispr/tree/main">AIWhispr</a> is an open source tool to enable LLM(large-language-model) powered semantic search. It offers a no/low-code option for users to deploy semantic search on their internal documents.</p><p>My <a href="https://medium.com/@arundona/semantic-search-over-2000-news-stories-with-aiwhispr-and-qdrant-eff0be6e6e9b">earlier blog </a>showed the steps to install, configure AIWhispr for semantic search over 2000+ news stories.</p><p>This blog aims to explain the modular design approach in AIWhispr.</p><h3><strong>Modules for a Semantic Search Engine</strong></h3><p>4 distinct functions are coordinated to drive a scalable semantic search engine. This helped us scale up quickly to build a demo which processes over 1 million askubuntu.com posts downloaded from Internet Archive.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kie4jV3dnhrCrD6wU_RyYA.png" /></figure><ol><li><strong>Content site handler</strong> : It can access cloud storage (AWS S3 bucket, Azure blob, Google Cloud Storage) or local directory path to read files. It will then extract text from different document types (pdf, xlsx, docx, pptx, csv ) , create vector embeddings by submitting the text chunk to a large language model encoding service. The vector embedding and related metadata of the file is stored in a vector database. It scales up by spawning multiple processes to distribute this workload.</li><li><strong>Large Language Model</strong> is primarily responsible for creating vector embedding.</li><li><strong>Vector Database</strong> that stores the vector embedding for the file content along with metadata related to the file e.g. location, size, last edited date. The vector database supports similarity searches on the stored vector data.</li><li><strong>Semantic Search Service — </strong>a programmatic interface that accepts a user query e.g. “<em>what is the best computer to buy for an affordable price?</em>”, converts it into a vector embedding and then runs a similarity search in the vector database to retrieve the results (vector and corresponding text, file meta data). It formats these retrieved results into html&lt;div&gt; or json and responds to the user query.</li></ol><h3><strong>Driving semantic search with configurations</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BxRo2WOWhw5voNl7k6t9tA.png" /></figure><p>An AIWhispr configuration file exhibits this modular design approach.</p><p>A typical configuration file looks like:</p><pre>#### CONFIGFILE #### <br>[content-site] <br>sitename=example_bbc.filepath.qdrant <br>srctype=filepath <br>srcpath=/&lt;aiwhispr_home&gt;/aiwhispr/examples/http/bbc <br>displaypath=http://127.0.0.1:9000/bbc <br>contentSiteModule=filepathContentSite <br>[content-site-auth] <br>authtype=filechecks <br>check-file-permission=Y <br>[local] <br>indexing-processes=2<br>working-dir=/&lt;aiwhispr_home&gt;/aiwhispr/examples/http/working-dir <br>index-dir=/&lt;aiwhispr_home&gt;/aiwhispr/examples/http/working-dir<br>[vectordb]<br>vectorDbModule=qdrantVectorDb <br>api-address= localhost <br>api-port=6333 <br>api-key=<br>[llm-service] <br>model-family=sbert <br>model-name=all-mpnet-base-v2 <br>llm-service-api-key= <br>llmServiceModule=libSbertLlmService</pre><p><strong>Overview of the configuration file</strong></p><p>The configuration file has 5 sections</p><h4><strong>[content-site]</strong></h4><p>This section contains the configurations for the content source(Cloud/Local Directory) from which AIWhispr will read the files to be indexed.</p><p><strong>sitename</strong>=&lt;unique_name_across_all_configurations&gt;</p><p>It cannot contain whitespace, special characters except ‘.’</p><p><strong>srctype</strong>=&lt;<strong>filepath</strong> / <strong>s3</strong> / <strong>azureblob / google-cloud </strong>&gt;</p><p>filepath: top level local or mounted directory path</p><p>s3 : Content source is an AWS S3 bucket</p><p>azureblob: Content source is an Azure blob container</p><p>google-cloud: Content source is a Google Cloud Storage bucket</p><p><strong>srcpath</strong>=&lt;top_level_path_which_AIWhispr_will_read_files&gt;</p><p>Example AWS S3: s3//&lt;<em>bucket_name</em>&gt;</p><p>Example Azure Blob : https://&lt;<em>storage_account</em>&gt;.blob.core.windows.net/&lt;<em>container_name</em>&gt;</p><p>Example Google Cloud Storage: gs//&lt;<em>bucket_name</em>&gt;</p><p><strong>displaypath</strong> = &lt;top level path,AIWhispr will use in the search results&gt;</p><p>Example : you can save all your files under the Nginx http root. A file could be /var/www/html/index_this_file.pdf</p><p>— — — — — — — — — — — — — — —</p><p>srctype=filepath</p><p>srcpath=/var/www/html</p><p>displaypath=http:&lt;<em>hostname</em>&gt;</p><p>— — — — — — — — — — — — — — —</p><p>When the search results are displayed, the top level path is http://&lt;<em>hostname</em>&gt;/index_this_file.pdf</p><p><strong>contentSiteModule</strong>=&lt;<strong>awsS3ContentSite</strong> / <strong>azureContentSite</strong> / <strong>googleContentSite</strong> / <strong>filepathContentSite</strong> &gt;</p><p>These are are python modules that that contain the code for reading files from Cloud / Local Directory and orchestrate text extraction, vector embedding and storing them into the vector database.</p><p>You can add custom content site handler python modules under $AIWHISPR_HOME/python/content-site directory and configure them.</p><p><strong>doNotReadDirList</strong>=&lt;A comma separated directory list for directories that should not be read&gt;</p><p>If <em>srctype=filepath </em>then it should be the full path to the directory.</p><p>For cloud based storage, do not include the bucket/container name in the path.</p><p><strong>doNotReadFileList</strong>=&lt;A comma separated list of filename or filename pattern(regex) that should not be read&gt;</p><p>example — to avoid reading log and json files: <em>doNotReadFileList=*.log,*.json</em></p><p>An example to read files from AWS S3</p><pre>[content-site] <br>sitename=my_files_on_s3<br>srctype=s3<br>srcpath=s3://my_bucket/<br>displaypath=http://mywebserver.mydomain.com/<br>contentSiteModule=awsS3ContentSite<br>doNotReadFileList=*.log, *.json</pre><h4><strong>[content-site-auth]</strong></h4><p>In this section you can configure the authentication for the source (S3 bucket/Azure blob container/ Google Cloud Storage).</p><p>If you are reading files from a local directory then configure <em>authtype=filechecks</em></p><pre>[content-site] <br>...<br>srctype=filepath <br>contentSiteModule=filepathContentSite<br>...<br>[content-site-auth] <br>authtype=filechecks </pre><p>If you are reading files from Azure then you have the option to use either Azure SAS token or Azure storage key.</p><p>For Azure SAS token, configure <em>authtype=sas ; </em>the SAS token is configured in <strong>sastoken</strong></p><pre>[content-site] <br>...<br>srctype=azureblob<br>contentSiteModule=azureContentSite<br>...<br>[content-site-auth]<br>authtype=sas<br>sastoken=&lt;SAS_TOKEN e.g. ?sv=XXXXXX..........EmgmBY%3D&gt;</pre><p>For Azure Key, configure <em>authtype=sas ; </em>the storage key is configured in <strong>key</strong></p><pre>[content-site] <br>...<br>srctype=azureblob<br>contentSiteModule=azureContentSite<br>...<br>[content-site-auth]<br>authtype=az-storage-key<br>key=&lt;AZURE_STORAGE_KEY e.g. XXXXXX...........+AStOUjTVw==&gt;</pre><p>For AWS Key, set <em>authtype=aws-key. </em>AWS Access Key Id, AWS Secret Access Key are configured in the same section.</p><pre>[content-site] <br>...<br>srctype=s3<br>contentSiteModule=awsS3ContentSite<br>...<br>[content-site-auth]<br>authtype=aws-key<br>aws-access-key-id=&lt;AWS_ACCESS_KEY&gt;<br>aws-secret-access-key=&lt;AWS_SECRET_ACCESS_KEY&gt;</pre><p>For Google Cloud Storage, set <em>authtype=google-cred-key</em></p><p>The path to the credential file is configured in google-cred-path, the project-id is configured in google-project-id, api-key for cloud storage is configured in google-storage-api-key.</p><pre>[content-site] <br>...<br>srctype=google-cloud<br>contentSiteModule=googleContentSite<br>...<br>[content-site-auth]<br>authtype=google-cred-key<br>google-cred-path=&lt;/path/to/google/credential/file.json&gt;<br>google-project-id=&lt;project-id-to which-storage-is-billed-google&gt;<br>google-storage-api-key=&lt;api-key-to-access-google-storage&gt;</pre><h4><strong>[local]</strong></h4><p>This section is used to configure the path to local directories that AIWhispr can use for its content indexing processes and to configure how many processes should be started in parallel to distribute the workload.</p><p>AIWhispr requires a local working directory o work with extracted text.</p><p><strong>working-dir</strong>=/path/to/local/working-dir</p><p>An index directory is where AIWhispr will store a local SQLite3 database to store content metadata which is used when indexing the content.</p><p><strong>index-dir</strong>=/path/to/local/index-dir</p><p>AIWhispr can spawn multiple processes to distribute indexing workload. The number of processes is controlled by specifying</p><p><strong>indexing-processes</strong>=&lt;integer:should_be_1_or_less_than_no_of_cpu&gt;</p><p>indexing-processes is configured to an integer value 1 or greater. It should not be greater than the number of CPUs on the machine. Spawning of multiple indexing processes is effective when you have GPUs for LLM/vector embedding and multiple CPUs to handle the text extraction.</p><p>If you have only CPUs , no GPU’s, then this should be set to 1 or 50% of the CPUs on the machine to ensure you have enough CPUs for other processes. e.g. on a 4 CPU machine with no GPU, configure indexing-processes=2</p><pre>[local]<br>working-dir=&lt;/path/to/local/working-dir&gt;<br>index-dir=&lt;/path/to/local/index-dir&gt;<br>indexing-processes=2</pre><h4><strong>[vectordb]</strong></h4><p>A section to configure the vector database access.</p><p>api-address=&lt;hostname/ip address of the vector database&gt;</p><p>api-port=&lt;port number of the vector database&gt;</p><p>api-key=&lt;api key for the vector database&gt;</p><p>vectorDbModule=&lt;python module in AIWhispr to connect to vector db&gt;</p><p>Currently AIWhispr has inbuilt support for Typesense(<em>typesenseVectorDb</em>), Qdrant(<em>qdrantVectorDb</em>) . Support for more vector database is on the way.</p><p>Example for Qdrant VectorDB on local machine</p><pre>[vectordb]<br>api-address=0.0.0.0<br>api-port=8108<br>api-key=<br>vectorDbModule=qdrantVectorDb</pre><p>You can add custom vector database handler python modules under the directory $AIWHISPR_HOME/python/vectordb. You can then configure</p><p>vectorDbModule=&lt;myPythonModule&gt;</p><h4><strong>[llm-service]</strong></h4><p>A section to configure the large-language-model (LLM) used to create the vector embedding. AIWhispr uses sentence-transformer library.</p><p>You can customize this by writing your own LLM encoding handler under $AIWHISPR_HOME/python/llm-service</p><p>The default configuration is:</p><pre>[llm-service] <br>model-family=sbert <br>model-name=all-mpnet-base-v2 <br>llm-service-api-key= <br>llmServiceModule=libSbertLlmService</pre><p>I hope this helps you understand how AIWhispr can be configured to activate your next semantic search project. You can download AIWhispr from <a href="https://github.com/prasaar/aiwhispr/tree/main">https://github.com/prasaar/aiwhispr/tree/main</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3755ab9bde85" width="1" height="1" alt=""><hr><p><a href="https://blog.gopenai.com/overview-of-aiwhispr-design-to-drive-semantic-search-using-configs-3755ab9bde85">Overview of AIWhispr design to drive semantic search using configs.</a> was originally published in <a href="https://blog.gopenai.com/">GoPenAI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>