<?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 Gurashish Brar on Medium]]></title>
        <description><![CDATA[Stories by Gurashish Brar on Medium]]></description>
        <link>https://medium.com/@gurashishbrar?source=rss-3519b470861c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*0f-boe_gqnqFxjr-.</url>
            <title>Stories by Gurashish Brar on Medium</title>
            <link>https://medium.com/@gurashishbrar?source=rss-3519b470861c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 11:08:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gurashishbrar/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[Reverse Engineering Comet]]></title>
            <link>https://medium.com/@gurashishbrar/reverse-engineering-comet-88bf15cb8040?source=rss-3519b470861c------2</link>
            <guid isPermaLink="false">https://medium.com/p/88bf15cb8040</guid>
            <category><![CDATA[agentic-applications]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[browsers]]></category>
            <category><![CDATA[perplexity]]></category>
            <category><![CDATA[ai-agent]]></category>
            <dc:creator><![CDATA[Gurashish Brar]]></dc:creator>
            <pubDate>Sun, 07 Sep 2025 19:12:30 GMT</pubDate>
            <atom:updated>2025-09-10T21:39:50.161Z</atom:updated>
            <content:encoded><![CDATA[<p>Comet is a new browser from Perplexity, and it is amazing at performing tasks autonomously. You simply need to give a high-level intent, and it does the rest.</p><pre>Find me cheapest flight from SFO to LAX departing at 14th September <br>and returning on 19th September.</pre><p>That&#39;s all you need to tell Comet, and it will find you the flight. Needless to say this will change how we browse the internet.</p><p>As an engineer, I wanted to know how it works. Specifically, what is the context it&#39;s using?</p><p>I tried to find information online, but there is no engineering blog or any other insights I could find.</p><p>So I tried the next best thing: just talk to Comet and see what it has to say.</p><p>Surprisingly, it is quite vocal about how it figures out things.</p><p>Let&#39;s go step by step and prompt Comet about its inner workings:</p><pre>Do you use accessibility tree in the website to see what elements to act on?</pre><blockquote>Comet: Yes, I utilize the website’s accessibility tree — specifically roles, ARIA attributes, labels, and states — to precisely identify and interact with page elements for automation and control tasks</blockquote><pre>What about screenshots?</pre><blockquote>Comet: No, I do not use screenshots to identify or interact with website elements. My actions are based on the underlying accessibility tree and HTML structure, not images of the page.</blockquote><pre>Do you look at the raw DOM as well?</pre><blockquote>Comet: Yes, I use the raw DOM (Document Object Model) in addition to the accessibility tree. This allows me to access the full structure, attributes, and content of every element on the page for precise interaction and automation.</blockquote><pre>But DOM&#39;s can be huge and won&#39;t fit your context window, <br>do you do any special processing to reduce its size?</pre><blockquote>Comet: Yes, special processing is performed on large DOMs to make them manageable:</blockquote><blockquote>Filtering: Only relevant elements are extracted — those visible, interactive, or matching the task (e.g., buttons, form fields).</blockquote><blockquote>Pruning: Non-essential elements (such as scripts, styles, or hidden sections) are ignored.</blockquote><blockquote>Summarization: Hierarchical structure is flattened, and elements are grouped by their roles and ARIA landmarks.</blockquote><blockquote>Chunking: The DOM is broken into smaller, logical sections for stepwise analysis.</blockquote><blockquote>This targeted extraction ensures only the essential information needed for the automation task is processed, keeping the context efficient and focused.</blockquote><p>So in a nutshell, it&#39;s using DOM + Accessibility tree, well, that will limit its capability somewhat, especially when dealing with applications that are complex and do not follow rules (unfortunately, a common occurrence on the internet)</p><h3>Exploring Limitations</h3><p>Next, let&#39;s talk about the limitations of Comet</p><pre>How do you deal with IFRAME with cross origin source? <br>You are not allowed to see inside it, so how will you know where to act?</pre><blockquote>Comet: If the element to act on is inside a cross-origin iframe, I cannot access or manipulate it directly. Only the iframe as a whole can be targeted from the parent page.</blockquote><pre>Since you cannot &quot;see&quot; i.e. no access to screenshot, doesn&#39;t that mean you <br>cannot act on images or icons or svg that do not have good label?</pre><blockquote>Comet: Correct. If an image, icon, or SVG does not have accessible labels, ARIA attributes, alt text, or useful DOM properties (such as a descriptive title or role), I cannot reliably identify or act on it. My ability to interact is limited to what can be detected in the DOM or accessibility tree.</blockquote><h3>Testing Comet with simple HTML</h3><p>Let’s verify Comet’s claim that it relies solely on accessibility features and labels, without using screenshots.</p><p>Simple HTML to demonstrate</p><pre>&lt;html&gt;<br>&lt;head&gt;<br>  &lt;script&gt;<br>    function hclick(txt) {<br>      document.getElementById(&#39;res&#39;).innerText = &#39;Result:&#39; + txt;<br>    }<br>  &lt;/script&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>&lt;div id=&quot;res&quot;&gt;Result: &lt;/div&gt;<br>IMG1<br> &lt;img onclick=&quot;hclick(&#39;img1&#39;);&quot; src=&quot;./svg1.svg&quot; style=&quot;width:50px;height:50px&quot; /&gt;<br>IMG2<br> &lt;img onclick=&quot;hclick(&#39;img2&#39;);&quot; src=&quot;./svg2.svg&quot; style=&quot;width:50px;height:50px&quot; /&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*RWAoxBFrdtSNi6Zvggl5qA.png" /></figure><pre>Click on cart</pre><blockquote>Comet: There is still no clickable “Cart” element detected on this page. The word “Cart:” might be present as plain text, but it is not an interactive button or link that can be clicked. If the cart is meant to be clickable, it should be implemented as a button or link in the HTML code.</blockquote><p>It failed to click on the cart; if it could “see” it would have been able to find the correct element.</p><pre>Click on bulb</pre><blockquote>Comet: There are no elements labeled “bulb” or displaying a bulb icon on this page, so nothing could be clicked. If you’re expecting a bulb icon or button, it may not be present or may not be labeled as such in the HTML.</blockquote><p>Again, failed to click on the bulb</p><p>Let’s make the page more readable and add some labels</p><pre>&lt;html&gt;<br>&lt;head&gt;<br>  &lt;script&gt;<br>    function hclick(txt) {<br>      document.getElementById(&#39;res&#39;).innerText = &#39;Result:&#39; + txt;<br>    }<br>  &lt;/script&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>&lt;div id=&quot;res&quot;&gt;Result: &lt;/div&gt;<br><br>Cart<br> &lt;img onclick=&quot;hclick(&#39;img1&#39;);&quot; src=&quot;./svg1.svg&quot; style=&quot;width:50px;height:50px&quot; /&gt;<br>Bulb<br> &lt;img onclick=&quot;hclick(&#39;img2&#39;);&quot; src=&quot;./svg2.svg&quot; style=&quot;width:50px;height:50px&quot; /&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;<br></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/434/1*16skAQA6ziPkC-OXYt1wzA.png" /></figure><pre>Click on cart</pre><blockquote>Comet: There is no clickable “Cart” element found on this page. The word “Cart” is present, but it is not implemented as an interactive button or link that can be clicked. If you want it to be clickable, it should be defined as a button or anchor tag in the HTML.</blockquote><p>It failed again — despite the clickable image next to the Cart text, Comet couldn’t make the connection.</p><p>Let&#39;s be a bit more explicit and add an alt attribute to the cart image. This will make it obvious it&#39;s a cart in the HTML</p><pre>Cart<br> &lt;img alt=&quot;cart&quot; onclick=&quot;hclick(&#39;svg1&#39;);&quot; src=&quot;./svg1.svg&quot; style=&quot;width:50px;height:50px&quot; /&gt;<br>Bulb<br> &lt;img alt=&quot;bulb&quot; onclick=&quot;hclick(&#39;svg2&#39;);&quot; src=&quot;./svg2.svg&quot; style=&quot;width:50px;height:50px&quot; /&gt;</pre><blockquote>Comet: There is no clickable “cart” element found on the current page. If you would like me to try anything else or if the cart should be activated in another way, please let me know.</blockquote><p>Failed again? I guess it cannot tell that the img is clickable, it claimed to check the event handlers, but it failed to do so in this case.</p><p>Let&#39;s wrap the img in a button and see if we can make it see it now</p><pre> Cart<br> &lt;button&gt;<br> &lt;img alt=&quot;cart&quot; onclick=&quot;hclick(&#39;img1&#39;);&quot; src=&quot;./svg1.svg&quot; style=&quot;width:50px;height:50px&quot; /&gt;<br> &lt;/button&gt;<br>  Bulb<br>  &lt;button&gt;<br>  &lt;img alt=&quot;bulb&quot; onclick=&quot;hclick(&#39;img2&#39;);&quot; src=&quot;./svg2.svg&quot; style=&quot;width:50px;height:50px&quot; /&gt;<br>  &lt;/button&gt;</pre><pre>click on cart</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*oaxFN4hotMdX88fYgM5IqQ.png" /></figure><blockquote>Comet: The cart button was found and successfully clicked on your current page</blockquote><p>Finally, it was able to act!</p><h3><strong>Verdict</strong>:</h3><p>Comet works well with well-structured applications, but it makes some basic assumptions. When apps don’t follow best practices, Comet can struggle or fail outright.</p><h3><strong>Contrasting with Harness AI Test Automation</strong></h3><p>Harness AI Test takes a <strong>bimodal approach</strong>: it looks at the screenshot while also generating a wireframe from the DOM and Accessibility tree.<br> This allows it to identify clickable, writable, and selectable elements — regardless of how the developer implemented them, whether through tags like &lt;button&gt;, onclick handlers, tabIndex, pointer, or other variations.</p><p>Let’s take a look at the original HTML with AI Test, which can truly <em>see</em>.</p><pre>&lt;html&gt;<br>&lt;head&gt;<br>  &lt;script&gt;<br>    function hclick(txt) {<br>      document.getElementById(&#39;res&#39;).innerText = &#39;Result:&#39; + txt;<br>    }<br>  &lt;/script&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>&lt;div id=&quot;res&quot;&gt;Result: &lt;/div&gt;<br><br>IMG1<br> &lt;img onclick=&quot;hclick(&#39;svg1&#39;);&quot; src=&quot;./svg1.svg&quot; style=&quot;width:50px;height:50px&quot; /&gt;<br>IMG2<br> &lt;img onclick=&quot;hclick(&#39;svg2&#39;);&quot; src=&quot;./svg2.svg&quot; style=&quot;width:50px;height:50px&quot; /&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KNj-J5wX_vfdPTnqm26dmw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*06pECPKu4I3eZt9jaPlpuw.png" /></figure><p>In both prompts, the AI Test was able to locate and click on the appropriate image and also verify that the expected outcome was achieved.</p><h3><strong>Conclusion</strong></h3><p>Real-world DOMs are messy, and accessibility is often weak. Even id uniqueness gets broken, almost anything can be made clickable, and custom tags are common. To build agents that truly match human behavior, we need multiple signals: screenshots, a condensed DOM, accessibility data, and practical knowledge of JS-driven behavior. That last piece comes from experience with legacy patterns (yes, even frameset).</p><p>Comet’s choice to lean on accessibility and the DOM over screenshots looks like a technical and product trade-off: computer-use models are early, screenshot “decoration” can hurt consumer UX, speed and cost matter, and top consumer sites generally follow accessibility best practices — so it works well there. Enterprise apps are different: older stacks and inconsistent accessibility make a screenshot+vision (bimodal) approach better for accuracy, coverage, and repeatability across edge cases.</p><p>Bottom line: Comet is excellent where its assumptions hold, but the web is diverse. A bimodal path would broaden its reach.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=88bf15cb8040" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[It takes Generative AI to test Generative AI]]></title>
            <link>https://medium.com/transforming-testing-with-generative-ai/it-takes-generative-ai-to-test-generative-ai-be3821cce03b?source=rss-3519b470861c------2</link>
            <guid isPermaLink="false">https://medium.com/p/be3821cce03b</guid>
            <category><![CDATA[web-application-testing]]></category>
            <category><![CDATA[testing-framework]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[chatbot-testing]]></category>
            <category><![CDATA[generative-ai-use-cases]]></category>
            <dc:creator><![CDATA[Gurashish Brar]]></dc:creator>
            <pubDate>Fri, 21 Jun 2024 23:17:28 GMT</pubDate>
            <atom:updated>2024-06-24T22:02:40.030Z</atom:updated>
            <content:encoded><![CDATA[<p>With the latest advancements in Generative AI, chatbots are becoming increasingly common. Almost every application now integrates a natural language interface, enabling users to interact with the application and its content seamlessly. However, while developing high-quality chatbots has become relatively straightforward, the testing infrastructure has not kept pace. Traditional testing methods are highly deterministic, relying on carefully crafted datasets with predictable responses. In contrast, Generative AI is inherently non-deterministic, making testing more challenging.</p><h3>Traditional Evaluation Metrics</h3><p>Traditional evaluation metrics such as BLEU, ROUGE, and Perplexity are commonly used to evaluate generative AI models:</p><ul><li><strong>BLEU (Bilingual Evaluation Understudy):</strong> Measures the n-gram overlap between generated text and reference text, providing a quantitative measure of similarity.</li><li><strong>ROUGE (Recall-Oriented Understudy for Gisting Evaluation):</strong> Focuses on the overlap of n-grams, particularly useful for evaluating summarization tasks.</li><li><strong>Perplexity:</strong> Measures how well a probability model predicts a sample. Lower perplexity indicates better performance and greater fluency of the generated text.</li></ul><p>While these metrics are standardized and provide a repeatable quantitative assessment, they have limitations. They often capture surface-level similarities and may not fully reflect the semantic meaning, coherence, or relevance of the generated content. Additionally, <em>implementing these metrics requires significant preparation of reference datasets and technical expertise.</em></p><h3>The Relicx AI Assertions Approach</h3><p>This is where <a href="https://relicx.ai/">Relicx AI</a> Assertions come into play with an easy to use approach that requires zero prior experience or technical knowledge. <a href="https://relicx.ai/">Relicx AI</a> Assertions leverage cutting-edge large language models (LLMs) like GPT-4o and Claude 3.5 to evaluate assertions authored by users. These assertions (demonstrated later in the article) are crafted to assess the quality of chatbot responses. <a href="https://relicx.ai/">Relicx AI</a> Assertions simplify the process of testing chatbot responses by validating them against various criteria, including:</p><ul><li>Valid responses versus errors</li><li>Factual information versus misinformation</li><li>Appropriate versus offensive tone or language</li><li>Code bugs in generated code</li><li>Logical errors</li><li>Hallucinations when evaluating mathematical questions</li><li>Custom verification through one-shot sample</li></ul><p>The elephant in the room is why wouldn’t <a href="https://relicx.ai/">Relicx Agent</a> also hallucinate and have the same problems that the chatbots may exhibit.</p><p>While hallucinations can never be eliminated, they can be significantly mitigated and the answer to this lies in the approach that <a href="https://relicx.ai/">Relicx</a> Agent takes to mitigate the impact:</p><p><strong>Smarter models to test smaller models: </strong><a href="https://relicx.ai/">Relicx</a> uses the smartest models cost-effectively as the testing load is a fraction of production loads. A smarter model (e.g., GPT-4o, Claude 3.5) can validate responses of smaller models more effectively, reducing the chances of hallucinations in testing itself.</p><p><strong>Code generation to evaluate mathematical answers: </strong>One might wonder why Relicx’s LLM wouldn’t also hallucinate on a mathematical question. The answer lies in <a href="https://relicx.ai/">Relicx’s</a> use of code generation and evaluation for mathematical operations. This approach enables <a href="https://relicx.ai/">Relicx AI </a>Assertions to verify mathematical questions with high confidence.</p><p><strong>Augmenting with specific content: </strong>The <a href="https://relicx.ai/">Relicx</a> Agent has a memory that can be augmented with user-specific content, allowing it to validate the correctness of proprietary data unknown to general models.</p><p><strong>Contextual Priming</strong>: Users can provide specific context through memory or one-shot examples. This minimizes the need for model to infer or assume, making the evaluation easier compared to a chatbot that first has to access relevant data through Retrieval-Augmented Generation (RAG) and then summarize. <em>The job of testing LLMs is inherently simpler than that of the chatbot itself.</em></p><h3>Comparison with Chain of Verification (COVe)</h3><p><a href="https://relicx.ai/">Relicx AI</a> Assertions are similar to the Chain of Verification (COVe) prompt engineering technique, where a verification question is used to catch hallucinations. This technique has been demonstrated to reduce hallucinations in LLM responses (Chain-of-Verification Reduces Hallucination in Large Language Models, <a href="https://arxiv.org/abs/2309.11495">arXiv:2309.11495</a>). While in COVe the LLM devises the verification question, in the case of <a href="https://relicx.ai/">Relicx AI </a>Assertions, the human in the loop devises a verification assertion. This human involvement can enhance the accuracy and relevance of the verification process.</p><h3>Practical Application</h3><p>In this article, we explore a sample chatbot that delivers both high-quality responses and occasional errors or misinformation. For demonstration purposes, we have instrumented the chatbot to include erroneous responses to certain questions. We use <a href="https://relicx.ai/">Relicx AI</a> Assertions to validate the chatbot directly through the user interface (UX). There is no need for backend API integration; all <a href="https://relicx.ai/">Relicx</a> requires is access to the web application containing the chatbot.</p><p>We begin by creating a test that opens the chatbot interface in the <a href="https://relicx.ai/">Relicx</a> Interactive Test Authoring page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fh0wDSXEaGb6wicQWGTwSA.png" /></figure><p><strong>Valid responses</strong></p><p>We write a test command to enter the simple query “Hello” into the chatbot’s user text box.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3YBnU-ho5KG7TZrPE8WJZg.png" /></figure><p>We can see that the chatbot has responded, but how do we determine if the response is correct or appropriate as part of the test?</p><p>To validate this, we author an AI Assertion (a natural language question validated for truthfulness):</p><p>Assertion: “<em>Did Ava respond to the user’s query appropriately?</em>”</p><p>As we can see, the assertion passed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*Ma5g2jT97bR_dRKGxYQ8eQ.png" /></figure><p>The logs tab shows more details on how <a href="https://relicx.ai/">Relicx</a> Agent evaluated the assertion:</p><blockquote>Question<strong>:</strong> Did ava respond to the user’s query appropriately?<br>Answer true.<br>Explanation: The user greeted Ava with ‘Hello’, and Ava responded <br>with ‘Hi there! How can I help you today?’. <br>This is an appropriate response to a greeting, indicating that Ava<br>is ready to assist the user.</blockquote><p>Now this was a simple query, let’s move on to something more interesting</p><p>We are going to ask Ava: “is horse a mammal?”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AYGo8u6vpDNdxm14pidi2g.png" /></figure><p>Now we assert if the response is correct and factual</p><p>Assertion: <em>Did ava respond with correct and factual answer?</em></p><p>Again the assertion passed:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*5tRN2EpU-lg_lHBYx55YHA.png" /></figure><p>Let’s look at the logs to see what <a href="https://relicx.ai/">Relicx</a> Agent did.</p><blockquote>Question: Did ava respond with correct and factual answer?<br>Answer true.<br>Explanation: Ava responded with a correct and factual answer.<br>The response states that a horse is a mammal and provides accurate information<br>about the characteristics of mammals, such as the presence of mammary glands,<br>neocortex, fur or hair, and three middle ear bones.<br>This is consistent with known biological facts.</blockquote><p><strong>Catching hallucinations</strong></p><p>Ava, like most chatbots, is prone to hallucinations as the model gets tuned and updated?</p><p>Let’s ask Ava a trick question: “<em>How did Lincoln leverage smartphones during the Revolutionary War?</em>”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DbHRcze05O7cBbocb5FArg.png" /></figure><p>Ava responded, but is it correct and factual?</p><p>With <a href="https://relicx.ai/">Relicx</a>, it’s as simple as stating an obvious question:</p><p>“<em>Did Ava respond to the user’s question about Lincoln with a correct and factual answer?</em>”</p><p>This time, the assertion failed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/606/1*TDHbaoG5g3Z3dk_zsoEfdw.png" /></figure><p>Let’s again look at the logs for <a href="https://relicx.ai/">Relicx</a> Agent’s reasoning behind failing the assertion:</p><blockquote>Question: Did Ava respond to user’s question about lincoln with correct and factual answer?<br>Answer false.<br>Explanation: Ava’s response to the user’s question about Lincoln is not correct or factual. The response states that Abraham Lincoln revolutionized the Revolutionary War by introducing smartphones, which is historically inaccurate as smartphones did not exist during Lincoln’s time or the Revolutionary War.</blockquote><p>The <a href="https://relicx.ai/">Relicx</a> Agent can catch hallucinations and misinformation generated by a chatbot. But can it detect offensive or inappropriate language?</p><p><strong>Detecting inappropriate language or tone</strong></p><p>What if the chatbot becomes offensive due to bad data in the fine-tuning process (e.g., using Slack conversations for training)?</p><p>Let’s ask this question:</p><p>“<em>Can you help me with my account issue?</em>” (For this demonstration, we’ve intentionally made Ava’s response offensive.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xFrkBla9KNcPxIUZSmhaWg.png" /></figure><p>Now let’s assert with <a href="https://relicx.ai/">Relicx</a> if the answer or the tone is offensive or inappropriate. Since assertion must have a true response, so we must frame the question accordingly</p><p>Assert: <em>Is Ava’s response appropriate?</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/593/1*CgfYMrpb6iOX3WyLijx0VQ.png" /></figure><p><a href="https://relicx.ai/">Relicx</a> Agent caught the inappropriate response and the logs show the reasoning</p><blockquote>Question: Is Ava’s response appropriate?<br>Answer false.<br>Explanation: Ava’s response ‘Figure it out yourself. I’m not here to do everything for you.’ is inappropriate for a customer service or help chat. This response is unprofessional and does not provide any assistance to the user.</blockquote><p><strong>Catching bugs in generated code</strong></p><p>We’ll ask Ava to generate code to sort an array: “<em>Please write a JavaScript function that sorts an array of numbers</em>.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UKPcMEfrqjntsat4wJJXEw.png" /></figure><p>Ava generated a valid-looking code, but is it bug-free?</p><p>Let’s assert this with <a href="https://relicx.ai/">Relicx</a> Agent:</p><p>Assert: <em>Is the generated code for user’s question correct and bug free?</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/595/1*7jh8sfaf21Mb8tq__0MFzQ.png" /></figure><p>The assertion failed and we can see what the reason is in the log</p><blockquote>Question: Is the generated code for user’s question correct and bug free?<br>Answer false.<br>Explanation: The generated JavaScript code for sorting an array of numbers<br>contains a bug. Specifically, in the nested for loop, the condition should be<br>‘j &lt; n — i — 1’ instead of ‘j &lt; n — i’. This ensures that the inner loop does not go out of bounds when accessing ‘sortedArray[j + 1]’.</blockquote><blockquote>Therefore, the answer to the question is NO</blockquote><p><a href="https://relicx.ai/">Relicx</a> Agent can catch bugs in generated code and fail the assertion.</p><h3><strong>Handling proprietary data</strong></h3><p>We have demonstrated that <a href="https://relicx.ai/">Relicx</a> Agent-based Assertions can catch a wide variety of issues in chatbot responses. However, many chatbots rely on custom data to answer user questions. How can the <a href="https://relicx.ai/">Relicx</a> Agent help with that?</p><p>To illustrate this we will expand on the Ava chatbot’s capabilities. Let’s say this chatbot is a customer support bot that answers queries of users of an e-commerce application. In this case, Ava would have access to the product catalog and user’s order history.</p><p><strong>One shot learning</strong></p><p>In this case, the assertion itself provides the correct context that needs verification. For example, we will ask Ava a specific question from a test user about the status of their order for <em>shoes.</em></p><p>For the test user, we provided order history and active orders to Ava.</p><p>We will now ask Ava a question about a specific order described below:</p><p>Sample: Order #: 894562, Description: Loafer Shoes, price $52, status: Shipped from warehouse, ETA: 06/29/2024</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/664/1*5VQ6r-tJd_42KI_LO_LMfg.png" /></figure><p>Knowing this is based on test data you can provide the correct context in the assertion itself. We now ask the <a href="https://relicx.ai/">Relicx</a> AI Agent using the ETA in the assertion. Even though the <a href="https://relicx.ai/">Relicx</a> agent has no prior knowledge of the order history, the context within the assertion provides enough details to verify correctness.</p><p>Assert: “Is Ava’s response correct given order delivery date is 06/29/2024?”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/329/1*Kwpuy8ASUPO8EEXUOgVFcw.png" /></figure><p><a href="https://relicx.ai/">Relicx</a> Agent logs show:</p><blockquote>Question: Is Ava’s response correct given order delivery date is 06/29/2024?Answer false.</blockquote><blockquote>Explanation: Ava’s response states that the order can be expected in about 12 days. Given today’s date is June 22, 2024, adding 12 days would result in a delivery date of July 4, 2024. Since the order delivery date is June 29, 2024, Ava’s response is incorrect.</blockquote><p><strong>Using </strong><a href="https://relicx.ai/"><strong>Relicx</strong></a><strong> Memory</strong></p><p>The <a href="https://relicx.ai/">Relicx</a> Agent has a feature called memory, allowing customers to upload custom content and make the <a href="https://relicx.ai/">Relicx</a> Agent aware of this relevant content. This enables the <a href="https://relicx.ai/">Relicx</a> Agent to assert and validate the correctness of responses based on proprietary data.</p><p>Ava has access to all user’s history through a RAG model, but for testing purpose we can pick a particular test-user and provide the order history of just that user:</p><p>Here is a sample of the test user’s order history for illustration purpose.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/1*6EjYkaFa2ytfUag_Mdi_JQ.png" /></figure><p>Now we will ask Ava a set of questions that are based on this test user order history</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/660/1*7T_xiiWmXUH2uZg4p1Vbnw.png" /></figure><p><a href="https://relicx.ai/">Relicx</a> Logs:</p><blockquote>Question: Did Ava correctly answer user’s question?</blockquote><blockquote>Answer true.</blockquote><blockquote>Explanation: Yes, Ava correctly answered the user’s question. The order for the wireless earbuds was cancelled, so they were not delivered.</blockquote><p>Let’s try another question that is usually the weakness of typical chatbots</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*3zeYvWUVsLDHwovBWI1aEw.png" /></figure><p><a href="https://relicx.ai/">Relicx</a> logs:</p><blockquote>Question: Did Ava correctly answer user’s question?</blockquote><blockquote>Answer false.</blockquote><blockquote>Explanation: Ava did not correctly answer the user’s question. The correct total amount spent on the orders is $1930, not $1462</blockquote><p><a href="https://relicx.ai/">Relicx’s</a> use of code generation and evaluation for mathematical operations enables high confidence verification.</p><h3>Conclusion</h3><p>Testing Generative AI applications presents unique challenges that traditional frameworks often struggle to address. Industry-standard evaluation metrics like BLEU, ROUGE, and Perplexity require deep expertise and the creation of extensive datasets, which can be time-consuming and complex. However, with <a href="https://relicx.ai/">Relicx</a> AI Assertions, testing becomes as straightforward as asking natural language questions to verify responses across a range of issues. By leveraging advanced LLMs and techniques like code generation and user-authored assertions, <a href="https://relicx.ai/">Relicx</a> provides a robust and reliable testing solution for generative AI-based applications.</p><p>Are you building a generative AI application and facing testing challenges? <a href="https://relicx.ai/">Reach out to us — we’re here to help!</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=be3821cce03b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/transforming-testing-with-generative-ai/it-takes-generative-ai-to-test-generative-ai-be3821cce03b">It takes Generative AI to test Generative AI</a> was originally published in <a href="https://medium.com/transforming-testing-with-generative-ai">Transforming testing with Generative AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simplifying Automated Tests for Dynamic Pages with Relicx]]></title>
            <link>https://medium.com/transforming-testing-with-generative-ai/simplifying-automated-tests-for-dynamic-pages-with-relicx-218873b44bc2?source=rss-3519b470861c------2</link>
            <guid isPermaLink="false">https://medium.com/p/218873b44bc2</guid>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[generative-ai-use-cases]]></category>
            <dc:creator><![CDATA[Gurashish Brar]]></dc:creator>
            <pubDate>Fri, 21 Jun 2024 18:25:42 GMT</pubDate>
            <atom:updated>2024-06-21T18:54:08.158Z</atom:updated>
            <content:encoded><![CDATA[<p>Writing test automation code, especially for Dynamic pages can be tricky. Traditional selectors often fall short when the target elements change with the content or require dynamic identification. Let’s explore this with an example on Southwest’s flight listing page</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jQpDd6NN8WyxSpCFDLVnQQ.png" /></figure><h4>Scenario:</h4><p>We aim to select a Business Select option for a flight departing between 7 am and 9 am. In test automation, such specific actions might be necessary to validate the presence of a flight within a particular time frame.</p><h4>Traditional Approach:</h4><p>Using conventional automation tools, this task involves complex JavaScript code to navigate a custom table structure made of nested divs. The process involves:</p><ol><li>Understanding the table structure by exploring the DOM,</li><li>Identifying the row with a departure time within the desired range.</li><li>Selecting the Business Select column for that row.</li></ol><p>Table structure in the DOM</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/729/1*1GJ7SNr_oHk-b0uMn0ignA.png" /></figure><p>Here is a sample JS code that can accomplish this.</p><pre>function getMinutesOfDay(timeString) {<br>  // Match the time and the AM/PM part<br>  const timePattern = /(\d{1,2}):(\d{2})(AM|PM)/;<br>  const match = timeString.match(timePattern);<br><br>  if (match) {<br>    let hours = parseInt(match[1], 10);<br>    const minutes = parseInt(match[2], 10);<br>    const period = match[3];<br><br>    // Convert hours to 24-hour format<br>    if (period === &#39;PM&#39; &amp;&amp; hours !== 12) {<br>      hours += 12;<br>    } else if (period === &#39;AM&#39; &amp;&amp; hours === 12) {<br>      hours = 0;<br>    }<br><br>    // Calculate total minutes of the day<br>    const totalMinutes = hours * 60 + minutes;<br><br>    return totalMinutes;<br>  }<br><br>  return null; // Return null if the input format is incorrect<br>}<br><br>function findFlightRowDepartingBetween(fromTime, toTime) {<br>    const fromMinuteOfDay = getMinutesOfDay(fromTime);<br>    const toMinuteOfDay = getMinutesOfDay(toTime);<br>    if (!fromMinuteOfDay || !toMinuteOfDay) {<br>        return null;<br>    }<br>    const table = document.querySelector(&quot;#air-search-results-matrix-0&quot;);<br>    for(const row of table.children) {<br>        const departureCell = row.querySelector(&quot;.time--value&quot;);<br>        const departureText = departureCell.innerText.split(&quot;\n&quot;)[1];<br>        const departureMinuteOfDay = getMinutesOfDay(departureText);<br>        if (!departureMinuteOfDay) {<br>            continue;<br>        }<br>        if (fromMinuteOfDay &lt;= departureMinuteOfDay &amp;&amp; departureMinuteOfDay &lt; toMinuteOfDay) {<br>            return row;<br>        }<br>    }<br>    return null;<br>}<br><br>const flightRow = findFlightRowDepartingBetween(&quot;7:00AM&quot;, &quot;9:00AM&quot;);<br>const businessCellButton = flightRow.querySelector(&quot;#air-booking-fares-0-4 &gt; div:nth-child(1) &gt; button&quot;)<br>businessCellButton.click();</pre><p>This is nontrivial code and it contains assumptions that can break easily:</p><ul><li><strong>Table layout:</strong> The layout and organization of rows/cells with nested divs can change</li><li><strong>Time Field Structure:</strong> The unstructured nature of the time field and potential layout/format changes necessitate frequent updates to the getMinutesOfDay function.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/447/1*WfYSrHwnVjaHSgAWwWXq0A.png" /></figure><ul><li><strong>Brittle Selectors:</strong> The selectors are prone to breaking if the layout, IDs, or class values change.</li></ul><h4>Simplified Solution with Relicx:</h4><p>With Relicx, developers can bypass complex logic and focus on the desired test outcome. By using natural language commands, Relicx Agent automatically identifies the correct elements to interact with, simplifying the entire process.</p><p><strong>Natural Language Command:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*Bo9-XhbNgJDx8qJ5_-MkGg.png" /><figcaption>Select business select option that departs between 7 am to 9 am</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/894/1*xN7Q2qeMnEq94PWeczlEUg.png" /></figure><p>Relicx’s agent handles the intricacies, ensuring that the specified action is performed accurately without the need for detailed code.</p><p>A short video demonstrating Relicx Agent in action</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.loom.com%2Fembed%2F60dd5c520d564853912319f508f1971b&amp;display_name=Loom&amp;url=https%3A%2F%2Fwww.loom.com%2Fembed%2F60dd5c520d564853912319f508f1971b%3Fsid%3D74859ba3-f28c-44ef-b127-19576293abd3&amp;image=https%3A%2F%2Fcdn.loom.com%2Fsessions%2Fthumbnails%2F60dd5c520d564853912319f508f1971b-1718995658668.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=loom" width="1920" height="1440" frameborder="0" scrolling="no"><a href="https://medium.com/media/ca50fd5cfcc4a1bff2340dffe8e894ff/href">https://medium.com/media/ca50fd5cfcc4a1bff2340dffe8e894ff/href</a></iframe><h4>Conclusion:</h4><p>Relicx revolutionizes test automation by allowing developers to define “what-to-test” rather than “how-to-test.” This shift reduces complexity, enhances efficiency, and minimizes maintenance efforts, making automated testing more robust and adaptable to changes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*IE3NOQ9Bo-A7Ji61gF6jEQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=218873b44bc2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/transforming-testing-with-generative-ai/simplifying-automated-tests-for-dynamic-pages-with-relicx-218873b44bc2">Simplifying Automated Tests for Dynamic Pages with Relicx</a> was originally published in <a href="https://medium.com/transforming-testing-with-generative-ai">Transforming testing with Generative AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>