<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Yogesh Choudhary</title>
    <description>The latest articles on DEV Community by Yogesh Choudhary (@yogesh009).</description>
    <link>https://dev.to/yogesh009</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1188912%2Fdd58dea6-2229-4dfc-b24f-8617f81dbeb4.jpg</url>
      <title>DEV Community: Yogesh Choudhary</title>
      <link>https://dev.to/yogesh009</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/yogesh009"/>
    <language>en</language>
    <item>
      <title>Using RAG to Build Your IDE Agents</title>
      <dc:creator>Yogesh Choudhary</dc:creator>
      <pubDate>Tue, 18 Jun 2024 21:59:22 +0000</pubDate>
      <link>https://dev.to/commanddash/using-rag-to-build-your-ide-agents-1pcj</link>
      <guid>https://dev.to/commanddash/using-rag-to-build-your-ide-agents-1pcj</guid>
      <description>&lt;p&gt;In the post-GPT revolution era, many of us developers have started using LLM-enabled tools in our development workflows. Nowadays, you can complete new and complex development tasks in a short span with the help of theses LLM tools when used correctly.&lt;/p&gt;

&lt;p&gt;Until you start using them for anything related to new APIs or SDKs or their latest version, this is the place where they fall short.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fixing the Shortcomings with RAG
&lt;/h2&gt;

&lt;p&gt;At CommandDash (formerly Welltested), our team has been working in code generation. Like other organizations in this field, we recognized the challenges and have actively developed solutions. &lt;/p&gt;

&lt;p&gt;Therefore, with the Dash Agent Framework, we initiated building a robust RAG system to tackle these issues from inception stage itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is RAG?
&lt;/h2&gt;

&lt;p&gt;Retrieval-Augmented Generation (RAG) is a powerful technique that combines the capabilities of LLMs with relevant references to enrich the responses. These relevant references are typically derived from external knowledge sources like document databases and more.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft20cacf94fkxu0uavek9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft20cacf94fkxu0uavek9.png" alt="RAG-enabled Architecture" width="800" height="330"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;RAG significantly enhances the capabilities of LLMs, especially when working with new packages and frameworks. By accessing up-to-date information from documentation, code examples, and other sources, RAG-based LLMs can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Provide accurate and contextual responses&lt;/strong&gt;: Instead of relying solely on pre-trained data, LLMs can access the latest documentation and code examples to provide accurate and relevant information.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Adapt to evolving technologies&lt;/strong&gt;: As APIs and SDKs evolve, RAG can keep pace by constantly updating its knowledge base from official sources.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this blog, we will build a powerful IDE agent for &lt;a href="https://pandas-ai.com/"&gt;PandasAI&lt;/a&gt; using Dash Agent. Then later on, we'll understand how using RAG can significantly improve LLM responses.&lt;/p&gt;

&lt;h2&gt;
  
  
  Building PandasAI Agent
&lt;/h2&gt;

&lt;p&gt;PandasAI is a Python platform that makes it easy to ask questions about your data in a natural language. It integrates generative artificial intelligence capabilities into pandas to allow you to extract insights effortlessly.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3ck1ynlaxjmot6cuigtc.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3ck1ynlaxjmot6cuigtc.gif" alt="PandasAI Demo" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now that you're familiar with PandasAI. Let's start our journey to build our own PandasAI agent. The job of this agent will be to assist developers in building and integrating PandasAI code efficiently.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prerequisite Steps
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;1. Install Dart&lt;/strong&gt;&lt;br&gt;
Dash Agent is built upon dart language. If you haven't already, follow the official Flutter installation instructions &lt;a href="https://flutter.dev/docs/get-started/install"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Install dash_cli&lt;/strong&gt;&lt;br&gt;
Now, install the dash_cli command line tool that enables you to create and publish your agents at the CommandDash marketplace. Open your terminal and run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dart pub global activate dash_cli 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Create PandasAI Project
&lt;/h3&gt;

&lt;p&gt;Next, you will create the pandas_ai project. This is the place where you will define your agent configurations. Run the following command in the terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dash_cli create pandas_ai
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will create a dash agent project that contains the template code agent building. Then, open the project in your preferred IDE where the &lt;a href="https://docs.flutter.dev/get-started/install/macos/mobile-ios?tab=download#text-editor-or-integrated-development-environment"&gt;flutter extension&lt;/a&gt; is installed.&lt;/p&gt;

&lt;h3&gt;
  
  
  Adding Agent Data Sources
&lt;/h3&gt;

&lt;p&gt;The core of a RAG-based agent lies in its knowledge base, known as data sources. These sources provide the agent with context and information to understand and respond to user requests.&lt;/p&gt;

