<?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: Ananya S</title>
    <description>The latest articles on DEV Community by Ananya S (@zeroshotanu).</description>
    <link>https://dev.to/zeroshotanu</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%2F3559285%2Fc3ef331f-5380-4103-9520-7e34720fd7dc.jpeg</url>
      <title>DEV Community: Ananya S</title>
      <link>https://dev.to/zeroshotanu</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/zeroshotanu"/>
    <language>en</language>
    <item>
      <title>FastAPI for AI Engineers - Part 2: Building Your First CRUD API</title>
      <dc:creator>Ananya S</dc:creator>
      <pubDate>Mon, 01 Jun 2026 17:06:06 +0000</pubDate>
      <link>https://dev.to/zeroshotanu/fastapi-for-ai-engineers-part-2-building-your-first-crud-api-lpl</link>
      <guid>https://dev.to/zeroshotanu/fastapi-for-ai-engineers-part-2-building-your-first-crud-api-lpl</guid>
      <description>&lt;p&gt;In the previous article, we explored why FastAPI has become one of the most popular backend frameworks for modern AI applications.&lt;/p&gt;

&lt;p&gt;If you haven't read the previous post, check it out: &lt;a href="https://dev.to/zeroshotanu/fastapi-for-ai-engineers-part-1-why-every-ai-backend-is-moving-toward-fastapi-45fg"&gt;https://dev.to/zeroshotanu/fastapi-for-ai-engineers-part-1-why-every-ai-backend-is-moving-toward-fastapi-45fg&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now it's time to build something practical.&lt;/p&gt;

&lt;p&gt;Most backend applications revolve around four basic operations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create&lt;/li&gt;
&lt;li&gt;Read&lt;/li&gt;
&lt;li&gt;Update&lt;/li&gt;
&lt;li&gt;Delete&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Together, these operations are known as &lt;strong&gt;CRUD&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Whether you're building:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a social media application,&lt;/li&gt;
&lt;li&gt;an e-commerce platform,&lt;/li&gt;
&lt;li&gt;a chatbot,&lt;/li&gt;
&lt;li&gt;or an AI agent,&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;CRUD operations are the foundation of backend development.&lt;/p&gt;

&lt;p&gt;In this article, we'll build a simple Student Management API while learning:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Path Parameters&lt;/li&gt;
&lt;li&gt;Query Parameters&lt;/li&gt;
&lt;li&gt;GET Requests&lt;/li&gt;
&lt;li&gt;POST Requests&lt;/li&gt;
&lt;li&gt;PUT Requests&lt;/li&gt;
&lt;li&gt;DELETE Requests&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Creating Sample Data
&lt;/h2&gt;

&lt;p&gt;Let's start with a small dataset.&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;fastapi&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;FastAPI&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;FastAPI&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="n"&gt;students&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&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;id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;name&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;Ananya&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;department&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;CSE&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;cgpa&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;8.9&lt;/span&gt;
    &lt;span class="p"&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;id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;name&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;Rahul&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;department&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;ECE&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;cgpa&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;8.4&lt;/span&gt;
    &lt;span class="p"&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;id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;name&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;Priya&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;department&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;IT&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;cgpa&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;9.1&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;Run the application:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;uvicorn main:app &lt;span class="nt"&gt;--reload&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open Swagger UI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://127.0.0.1:8000/docs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Path Parameters
&lt;/h2&gt;

&lt;p&gt;A path parameter is part of the URL itself.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/student/2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, &lt;code&gt;2&lt;/code&gt; is the path parameter.&lt;br&gt;
Think of path parameters as:&lt;/p&gt;

&lt;p&gt;"I know exactly which resource I want."&lt;/p&gt;

&lt;p&gt;Examples:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/users/10
/products/25
/orders/1001
/student/2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's fetch a specific student using their ID.&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="nd"&gt;@app.get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/student/{id}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_student_info&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;students&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;id&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="nb"&gt;id&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;user&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;message&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;Student not found&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Request:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/student/2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Response:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Rahul"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"department"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ECE"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"cgpa"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;8.4&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Query Parameters
&lt;/h2&gt;

&lt;p&gt;A query parameter appears after the &lt;code&gt;?&lt;/code&gt; in a URL.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/student?department="CSE"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;They are commonly used for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;filtering&lt;/li&gt;
&lt;li&gt;searching&lt;/li&gt;
&lt;li&gt;sorting&lt;/li&gt;
&lt;li&gt;pagination&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's implement the same endpoint using a query parameter.&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="nd"&gt;@app.get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/students&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_students&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;department&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;

    &lt;span class="n"&gt;filtered_students&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;student&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;students&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;student&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;department&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="n"&gt;department&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;filtered_students&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;student&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;filtered_students&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Request:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/student?department="CSE"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Response:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Ananya"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"department"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"CSE"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"cgpa"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;8.9&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All students in CSE department would be filtered.&lt;br&gt;
Query parameters are often optional and are used to modify, filter, or search results.&lt;/p&gt;
&lt;h3&gt;
  
  
  Path vs Query Parameters
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Path Parameter&lt;/th&gt;
&lt;th&gt;Query Parameter&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Part of URL path&lt;/td&gt;
&lt;td&gt;Appears after ?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Identifies a resource&lt;/td&gt;
&lt;td&gt;Filters or searches&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/student/1&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/student?id=1&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;


&lt;h2&gt;
  
  
  GET Request
&lt;/h2&gt;

&lt;p&gt;GET requests are used to retrieve data.&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="nd"&gt;@app.get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/students&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_all_students&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;students&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Response:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Ananya"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"department"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"CSE"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"cgpa"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;8.9&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Rahul"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"department"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ECE"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"cgpa"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;8.4&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Priya"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"department"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"IT"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"cgpa"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;9.1&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Request Bodies with Pydantic
&lt;/h2&gt;

&lt;p&gt;When users send data to our API, FastAPI needs a way to validate that the incoming data has the correct structure.&lt;/p&gt;

&lt;p&gt;This is where Pydantic comes in.&lt;/p&gt;

&lt;p&gt;Pydantic allows us to define the expected shape of incoming data using Python classes.&lt;/p&gt;

&lt;p&gt;For example, every student should have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;an ID&lt;/li&gt;
&lt;li&gt;a name&lt;/li&gt;
&lt;li&gt;a department&lt;/li&gt;
&lt;li&gt;a CGPA&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We can define this structure using a Pydantic model.&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;pydantic&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;BaseModel&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Student&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BaseModel&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;department&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;cgpa&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now FastAPI automatically validates incoming requests.&lt;/p&gt;

&lt;p&gt;For example, this request is valid:&lt;/p&gt;