&lt;p&gt;For our PandasAI agent, we will gather data from the following sources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Official PandasAI Documentation&lt;/strong&gt;: &lt;a href="https://docs.pandas-ai.com"&gt;https://docs.pandas-ai.com&lt;/a&gt;, &lt;a href="https://pandasai-docs.readthedocs.io/en/latest"&gt;https://pandasai-docs.readthedocs.io/en/latest&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Official Examples and Issues shared by PandasAI team&lt;/strong&gt;: &lt;a href="https://github.com/sinaptik-ai/pandas-ai"&gt;https://github.com/sinaptik-ai/pandas-ai&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Other Open Source Examples&lt;/strong&gt;: &lt;a href="https://github.com/kBrutal/CSV_ChatBot"&gt;CSV Chatbot&lt;/a&gt;, &lt;a href="https://github.com/InsightEdge01/GroqMultiCSVChatPandasAI"&gt;GroqMultiCSVChatPandasAI
&lt;/a&gt;, &lt;a href="https://github.com/InsightEdge01/MutipleCSVChatllama3Pandasai"&gt;MutipleCSVChatllama3Pandasai&lt;/a&gt;, &lt;a href="https://github.com/TirendazAcademy/PandasAI-Tutorials"&gt;PandasAI-Tutorials&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Navigate to the &lt;strong&gt;lib/data_sources&lt;/strong&gt; file in your project and replace the existing code with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:dash_agent/data/datasource.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:dash_agent/data/filters/filter.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:dash_agent/data/objects/file_data_object.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:dash_agent/data/objects/project_data_object.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:dash_agent/data/objects/web_data_object.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Indexes all the documentation related data&lt;/span&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;DocsDataSource&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;DataSource&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nd"&gt;@override&lt;/span&gt;
  &lt;span class="kt"&gt;List&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;FileDataObject&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="kd"&gt;get&lt;/span&gt; &lt;span class="n"&gt;fileObjects&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;

  &lt;span class="nd"&gt;@override&lt;/span&gt;
  &lt;span class="kt"&gt;List&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;ProjectDataObject&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="kd"&gt;get&lt;/span&gt; &lt;span class="n"&gt;projectObjects&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;

  &lt;span class="nd"&gt;@override&lt;/span&gt;
  &lt;span class="kt"&gt;List&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;WebDataObject&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="kd"&gt;get&lt;/span&gt; &lt;span class="n"&gt;webObjects&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="n"&gt;WebDataObject&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;fromSiteMap&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'https://docs.pandas-ai.com/sitemap.xml'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="n"&gt;WebDataObject&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;fromSiteMap&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="s"&gt;'https://www.xml-sitemaps.com/download/pandasai-docs.readthedocs.io-a2835e7d4/sitemap.xml?view=1'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Indexes all the example code and issues related data&lt;/span&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ExampleDataSource&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;DataSource&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;accessToken&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;'your_personal_github_access_token'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nd"&gt;@override&lt;/span&gt;
  &lt;span class="kt"&gt;List&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;FileDataObject&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="kd"&gt;get&lt;/span&gt; &lt;span class="n"&gt;fileObjects&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;

  &lt;span class="nd"&gt;@override&lt;/span&gt;
  &lt;span class="kt"&gt;List&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;ProjectDataObject&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="kd"&gt;get&lt;/span&gt; &lt;span class="n"&gt;projectObjects&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;

  &lt;span class="nd"&gt;@override&lt;/span&gt;
  &lt;span class="kt"&gt;List&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;WebDataObject&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="kd"&gt;get&lt;/span&gt; &lt;span class="n"&gt;webObjects&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="n"&gt;WebDataObject&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;fromGithub&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="s"&gt;'https://github.com/sinaptik-ai/pandas-ai'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;accessToken&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="nl"&gt;codeFilter:&lt;/span&gt; &lt;span class="n"&gt;CodeFilter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nl"&gt;pathRegex:&lt;/span&gt; &lt;span class="sx"&gt;r'^examples\/.*'&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;
        &lt;span class="n"&gt;WebDataObject&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;fromGithub&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="s"&gt;'https://github.com/ismailtachafine/PandasAI-CSV-Analysis'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;accessToken&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="nl"&gt;codeFilter:&lt;/span&gt; &lt;span class="n"&gt;CodeFilter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nl"&gt;pathRegex:&lt;/span&gt; &lt;span class="sx"&gt;r'.*\.py$'&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;
        &lt;span class="n"&gt;WebDataObject&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;fromGithub&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="s"&gt;'https://github.com/kBrutal/CSV_ChatBot'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;accessToken&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="nl"&gt;codeFilter:&lt;/span&gt; &lt;span class="n"&gt;CodeFilter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nl"&gt;pathRegex:&lt;/span&gt; &lt;span class="sx"&gt;r'.*\.py$'&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;
        &lt;span class="n"&gt;WebDataObject&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;fromGithub&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="s"&gt;'https://github.com/InsightEdge01/GroqMultiCSVChatPandasAI'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;accessToken&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="nl"&gt;codeFilter:&lt;/span&gt; &lt;span class="n"&gt;CodeFilter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nl"&gt;pathRegex:&lt;/span&gt; &lt;span class="sx"&gt;r'.*\.py$'&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;
        &lt;span class="n"&gt;WebDataObject&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;fromGithub&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="s"&gt;'https://github.com/InsightEdge01/MutipleCSVChatllama3Pandasai'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;accessToken&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="nl"&gt;codeFilter:&lt;/span&gt; &lt;span class="n"&gt;CodeFilter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nl"&gt;pathRegex:&lt;/span&gt; &lt;span class="sx"&gt;r'.*\.py$'&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;
        &lt;span class="n"&gt;WebDataObject&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;fromGithub&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="s"&gt;'https://github.com/TirendazAcademy/PandasAI-Tutorials'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;accessToken&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="nl"&gt;codeFilter:&lt;/span&gt; &lt;span class="n"&gt;CodeFilter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nl"&gt;pathRegex:&lt;/span&gt; &lt;span class="sx"&gt;r'.*\.py$'&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;
      &lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above code shared the references of sources that need to be indexed both the documentation and examples. Apart from the sources link, you have also provided &lt;code&gt;accessToken&lt;/code&gt; and &lt;code&gt;codeFilter&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;accessToken&lt;/code&gt;: During processing, the CommandDash server indexes data for &lt;code&gt;WebDataObject.fromGithub&lt;/code&gt;  via Github's official API. To fetch the data from the GitHub API efficiently, the personal github token is required and can be easily generated by visiting the &lt;a href="https://github.com/settings/tokens"&gt;tokens&lt;/a&gt; page. &lt;/li&gt;
&lt;li&gt;
&lt;code&gt;CodeFilter&lt;/code&gt;: This filter enables the framework to selectively index the code files based on the regex shared. This is optional.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: Your Personal Access Token is very sensitive data. Please make sure not it share it with anyone or push it to any public source.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You can learn more about &lt;code&gt;WebDataObject&lt;/code&gt; and associated properties in detail at CommandDash &lt;a href="https://www.commanddash.io/docs/capabilities-datasources"&gt;documentation&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Adding Agent System Prompt and Metadata
&lt;/h3&gt;

&lt;p&gt;Next, you'll add system prompt and agent metadata to the &lt;code&gt;AgentConfiguration&lt;/code&gt; class. Navigate to &lt;strong&gt;lib/agent.dart&lt;/strong&gt; file and replace the existing code with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:dash_agent/configuration/metadata.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:dash_agent/data/datasource.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:dash_agent/configuration/command.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:dash_agent/configuration/dash_agent.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'data_sources.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;PandasAI&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;AgentConfiguration&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;docsDataSource&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;DocsDataSource&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;exampleDataSource&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ExampleDataSource&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

  &lt;span class="c1"&gt;// Add the metadata information about PandasAI agent&lt;/span&gt;
  &lt;span class="nd"&gt;@override&lt;/span&gt;
  &lt;span class="n"&gt;Metadata&lt;/span&gt; &lt;span class="kd"&gt;get&lt;/span&gt; &lt;span class="n"&gt;metadata&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;Metadata&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="nl"&gt;name:&lt;/span&gt; &lt;span class="s"&gt;'Pandas AI'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;avatarProfile:&lt;/span&gt; &lt;span class="s"&gt;'assets/logo.jpeg'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;tags:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;'LLM Framework'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;'Data Analysis'&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;

  &lt;span class="c1"&gt;// Add the systemPrompt for dash agent's commandless mode (also know as chat mode). &lt;/span&gt;
  &lt;span class="c1"&gt;// System prompt is a key component for conversational-style agents. As it provides &lt;/span&gt;
  &lt;span class="c1"&gt;// the initial context and guidance regarding the agent's purpose and functionality to the LLM.&lt;/span&gt;
  &lt;span class="nd"&gt;@override&lt;/span&gt;
  &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="kd"&gt;get&lt;/span&gt; &lt;span class="n"&gt;registerSystemPrompt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="s"&gt;'''You are a Pandas AI assistant inside user'&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="n"&gt;IDE&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="n"&gt;PandasAI&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;Python&lt;/span&gt; &lt;span class="kn"&gt;library&lt;/span&gt; &lt;span class="n"&gt;that&lt;/span&gt; &lt;span class="n"&gt;makes&lt;/span&gt; &lt;span class="n"&gt;it&lt;/span&gt; &lt;span class="n"&gt;easy&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;ask&lt;/span&gt; &lt;span class="n"&gt;questions&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;your&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;natural&lt;/span&gt; &lt;span class="n"&gt;language&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;

      &lt;span class="n"&gt;You&lt;/span&gt; &lt;span class="n"&gt;will&lt;/span&gt; &lt;span class="n"&gt;be&lt;/span&gt; &lt;span class="n"&gt;provided&lt;/span&gt; &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;latest&lt;/span&gt; &lt;span class="n"&gt;docs&lt;/span&gt; &lt;span class="n"&gt;and&lt;/span&gt; &lt;span class="n"&gt;examples&lt;/span&gt; &lt;span class="n"&gt;relevant&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="n"&gt;questions&lt;/span&gt; &lt;span class="n"&gt;and&lt;/span&gt; &lt;span class="n"&gt;you&lt;/span&gt; &lt;span class="n"&gt;have&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;help&lt;/span&gt; &lt;span class="n"&gt;them&lt;/span&gt; &lt;span class="n"&gt;achieve&lt;/span&gt; &lt;span class="n"&gt;their&lt;/span&gt; &lt;span class="n"&gt;desired&lt;/span&gt; &lt;span class="n"&gt;results&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="n"&gt;Output&lt;/span&gt; &lt;span class="n"&gt;code&lt;/span&gt; &lt;span class="n"&gt;and&lt;/span&gt; &lt;span class="n"&gt;quote&lt;/span&gt; &lt;span class="n"&gt;links&lt;/span&gt; &lt;span class="n"&gt;and&lt;/span&gt; &lt;span class="n"&gt;say&lt;/span&gt; &lt;span class="n"&gt;I&lt;/span&gt; &lt;span class="n"&gt;don&lt;/span&gt;&lt;span class="s"&gt;'t know when the docs don'&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="n"&gt;cover&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="s"&gt;'s query.'''&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

  &lt;span class="c1"&gt;// Add the data sources that needs to indexed for RAG purposes.&lt;/span&gt;
  &lt;span class="nd"&gt;@override&lt;/span&gt;
  &lt;span class="kt"&gt;List&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;DataSource&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="kd"&gt;get&lt;/span&gt; &lt;span class="n"&gt;registerDataSources&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;docsDataSource&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;exampleDataSource&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;

  &lt;span class="nd"&gt;@override&lt;/span&gt;
  &lt;span class="kt"&gt;List&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="kd"&gt;get&lt;/span&gt; &lt;span class="n"&gt;registerSupportedCommands&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above code basically glues everything all together for the PandasAI agent - data source, metadata, system prompt, commands, etc. that are needed to build the dash agent.&lt;/p&gt;