&lt;p&gt;{&lt;br&gt;
    "id": 4,&lt;br&gt;
    "name": "Karthik",&lt;br&gt;
    "department": "AI",&lt;br&gt;
    "cgpa": 8.8&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;But if someone sends:&lt;/p&gt;

&lt;p&gt;{&lt;br&gt;
    "id": "four",&lt;br&gt;
    "name": "Karthik"&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;FastAPI will automatically return a validation error because:&lt;/p&gt;

&lt;p&gt;id should be an integer&lt;br&gt;
required fields are missing&lt;/p&gt;

&lt;p&gt;This saves us from writing validation code manually.&lt;br&gt;
We'll explore Pydantic, validation, optional fields, custom validators, and advanced request handling in a dedicated article later in this series.&lt;/p&gt;
&lt;h2&gt;
  
  
  POST Request
&lt;/h2&gt;

&lt;p&gt;POST requests are used to create new resources.&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;pydantic&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;BaseModel&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Student&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BaseModel&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;department&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;cgpa&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nd"&gt;@app.post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/student&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;add_student&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;student&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Student&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;

    &lt;span class="n"&gt;students&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;student&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dict&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;message&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;Student added successfully&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;student&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;student&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Request Body:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Karthik"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"department"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"AI"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"cgpa"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;8.8&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  PUT Request
&lt;/h2&gt;

&lt;p&gt;PUT requests are used to update existing resources.&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="nd"&gt;@app.put&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/student/{id}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;update_student&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;updated_student&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Student&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;enumerate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;students&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;id&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="nb"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

            &lt;span class="n"&gt;students&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;updated_student&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dict&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;message&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;Student updated successfully&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;student&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;updated_student&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;message&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;Student not found&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Request:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PUT /student/2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  DELETE Request
&lt;/h2&gt;

&lt;p&gt;DELETE requests are used to remove resources.&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="nd"&gt;@app.delete&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/student/{id}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;delete_student&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;enumerate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;students&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;id&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="nb"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

            &lt;span class="n"&gt;deleted_student&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;students&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pop&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;message&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;Student deleted successfully&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;student&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;deleted_student&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;message&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;Student not found&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Request:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DELETE /student/3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  CRUD Summary
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Operation&lt;/th&gt;
&lt;th&gt;HTTP Method&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Create&lt;/td&gt;
&lt;td&gt;POST&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Read&lt;/td&gt;
&lt;td&gt;GET&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Update&lt;/td&gt;
&lt;td&gt;PUT&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Delete&lt;/td&gt;
&lt;td&gt;DELETE&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;CRUD operations form the foundation of almost every backend application you'll build.&lt;/p&gt;




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

&lt;p&gt;Right now, our data exists only in memory.&lt;/p&gt;

&lt;p&gt;If the server restarts, everything disappears.&lt;/p&gt;

&lt;p&gt;In the next article, we'll connect FastAPI with SQLite and MySQL so our application can store data permanently, just like real-world production systems.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>backend</category>
      <category>fastapi</category>
      <category>python</category>
    </item>
    <item>
      <title>FastAPI for AI Engineers — Part 1: Why Every AI Backend Is Moving Toward FastAPI</title>
      <dc:creator>Ananya S</dc:creator>
      <pubDate>Fri, 29 May 2026 17:57:34 +0000</pubDate>
      <link>https://dev.to/zeroshotanu/fastapi-for-ai-engineers-part-1-why-every-ai-backend-is-moving-toward-fastapi-45fg</link>
      <guid>https://dev.to/zeroshotanu/fastapi-for-ai-engineers-part-1-why-every-ai-backend-is-moving-toward-fastapi-45fg</guid>
      <description>&lt;p&gt;You open ChatGPT.&lt;/p&gt;

&lt;p&gt;You type a prompt.&lt;/p&gt;

&lt;p&gt;Within seconds:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;your request reaches a backend server,&lt;/li&gt;
&lt;li&gt;the backend communicates with an LLM,&lt;/li&gt;
&lt;li&gt;retrieves memory,&lt;/li&gt;
&lt;li&gt;queries vector databases,&lt;/li&gt;
&lt;li&gt;processes context,&lt;/li&gt;
&lt;li&gt;and streams responses back to you in real time.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Modern AI applications are no longer just “apps.”&lt;/p&gt;

&lt;p&gt;They are systems made up of multiple services constantly communicating with each other through APIs.&lt;/p&gt;

&lt;p&gt;And one framework has quietly become the default choice for building these modern AI backends:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;FastAPI.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this article, we’ll understand:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;why APIs are essential,&lt;/li&gt;
&lt;li&gt;why modern AI systems depend heavily on them,&lt;/li&gt;
&lt;li&gt;what FastAPI actually is,&lt;/li&gt;
&lt;li&gt;and why it became the preferred backend framework for AI engineers.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Modern Applications Are API Systems
&lt;/h2&gt;

&lt;p&gt;Most applications today are distributed systems.&lt;/p&gt;

&lt;p&gt;Your frontend, backend, database, authentication service, payment gateway, and AI models continuously exchange data with one another.&lt;/p&gt;

&lt;p&gt;When you order food online:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Frontend → Backend API → Database → Response
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When you use an AI chatbot:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User → FastAPI Backend → LLM → Vector DB → Response
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Without APIs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;frontend applications would directly access databases,&lt;/li&gt;
&lt;li&gt;systems would become tightly coupled,&lt;/li&gt;
&lt;li&gt;security would become difficult,&lt;/li&gt;
&lt;li&gt;scaling would become messy,&lt;/li&gt;
&lt;li&gt;and AI applications would be extremely difficult to maintain.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;APIs act as communication bridges between systems.&lt;/p&gt;

&lt;p&gt;They define:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;how requests are sent,&lt;/li&gt;
&lt;li&gt;what data is expected,&lt;/li&gt;
&lt;li&gt;and what responses should be returned.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Modern software runs on APIs.&lt;/p&gt;

&lt;p&gt;Modern AI systems depend on them even more.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Exactly Is an API?
&lt;/h2&gt;

&lt;p&gt;API stands for &lt;strong&gt;Application Programming Interface&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In simple terms:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;An API allows two software systems to communicate with each other.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a frontend sends a request,&lt;/li&gt;
&lt;li&gt;the backend processes it,&lt;/li&gt;
&lt;li&gt;and returns a response (usually JSON).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"message"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Hello World"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every major application you use today relies heavily on APIs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Instagram&lt;/li&gt;
&lt;li&gt;Netflix&lt;/li&gt;
&lt;li&gt;Uber&lt;/li&gt;
&lt;li&gt;Spotify&lt;/li&gt;
&lt;li&gt;ChatGPT&lt;/li&gt;
&lt;li&gt;AI agents&lt;/li&gt;
&lt;li&gt;recommendation systems&lt;/li&gt;
&lt;li&gt;RAG applications&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;APIs are the foundation of modern backend engineering.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why AI Applications Changed Backend Development
&lt;/h2&gt;

&lt;p&gt;Traditional web applications were already API-heavy.&lt;/p&gt;

&lt;p&gt;But AI applications introduced entirely new backend challenges.&lt;/p&gt;

&lt;p&gt;Modern AI systems constantly:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;communicate with LLM APIs,&lt;/li&gt;
&lt;li&gt;query vector databases,&lt;/li&gt;
&lt;li&gt;retrieve embeddings,&lt;/li&gt;
&lt;li&gt;stream responses,&lt;/li&gt;
&lt;li&gt;interact with external tools,&lt;/li&gt;
&lt;li&gt;and handle concurrent requests.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This created a need for backend frameworks that were:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;lightweight,&lt;/li&gt;
&lt;li&gt;fast,&lt;/li&gt;
&lt;li&gt;asynchronous,&lt;/li&gt;
&lt;li&gt;scalable,&lt;/li&gt;
&lt;li&gt;and developer-friendly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That’s where FastAPI entered.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Is FastAPI?
&lt;/h2&gt;

&lt;p&gt;FastAPI is a modern Python framework designed specifically for building APIs.&lt;/p&gt;

&lt;p&gt;It became popular because it combines:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;high performance,&lt;/li&gt;
&lt;li&gt;async support,&lt;/li&gt;
&lt;li&gt;automatic validation,&lt;/li&gt;
&lt;li&gt;clean developer experience,&lt;/li&gt;
&lt;li&gt;and excellent scalability.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;FastAPI is built on top of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Starlette&lt;/strong&gt; → provides ASGI and async capabilities&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pydantic&lt;/strong&gt; → handles data validation&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Uvicorn&lt;/strong&gt; → runs FastAPI applications efficiently&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Together, this stack became perfect for modern AI systems.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
        Client Request
               │
               ▼
         ┌─────────┐
         │ FastAPI │
         └────┬────┘
              │
     ┌────────┼────────┐
     ▼                 ▼
 Starlette         Pydantic
 (ASGI/Async)     (Validation)
              │
              ▼
           Uvicorn
        (ASGI Server)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Why FastAPI Became the Standard for AI Backends
&lt;/h2&gt;

&lt;h2&gt;
  
  
  1. Async Support
&lt;/h2&gt;

&lt;p&gt;This is one of the biggest reasons FastAPI exploded in popularity.&lt;/p&gt;

&lt;p&gt;AI applications constantly wait for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;LLM responses,&lt;/li&gt;
&lt;li&gt;vector database retrieval,&lt;/li&gt;
&lt;li&gt;external APIs,&lt;/li&gt;
&lt;li&gt;embeddings,&lt;/li&gt;
&lt;li&gt;cloud services.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;FastAPI supports asynchronous programming using Python’s &lt;code&gt;async&lt;/code&gt; and &lt;code&gt;await&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Example:&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="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;generate_response&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;message&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;Async response&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead of blocking the server while waiting for responses, FastAPI can efficiently handle multiple requests concurrently.&lt;/p&gt;

&lt;p&gt;For AI systems, this matters a lot.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Built on Starlette
&lt;/h2&gt;

&lt;p&gt;FastAPI uses Starlette underneath.&lt;/p&gt;

&lt;p&gt;Starlette provides:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ASGI support,&lt;/li&gt;
&lt;li&gt;middleware,&lt;/li&gt;
&lt;li&gt;WebSockets,&lt;/li&gt;
&lt;li&gt;background tasks,&lt;/li&gt;
&lt;li&gt;async request handling.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This makes FastAPI much better suited for modern real-time AI applications compared to older synchronous architectures.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Powered by Uvicorn
&lt;/h2&gt;

&lt;p&gt;FastAPI applications are commonly run using Uvicorn.&lt;/p&gt;

&lt;p&gt;Start a FastAPI server using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;uvicorn main:app &lt;span class="nt"&gt;--reload&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;main&lt;/code&gt; → filename&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;app&lt;/code&gt; → FastAPI instance&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;--reload&lt;/code&gt; → automatically reloads during development&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Uvicorn is an ASGI server optimized for high-performance asynchronous applications.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Automatic Swagger UI Documentation
&lt;/h2&gt;

&lt;p&gt;One of FastAPI’s most loved features is automatic API documentation.&lt;/p&gt;

&lt;p&gt;The moment you create routes, FastAPI automatically generates interactive API documentation for you.&lt;/p&gt;

&lt;p&gt;Visit:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://127.0.0.1:8000/docs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;test endpoints,&lt;/li&gt;
&lt;li&gt;send requests,&lt;/li&gt;
&lt;li&gt;inspect responses,&lt;/li&gt;
&lt;li&gt;and debug APIs directly from the browser.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This becomes incredibly useful when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;working with frontend developers,&lt;/li&gt;
&lt;li&gt;building AI APIs,&lt;/li&gt;
&lt;li&gt;or testing backend systems quickly.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  5. Automatic Data Validation Using Pydantic
&lt;/h2&gt;

&lt;p&gt;FastAPI uses Python type hints for validation.&lt;/p&gt;

&lt;p&gt;Example:&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;pydantic&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;BaseModel&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BaseModel&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If invalid data is sent, FastAPI automatically validates and rejects it.&lt;/p&gt;

&lt;p&gt;This removes a huge amount of manual validation code developers previously had to write themselves.&lt;/p&gt;




&lt;h2&gt;
  
  
  Installing FastAPI
&lt;/h2&gt;

&lt;p&gt;Install FastAPI and Uvicorn:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;fastapi uvicorn
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Your First FastAPI Application
&lt;/h2&gt;

&lt;p&gt;Create a file called &lt;code&gt;main.py&lt;/code&gt;&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;fastapi&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;FastAPI&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;FastAPI&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="nd"&gt;@app.get&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="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;home&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;message&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;Welcome to Dev.io&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffroaj5gsyore8nbdjufr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffroaj5gsyore8nbdjufr.png" alt="Sample example of home function" width="438" height="152"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Run the server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;uvicorn main:app &lt;span class="nt"&gt;--reload&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://127.0.0.1:8000/docs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo6rrj2igftkg7gpiim6k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo6rrj2igftkg7gpiim6k.png" alt="Sample example of Swagger UI docs" width="800" height="313"&gt;&lt;/a&gt;&lt;br&gt;
And you’ll see FastAPI’s automatically generated Swagger UI.&lt;/p&gt;

&lt;p&gt;At this point, you already have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a running backend server,&lt;/li&gt;
&lt;li&gt;a working API,&lt;/li&gt;
&lt;li&gt;and interactive API documentation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With surprisingly little code.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why FastAPI Matters for AI Engineers
&lt;/h2&gt;

&lt;p&gt;FastAPI became extremely popular because modern AI applications are fundamentally API systems.&lt;/p&gt;

&lt;p&gt;It is heavily used for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;RAG pipelines,&lt;/li&gt;
&lt;li&gt;AI agents,&lt;/li&gt;
&lt;li&gt;chatbot backends,&lt;/li&gt;
&lt;li&gt;LangChain applications,&lt;/li&gt;
&lt;li&gt;vector database APIs,&lt;/li&gt;
&lt;li&gt;recommendation systems,&lt;/li&gt;
&lt;li&gt;and model-serving APIs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Modern AI engineering is not just about building models anymore.&lt;/p&gt;

&lt;p&gt;It’s also about building scalable systems around those models.&lt;/p&gt;

&lt;p&gt;And FastAPI fits perfectly into that ecosystem.&lt;/p&gt;




&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;FastAPI didn’t become popular accidentally.&lt;/p&gt;

&lt;p&gt;It became the framework of choice for AI engineers because modern AI systems are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;asynchronous,&lt;/li&gt;
&lt;li&gt;API-driven,&lt;/li&gt;
&lt;li&gt;performance-sensitive,&lt;/li&gt;
&lt;li&gt;and highly modular.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Whether you're building:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AI agents,&lt;/li&gt;
&lt;li&gt;chat systems,&lt;/li&gt;
&lt;li&gt;RAG applications,&lt;/li&gt;
&lt;li&gt;or production AI platforms,&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;FastAPI provides the exact architecture modern AI applications need.&lt;/p&gt;




&lt;h2&gt;
  
  
  What’s Next?
&lt;/h2&gt;

&lt;p&gt;Right now, our API returns data, but it doesn’t actually store anything permanently.&lt;/p&gt;

&lt;p&gt;In the next article, we’ll build real CRUD APIs using FastAPI and understand:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GET requests,&lt;/li&gt;
&lt;li&gt;POST requests,&lt;/li&gt;
&lt;li&gt;PUT requests,&lt;/li&gt;
&lt;li&gt;DELETE requests,&lt;/li&gt;
&lt;li&gt;and how backend applications manage data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then we’ll move toward integrating databases like SQLite and MySQL in the following parts of this series.&lt;/p&gt;

&lt;p&gt;Check out the next post here:&lt;br&gt;
&lt;a href="https://dev.to/zeroshotanu/fastapi-for-ai-engineers-part-2-building-your-first-crud-api-lpl"&gt;https://dev.to/zeroshotanu/fastapi-for-ai-engineers-part-2-building-your-first-crud-api-lpl&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>backend</category>
      <category>api</category>
      <category>fastapi</category>
    </item>
    <item>
      <title>How I Built an AI-Powered Incident RCA Platform with LangGraph and RAG</title>
      <dc:creator>Ananya S</dc:creator>
      <pubDate>Tue, 26 May 2026 03:23:00 +0000</pubDate>
      <link>https://dev.to/zeroshotanu/how-i-built-an-ai-powered-incident-rca-platform-with-langgraph-and-rag-423j</link>
      <guid>https://dev.to/zeroshotanu/how-i-built-an-ai-powered-incident-rca-platform-with-langgraph-and-rag-423j</guid>
      <description>&lt;p&gt;It’s 2:13 AM.&lt;/p&gt;

&lt;p&gt;A payment API suddenly starts failing in production.&lt;/p&gt;

&lt;p&gt;Customers can’t complete transactions. Alerts begin firing everywhere. Dashboards turn red. Kubernetes pods restart unexpectedly. Database connections start timing out.&lt;/p&gt;

&lt;p&gt;And somewhere, an exhausted engineer opens Datadog and starts scrolling through thousands of logs trying to answer a single question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“What actually broke?”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Modern systems generate enormous amounts of telemetry:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;logs&lt;/li&gt;
&lt;li&gt;alerts&lt;/li&gt;
&lt;li&gt;traces&lt;/li&gt;
&lt;li&gt;metrics&lt;/li&gt;
&lt;li&gt;infrastructure events&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The problem isn’t the lack of monitoring anymore.&lt;/p&gt;

&lt;p&gt;The problem is:&lt;/p&gt;

&lt;h2&gt;
  
  
  making sense of the chaos quickly enough during an outage.
&lt;/h2&gt;

&lt;p&gt;That idea became the starting point for &lt;strong&gt;OpsMind AI&lt;/strong&gt; — an AI-powered incident root cause analysis platform inspired by real-world DevOps and Site Reliability Engineering workflows.&lt;/p&gt;

&lt;p&gt;The goal was ambitious but simple:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Upload observability logs → identify probable root cause → generate remediation recommendations automatically.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  The Core Problem
&lt;/h2&gt;

&lt;p&gt;In modern distributed systems, a single failure rarely stays isolated.&lt;/p&gt;

&lt;p&gt;A database lock might cause:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;API latency spikes&lt;/li&gt;
&lt;li&gt;gateway timeouts&lt;/li&gt;
&lt;li&gt;downstream service crashes&lt;/li&gt;
&lt;li&gt;Kubernetes restarts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;During incidents, engineers manually jump between:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Grafana dashboards&lt;/li&gt;
&lt;li&gt;Datadog alerts&lt;/li&gt;
&lt;li&gt;New Relic traces&lt;/li&gt;
&lt;li&gt;raw log streams&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;trying to correlate failures across services.&lt;/p&gt;

&lt;p&gt;This process is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;time-consuming&lt;/li&gt;
&lt;li&gt;mentally exhausting&lt;/li&gt;
&lt;li&gt;highly dependent on experience&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I wanted to explore whether multi-agent AI systems could assist in this process.&lt;/p&gt;

&lt;p&gt;Not just summarizing logs.&lt;/p&gt;

&lt;p&gt;But actually:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;retrieving similar historical incidents&lt;/li&gt;
&lt;li&gt;classifying incident severity&lt;/li&gt;
&lt;li&gt;reconstructing event timelines&lt;/li&gt;
&lt;li&gt;identifying affected services&lt;/li&gt;
&lt;li&gt;generating RCA explanations&lt;/li&gt;
&lt;li&gt;suggesting remediation steps&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Enter OpsMind AI
&lt;/h2&gt;

&lt;p&gt;OpsMind AI simulates an AI-driven observability assistant for SRE and DevOps teams.&lt;/p&gt;

&lt;p&gt;The platform processes observability logs through a &lt;strong&gt;LangGraph-based multi-agent workflow&lt;/strong&gt; that orchestrates specialized agents for different operational tasks.&lt;/p&gt;

&lt;p&gt;Instead of relying on a single monolithic LLM prompt, the system breaks incident investigation into multiple coordinated reasoning stages.&lt;/p&gt;




&lt;h2&gt;
  
  
  System Architecture
&lt;/h2&gt;

&lt;p&gt;The workflow begins by ingesting logs from simulated monitoring platforms such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Datadog&lt;/li&gt;
&lt;li&gt;Grafana&lt;/li&gt;
&lt;li&gt;New Relic&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The logs are normalized and passed into a multi-agent orchestration pipeline.&lt;/p&gt;

&lt;p&gt;The architecture consists of:&lt;/p&gt;

&lt;h3&gt;
  
  
  Retrieval Agent
&lt;/h3&gt;

&lt;p&gt;Searches historical incidents using FAISS vector similarity search.&lt;/p&gt;

&lt;h3&gt;
  
  
  Incident Classification Agent
&lt;/h3&gt;

&lt;p&gt;Identifies:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;incident type&lt;/li&gt;
&lt;li&gt;severity level&lt;/li&gt;
&lt;li&gt;monitoring source&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  RCA Agent
&lt;/h3&gt;

&lt;p&gt;Performs root cause analysis and generates remediation recommendations using LLM reasoning.&lt;/p&gt;

&lt;h3&gt;
  
  
  Timeline &amp;amp; Impact Analysis
&lt;/h3&gt;

&lt;p&gt;Reconstructs operational event sequences and identifies affected downstream services.&lt;/p&gt;

&lt;h3&gt;
  
  
  Evaluation Layer
&lt;/h3&gt;

&lt;p&gt;Measures:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;retrieval accuracy&lt;/li&gt;
&lt;li&gt;RCA quality&lt;/li&gt;
&lt;li&gt;latency&lt;/li&gt;
&lt;li&gt;incident correlation confidence&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The frontend dashboard was built using Streamlit to simulate an operational observability console.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why RAG Was Important Here
&lt;/h2&gt;

&lt;p&gt;One of the most interesting parts of the project was integrating retrieval-augmented generation.&lt;/p&gt;

&lt;p&gt;Production incidents often repeat patterns:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;database pool exhaustion&lt;/li&gt;
&lt;li&gt;API rate limiting&lt;/li&gt;
&lt;li&gt;Kubernetes OOM crashes&lt;/li&gt;
&lt;li&gt;retry storms&lt;/li&gt;
&lt;li&gt;deadlocks&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Instead of asking the LLM to reason from scratch every time, OpsMind AI retrieves semantically similar historical incidents from a FAISS vector database and uses them as contextual memory during RCA generation.&lt;/p&gt;

&lt;p&gt;This significantly improved the consistency of generated analyses.&lt;/p&gt;




&lt;h2&gt;
  
  
  Building the Multi-Agent Workflow
&lt;/h2&gt;

&lt;p&gt;The orchestration layer uses LangGraph to model incident analysis as a graph of specialized AI agents.&lt;/p&gt;

&lt;p&gt;This made the workflow:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;modular&lt;/li&gt;
&lt;li&gt;explainable&lt;/li&gt;
&lt;li&gt;easier to visualize&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One thing I particularly enjoyed was building the animated agent execution dashboard where each agent executes sequentially:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Retrieval Agent&lt;/li&gt;
&lt;li&gt;Classification Agent&lt;/li&gt;
&lt;li&gt;RCA Agent&lt;/li&gt;
&lt;li&gt;Timeline Agent&lt;/li&gt;
&lt;li&gt;Impact Analysis Agent&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Watching the workflow execute in real time made the system feel much closer to an actual operational AI assistant rather than just another chatbot interface.&lt;/p&gt;




&lt;h2&gt;
  
  
  Simulating Real Production Incidents
&lt;/h2&gt;

&lt;p&gt;Since real enterprise observability data isn’t publicly available, I generated synthetic production-style incident logs for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Kubernetes CrashLoopBackOff failures&lt;/li&gt;
&lt;li&gt;database connection exhaustion&lt;/li&gt;
&lt;li&gt;API rate limiting failures&lt;/li&gt;
&lt;li&gt;downstream gateway crashes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The architecture was intentionally designed so that simulated connectors can later be replaced with real monitoring APIs.&lt;/p&gt;




&lt;h2&gt;
  
  
  Evaluation Was Surprisingly Hard
&lt;/h2&gt;

&lt;p&gt;One unexpected realization during development:&lt;/p&gt;

&lt;p&gt;Building the RCA pipeline was easier than evaluating it.&lt;/p&gt;

&lt;p&gt;It’s very easy to generate convincing AI explanations.&lt;/p&gt;

&lt;p&gt;It’s much harder to measure:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;whether the RCA is actually correct&lt;/li&gt;
&lt;li&gt;whether retrieval is meaningful&lt;/li&gt;
&lt;li&gt;whether severity classification is reliable&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That’s why I added an evaluation layer measuring:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Retrieval Accuracy&lt;/li&gt;
&lt;li&gt;RCA Match Accuracy&lt;/li&gt;
&lt;li&gt;Severity Accuracy&lt;/li&gt;
&lt;li&gt;Average Latency&lt;/li&gt;
&lt;li&gt;Correlation Confidence&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Adding evaluation made the project feel significantly more engineering-focused rather than simply prompt-driven.&lt;/p&gt;




&lt;h2&gt;
  
  
  Tech Stack
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Python&lt;/li&gt;
&lt;li&gt;Streamlit&lt;/li&gt;
&lt;li&gt;LangGraph&lt;/li&gt;
&lt;li&gt;FAISS&lt;/li&gt;
&lt;li&gt;SentenceTransformers&lt;/li&gt;
&lt;li&gt;Groq LLM API&lt;/li&gt;
&lt;li&gt;Pandas&lt;/li&gt;
&lt;/ul&gt;







&lt;h2&gt;
  
  
  Building Under Hackathon Constraints
&lt;/h2&gt;

&lt;p&gt;OpsMind AI was originally built during a short-duration engineering hackathon focused on AI agents and developer infrastructure workflows.&lt;/p&gt;

&lt;p&gt;One interesting challenge was balancing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ambitious system design ideas&lt;/li&gt;
&lt;li&gt;realistic implementation scope&lt;/li&gt;
&lt;li&gt;evaluation reliability&lt;/li&gt;
&lt;li&gt;UI polish&lt;/li&gt;
&lt;li&gt;deployment constraints&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I wanted the project to feel less like a simple LLM wrapper and more like an actual operational intelligence platform, which is why I focused heavily on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;multi-agent orchestration&lt;/li&gt;
&lt;li&gt;retrieval systems&lt;/li&gt;
&lt;li&gt;evaluation metrics&lt;/li&gt;
&lt;li&gt;workflow visualization&lt;/li&gt;
&lt;li&gt;observability-inspired architecture&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Even within a constrained timeline, building the system end-to-end — from synthetic telemetry generation to agent orchestration and evaluation — was an incredibly valuable learning experience.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Learned
&lt;/h2&gt;

&lt;p&gt;This project taught me a lot about:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;observability systems&lt;/li&gt;
&lt;li&gt;multi-agent orchestration&lt;/li&gt;
&lt;li&gt;RAG pipelines&lt;/li&gt;
&lt;li&gt;AI evaluation strategies&lt;/li&gt;
&lt;li&gt;operational intelligence workflows&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;More importantly, it changed how I think about AI systems.&lt;/p&gt;

&lt;p&gt;The interesting challenge wasn’t generating text.&lt;/p&gt;

&lt;p&gt;It was designing systems that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;reason through operational data&lt;/li&gt;
&lt;li&gt;coordinate specialized agents&lt;/li&gt;
&lt;li&gt;retrieve contextual memory&lt;/li&gt;
&lt;li&gt;produce actionable outputs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That feels much closer to how real-world AI systems will evolve.&lt;/p&gt;




&lt;h2&gt;
  
  
  Demo &amp;amp; Repository
&lt;/h2&gt;

&lt;h3&gt;
  
  
  GitHub Repository
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/Anucool419/OpsMind-AI" rel="noopener noreferrer"&gt;https://github.com/Anucool419/OpsMind-AI&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Demo Video
&lt;/h3&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/OTj5cE5ortQ"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;




&lt;h2&gt;
  
  
  Future Improvements
&lt;/h2&gt;

&lt;p&gt;Some things I’d love to explore next:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;real-time telemetry ingestion&lt;/li&gt;
&lt;li&gt;live Datadog/New Relic integrations&lt;/li&gt;
&lt;li&gt;Slack incident alerting&lt;/li&gt;
&lt;li&gt;autonomous remediation workflows&lt;/li&gt;
&lt;li&gt;distributed tracing support&lt;/li&gt;
&lt;li&gt;long-term incident memory systems&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;What started as a simple idea — “Can AI help investigate production incidents faster?” — turned into a much deeper exploration of how intelligent systems can assist engineering operations.&lt;/p&gt;

&lt;p&gt;The most interesting part of building OpsMind AI wasn’t the UI or even the LLM integration.&lt;/p&gt;

&lt;p&gt;It was understanding how modern operational systems actually behave:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;cascading failures&lt;/li&gt;
&lt;li&gt;noisy telemetry&lt;/li&gt;
&lt;li&gt;infrastructure dependencies&lt;/li&gt;
&lt;li&gt;repeated incident patterns&lt;/li&gt;
&lt;li&gt;operational uncertainty&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This project made me realize that the future of AI in engineering is not just about chat interfaces.&lt;/p&gt;

&lt;p&gt;It’s about building systems that can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;reason over complex environments&lt;/li&gt;
&lt;li&gt;retrieve operational memory&lt;/li&gt;
&lt;li&gt;coordinate specialized agents&lt;/li&gt;
&lt;li&gt;assist humans during high-pressure decision making&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;OpsMind AI is still a prototype, but building it gave me a much deeper appreciation for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;observability engineering&lt;/li&gt;
&lt;li&gt;SRE workflows&lt;/li&gt;
&lt;li&gt;AI orchestration systems&lt;/li&gt;
&lt;li&gt;evaluation-driven AI development&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And honestly, that combination of AI + systems engineering is one of the most exciting areas to explore right now. Do suggest any improvements you think I should make or share your experiences.&lt;/p&gt;




&lt;p&gt;Thanks for reading.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>langgraph</category>
      <category>programming</category>
      <category>productivity</category>
    </item>
    <item>
      <title>🚀 This AI Tells You What to Study for Exams</title>
      <dc:creator>Ananya S</dc:creator>
      <pubDate>Mon, 04 May 2026 17:45:51 +0000</pubDate>
      <link>https://dev.to/zeroshotanu/this-ai-tells-you-what-to-study-for-exams-35ji</link>
      <guid>https://dev.to/zeroshotanu/this-ai-tells-you-what-to-study-for-exams-35ji</guid>
      <description>&lt;p&gt;Consider this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;It’s 3 days before your exam.&lt;br&gt;
You have 5 units. 2 are huge. 1 is confusing.&lt;br&gt;
And you’re thinking:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;“What do I actually study?”&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So you open past papers.&lt;/p&gt;

&lt;p&gt;You start spotting patterns… maybe.&lt;/p&gt;

&lt;p&gt;But it’s slow. Inconsistent. And honestly — a bit of guessing.&lt;/p&gt;




&lt;h2&gt;
  
  
  💡 What if that entire process was automated?
&lt;/h2&gt;

&lt;p&gt;What if you could:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Upload past papers 📄&lt;/li&gt;
&lt;li&gt;Instantly see &lt;strong&gt;what matters most&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Identify &lt;strong&gt;high-weightage topics&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Know what’s &lt;strong&gt;missing from your prep&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Get a &lt;strong&gt;day-wise study plan&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And that's the solution I built and prototyped in 6 hours during a GenAI hackathon&lt;/p&gt;




&lt;h2&gt;
  
  
  🎯 Introducing: AI Exam Strategist
&lt;/h2&gt;

&lt;p&gt;A system that analyzes past question papers and turns them into &lt;strong&gt;actionable study strategy&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Not just summaries. Not just answers.&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;Actual decision-making support for exams.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🧠 What It Does
&lt;/h2&gt;

&lt;h3&gt;
  
  
  📂 Multi-Paper Analysis
&lt;/h3&gt;

&lt;p&gt;Upload multiple past papers → the system processes them together and extracts meaningful patterns.&lt;/p&gt;




&lt;h3&gt;
  
  
  🔍 Pattern Detection
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Finds &lt;strong&gt;frequently asked topics&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Classifies &lt;strong&gt;difficulty levels&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Identifies &lt;strong&gt;year-wise trends&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;👉 Helps you focus on topics with the &lt;strong&gt;highest exam impact&lt;/strong&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  📚 Syllabus Mapping
&lt;/h3&gt;

&lt;p&gt;Upload your syllabus → instantly see:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ Topics already appearing in exams&lt;/li&gt;
&lt;li&gt;❌ Topics not covered (potential blind spots)&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  📊 Visual Insights
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Topic frequency charts&lt;/li&gt;
&lt;li&gt;Difficulty distribution&lt;/li&gt;
&lt;li&gt;Topic vs difficulty breakdown&lt;/li&gt;
&lt;li&gt;Year-wise trends&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;👉 Patterns become &lt;strong&gt;obvious at a glance&lt;/strong&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  🧠 Smart Study Planner
&lt;/h3&gt;

&lt;p&gt;Generates a &lt;strong&gt;day-wise plan&lt;/strong&gt; based on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;available time&lt;/li&gt;
&lt;li&gt;topic importance&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;👉 Designed for &lt;strong&gt;maximum ROI under time constraints&lt;/strong&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  📝 Practice Question Generator
&lt;/h3&gt;

&lt;p&gt;Select a topic → generate relevant practice questions instantly.&lt;/p&gt;




&lt;h3&gt;
  
  
  💬 AI Assistant
&lt;/h3&gt;

&lt;p&gt;Ask:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“What should I prioritize?”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Get answers grounded in your own analyzed data.&lt;/p&gt;




&lt;h2&gt;
  
  
  🏗️ Tech Stack
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;FastAPI&lt;/strong&gt; → backend APIs&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Streamlit&lt;/strong&gt; → interactive UI&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Groq API (LLM)&lt;/strong&gt; → classification &amp;amp; generation&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LangGraph&lt;/strong&gt; → structured workflow orchestration&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pandas&lt;/strong&gt; → data processing&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  ⚙️ How It Works
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Upload Papers → Extract Questions → Classify (Topic + Difficulty)
→ Analyze Patterns → Map with Syllabus → Generate Insights
→ Create Study Plan → Practice + AI Chat
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🤔 Did I Use RAG?
&lt;/h2&gt;

&lt;p&gt;Not in this version.&lt;/p&gt;

&lt;p&gt;Since the dataset is relatively small, I used:&lt;br&gt;
👉 &lt;strong&gt;context injection (passing structured analysis directly to the LLM)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This keeps the system fast and simple.&lt;/p&gt;

&lt;p&gt;For larger-scale usage, this can evolve into a &lt;strong&gt;RAG-based system with vector search&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  📏 Evaluation (Keeping It Real)
&lt;/h2&gt;

&lt;p&gt;I added a basic evaluation layer to understand how the system behaves.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Used a &lt;strong&gt;small, manually created dataset&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Measured:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Topic classification&lt;/li&gt;
&lt;li&gt;Difficulty classification&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;⚠️ Important:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Accuracy may appear low if you try it yourself&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Because:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;dataset is small&lt;/li&gt;
&lt;li&gt;matching is strict (semantic matches may be marked wrong)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;👉 The goal wasn’t perfect scoring —&lt;br&gt;
but to &lt;strong&gt;validate the system’s reasoning and consistency&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🧠 What I Learned
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Building GenAI systems is more about &lt;strong&gt;pipelines than prompts&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;LLM outputs are messy — &lt;strong&gt;normalization is critical&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Evaluation in AI is not straightforward&lt;/li&gt;
&lt;li&gt;Simple approaches (like context injection) can outperform complex ones for MVPs&lt;/li&gt;
&lt;li&gt;Speed + clarity &amp;gt; overengineering&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🔮 Future Improvements
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;OCR for scanned PDFs&lt;/li&gt;
&lt;li&gt;Semantic topic matching using embeddings&lt;/li&gt;
&lt;li&gt;Persistent memory across sessions&lt;/li&gt;
&lt;li&gt;Scalable deployment&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🎥 Demo &amp;amp; Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;🔗 GitHub: &lt;em&gt;&lt;a href="https://github.com/Anucool419/AI-Exam_Strategist" rel="noopener noreferrer"&gt;https://github.com/Anucool419/AI-Exam_Strategist&lt;/a&gt;&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;🎥 Demo Video: &lt;em&gt;&lt;a href="https://www.loom.com/share/04005565701e45d1855d1fa13bcee73a" rel="noopener noreferrer"&gt;https://www.loom.com/share/04005565701e45d1855d1fa13bcee73a&lt;/a&gt;&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;🌐 Live App: &lt;em&gt;&lt;a href="https://ai-examstrategist-ryjarq6usrfbsd85gipexy.streamlit.app/" rel="noopener noreferrer"&gt;https://ai-examstrategist-ryjarq6usrfbsd85gipexy.streamlit.app/&lt;/a&gt;&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  ⚠️ Note: The live demo UI is deployed, but the backend runs locally. Full functionality is shown in the demo video.
&lt;/h2&gt;

&lt;h2&gt;
  
  
  🏁 Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Exams aren’t just about how much you study.&lt;/p&gt;

&lt;p&gt;They’re about:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;what you choose to study&lt;/li&gt;
&lt;li&gt;how you prioritize&lt;/li&gt;
&lt;li&gt;how well you use limited time&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And right now, students are expected to figure that out manually.&lt;/p&gt;

&lt;p&gt;This project explores a simple idea:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;What if AI could guide those decisions?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Not replace studying.&lt;br&gt;
Not shortcut learning.&lt;/p&gt;

&lt;p&gt;But make preparation &lt;strong&gt;more focused, more intentional, and more efficient&lt;/strong&gt;.&lt;/p&gt;




&lt;blockquote&gt;
&lt;p&gt;Because sometimes, the smartest move…&lt;br&gt;
is knowing what &lt;em&gt;not&lt;/em&gt; to study.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In &lt;em&gt;~6 hours&lt;/em&gt;, this went from an idea to a working system.&lt;/p&gt;

&lt;p&gt;It’s not perfect — but it solves a real problem:&lt;/p&gt;

&lt;blockquote&gt;
&lt;h3&gt;
  
  
  Maximizing study ROI when time is limited
&lt;/h3&gt;
&lt;/blockquote&gt;




&lt;p&gt;Would love your thoughts 👇&lt;/p&gt;

</description>
      <category>ai</category>
      <category>genai</category>
      <category>productivity</category>
      <category>python</category>
    </item>
    <item>
      <title>🚀 I Built an AI-Powered Fest Assistant with Agents, RAG &amp; Planning (Pragyan @ NITT)</title>
      <dc:creator>Ananya S</dc:creator>
      <pubDate>Tue, 14 Apr 2026 17:57:01 +0000</pubDate>
      <link>https://dev.to/zeroshotanu/i-built-an-ai-powered-fest-assistant-with-agents-rag-planning-pragyan-nitt-44e9</link>
      <guid>https://dev.to/zeroshotanu/i-built-an-ai-powered-fest-assistant-with-agents-rag-planning-pragyan-nitt-44e9</guid>
      <description>&lt;p&gt;I deleted Instagram more than a year ago, and honestly, it saved me from a lot of distractions.&lt;/p&gt;

&lt;p&gt;But there was an unexpected downside.&lt;/p&gt;

&lt;p&gt;A lot of informal, real-time information — especially during college events — still lives there.&lt;/p&gt;

&lt;p&gt;During our college fest, for example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Event schedules&lt;/li&gt;
&lt;li&gt;Last-minute updates&lt;/li&gt;
&lt;li&gt;Food stall announcements&lt;/li&gt;
&lt;li&gt;Informal activities&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;…everything gets posted on Instagram.&lt;/p&gt;

&lt;p&gt;At the same time:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fest details and significance are on the official website&lt;/li&gt;
&lt;li&gt;Food stall info is on a separate app&lt;/li&gt;
&lt;li&gt;The entire 3-day schedule is compressed into a few posts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There’s no single place to get a clear, structured view of everything.&lt;/p&gt;

&lt;p&gt;And that’s when it hit me:&lt;/p&gt;

&lt;p&gt;Most college fests have websites.&lt;br&gt;
Some even have apps.&lt;/p&gt;

&lt;p&gt;But none of them actually &lt;strong&gt;help you navigate the fest intelligently.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;They give information.&lt;br&gt;
They don’t give guidance.&lt;/p&gt;

&lt;p&gt;But I wanted to build something smarter —&lt;br&gt;
an &lt;strong&gt;AI assistant that actually understands queries, plans your day, and even helps you find teammates.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;So, I built &lt;strong&gt;Pragyan Mentor Assistant&lt;/strong&gt; — an AI-powered system for navigating a techno-managerial fest.&lt;/p&gt;




&lt;h2&gt;
  
  
  🎯 Problem
&lt;/h2&gt;

&lt;p&gt;During college fests like Pragyan (NIT Trichy):&lt;br&gt;
There are &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;There are &lt;strong&gt;dozens of events, workshops, and shows&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Information is scattered across PDFs, sites, and posters&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Users don’t know:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;what to attend&lt;/li&gt;
&lt;li&gt;what matches their interests&lt;/li&gt;
&lt;li&gt;how to plan their time&lt;/li&gt;
&lt;li&gt;who to team up with&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;👉 Traditional apps = static information&lt;br&gt;
👉 I wanted &lt;strong&gt;intelligent interaction&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  💡 Solution
&lt;/h2&gt;

&lt;p&gt;I built a &lt;strong&gt;multi-tool AI assistant&lt;/strong&gt; that can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🎉 Answer questions about events, workshops, proshows&lt;/li&gt;
&lt;li&gt;🍔 Show food stalls &amp;amp; mess menu&lt;/li&gt;
&lt;li&gt;🧠 Recommend activities based on user intent&lt;/li&gt;
&lt;li&gt;📅 Plan your schedule&lt;/li&gt;
&lt;li&gt;🤝 Match you with like-minded participants/Suggest potential teammates (prototype)&lt;/li&gt;
&lt;li&gt;📚 Answer fest-related questions using RAG&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🧠 System Design
&lt;/h2&gt;

&lt;p&gt;Instead of a simple chatbot, I designed it as a &lt;strong&gt;tool-using agent system&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  🔹 Tools
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;fetch_events&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;fetch_workshops&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;fetch_food_stall&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;fetch_mess_menu&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;pragyan_bot&lt;/code&gt; (RAG-based)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;smart_recommender&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;planner&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;buddy_matcher&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  🔹 Agent Flow
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;User query&lt;/li&gt;
&lt;li&gt;LLM decides:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Which tool to call

&lt;ol&gt;
&lt;li&gt;Tool executes&lt;/li&gt;
&lt;li&gt;Response is generated in natural language&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  📚 Retrieval Approach
&lt;/h3&gt;

&lt;p&gt;This system uses a hybrid retrieval strategy at the system level:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Structured retrieval (keyword-based)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Direct tool calls for events/workshops&lt;/li&gt;
&lt;li&gt;Fast and deterministic&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Semantic retrieval (RAG)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Vector search over fest documents&lt;/li&gt;
&lt;li&gt;Handles open-ended queries&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;👉 This combination allows both precision and flexibility&lt;/p&gt;

&lt;h2&gt;
  
  
  📚 RAG (Retrieval Augmented Generation)
&lt;/h2&gt;

&lt;p&gt;To handle fest knowledge:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Used:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Text files (events, shows, lectures, FAQs)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Built:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;FAISS vector store&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Retrieval:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Semantic search on query&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Response:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Context-aware answers&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  🧠 Memory
&lt;/h2&gt;

&lt;p&gt;Using:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;InMemorySaver()&lt;/code&gt; (LangGraph)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;👉 Enables:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;remembering user preferences&lt;/li&gt;
&lt;li&gt;better recommendations&lt;/li&gt;
&lt;li&gt;conversational continuity&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🤖 Smart Features
&lt;/h2&gt;

&lt;h3&gt;
  
  
  🎯 Recommendations
&lt;/h3&gt;

&lt;p&gt;Understands intent like:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"What should I attend if I like tech and fun?"&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  📅 Planner Agent
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;"Plan my next 3 hours"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Generates a structured schedule based on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;time&lt;/li&gt;
&lt;li&gt;interests&lt;/li&gt;
&lt;li&gt;available events&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  🤝 Buddy Matching (Prototype)
&lt;/h3&gt;

&lt;p&gt;Matches based on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;interests&lt;/li&gt;
&lt;li&gt;level&lt;/li&gt;
&lt;li&gt;context (e.g. case study competitions)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Uses a small dataset to demonstrate logic&lt;/p&gt;




&lt;h2&gt;
  
  
  🖥️ UI
&lt;/h2&gt;

&lt;p&gt;Built with &lt;strong&gt;Streamlit&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Chat-based interface&lt;/li&gt;
&lt;li&gt;Quick action buttons&lt;/li&gt;
&lt;li&gt;Structured responses&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🚀 Deployment
&lt;/h2&gt;

&lt;p&gt;Deployed on Render (free tier)&lt;br&gt;
Environment variables for API security&lt;/p&gt;




&lt;p&gt;&lt;a href="" class="article-body-image-wrapper"&gt;&lt;img width="100%"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  🎥 Demo
&lt;/h2&gt;

&lt;p&gt;👉 &lt;a href="https://www.loom.com/share/13f87025a9154a55b80fc240bfc91ba2" rel="noopener noreferrer"&gt;https://www.loom.com/share/13f87025a9154a55b80fc240bfc91ba2&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🛠️ Tech Stack
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Python&lt;/li&gt;
&lt;li&gt;LangChain&lt;/li&gt;
&lt;li&gt;OpenAI API&lt;/li&gt;
&lt;li&gt;FAISS&lt;/li&gt;
&lt;li&gt;Streamlit&lt;/li&gt;
&lt;li&gt;Render&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  ⚠️ Challenges Faced
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;RAG retrieval quality (chunking + parsing issues)&lt;/li&gt;
&lt;li&gt;Tool selection accuracy&lt;/li&gt;
&lt;li&gt;Structuring multi-agent workflow&lt;/li&gt;
&lt;li&gt;Deployment + API key handling&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🔄 Ongoing Improvements
&lt;/h2&gt;

&lt;p&gt;Some features I’m actively working on:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Adding database-backed user profiles for real buddy matching&lt;/li&gt;
&lt;li&gt;Improving RAG with better retrieval and evaluation&lt;/li&gt;
&lt;li&gt;Expanding dataset coverage for more complete fest information&lt;/li&gt;
&lt;li&gt;Exploring true hybrid retrieval + reranking&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  📈 What I Learned
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Building &lt;strong&gt;agents &amp;gt; building chatbots&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;RAG needs &lt;strong&gt;data structuring, not just embeddings&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;UI matters a lot for perceived intelligence&lt;/li&gt;
&lt;li&gt;Deployment and debugging are part of the real challenge&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🔗 Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;🔒 Live demo available on request&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  💭 Final Thoughts
&lt;/h2&gt;

&lt;p&gt;This project made me realize:&lt;/p&gt;

&lt;p&gt;👉 The future isn’t just about LLMs&lt;br&gt;
👉 It’s about &lt;strong&gt;systems built around them&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;If you have suggestions or ideas to improve this, I’d love to hear them!&lt;/p&gt;




</description>
      <category>ai</category>
      <category>python</category>
      <category>langchain</category>
      <category>rag</category>
    </item>
    <item>
      <title>Stop Calling FAISS a Database: The VectorStore vs. VectorDB Showdown🧠⚡</title>
      <dc:creator>Ananya S</dc:creator>
      <pubDate>Tue, 17 Mar 2026 16:40:58 +0000</pubDate>
      <link>https://dev.to/zeroshotanu/stop-calling-faiss-a-database-the-vectorstore-vs-vectordb-showdown-4g94</link>
      <guid>https://dev.to/zeroshotanu/stop-calling-faiss-a-database-the-vectorstore-vs-vectordb-showdown-4g94</guid>
      <description>&lt;p&gt;If you’ve been building with LangChain, you’ve probably used Chroma or FAISS and called them "databases." But in a production environment, that distinction could be the difference between a smooth app and a total system crash.&lt;/p&gt;

&lt;p&gt;As AI Engineers, we need to know when to use a lightweight VectorStore and when to upgrade to a full Vector Database.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is a VectorStore? (The Engine)
&lt;/h2&gt;

&lt;p&gt;A VectorStore is a specialized data structure or a local library. Its primary job is simple: Calculate the distance between vectors as fast as possible.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Best for&lt;/em&gt;: Prototypes, local research, and small datasets.&lt;br&gt;
&lt;em&gt;Pros&lt;/em&gt;: Zero latency (runs in-process), easy to set up, free.&lt;br&gt;
&lt;em&gt;Cons&lt;/em&gt;: If your app restarts, your data might vanish (if not saved to disk). It doesn't scale across multiple servers easily.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Popular Choice&lt;/em&gt;: FAISS (by Meta). It's incredibly fast but lacks "database" features like user authentication or real-time updates.&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_community.vectorstores&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;FAISS&lt;/span&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;OpenAIEmbeddings&lt;/span&gt;

&lt;span class="c1"&gt;# 1. Initialize Embeddings
&lt;/span&gt;&lt;span class="n"&gt;embeddings&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;OpenAIEmbeddings&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="c1"&gt;# 2. Create the VectorStore (In-memory)
&lt;/span&gt;&lt;span class="n"&gt;texts&lt;/span&gt; &lt;span class="o"&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;AI is transforming civil engineering&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;LangChain is a framework for LLMs&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;vector_store&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;FAISS&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;from_texts&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;texts&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;embeddings&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# 3. Search (Fast, but only local)
&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;What is LangChain?&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;results&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;vector_store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;similarity_search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# 4. Persistence (Manual step required)
&lt;/span&gt;&lt;span class="n"&gt;vector_store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;save_local&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;my_faiss_index&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
&lt;span class="c1"&gt;# To use it later, you must load_local() manually
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What is a Vector Database? (The Full System)
&lt;/h2&gt;

&lt;p&gt;A Vector Database is a production-ready management system. It uses a vector store under the hood but wraps it in the features we expect from enterprise software.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Best for:&lt;/em&gt; Production apps, multi-user systems, and massive datasets (millions of vectors).&lt;/p&gt;

&lt;p&gt;The "Extras" you get:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Persistence&lt;/em&gt;: Your data lives on a server, not just in your RAM.&lt;br&gt;
&lt;em&gt;Metadata Filtering&lt;/em&gt;: The ability to say "Find similar vectors, but only for documents created in 2024."&lt;br&gt;
&lt;em&gt;Scalability&lt;/em&gt;: It can handle billions of vectors by spreading them across different "pods" or nodes.&lt;/p&gt;

&lt;p&gt;Popular Choice: Pinecone or Weaviate.&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_pinecone&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;PineconeVectorStore&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pinecone&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Pinecone&lt;/span&gt;

&lt;span class="c1"&gt;# 1. Initialize Cloud Client
&lt;/span&gt;&lt;span class="n"&gt;pc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Pinecone&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;api_key&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_PINECONE_API_KEY&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;index_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;my-production-index&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="c1"&gt;# 2. Connect to the Index (Data lives on Pinecone's servers)
&lt;/span&gt;&lt;span class="n"&gt;vector_db&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;PineconeVectorStore&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;from_texts&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;texts&lt;/span&gt;&lt;span class="o"&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;B.Tech students at NITT are building AI agents&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="n"&gt;embedding&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nc"&gt;OpenAIEmbeddings&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="n"&gt;index_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;index_name&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# 3. Search (API Call to the cloud)
# Anyone with the API key can now query this from any device
&lt;/span&gt;&lt;span class="n"&gt;results&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;vector_db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;similarity_search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Who is building agents?&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Key Observation&lt;/strong&gt;: There is no "save" step. The moment you run from_texts, the data is permanently stored in the cloud. You can delete your local code, and the data remains accessible.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;VectorStore (e.g., FAISS, Chroma)&lt;/th&gt;
&lt;th&gt;Vector Database (e.g., Pinecone, Milvus)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Architecture&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;A library that runs &lt;strong&gt;inside&lt;/strong&gt; your application code.&lt;/td&gt;
&lt;td&gt;A standalone &lt;strong&gt;distributed system&lt;/strong&gt; running on a server.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Data Persistence&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Mostly &lt;strong&gt;In-Memory&lt;/strong&gt;. Data is lost when the script ends.&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Persistent by default&lt;/strong&gt;. Data is stored on cloud/disk.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Scalability&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Limited by your machine's &lt;strong&gt;RAM/Disk&lt;/strong&gt;. Hard to scale.&lt;/td&gt;
&lt;td&gt;Built for &lt;strong&gt;Horizontal Scaling&lt;/strong&gt;. Handles billions of vectors.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Multi-tenancy&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;No built-in support for isolated users.&lt;/td&gt;
&lt;td&gt;High. Supports multiple users and &lt;strong&gt;isolated indexes&lt;/strong&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;CRUD Operations&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Hard to update specific vectors without rebuilding.&lt;/td&gt;
&lt;td&gt;Full &lt;strong&gt;Create, Read, Update, Delete&lt;/strong&gt; support via API.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Metadata&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Basic filtering capabilities.&lt;/td&gt;
&lt;td&gt;Advanced &lt;strong&gt;Metadata Filtering&lt;/strong&gt; (e.g., Filter by date).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Cost&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Free&lt;/strong&gt; (Uses your local resources).&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Tiered&lt;/strong&gt;. Free tiers available, then paid.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Let's Discuss!&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
Are you currently using a local store like Chroma or have you made the jump to a cloud database? What's the biggest challenge you've faced with vector scaling? Drop a comment below! 👇&lt;/p&gt;

</description>
      <category>ai</category>
      <category>langchain</category>
      <category>vectordatabase</category>
      <category>python</category>
    </item>
    <item>
      <title>Decoding Embedding Models: Why Your RAG Is Only as Good as Your Vectors 🚀</title>
      <dc:creator>Ananya S</dc:creator>
      <pubDate>Mon, 09 Mar 2026 17:36:43 +0000</pubDate>
      <link>https://dev.to/zeroshotanu/decoding-embedding-models-why-your-rag-is-only-as-good-as-your-vectors-4k0n</link>
      <guid>https://dev.to/zeroshotanu/decoding-embedding-models-why-your-rag-is-only-as-good-as-your-vectors-4k0n</guid>
      <description>&lt;p&gt;As an AI Engineer, the first major decision you make in a RAG (Retrieval-Augmented Generation) pipeline isn't which LLM to use—it's which Embedding Model will represent your data. If your vectors are low-quality, your retrieval will fail, and even a top-tier LLM can't save a response based on the wrong context.&lt;/p&gt;

&lt;h2&gt;
  
  
  🏗️ What exactly is an Embedding?
&lt;/h2&gt;

&lt;p&gt;Embedding models take text tokens and map them into a multi-dimensional coordinate system (vectors).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Dimensions&lt;/em&gt;&lt;/strong&gt;: These represent the "features" the model understands. Different models represent words in vectors of different dimensions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Semantic Proximity&lt;/em&gt;&lt;/strong&gt;: In a good model, the vector for "King" and "Queen" will be mathematically closer than "King" and "Keyboard."&lt;/p&gt;

&lt;h2&gt;
  
  
  🌟 Popular Embedding Models: Hugging Face
&lt;/h2&gt;

&lt;p&gt;Hugging Face models are the go-to for privacy, local deployment, and cost-efficiency. Here are the top picks:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;1. all-MiniLM-L6-v2&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Dimensions: 384&lt;br&gt;
Description: Fast, efficient, and good quality.&lt;br&gt;
Use Case: General purpose; ideal for real-time applications.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;2. all-mpnet-base-v2&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Dimensions: 768&lt;br&gt;
Description: The best quality in the MiniLM family, though slower than L6. More dimensions lead to an improvement in accuracy.&lt;br&gt;
Use Case: When quality matters more than speed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;3. all-MiniLM-L12-v2&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Dimensions: 384&lt;br&gt;
Description: Slightly better than L6 but a bit slower.&lt;br&gt;
Use Case: A solid balance of speed and quality.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;4. multi-qa-MiniLM-L6-cos-v1&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Dimensions: 384&lt;br&gt;
Description: Optimized specifically for question-answering.&lt;br&gt;
Use Case: Q&amp;amp;A systems and semantic search.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;5. paraphrase-multilingual-MiniLM-L12-v2&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Dimensions: 384&lt;br&gt;
Description: Supports 50+ languages.&lt;br&gt;
Use Case: Global and multilingual applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  💰 The OpenAI Standard
&lt;/h2&gt;

&lt;p&gt;If you need massive scale and the highest "reasoning" in your vectors without managing infrastructure:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;&lt;em&gt;text-embedding-3-small&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Dimensions: 1536&lt;br&gt;
Cost: ~$0.02 per 1M tokens.&lt;br&gt;
Description: Highly cost-effective with improved accuracy over older models. It also supports Matryoshka Representation Learning, allowing you to trim dimensions (e.g., to 512) to save storage costs without losing much performance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;2. text-embedding-3-large&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Dimensions: 3072&lt;br&gt;
Cost: ~$0.13 per 1M tokens.&lt;br&gt;
Description: The most powerful model available. It captures incredibly fine-grained nuances in text.&lt;br&gt;
Feature: Like the "small" version, it supports Matryoshka Representation Learning, which means you can shorten the vector to 256 or 1024 dimensions to save database space while keeping most of the accuracy.&lt;br&gt;
Use Case: Enterprise-level research, legal document analysis, or complex medical data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;3. text-embedding-ada-002&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Dimensions: 1536&lt;br&gt;
Cost: ~$0.10 per 1M tokens.&lt;br&gt;
Description: The previous industry standard. While still reliable, it is now considered legacy compared to the "v3" family.&lt;br&gt;
Use Case: Mostly seen in older "legacy" AI systems. For any new project in 2026, you should skip this and go straight to text-embedding-3-small.&lt;/p&gt;

&lt;h2&gt;
  
  
  ⚖️ How to Choose?
&lt;/h2&gt;

&lt;p&gt;Strict Privacy/On-Prem? ➔ Hugging Face (Local).&lt;/p&gt;

&lt;p&gt;Real-time/Low Latency? ➔ all-MiniLM-L6-v2.&lt;/p&gt;

&lt;p&gt;Multilingual Data? ➔ paraphrase-multilingual-MiniLM-L12-v2.&lt;/p&gt;

&lt;p&gt;Enterprise Scale &amp;amp; Accuracy? ➔ text-embedding-3-small.&lt;/p&gt;

&lt;h2&gt;
  
  
  🚀 Conclusion
&lt;/h2&gt;

&lt;p&gt;In 2026, picking the right embedding model is about balancing latency, cost, and accuracy. Don't just pick the one with the most dimensions—pick the one that fits your specific data and hardware.&lt;/p&gt;

&lt;p&gt;What's your go-to embedding model for production? Let's discuss in the comments!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>vectordatabase</category>
      <category>python</category>
      <category>langchain</category>
    </item>
    <item>
      <title>🧠 Your LLM Isn’t an Agent — Until It Has Tools, Memory, and Structure (LangChain Deep Dive)</title>
      <dc:creator>Ananya S</dc:creator>
      <pubDate>Mon, 02 Mar 2026 17:09:48 +0000</pubDate>
      <link>https://dev.to/zeroshotanu/your-llm-isnt-an-agent-until-it-has-tools-memory-and-structure-langchain-deep-dive-18d8</link>
      <guid>https://dev.to/zeroshotanu/your-llm-isnt-an-agent-until-it-has-tools-memory-and-structure-langchain-deep-dive-18d8</guid>
      <description>&lt;p&gt;Most “AI apps” today are just:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Prompt → LLM → Text Response&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That’s not an agent.&lt;/p&gt;

&lt;p&gt;That’s autocomplete with branding.&lt;/p&gt;

&lt;p&gt;A real AI agent can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🛠 Use tools&lt;/li&gt;
&lt;li&gt;🧠 Remember context&lt;/li&gt;
&lt;li&gt;📦 Return structured outputs&lt;/li&gt;
&lt;li&gt;🔁 Reason across multiple steps&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With modern LangChain, building this is surprisingly clean.&lt;/p&gt;

&lt;p&gt;Let’s build one properly.&lt;/p&gt;




&lt;h2&gt;
  
  
  🚀 The Architecture of a Real Agent
&lt;/h2&gt;

&lt;p&gt;A production-ready AI agent has four core components:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Model&lt;/strong&gt; – the brain&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tools&lt;/strong&gt; – capabilities&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Structured outputs&lt;/strong&gt; – reliability and formatting&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Memory&lt;/strong&gt; – continuity&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you’re missing one of these, you’re not building a system — you’re running a demo.&lt;/p&gt;




&lt;h2&gt;
  
  
  1️⃣ The Brain: Modern Agent Setup
&lt;/h2&gt;

&lt;p&gt;We start with &lt;code&gt;create_agent()&lt;/code&gt; — the current way to build agents in LangChain.&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.agents&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;create_agent&lt;/span&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="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="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gpt-4o-mini&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;temperature&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Low temperature = more deterministic reasoning.&lt;/p&gt;

&lt;p&gt;Now let’s give it capabilities.&lt;/p&gt;




&lt;h2&gt;
  
  
  2️⃣ Tools: Giving the Agent Superpowers
&lt;/h2&gt;

&lt;p&gt;Tools are just Python functions with clear docstrings.&lt;br&gt;
The docstring matters — it’s how the model decides when to use the tool.&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.tools&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;tool&lt;/span&gt;

&lt;span class="nd"&gt;@tool&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;calculate_revenue&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;price&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;quantity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Calculate total revenue given price per unit and quantity sold.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;price&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;quantity&lt;/span&gt;


&lt;span class="nd"&gt;@tool&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_exchange_rate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;currency&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Get the USD exchange rate for a given currency code.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="n"&gt;rates&lt;/span&gt; &lt;span class="o"&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;EUR&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;1.1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;GBP&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;1.25&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;rates&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;currency&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;upper&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we assemble the agent:&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="n"&gt;agent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;create_agent&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;llm&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;tools&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;calculate_revenue&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;get_exchange_rate&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="n"&gt;system_prompt&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 financial analysis assistant.&lt;/span&gt;&lt;span class="sh"&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.&lt;/p&gt;

&lt;p&gt;The agent now:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Decides when math is needed&lt;/li&gt;
&lt;li&gt;Calls tools autonomously&lt;/li&gt;
&lt;li&gt;Observes results&lt;/li&gt;
&lt;li&gt;Produces a final answer&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;No manual routing logic.&lt;/p&gt;




&lt;h2&gt;
  
  
  3️⃣ Structured Outputs: Stop Parsing Strings
&lt;/h2&gt;

&lt;p&gt;If you're still doing regex on LLM responses, stop.&lt;/p&gt;

&lt;p&gt;Modern agents can return structured data using schemas.&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;pydantic&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;BaseModel&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;FinancialReport&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BaseModel&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;revenue&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;
    &lt;span class="n"&gt;currency&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;usd_value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we enforce structure:&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="n"&gt;structured_agent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;create_agent&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;llm&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;tools&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;calculate_revenue&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;get_exchange_rate&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="n"&gt;response_format&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;FinancialReport&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;Now when you invoke:&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="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;structured_agent&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="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;messages&lt;/span&gt;&lt;span class="sh"&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;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;role&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;user&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;content&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;I sold 120 units at 50 EUR each. Convert to USD.&lt;/span&gt;&lt;span class="sh"&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;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You don’t get text.&lt;/p&gt;

&lt;p&gt;You get validated data.&lt;br&gt;
Using Pydantic structured output parsers ensures the datatype of the fields is based on how we defined it.&lt;/p&gt;


&lt;h2&gt;
  
  
  4️⃣ Memory: Making the Agent Stateful
&lt;/h2&gt;

&lt;p&gt;Without memory, every request is a new message.&lt;/p&gt;

&lt;p&gt;With memory, your agent becomes a collaborator.&lt;/p&gt;

&lt;p&gt;In LangChain, memory can be plugged in via message history.&lt;/p&gt;

&lt;p&gt;Example pattern:&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="n"&gt;chat_history&lt;/span&gt; &lt;span class="o"&gt;=&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;agent&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="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;messages&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;chat_history&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&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;role&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;user&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;content&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;My product costs 20 USD.&lt;/span&gt;&lt;span class="sh"&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;span class="n"&gt;chat_history&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;extend&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;messages&lt;/span&gt;&lt;span class="sh"&gt;"&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;agent&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="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;messages&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;chat_history&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&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;role&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;user&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;content&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;Now calculate revenue for 300 units.&lt;/span&gt;&lt;span class="sh"&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;Now the agent remembers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Product price&lt;/li&gt;
&lt;li&gt;Prior discussion&lt;/li&gt;
&lt;li&gt;Contextual decisions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Memory transforms isolated responses into evolving workflows.&lt;/p&gt;




&lt;h2&gt;
  
  
  🧠 What’s Actually Happening Internally?
&lt;/h2&gt;

&lt;p&gt;When you call:&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="n"&gt;agent&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The agent:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Reads conversation + system prompt&lt;/li&gt;
&lt;li&gt;Plans next action&lt;/li&gt;
&lt;li&gt;Chooses a tool (if needed)&lt;/li&gt;
&lt;li&gt;Executes tool&lt;/li&gt;
&lt;li&gt;Feeds result back into reasoning&lt;/li&gt;
&lt;li&gt;Produces structured final output&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This loop is grounded in tool-calling rather than fragile prompt tricks.&lt;/p&gt;




&lt;h2&gt;
  
  
  ⚠️ Common Mistakes
&lt;/h2&gt;

&lt;p&gt;Things beginner devs get wrong:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;❌ Adding too many tools&lt;/li&gt;
&lt;li&gt;❌ Writing vague tool descriptions&lt;/li&gt;
&lt;li&gt;❌ Not enforcing structured outputs&lt;/li&gt;
&lt;li&gt;❌ Forgetting observability/logging&lt;/li&gt;
&lt;li&gt;❌ Letting the agent free-run without constraints&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Agents are probabilistic planners — not deterministic scripts.&lt;/p&gt;

&lt;p&gt;Design them intentionally.&lt;/p&gt;




&lt;h2&gt;
  
  
  🏗 The Big Shift in How We Build Software
&lt;/h2&gt;

&lt;p&gt;Before agents:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;APIs returned static responses&lt;/li&gt;
&lt;li&gt;Business logic was deterministic&lt;/li&gt;
&lt;li&gt;LLMs were “smart text generators”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After agents:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;LLMs orchestrate execution&lt;/li&gt;
&lt;li&gt;Tools become capabilities&lt;/li&gt;
&lt;li&gt;Structure guarantees reliability&lt;/li&gt;
&lt;li&gt;Memory enables continuity&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You're no longer building chat interfaces.&lt;/p&gt;

&lt;p&gt;You're building &lt;strong&gt;goal-driven systems&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  🎯 Final Take
&lt;/h2&gt;

&lt;p&gt;If your AI system:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Doesn’t use tools&lt;/li&gt;
&lt;li&gt;Doesn’t enforce structure&lt;/li&gt;
&lt;li&gt;Doesn’t maintain memory&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It’s not an agent.&lt;/p&gt;

&lt;p&gt;It’s autocomplete with better marketing.&lt;/p&gt;

&lt;p&gt;With modern LangChain, the barrier to real agents is gone.&lt;/p&gt;

&lt;p&gt;The question isn’t &lt;em&gt;“Can we build agents?”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;It’s:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What workflows are we ready to automate?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Do comment how you build agents and regarding any interesting types of agents you've built!&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>beginners</category>
      <category>langchain</category>
      <category>agents</category>
    </item>
    <item>
      <title>Understanding LangChain and Vector Embeddings: The Power Duo of Modern AI Applications</title>
      <dc:creator>Ananya S</dc:creator>
      <pubDate>Mon, 23 Feb 2026 17:23:19 +0000</pubDate>
      <link>https://dev.to/zeroshotanu/understanding-langchain-and-vector-embeddings-the-power-duo-of-modern-ai-applications-3g3l</link>
      <guid>https://dev.to/zeroshotanu/understanding-langchain-and-vector-embeddings-the-power-duo-of-modern-ai-applications-3g3l</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In the rapidly evolving landscape of artificial intelligence and natural language processing, two technologies have emerged as fundamental building blocks for creating intelligent applications: &lt;strong&gt;LangChain&lt;/strong&gt; and &lt;strong&gt;vector embeddings&lt;/strong&gt;. Together, they form a powerful combination that enables developers to build sophisticated AI systems capable of understanding, reasoning, and generating human-like responses. This post explores both concepts and demonstrates how they work together to create the next generation of AI applications.&lt;/p&gt;

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

&lt;p&gt;LangChain is an open-source framework designed to simplify the development of applications powered by large language models (LLMs). It provides a comprehensive set of tools, components, and abstractions that help developers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Chain together&lt;/strong&gt; multiple LLM calls and other components&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Integrate with external data sources&lt;/strong&gt; and APIs&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Implement memory&lt;/strong&gt; to maintain context across interactions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Create agents&lt;/strong&gt; that can make decisions and take actions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Handle complex workflows&lt;/strong&gt; with ease&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At its core, LangChain acts as a bridge between raw LLM capabilities and real-world applications, providing structure and patterns for building production-ready AI systems.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding Vector Embeddings
&lt;/h2&gt;

&lt;p&gt;Vector embeddings are numerical representations of data (typically text, but also images, audio, etc.) in a high-dimensional space. These representations capture semantic meaning and relationships between items:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Semantic similarity&lt;/strong&gt;: Items with similar meanings have similar vector representations&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dimensionality&lt;/strong&gt;: Typically 1536, 768, or other dimensions depending on the model&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Distance metrics&lt;/strong&gt;: Cosine similarity or Euclidean distance can measure relatedness&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, the words "king" and "queen" would have vector embeddings that are close to each other in vector space, while "king" and "banana" would be farther apart.&lt;/p&gt;

&lt;h3&gt;
  
  
  Common Embedding Models:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;OpenAI's text-embedding-ada-002&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Sentence-BERT (SBERT)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Hugging Face's all-MiniLM-L6-v2&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How LangChain and Vector Embeddings Work Together
&lt;/h2&gt;

&lt;p&gt;The true power emerges when LangChain integrates vector embeddings into its architecture. Here's how they complement each other:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. &lt;strong&gt;Retrieval-Augmented Generation (RAG)&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;This is perhaps the most impactful combination. LangChain uses vector embeddings to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Convert documents into vector representations&lt;/li&gt;
&lt;li&gt;Store these vectors in vector databases (like Pinecone, Chroma, or FAISS)&lt;/li&gt;
&lt;li&gt;Retrieve relevant context when a user asks a question&lt;/li&gt;
&lt;li&gt;Pass the retrieved context to an LLM for generating accurate, grounded responses
&lt;/li&gt;
&lt;/ul&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_community.vectorstores&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Chroma&lt;/span&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;OpenAIEmbeddings&lt;/span&gt;&lt;span class="p"&gt;,&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.chains&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;RetrievalQA&lt;/span&gt;

&lt;span class="c1"&gt;# Create embeddings
&lt;/span&gt;&lt;span class="n"&gt;embeddings&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;OpenAIEmbeddings&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="c1"&gt;# Store documents in vector database
&lt;/span&gt;&lt;span class="n"&gt;vectorstore&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Chroma&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;from_documents&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;documents&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;embeddings&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Create RAG chain
&lt;/span&gt;&lt;span class="n"&gt;qa_chain&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;RetrievalQA&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;from_chain_type&lt;/span&gt;&lt;span class="p"&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;retriever&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;vectorstore&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;as_retriever&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="n"&gt;return_source_documents&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Get answer with context
&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;qa_chain&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="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;What is vector similarity search?&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. &lt;strong&gt;Semantic Search and Filtering&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Vector embeddings enable LangChain to perform semantic searches rather than just keyword matching:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Find documents that are conceptually similar to a query&lt;/li&gt;
&lt;li&gt;Filter results based on semantic relevance scores&lt;/li&gt;
&lt;li&gt;Group similar content automatically&lt;/li&gt;
&lt;li&gt;Identify duplicate or near-duplicate content&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. &lt;strong&gt;Memory and Context Management&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;LangChain uses embeddings to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Store conversation history as vectors&lt;/li&gt;
&lt;li&gt;Retrieve relevant past interactions based on current context&lt;/li&gt;
&lt;li&gt;Maintain long-term memory across sessions&lt;/li&gt;
&lt;li&gt;Recognize when similar situations have occurred before&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Practical Use Cases
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Enterprise Knowledge Base&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;A company can use LangChain with vector embeddings to create an intelligent knowledge base:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Ingest internal documents, manuals, and policies&lt;/li&gt;
&lt;li&gt;Convert all content to vector embeddings&lt;/li&gt;
&lt;li&gt;Allow employees to ask natural language questions&lt;/li&gt;
&lt;li&gt;Retrieve relevant information and generate comprehensive answers&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Customer Support Chatbot&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Build a chatbot that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Understands customer queries semantically&lt;/li&gt;
&lt;li&gt;Retrieves relevant support articles and FAQs&lt;/li&gt;
&lt;li&gt;Provides accurate, context-aware responses&lt;/li&gt;
&lt;li&gt;Learns from past interactions to improve over time&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Research Assistant&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Create a tool that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Analyzes academic papers and research documents&lt;/li&gt;
&lt;li&gt;Finds connections between different research areas&lt;/li&gt;
&lt;li&gt;Summarizes complex topics based on relevant sources&lt;/li&gt;
&lt;li&gt;Recommends related papers based on semantic similarity&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Implementation Considerations
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Choosing the Right Embedding Model&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Consider these factors:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Accuracy vs. Cost&lt;/strong&gt;: OpenAI embeddings are highly accurate but costly; open-source models like all-MiniLM-L6-v2 are free but less accurate&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dimensionality&lt;/strong&gt;: Higher dimensions capture more nuance but require more storage and computation&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Language support&lt;/strong&gt;: Some models work better for specific languages or domains&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Vector Database Selection&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Popular options include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Chroma&lt;/strong&gt;: Lightweight, easy to set up, great for development&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pinecone&lt;/strong&gt;: Fully managed, scalable, production-ready&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;FAISS&lt;/strong&gt;: High performance, optimized for similarity search&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Performance Optimization&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Chunking strategy&lt;/strong&gt;: How you split documents affects retrieval quality&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Indexing techniques&lt;/strong&gt;: HNSW, IVF, or other indexing methods impact speed and accuracy&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hybrid search&lt;/strong&gt;: Combine vector search with keyword filtering for better results&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Caching&lt;/strong&gt;: Store frequent queries and results to reduce latency&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Code Example: Building a Simple RAG System
&lt;/h2&gt;

&lt;p&gt;Here's a complete example showing how to build a basic RAG system with LangChain and vector embeddings:&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;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;langchain_community.document_loaders&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;TextLoader&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;langchain_text_splitters&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;RecursiveCharacterTextSplitter&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;langchain_community.vectorstores&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Chroma&lt;/span&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;OpenAIEmbeddings&lt;/span&gt;&lt;span class="p"&gt;,&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.chains&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;RetrievalQA&lt;/span&gt;

&lt;span class="c1"&gt;# Set up environment
&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-api-key&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="c1"&gt;# Load and process documents
&lt;/span&gt;&lt;span class="n"&gt;loader&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;TextLoader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;knowledge_base.txt&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;documents&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;loader&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;load&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;text_splitter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;RecursiveCharacterTextSplitter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chunk_size&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;chunk_overlap&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;texts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;text_splitter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split_documents&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;documents&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Create embeddings and vector store
&lt;/span&gt;&lt;span class="n"&gt;embeddings&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;OpenAIEmbeddings&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;vectorstore&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Chroma&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;from_documents&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;texts&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;embeddings&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Create QA system
&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;temperature&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;qa_chain&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;RetrievalQA&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;from_chain_type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;llm&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="n"&gt;retriever&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;vectorstore&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;as_retriever&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="n"&gt;return_source_documents&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Query the system
&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Explain vector embeddings in simple terms&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;qa_chain&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;query&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="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Answer: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;result&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&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;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Sources: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;doc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;metadata&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;doc&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;source_documents&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Best Practices
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Data Preparation&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Clean and preprocess text before embedding&lt;/li&gt;
&lt;li&gt;Remove noise, standardize formatting&lt;/li&gt;
&lt;li&gt;Consider domain-specific preprocessing&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Evaluation Metrics&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Recall@k&lt;/strong&gt;: Percentage of relevant documents in top k results&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mean Reciprocal Rank (MRR)&lt;/strong&gt;: Quality of ranking&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Precision&lt;/strong&gt;: Relevance of retrieved results&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;End-to-end accuracy&lt;/strong&gt;: How well the final answer addresses the query&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Security and Privacy&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Be mindful of sensitive data in vector databases&lt;/li&gt;
&lt;li&gt;Implement proper access controls&lt;/li&gt;
&lt;li&gt;Consider data retention policies&lt;/li&gt;
&lt;li&gt;Be aware of embedding model biases&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Future Directions
&lt;/h2&gt;

&lt;p&gt;The intersection of LangChain and vector embeddings is rapidly evolving:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Multimodal embeddings&lt;/strong&gt;: Combining text, images, and audio embeddings&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Real-time indexing&lt;/strong&gt;: Near-instantaneous updates to knowledge bases&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cross-lingual capabilities&lt;/strong&gt;: Seamless understanding across languages&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Personalized embeddings&lt;/strong&gt;: Tailored to individual users or organizations&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Edge deployment&lt;/strong&gt;: Running embedding models on devices&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;LangChain and vector embeddings represent a paradigm shift in how we build AI applications. By combining the power of large language models with semantic understanding through vector representations, developers can create systems that truly understand context, retrieve relevant information, and generate meaningful responses.&lt;/p&gt;

&lt;p&gt;The beauty of this combination lies in its accessibility – with the right tools and understanding, developers can build sophisticated AI applications without needing deep expertise in machine learning. As these technologies continue to evolve, we can expect even more powerful and intuitive applications that bridge the gap between human intention and machine capability.&lt;/p&gt;

&lt;p&gt;Whether you're building an enterprise knowledge base, a customer support system, or a research assistant, the LangChain + vector embeddings combination provides a robust foundation for creating intelligent, context-aware applications that deliver real value to users.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started Resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;LangChain Documentation&lt;/strong&gt;: &lt;a href="https://python.langchain.com" rel="noopener noreferrer"&gt;https://python.langchain.com&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hugging Face Embeddings&lt;/strong&gt;: &lt;a href="https://huggingface.co/models?library=sentence-transformers" rel="noopener noreferrer"&gt;https://huggingface.co/models?library=sentence-transformers&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pinecone&lt;/strong&gt;: &lt;a href="https://www.pinecone.io" rel="noopener noreferrer"&gt;https://www.pinecone.io&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What use cases are you exploring with LangChain and vector embeddings? Share your experiences in the comments below!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>langchain</category>
      <category>vectordatabase</category>
      <category>rag</category>
    </item>
    <item>
      <title>🚀 Stop Hallucinating! Build a RAG Chatbot in 5 Minutes with LangChain</title>
      <dc:creator>Ananya S</dc:creator>
      <pubDate>Mon, 09 Feb 2026 18:03:48 +0000</pubDate>
      <link>https://dev.to/zeroshotanu/stop-hallucinating-build-a-rag-chatbot-in-5-minutes-with-langchain-5da9</link>
      <guid>https://dev.to/zeroshotanu/stop-hallucinating-build-a-rag-chatbot-in-5-minutes-with-langchain-5da9</guid>
      <description>&lt;p&gt;Ever asked an AI about something that happened yesterday, only for it to confidently lie to your face? That’s because LLMs are frozen in time—limited by their training data.&lt;/p&gt;

&lt;p&gt;Enter RAG (Retrieval-Augmented Generation). It’s like giving your AI an open-book exam. Instead of guessing, it looks up the answer in your documents first.&lt;/p&gt;

&lt;p&gt;In this post, we’re building a simple RAG pipeline using LangChain. Let’s dive in! 🏊‍♂️&lt;/p&gt;

&lt;h3&gt;
  
  
  🔥 &lt;strong&gt;The "Big Idea"&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;RAG works in three simple steps:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Index&lt;/strong&gt;: Chop your documents into small "chunks" and turn them into math (vectors).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Retrieve&lt;/strong&gt;: When a user asks a question, find the chunks that match best.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Augment&lt;/strong&gt;: Stuff those chunks into the prompt and let the AI summarize them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🛠️The Setup&lt;/strong&gt;&lt;br&gt;
You'll need a few libraries. Open your terminal and run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install langchain langchain-openai langchain-community chromadb pypdf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;💻 &lt;strong&gt;The Code&lt;/strong&gt;&lt;br&gt;
Here is a complete, minimal script to chat with a PDF. Replace "your_api_key" with your actual OpenAI key.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import os
from langchain_community.document_loaders import PyPDFLoader
from langchain_text_splitters import RecursiveCharacterTextSplitter
from langchain_openai import OpenAIEmbeddings, ChatOpenAI
from langchain_community.vectorstores import Chroma
from langchain.chains import RetrievalQA

# 1. Set your API Key
os.environ["OPENAI_API_KEY"] = "sk-..."

# 2. Load your data (Change this to your PDF path!)
loader = PyPDFLoader("my_awesome_doc.pdf")
data = loader.load()

# 3. Chop it up! (Chunking)
# We split text so the AI doesn't get overwhelmed.
text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=100)
chunks = text_splitter.split_documents(data)

# 4. Create the "Brain" (Vector Store)
# This turns text into vectors and stores them locally.
vectorstore = Chroma.from_documents(
    documents=chunks, 
    embedding=OpenAIEmbeddings()
)

# 5. Build the RAG Chain
llm = ChatOpenAI(model_name="gpt-4o", temperature=0)
rag_chain = RetrievalQA.from_chain_type(
    llm=llm,
    chain_type="stuff", # "Stuff" all chunks into the prompt
    retriever=vectorstore.as_retriever()
)

# 6. Ask away!
question = "What is the main conclusion of this document?"
response = rag_chain.invoke(question)

print(f"🤖 AI: {response['result']}")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🤔 &lt;strong&gt;Why did we do that?&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;RecursiveCharacterTextSplitter&lt;/em&gt;: Why not just feed the whole PDF? Because LLMs have a "context window" (limit). Chunking keeps the info bite-sized and relevant.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;ChromaDB&lt;/em&gt;: This is our temporary database. It stores the "meaning" of our text so we can search it numerically.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;chain_type&lt;/em&gt;="stuff": This is the funniest name in LangChain. It literally means "stuff all the retrieved documents into the prompt."&lt;/p&gt;

&lt;p&gt;🌟 &lt;strong&gt;Pro-Tips for the Road&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Overlap matters&lt;/em&gt;: Notice chunk_overlap=100? This ensures that if a sentence is cut in half, the context lives in both chunks.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Local Models&lt;/em&gt;: Don't want to pay for OpenAI? Swap ChatOpenAI for Ollama and run it 100% locally!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Garbage In, Garbage Out&lt;/em&gt;: If your PDF is a messy scan, your RAG will be messy too. Clean your data!&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;🎁 Wrapping Up&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;You just built a production-grade logic loop. RAG is the backbone of almost every AI startup today. Whether it's a legal bot, a medical assistant, or a "Chat with your Resume" tool—you now have the blueprint.&lt;/p&gt;

&lt;p&gt;What are you planning to build with RAG? Let me know in the comments! 👇&lt;/p&gt;

</description>
      <category>ai</category>
      <category>langchain</category>
      <category>rag</category>
      <category>python</category>
    </item>
    <item>
      <title>From Words to Meaning: Core NLP Concepts Every Beginner Must Know</title>
      <dc:creator>Ananya S</dc:creator>
      <pubDate>Tue, 27 Jan 2026 17:48:10 +0000</pubDate>
      <link>https://dev.to/zeroshotanu/from-words-to-meaning-core-nlp-concepts-every-beginner-must-know-3hl3</link>
      <guid>https://dev.to/zeroshotanu/from-words-to-meaning-core-nlp-concepts-every-beginner-must-know-3hl3</guid>
      <description>&lt;p&gt;In the previous post, we covered the basics of NLP such as tokenization, stemming, lemmatization, and stop words.&lt;/p&gt;

&lt;p&gt;In this continuation, we will understand how machines extract meaning from text and represent language numerically.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;1. Named Entity Recognition (NER)&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Named Entity Recognition (NER) is an NLP technique used to identify and classify real-world entities in text.&lt;/p&gt;

&lt;p&gt;Common entity types:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Person&lt;/li&gt;
&lt;li&gt;Organization&lt;/li&gt;
&lt;li&gt;Location&lt;/li&gt;
&lt;li&gt;Date&lt;/li&gt;
&lt;li&gt;Time&lt;/li&gt;
&lt;li&gt;Money&lt;/li&gt;
&lt;li&gt;Percentage&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Example sentence:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Elon Musk is the CEO of Tesla and lives in the USA.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;NER output:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Elon Musk → PERSON&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Tesla → ORGANIZATION&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;USA → LOCATION&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why NER is important:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Helps extract structured information from unstructured text&lt;/li&gt;
&lt;li&gt;Used in resume parsing and document processing&lt;/li&gt;
&lt;li&gt;Widely applied in medical and legal NLP systems&lt;/li&gt;
&lt;li&gt;Improves search engines and chatbots&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;2. Bag of Words (BoW)&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Bag of Words is one of the simplest techniques to convert text into numbers.&lt;/p&gt;

&lt;p&gt;Core idea:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Word order is ignored&lt;/li&gt;
&lt;li&gt;Grammar is ignored&lt;/li&gt;
&lt;li&gt;Only word frequency matters&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Sentence 1: I love NLP  
Sentence 2: I love AI
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Vocabulary:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[I, love, NLP, AI]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Vector representation:&lt;/p&gt;

&lt;p&gt;Sentence 1 → [1, 1, 1, 0]&lt;/p&gt;

&lt;p&gt;Sentence 2 → [1, 1, 0, 1]&lt;/p&gt;

&lt;p&gt;Advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Very easy to implement&lt;/li&gt;
&lt;li&gt;Works well for small datasets&lt;/li&gt;
&lt;li&gt;Useful as a baseline model&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Limitations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No understanding of context&lt;/li&gt;
&lt;li&gt;No semantic meaning&lt;/li&gt;
&lt;li&gt;Treats all words as equally important&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;3. TF-IDF (Term Frequency – Inverse Document Frequency)&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;TF-IDF improves Bag of Words by assigning importance scores to words.&lt;/p&gt;

&lt;p&gt;TF-IDF= TF*IDF&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;TF(t,d)= Total number of terms in document d/Number of times term t appears in document d

IDF(t)=log( Number of documents containing term t/Total number of documents)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Intuition:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Words that occur frequently in a document are important.&lt;/li&gt;
&lt;li&gt;Words that occur in many documents are less important.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Components:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Term Frequency (TF)&lt;/strong&gt;: frequency of a word in a document&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Inverse Document Frequency (IDF)&lt;/strong&gt;: rarity of the word across documents&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why TF-IDF is better than BoW:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reduces importance of common words like the and is&lt;/li&gt;
&lt;li&gt;Highlights meaningful words&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Performs well in:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Search engines&lt;/li&gt;
&lt;li&gt;Spam detection&lt;/li&gt;
&lt;li&gt;Document similarity tasks&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Limitations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Does not capture semantic meaning&lt;/li&gt;
&lt;li&gt;Synonyms are treated as different words&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;4. Word2Vec&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Word2Vec represents words as dense numerical vectors that capture meaning and context.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Key idea:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Words used in similar contexts have similar meanings. The vectors used to represent King, Queen, Man and Woman when undergo arithmetic operations, give results as below.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Famous examples:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;King − Man + Woman ≈ Queen&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Paris − France + Italy ≈ Rome&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Word2Vec has 2 components:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. CBOW (Continuous Bag of Words)&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Predicts a word using surrounding context.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Sentence: "Raj went to school yesterday"
Window size: 1

Input: [Raj, to] → Output: went
Input: [went, school] → Output: to
Input: [to, yesterday] → Output: school

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Working:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The context words are converted to one-hot vectors.&lt;/li&gt;
&lt;li&gt;These vectors are summed or averaged&lt;/li&gt;
&lt;li&gt;They are passed through the hidden layer.&lt;/li&gt;
&lt;li&gt;The model predicts the target word&lt;/li&gt;
&lt;li&gt;Error is calculated&lt;/li&gt;
&lt;li&gt;Weights are updated using backpropagation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Skip-Gram&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Predicts surrounding words using a target word.&lt;br&gt;
 For same sentence,&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Target word: went
Context words: Raj, to

Training pairs:
Input: went → Output: Raj
Input: went → Output: to

Target = to
Context words: went, school

Training pairs:
Input: to → Output: went
Input: to → Output: school

Target = school
Context words: to, yesterday

Training pairs:
Input: school → Output: to
Input: school → Output: yesterday

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Working&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The target word is converted to a one-hot vector&lt;/li&gt;
&lt;li&gt;Passed through the hidden layer&lt;/li&gt;
&lt;li&gt;The model predicts each context word&lt;/li&gt;
&lt;li&gt;Error is calculated&lt;/li&gt;
&lt;li&gt;Weights are updated using backpropagation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;👉 The hidden layer weights become the word embeddings&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Advantages:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Captures semantic relationships&lt;/li&gt;
&lt;li&gt;Produces dense and meaningful embeddings&lt;/li&gt;
&lt;li&gt;Useful for clustering and similarity tasks&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Limitation:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Same word has the same vector in all contexts&lt;/p&gt;

&lt;p&gt;Example: &lt;br&gt;
bank (river) and bank (money)&lt;/p&gt;

&lt;p&gt;This limitation is addressed by contextual models like BERT.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When to Use Each Technique?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Bag of Words when:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Building simple text classifiers&lt;/li&gt;
&lt;li&gt;Creating baseline NLP models&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Use TF-IDF when:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Working on search systems&lt;/li&gt;
&lt;li&gt;Performing document similarity&lt;/li&gt;
&lt;li&gt;Detecting spam&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Use Word2Vec when:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Semantic similarity is important&lt;/li&gt;
&lt;li&gt;Building recommendation systems&lt;/li&gt;
&lt;li&gt;Clustering text data&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;These techniques show the evolution of NLP from counting words to weighting word importance to understanding semantic meaning.&lt;br&gt;
They form the foundation for modern NLP and Generative AI systems.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>nlp</category>
      <category>beginners</category>
      <category>python</category>
    </item>
    <item>
      <title>🌱 NLP for Beginners: Understanding the Basics of Natural Language Processing</title>
      <dc:creator>Ananya S</dc:creator>
      <pubDate>Thu, 22 Jan 2026 16:03:32 +0000</pubDate>
      <link>https://dev.to/zeroshotanu/nlp-for-beginners-understanding-the-basics-of-natural-language-processing-4784</link>
      <guid>https://dev.to/zeroshotanu/nlp-for-beginners-understanding-the-basics-of-natural-language-processing-4784</guid>
      <description>&lt;p&gt;Natural Language Processing (NLP) is one of the most exciting areas of Artificial Intelligence today. From chatbots and search engines to spam detection and sentiment analysis, NLP helps machines understand human language.&lt;/p&gt;

&lt;p&gt;If you’re just starting out and feel confused by terms like &lt;em&gt;tokenization&lt;/em&gt; or &lt;em&gt;lemmatization&lt;/em&gt;, this post will give you a clear and gentle introduction.&lt;/p&gt;




&lt;h2&gt;
  
  
  📌 What is Natural Language Processing (NLP)?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Natural Language Processing (NLP)&lt;/strong&gt; is a subfield of Artificial Intelligence that enables computers to &lt;strong&gt;understand, analyze, and generate human language&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In simple terms:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;NLP allows machines to work with text and speech in a meaningful way.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Real-world applications of NLP
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Chatbots and virtual assistants&lt;/li&gt;
&lt;li&gt;Google Search and autocomplete&lt;/li&gt;
&lt;li&gt;Spam email detection&lt;/li&gt;
&lt;li&gt;Sentiment analysis of reviews&lt;/li&gt;
&lt;li&gt;Language translation&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🗺️ A Beginner-Friendly Roadmap to Learn NLP
&lt;/h2&gt;

&lt;p&gt;Before diving into complex models, it’s important to understand how text is processed.&lt;/p&gt;

&lt;h3&gt;
  
  
  A simple conceptual roadmap
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Text Preprocessing&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Tokenization&lt;/li&gt;
&lt;li&gt;Stop words removal&lt;/li&gt;
&lt;li&gt;Stemming&lt;/li&gt;
&lt;li&gt;Lemmatization&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Text Representation&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Bag of Words&lt;/li&gt;
&lt;li&gt;TF-IDF&lt;/li&gt;
&lt;li&gt;Word Embeddings&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Classical NLP Tasks&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Text classification&lt;/li&gt;
&lt;li&gt;Sentiment analysis&lt;/li&gt;
&lt;li&gt;Named Entity Recognition&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Advanced NLP (Later Stage)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Transformers&lt;/li&gt;
&lt;li&gt;BERT&lt;/li&gt;
&lt;li&gt;GPT&lt;/li&gt;
&lt;li&gt;Large Language Models&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  🧹 Why Text Preprocessing is Important
&lt;/h2&gt;

&lt;p&gt;Machines don’t understand language like humans do.&lt;/p&gt;

&lt;p&gt;Example sentence: "I am learning Natural Language Processing!"&lt;/p&gt;

&lt;p&gt;To a machine, this is just a sequence of characters.&lt;br&gt;&lt;br&gt;
Text preprocessing helps convert raw text into a format that machine learning models can understand.&lt;/p&gt;


&lt;h2&gt;
  
  
  ✂️ Tokenization
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Tokenization&lt;/strong&gt; is the process of breaking text into smaller units called &lt;strong&gt;tokens&lt;/strong&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;

&lt;p&gt;Sentence:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"I love learning NLP"

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After tokenization:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;["I", "love", "learning", "NLP"]

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Types of tokenization
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Word tokenization&lt;/li&gt;
&lt;li&gt;Sentence tokenization&lt;/li&gt;
&lt;li&gt;Subword tokenization (used in transformers)&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🛑 Stop Words
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Stop words&lt;/strong&gt; are commonly used words that usually don’t add much meaning to the text.&lt;/p&gt;

&lt;p&gt;Examples:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;is, am, are, the, a, an, in, on, and
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Why remove stop words?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;They add noise&lt;/li&gt;
&lt;li&gt;They increase dimensionality&lt;/li&gt;
&lt;li&gt;They often don’t help in tasks like classification&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🌿 Stemming
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Stemming&lt;/strong&gt; reduces words to their &lt;strong&gt;root form&lt;/strong&gt; by removing suffixes.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fast&lt;/li&gt;
&lt;li&gt;Not always linguistically correct&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Common stemming algorithms: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;PorterStemmer() : just removes suffix or prefix without context understanding.&lt;/li&gt;
&lt;li&gt;SnowballStemmer() : better than PorterStemmer and supports many languages.&lt;/li&gt;
&lt;li&gt;RegexStemmer() : removes prefix or suffix based on given expression to be removed.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;words=['eating','eaten','eat','write','writes','history','mysterious','mystery','finally','finalised','historical']
from nltk.stem import PorterStemmer
stemming=PorterStemmer()
for word in words:
    print(word+"------&amp;gt;"+ stemming.stem(word))

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;OUTPUT:&lt;br&gt;
eating------&amp;gt;eat&lt;br&gt;
eaten------&amp;gt;eaten&lt;br&gt;
eat------&amp;gt;eat&lt;br&gt;
write------&amp;gt;write&lt;br&gt;
writes------&amp;gt;write&lt;br&gt;
history------&amp;gt;histori&lt;br&gt;
mysterious------&amp;gt;mysteri&lt;br&gt;
mystery------&amp;gt;mysteri&lt;br&gt;
finally------&amp;gt;final&lt;br&gt;
finalised------&amp;gt;finalis&lt;br&gt;
historical------&amp;gt;histor&lt;/p&gt;

&lt;p&gt;Stemming just removes prefixes or suffixes and doesn't give meaning words.&lt;/p&gt;


&lt;h2&gt;
  
  
  🍃 Lemmatization
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Lemmatization&lt;/strong&gt; converts words into their &lt;strong&gt;dictionary base form&lt;/strong&gt;, called a &lt;em&gt;lemma&lt;/em&gt;.&lt;br&gt;
NLTK provides WordNetLemmatizer class which is a thin wrapper around the wordnet corpus&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from nltk.stem import WordNetLemmatizer
## WordNet is a dictionary dataset which has words with their base form.We need to download this dataset to use WordNetLemmatizer
import nltk
nltk.download('wordnet')
lemmatizer=WordNetLemmatizer()
lemmatizer.lemmatize('going') #output: going
lemmatizer.lemmatize('going', pos='v') #ouput : go
#This lemmatize command we can add pos_tags that identify the word as verb, noun, adjective, etc. to help decide how to go to root word.
## Parts of Speech: Noun -n, Verb-v, adverb-r, adjective-a. Default pos tag is 'n'

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Considers grammar and context&lt;/li&gt;
&lt;li&gt;Produces meaningful words&lt;/li&gt;
&lt;li&gt;More accurate but slower than stemming&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  ⚖️ Stemming vs Lemmatization
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Stemming&lt;/th&gt;
&lt;th&gt;Lemmatization&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Speed&lt;/td&gt;
&lt;td&gt;Fast&lt;/td&gt;
&lt;td&gt;Slower&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Accuracy&lt;/td&gt;
&lt;td&gt;Lower&lt;/td&gt;
&lt;td&gt;Higher&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Output&lt;/td&gt;
&lt;td&gt;May not be a real word&lt;/td&gt;
&lt;td&gt;Always a valid word&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Grammar-aware&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  🧠 Final Thoughts
&lt;/h2&gt;

&lt;p&gt;NLP is not magic — its structured text processing combined with machine learning.&lt;br&gt;
Which is your favorite concept in NLP?&lt;br&gt;
Drop a comment down below!&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>nlp</category>
      <category>ai</category>
      <category>python</category>
    </item>
  </channel>
</rss>