&lt;p&gt;For more details related to the &lt;code&gt;AgentConfiguration&lt;/code&gt; please read the &lt;a href="https://pub.dev/packages/dash_agent"&gt;dash_agent framework&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Finally, head to &lt;strong&gt;bin/main.dart&lt;/strong&gt; file and replace the existing code with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:dash_agent/dash_agent.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:pandas_ai/agent.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;/// Entry point used by the [dash-cli] to extract your agent&lt;/span&gt;
&lt;span class="c1"&gt;/// configuration during publishing.&lt;/span&gt;
&lt;span class="n"&gt;Future&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="kd"&gt;async&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;processAgent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;PandasAI&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it. Your agent is now configured and ready to be used. Next, you'll publish it so that it can be tested and shared with other devs as well.&lt;/p&gt;

&lt;h2&gt;
  
  
  Publishing the PandasAI Agent
&lt;/h2&gt;

&lt;p&gt;You need to be logged in to dash_cli using GitHub auth to publish your agent. Run the following command in the terminal to login:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dash_cli login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, run the following command in the terminal from the root folder of your pandas_ai project to publish the agent:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dash_cli publish
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will validate the configuration and if all looks good. It will schedule your agent publication. Once your agent is ready to be used. You will get an email confirming the successful publication and PandasAI will be visible in the CommandDash Marketplace:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa9qzwcaeyv0gnaxttujw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa9qzwcaeyv0gnaxttujw.png" alt="PandaAI dash agent in CommandDash marketplace" width="800" height="831"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What's Next
&lt;/h2&gt;

&lt;p&gt;Congratulations! 🎉 Now you know how to create powerful agents using the Dash Agent framework. These agents leverage the power of RAG and LLMs. We're excited to see the innovative agents you'll build with &lt;a href="https://www.commanddash.io/docs/introduction"&gt;Dash Agent&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Also, don't forget to try out the PandasAI agent, which is currently live on the CommandDash extension for VS Code. Check it out &lt;a href="https://marketplace.visualstudio.com/items?itemName=WelltestedAI.fluttergpt"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Next up, we will see in our upcoming blog, how well PandasAI perform. Stay tuned!&lt;/p&gt;

</description>
      <category>rag</category>
      <category>commanddash</category>
      <category>pandasai</category>
      <category>vscode</category>
    </item>
    <item>
      <title>Understanding Dash Agents: A LangChain Case Study</title>
      <dc:creator>Yogesh Choudhary</dc:creator>
      <pubDate>Wed, 12 Jun 2024 18:23:51 +0000</pubDate>
      <link>https://dev.to/commanddash/understanding-dash-agents-a-langchain-case-study-1ip2</link>
      <guid>https://dev.to/commanddash/understanding-dash-agents-a-langchain-case-study-1ip2</guid>
      <description>&lt;p&gt;In software development, integrating APIs and SDKs is crucial. Yet, the process can be tedious and time-consuming. Documentation, syntax complexities, and debugging can quickly become time-consuming roadblocks. Thankfully, this is where Dash Agents comes in to ease these headaches.&lt;/p&gt;

&lt;p&gt;This blog post explores the capabilities of Dash Agents. It shows how they simplify the integration of APIs and SDKs for tools and frameworks like LangChain.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is LangChain?
&lt;/h2&gt;

&lt;p&gt;LangChain is a framework that allows users to integrate LLMs into their projects. It provides a comprehensive toolkit for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Model Handling&lt;/strong&gt;: It supports various LLMs and allows for easy integration of custom models, offering prompt templates and engineering tools.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Data Processing and Pipelines&lt;/strong&gt;: LangChain provides tools for data preprocessing and augmentation, along with the ability to create custom pipelines with a modular design.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Deployment and Monitoring&lt;/strong&gt;: It supports cloud deployment and scaling, offers evaluation metrics and real-time monitoring, and ensures security and compliance measures are in place.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can learn more about the LangChain framework on their &lt;a href="https://www.langchain.com"&gt;Official site&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introducing LangChain Agent
&lt;/h2&gt;

&lt;p&gt;Imagine having an intelligent assistant in your IDE. It's always there to help you integrate any LangChain-based code into your project. That's precisely what the LangChain Dash Agent offers.&lt;/p&gt;

&lt;p&gt;Why You'll Love LangChain Agent:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Extensive API Knowledge&lt;/strong&gt;: It is shared with vast knowledge of LangChain framework documentation and sample codes, allowing it to provide nearly accurate code and insights.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Contextual Awareness&lt;/strong&gt;: It is designed to respond to queries with the understanding of your codebase and project context. Thus, capable of providing better assistance and solutions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Saving Time During Coding&lt;/strong&gt;:  It generates the required code for you and if required debugs the code for you, saving you a lot of time. Thus, forget the days of tedious manual API docs searching and then coding only to realise that you need to fix a bug by searching multiple sources.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Install LangChain Agent
&lt;/h2&gt;

&lt;p&gt;Let's start by setting up your agent. If you've already LangChain installed please continue to the next section.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Install CommandDash Extension&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Head over to the VS Code Marketplace and search for "CommandDash." Install the extension.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk1fzi6oggi66n9d1k45b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk1fzi6oggi66n9d1k45b.png" alt="Fig. 1 — Install CommandDash" width="790" height="442"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Sign in to CommandDash&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Open the extension once installed. You'll need to sign in and provide your &lt;a href="https://aistudio.google.com/app/apikey"&gt;Gemini key&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Install LangChain Agent&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Then, go to the CommandDash Marketplace within your Extension.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxa2dojblwdc62xe4pm8h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxa2dojblwdc62xe4pm8h.png" alt="Fig. 2 - Open CommandDash Marketplace Page" width="800" height="72"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Search for "LangChain" and install the agent.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnannm0od1ougihztji80.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnannm0od1ougihztji80.png" alt="Fig. 3 — Install LangChain Agent" width="800" height="141"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, it's time to put the installed LangChain agent to use.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started with LangChain Agent
&lt;/h2&gt;

&lt;p&gt;Finally, it is time to put the agent to work with a compelling use case: building a creative text generator in Python. &lt;/p&gt;

&lt;p&gt;This program takes the starting phrases of the poem as input. Then, it uses an LLM to extract the user's writing style and generate the remaining part of the poem.&lt;/p&gt;

&lt;p&gt;Start by activating the LangChain agent. In your CommandDash extension, type &lt;code&gt;@&lt;/code&gt; in the bottom text field and select "LangChain" from the dropdown:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjbug7vofze2f604kbihp.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjbug7vofze2f604kbihp.gif" alt="Fig. 3 — Activate LangChain Agent" width="600" height="1046"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This activates the agent within your current workspace.&lt;/p&gt;

&lt;p&gt;For demo purposes, we will attempt to use OpenAI's latest model - "GPT-4o". Type the following query into the CommandDash text field:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Generate the Python code to create an application to generate poem with the user-supplied initial phrases using OpenAI gpt-4o model"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The agent will analyze your request and will respond something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;langchain_openai&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ChatOpenAI&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;langchain_core.prompts&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ChatPromptTemplate&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;langchain_core.messages&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;HumanMessage&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;SystemMessage&lt;/span&gt;

&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;OPENAI_API_KEY&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;YOUR_OPENAI_API_KEY&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;generate_poem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;initial_phrases&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gpt-4o&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Generates a poem using OpenAI&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;s GPT-4o model.

    Args:
        initial_phrases (list): A list of initial phrases to start the poem.
        model (str, optional): The OpenAI model to use. Defaults to &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gpt-4o&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;.

    Returns:
        str: The generated poem.
    &lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;

    &lt;span class="n"&gt;llm&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;ChatOpenAI&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;prompt_template&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ChatPromptTemplate&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;from_messages&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="nc"&gt;SystemMessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;You are a helpful and creative poet. Generate a poem using the following initial phrases as inspiration: &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
            &lt;span class="nc"&gt;HumanMessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt; &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;initial_phrases&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
        &lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;messages&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;prompt_template&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;format_messages&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;llm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;invoke&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;__main__&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;initial_phrases&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Enter your initial phrases separated by commas: &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;,&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;poem&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;generate_poem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;initial_phrases&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Generated Poem:&lt;/span&gt;&lt;span class="se"&gt;\n\n&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;poem&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;Explanation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;span class="n"&gt;Some&lt;/span&gt; &lt;span class="n"&gt;explanation&lt;/span&gt; &lt;span class="n"&gt;about&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;code&lt;/span&gt;
&lt;span class="bp"&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In our case, we haven't asked for any API integration request but rather an app itself. Thus, the agent supplied us with the whole end-to-end Python code.&lt;/p&gt;

&lt;p&gt;Copy the code to a blank Python file and read the generated code. Right now, you can also update the code as needed. For instance, the current generated code is missing the &lt;code&gt;import os&lt;/code&gt; statement. So, I will manually add the missing import.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Tip&lt;/strong&gt;: At times, if you ever feel like the solution isn't straightforward, or you want to explore the problem more deeply or find a quick fix. Feel free to continue conversing with the agent.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Finally, add your &lt;a href="https://platform.openai.com/docs/quickstart/account-setup"&gt;OpenAI API&lt;/a&gt; key and run the app by executing the updated code:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp6pfzqe2pvssheyswn2n.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp6pfzqe2pvssheyswn2n.gif" alt="Fig. 4 — Run Python App" width="720" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Closing Thoughts
&lt;/h2&gt;

&lt;p&gt;LangChain agent is not all that CommandDash has to offer. We have more agents for various APIs and SDKs, such as &lt;a href="https://commanddash.hashnode.dev/how-to-use-firebase-genkit-in-your-nodejs-applications?source=more_articles_bottom_blogs"&gt;Firebase Genkit&lt;/a&gt;, Pandas AI, Vercel AI, and more. &lt;/p&gt;

&lt;p&gt;Additionally, we also allow developers like you to create public agents for your teams and other developers. If  interested, do visit the &lt;a href="https://www.commanddash.io/docs/introduction"&gt;Dash Agents Docs&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;That concludes this blog post. Now it's time to try it out yourself and materialize your LangChain use case to code instantly with CommandDash. We always love to hear what you build!&lt;/p&gt;

</description>
      <category>langchain</category>
      <category>codegen</category>
      <category>commanddash</category>
      <category>llm</category>
    </item>
    <item>
      <title>Why We Call Saving the Magical Feature</title>
      <dc:creator>Yogesh Choudhary</dc:creator>
      <pubDate>Thu, 19 Oct 2023 08:42:23 +0000</pubDate>
      <link>https://dev.to/welltestedai/why-we-call-saving-the-magical-feature-183o</link>
      <guid>https://dev.to/welltestedai/why-we-call-saving-the-magical-feature-183o</guid>
      <description>&lt;p&gt;Recently, the entire team at Welltested AI engaged in a discussion to understand what according to us is the most notable feature of Welltested at the moment. And, everyone agreed upon &lt;code&gt;welltested save unit&lt;/code&gt; which we also call the magic command :)&lt;/p&gt;

&lt;p&gt;While we internally love it, quick analytics into our database showed us that most of our users are not yet using it!  This led to the question: are we talking about it enough? haha.&lt;/p&gt;

&lt;p&gt;So, we decided to write this blog to share with our users what is so special about Welltested's &lt;strong&gt;save&lt;/strong&gt; feature and how to use it effectively. Let's dive into it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Setup Your Project
&lt;/h3&gt;

&lt;p&gt;For starters, download the &lt;a href="https://github.com/TheAlphamerc/flutter_twitter_clone"&gt;flutter twitter clone&lt;/a&gt; project that we will be using. You can also use your project or download any other open-source project of your choice to follow along. The steps that we will follow will mostly remain the same. &lt;/p&gt;

&lt;p&gt;Next, open the project in the IDE. After opening the project, we will need to head to &lt;a href="https://pub.dev/packages/welltested"&gt;Welltested&lt;/a&gt; on pub.dev. Then, follow the instructions available on the page to set up Welltested. Since the setup process is fairly straightforward and well-documented, you will not face any issues following along. The general steps include:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Getting the API key and adding it to the project&lt;/li&gt;
&lt;li&gt;Adding the Welltested packages&lt;/li&gt;
&lt;li&gt;Activating Welltested CLI in your terminal&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Once done we are ready to generate and save the tests :)&lt;/p&gt;

&lt;h3&gt;
  
  
  Generate Unit Tests
&lt;/h3&gt;

&lt;p&gt;To generate the tests. We'll need to add the &lt;code&gt;@Welltested&lt;/code&gt; annotation to the methods or classes for which we need to generate tests. This will help Welltested pick methods for whom test generation is requested. &lt;/p&gt;

&lt;p&gt;Open &lt;strong&gt;lib/helper/utility.dart&lt;/strong&gt; file in the project. We will find &lt;code&gt;Utility&lt;/code&gt; class with a bunch of static methods declared inside it:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpox9k2p4joe1igeqqfcf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpox9k2p4joe1igeqqfcf.png" alt="Utility Class Definition" width="800" height="633"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For this blog, we will generate tests for the methods present in the Utility class only. Add the Welltested annotation at the top of the &lt;code&gt;Utility&lt;/code&gt; class:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="nd"&gt;@Welltested&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This annotation above the &lt;code&gt;Utility&lt;/code&gt; class enables Welltested to know that we're interested in generating tests for the methods defined in this class.&lt;/p&gt;

&lt;p&gt;Next, we will generate the tests by running the following chain of commands in the terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;welltested generate unit &lt;span class="nt"&gt;-m&lt;/span&gt; getPostTime2 &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; 
welltested generate unit &lt;span class="nt"&gt;-m&lt;/span&gt; getDob &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; 
welltested generate unit &lt;span class="nt"&gt;-m&lt;/span&gt; getJoiningDate &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; 
welltested generate unit &lt;span class="nt"&gt;-m&lt;/span&gt; getUserName
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Upon execution of the above commands, Welltested will start generating the tests for the methods mentioned after the &lt;code&gt;-m&lt;/code&gt; parameter that have the &lt;code&gt;@welltested&lt;/code&gt; annotation too - either directly or on the class containing the methods.&lt;/p&gt;

&lt;p&gt;Open the generated tests located in the &lt;strong&gt;tests/helper/utility&lt;/strong&gt; directory after the execution of the generate commands is finished. Take a look at the generated files. Congratulations! You have successfully generated tests for your code in less than 5 minutes. Isn't it great :)&lt;/p&gt;

&lt;p&gt;Looking at the generated tests. You will see that some of the tests have errors:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs1kisupcx0iipth6iohw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs1kisupcx0iipth6iohw.png" alt="Fig. 2 — Generated Tests Errors" width="800" height="278"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But don't worry, Welltested has got you covered here. And this is where the Welltested's &lt;strong&gt;save&lt;/strong&gt; command shines 😎&lt;/p&gt;

&lt;h3&gt;
  
  
  Welltested's Save Command
&lt;/h3&gt;

&lt;p&gt;Welltested AI has the ability to constantly learn and improve as you interact with it. Since this is our first interaction with the AI, it may make mistakes in the initial tests as it hasn't yet learned about your project and your coding style. However, fixing this is simple.&lt;/p&gt;

&lt;p&gt;You can just simply fix the broken generated tests and save the tests using Welltested's &lt;code&gt;save&lt;/code&gt; command. Welltested will automatically learn from them and provide much smarter and error-free test cases in the future.&lt;/p&gt;

&lt;p&gt;To understand this in more detail. Let's look at an example by updating and saving one of the earlier generated unit tests. Afterwards, we will use Welltested's &lt;code&gt;generate&lt;/code&gt; command to generate the remaining tests again.&lt;/p&gt;

&lt;p&gt;Open &lt;strong&gt;test/helper/utility/getPostTime2.welltested_test.dart&lt;/strong&gt; file and update it with the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:flutter_test/flutter_test.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:flutter_twitter_clone/helper/utility.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;group&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'Utility getPostTime2'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="c1"&gt;// 1.&lt;/span&gt;
    &lt;span class="c1"&gt;// Older version&lt;/span&gt;
    &lt;span class="c1"&gt;// test('When date is null, should return empty string', () {&lt;/span&gt;
    &lt;span class="c1"&gt;//   final mockUtility = MockUtility();&lt;/span&gt;
    &lt;span class="c1"&gt;//   when(mockUtility.getPostTime2(null)).thenReturn('');&lt;/span&gt;
    &lt;span class="c1"&gt;//   expect(mockUtility.getPostTime2(null), '');&lt;/span&gt;
    &lt;span class="c1"&gt;// });&lt;/span&gt;
    &lt;span class="n"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'When date is null, should return empty string'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Utility&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getPostTime2&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;equals&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;''&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;

    &lt;span class="n"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'When date is empty, should return empty string'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Utility&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getPostTime2&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;''&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;equals&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;''&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;

    &lt;span class="n"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'When date is not in correct format, should throw FormatException'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;Utility&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getPostTime2&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'invalid date'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;throwsFormatException&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;

    &lt;span class="n"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'When date is in correct format, should return formatted date'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;date&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;'2022-12-01T20:18:04'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;expectedDate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;'08:18 PM - 01 Dec 22'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="n"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Utility&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getPostTime2&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;equals&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;expectedDate&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;

    &lt;span class="c1"&gt;// 2.&lt;/span&gt;
    &lt;span class="c1"&gt;// Older version&lt;/span&gt;
    &lt;span class="c1"&gt;// test('When date is in correct format but in different timezone, should return formatted date in local timezone', () {&lt;/span&gt;
    &lt;span class="c1"&gt;//   final mockUtility = MockUtility();&lt;/span&gt;
    &lt;span class="c1"&gt;//   String date = '2022-12-01T13:18:04Z'; // This is 20:18 in GMT+7&lt;/span&gt;
    &lt;span class="c1"&gt;//   String expectedDate = '08:18 PM - 01 Dec 22';&lt;/span&gt;
    &lt;span class="c1"&gt;//   when(mockUtility.getPostTime2(date)).thenReturn(expectedDate);&lt;/span&gt;
    &lt;span class="c1"&gt;//   expect(mockUtility.getPostTime2(date), equals(expectedDate));&lt;/span&gt;
    &lt;span class="c1"&gt;// });&lt;/span&gt;
    &lt;span class="n"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="s"&gt;'When date is in correct format but in different timezone, should return formatted date in local timezone'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;date&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;'2022-12-01T14:48:04Z'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// This is 20:18 in IST&lt;/span&gt;
      &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;expectedDate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;'08:18 PM - 01 Dec 22'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="n"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Utility&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getPostTime2&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;equals&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;expectedDate&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On comparing the updated code with the previously generated test code. You will find two major differences here:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The generated code utilizes &lt;code&gt;MockUtility&lt;/code&gt;, which is a mock version of the &lt;code&gt;Utility&lt;/code&gt; class. However, the updated code directly employs the &lt;code&gt;Utility&lt;/code&gt; class. This is because our objective is to test the methods that are encapsulated within this class.&lt;/li&gt;
&lt;li&gt;The final test case aims to verify that the &lt;code&gt;getPostTime2&lt;/code&gt; function accurately converts a date from a different time zone into the local time zone. Initially, the AI assumed GMT+7 was the local time zone, but this led to a failure because my actual local time zone is IST. Consequently, the code was adjusted to employ a date that, when processed by &lt;code&gt;getPostTime2&lt;/code&gt;, would align with the date stored in the expectedDate variable for Indian Standard Time (IST).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now, since we have only updated one test, we will delete all other generated tests. This is because when we execute the &lt;code&gt;save&lt;/code&gt; test command, Welltested saves all the tests it has generated and that are present in the test directory. We want to ensure that our AI doesn't learn from code with errors. Don't you agree?&lt;/p&gt;

&lt;p&gt;After deleting all the test files except &lt;strong&gt;/getPostTime2.welltested_test.dart&lt;/strong&gt;, run the following command in the terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;welltested save unit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After a successful save, you'll receive the following message in the terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;✅ Succeeded. 1 were saved.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, add the following command on the terminal to generate tests again:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;welltested generate unit &lt;span class="nt"&gt;-m&lt;/span&gt; getDob &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; 
welltested generate unit &lt;span class="nt"&gt;-m&lt;/span&gt; getJoiningDate &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; 
welltested generate unit &lt;span class="nt"&gt;-m&lt;/span&gt; getUserName
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After the test generation is completed. Revisit the generated tests:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9kduzq1zrkfvqx10c34s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9kduzq1zrkfvqx10c34s.png" alt="Fig. 3 — Updated Tests using Welletested" width="800" height="278"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This time, the tests adhere to our coding style. Also, the generated code correctly uses the local time zone for my case based on the saved code which is fantastic. Don't you agree? I certainly do.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;By now, I hope you can appreciate the power of saving tests in Welltested and how it can assist you in crafting more efficient tests tailored to your specific needs and coding style.&lt;/p&gt;

&lt;p&gt;I encourage you to generate tests using Welltested and to save all of them. This will not only speed up the test generation process but also enhance the quality of your tests over time. Happy Testing :)&lt;/p&gt;

</description>
      <category>welltested</category>
      <category>testing</category>
      <category>flutter</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
