<?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: Level09</title>
    <description>The latest articles on DEV Community by Level09 (@level09).</description>
    <link>https://dev.to/level09</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%2F140626%2F4ff4dcb9-5bfe-400e-b0db-055592254901.png</url>
      <title>DEV Community: Level09</title>
      <link>https://dev.to/level09</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/level09"/>
    <language>en</language>
    <item>
      <title>Chat your website to life: The CMS, Reimagined</title>
      <dc:creator>Level09</dc:creator>
      <pubDate>Fri, 09 May 2025 18:33:37 +0000</pubDate>
      <link>https://dev.to/level09/chat-your-website-to-life-the-cms-reimagined-3od6</link>
      <guid>https://dev.to/level09/chat-your-website-to-life-the-cms-reimagined-3od6</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;"Why can't building a website feel as fast as drafting a tweet?"&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Prologue
&lt;/h2&gt;

&lt;p&gt;A tired founder stares at a blank landing page and thinks: &lt;em&gt;"Code, hosting, SEO, deployment—why so many moving parts?"&lt;/em&gt; That frustration sparked &lt;strong&gt;Vilcos&lt;/strong&gt;.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  Chapter 1 — Foundations
&lt;/h2&gt;

&lt;p&gt;Vilcos unites three modern stacks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Chainlit + Agno&lt;/strong&gt; – a model-agnostic AI co-developer that edits HTML/CSS/JS on demand.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Vite + Tailwind&lt;/strong&gt; – hot-reload frontend workflow for instant feedback.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker + Fly.io&lt;/strong&gt; – global deployment in a single command.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Workflow overview:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Modern installation (new!)&lt;/span&gt;
npx create-vilcos-app my-website

&lt;span class="c"&gt;# Standard operations&lt;/span&gt;
./vilcos start    &lt;span class="c"&gt;# Live AI editing &amp;amp; preview&lt;/span&gt;
./vilcos publish  &lt;span class="c"&gt;# Static build &amp;amp; SEO post-processing&lt;/span&gt;
./vilcos deploy   &lt;span class="c"&gt;# Multi-stage Docker → Fly.io edge&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Get started in seconds with &lt;strong&gt;&lt;code&gt;npx create-vilcos-app my-website&lt;/code&gt;&lt;/strong&gt; and a polished black-themed template appears, ready for conversation-driven edits.&lt;/p&gt;

&lt;h2&gt;
  
  
  Chapter 2 — Conversational Development
&lt;/h2&gt;

&lt;p&gt;Drag-and-drop builders limit creativity. Vilcos lets you &lt;em&gt;talk&lt;/em&gt; to your site:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Ask&lt;/strong&gt; – "Add a pricing table with three tiers."&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;See&lt;/strong&gt; – Chainlit patches the code in seconds.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Refine&lt;/strong&gt; – "Switch to dark mode." Immediate.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;An embedded knowledge base keeps the AI grounded in your exact template files, avoiding hallucinations and ensuring output matches your site's existing structure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Chapter 3 — Deployment Without Drama
&lt;/h2&gt;

&lt;p&gt;Docker compiles; Caddy serves; Fly.io distributes.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Zero-config HTTPS and anycast IPs.&lt;/li&gt;
&lt;li&gt;Add a CNAME in Cloudflare, run &lt;code&gt;fly deploy&lt;/code&gt;, and you're online worldwide in under a minute.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why It Matters
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Speed&lt;/strong&gt; – Idea → live site in one sitting.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Simplicity&lt;/strong&gt; – One repo, one CLI, no CI pipeline gymnastics.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Portability&lt;/strong&gt; – Templates are plain files—take them anywhere.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flexibility&lt;/strong&gt; – Works with any AI model that Agno supports.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Accessibility&lt;/strong&gt; – Install with a single command using the familiar npx pattern.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Join the project, open a chat with Vilcos, and build something remarkable.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Built with practical caffeine and a commitment to making the web faster to create.&lt;/em&gt; &lt;/p&gt;

</description>
      <category>webdev</category>
      <category>ai</category>
      <category>mcp</category>
      <category>rag</category>
    </item>
    <item>
      <title>Build the Future: An AI-Powered, Natural Language CMS with Enferno</title>
      <dc:creator>Level09</dc:creator>
      <pubDate>Tue, 01 Apr 2025 16:20:17 +0000</pubDate>
      <link>https://dev.to/level09/build-the-future-an-ai-powered-natural-language-cms-with-enferno-3072</link>
      <guid>https://dev.to/level09/build-the-future-an-ai-powered-natural-language-cms-with-enferno-3072</guid>
      <description>&lt;p&gt;&lt;strong&gt;Forget everything you know about traditional content management.&lt;/strong&gt; Forget clunky admin panels, endless forms, and the tedious cycle of coding, testing, and deploying even simple text changes. Forget the limitations of predefined actions and the development time sunk into building those restrictive interfaces.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Now, imagine a different reality.&lt;/strong&gt; Imagine simply &lt;em&gt;telling&lt;/em&gt; your web application what you want. "Change the hero banner text." "Add a section about our new service." "Make this button green." Imagine using casual, everyday language – maybe even with a typo or two – and watching your application understand and execute your request instantly.&lt;/p&gt;

&lt;p&gt;Mind-blowing? Maybe. But this future isn't science fiction anymore. &lt;strong&gt;It's here, and it's powered by AI agents.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;With the &lt;strong&gt;Enferno framework&lt;/strong&gt;, integrating these agentic superpowers into your Flask application is surprisingly straightforward. We'll show you how to add an AI-powered "Developer Agent" that lets you modify frontend templates using simple natural language commands – like having a mini-Cursor running right inside your app, ready to follow your instructions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites &amp;amp; Dependencies
&lt;/h2&gt;

&lt;p&gt;To bring this agentic magic to life, you'll primarily need:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Enferno Framework:&lt;/strong&gt; The foundation for our application.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;An Agent Library:&lt;/strong&gt; We use &lt;code&gt;agno&lt;/code&gt; (version &lt;code&gt;1.2.6&lt;/code&gt; or higher is recommended) for its simplicity in creating agents and integrating tools.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;An LLM API Key:&lt;/strong&gt; For example, an OpenAI API key if using models like GPT-4o. Make sure to export your OpenAI API key in your &lt;code&gt;.env&lt;/code&gt; file:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nv"&gt;OPENAI_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;your-api-key-here
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Key Dependencies:&lt;/strong&gt; Ensure &lt;code&gt;agno&amp;gt;=1.2.6&lt;/code&gt; and &lt;code&gt;openai&amp;gt;=1.12.0&lt;/code&gt; (or your chosen LLM's library) are included in your &lt;code&gt;requirements.txt&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The Vision: Beyond Traditional CMS
&lt;/h2&gt;

&lt;p&gt;Traditional Content Management Systems offer predefined interfaces. While powerful, they can be rigid. Developer tasks like tweaking templates often involve manual code changes, context switching, and careful validation.&lt;/p&gt;

&lt;p&gt;What if we could bridge this gap? What if you could instruct your application directly?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"Hey Enferno, change the homepage title to 'Welcome Agents!' and make it blue."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the core idea: leveraging AI agents that understand your project's structure and rules to perform tasks based on natural language instructions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Meet the Enferno Developer Agent
&lt;/h2&gt;

&lt;p&gt;We can implement a &lt;code&gt;DeveloperAgent&lt;/code&gt; within our Enferno application. This agent acts as an AI assistant specialized in understanding and modifying the project structure, particularly Jinja2 templates.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Concepts:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;AI Agent Core:&lt;/strong&gt; Use a library (like &lt;code&gt;agno&lt;/code&gt;) to manage the agent's interaction with a Large Language Model (LLM), handle prompts, and process responses.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Tools for Action:&lt;/strong&gt; Equip the agent with tools to interact with the application. For template modification, &lt;code&gt;FileTools&lt;/code&gt; (scoped to the &lt;code&gt;templates&lt;/code&gt; directory for safety) allow the agent to read and write files.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Context-Aware Instructions:&lt;/strong&gt; This is crucial. Initialize the agent with detailed instructions about the Enferno framework's patterns (Vue/Jinja integration, Vuetify components). Dynamically loading project-specific rules (like &lt;code&gt;.cursor/rules/*.mdc&lt;/code&gt; files) ensures the agent adheres to your coding standards.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;CLI Integration:&lt;/strong&gt; Expose the agent's functionality via a clean Flask command-line interface using &lt;code&gt;click&lt;/code&gt; for easy access.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Under the Hood: The Agentic Engine
&lt;/h2&gt;

&lt;p&gt;So, how does this magic actually work? Let's peek behind the curtain at the core components. Adding agentic capabilities requires surprisingly little boilerplate in Enferno.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. The Brain: Defining the Agent (&lt;code&gt;enferno/agents/developer.py&lt;/code&gt;):&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This class is the heart of our operation – the AI assistant ready to follow instructions. We equip it with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  A powerful language model (like GPT-4o).&lt;/li&gt;
&lt;li&gt;  Safely scoped tools (like &lt;code&gt;FileTools&lt;/code&gt; restricted to the &lt;code&gt;templates&lt;/code&gt; directory).&lt;/li&gt;
&lt;li&gt;  Project-specific instructions and context (like your codebase rules loaded from &lt;code&gt;.cursor/rules&lt;/code&gt;).
&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="c1"&gt;# enferno/agents/developer.py
&lt;/span&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;pathlib&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Path&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;textwrap&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;dedent&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;agno.agent&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Agent&lt;/span&gt; &lt;span class="c1"&gt;# Example using agno
&lt;/span&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;agno.models.openai&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;OpenAIChat&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;agno.tools.file&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;FileTools&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;DeveloperAgent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;An AI assistant specialized in development tasks.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;current_dir&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;__file__&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;parent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;parent&lt;/span&gt;
        &lt;span class="n"&gt;templates_dir&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;current_dir&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;templates&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
        &lt;span class="n"&gt;rules_dir&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getcwd&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;.cursor&lt;/span&gt;&lt;span class="sh"&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;rules&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
        &lt;span class="c1"&gt;# ... (Rule loading logic to get combined_rules) ...
&lt;/span&gt;        &lt;span class="n"&gt;combined_rules&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rules_content&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;values&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;

        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;agent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Enferno Developer&lt;/span&gt;&lt;span class="sh"&gt;"&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="nc"&gt;OpenAIChat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gpt-4o&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="c1"&gt;# Use a powerful LLM
&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="nc"&gt;FileTools&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="n"&gt;base_dir&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;templates_dir&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;# Safely scoped
&lt;/span&gt;                &lt;span class="n"&gt;save_files&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="n"&gt;read_files&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="n"&gt;list_files&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="n"&gt;show_tool_calls&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="n"&gt;instructions&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nf"&gt;dedent&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="se"&gt;\
&lt;/span&gt;&lt;span class="s"&gt;                You are an expert Enferno framework developer...
                Follow Jinja2/Vue patterns...
                Use Vuetify components correctly...
                IMPORTANT - Follow these specific patterns:
                &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;combined_rules&lt;/span&gt;&lt;span class="si"&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="c1"&gt;# Inject project rules
&lt;/span&gt;            &lt;span class="n"&gt;markdown&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="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;modify_template&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;template_path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;index.html&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;stream&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="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Modify a template based on the request.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
        &lt;span class="n"&gt;template_path_obj&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;template_path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="c1"&gt;# ... (Logic to read template, prompt agent, execute, verify) ...
&lt;/span&gt;        &lt;span class="n"&gt;prompt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;dedent&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="se"&gt;\
&lt;/span&gt;&lt;span class="s"&gt;            Please modify template: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;template_path_obj&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;
            Request: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;
            Perform these steps:
            1. Read the file content.
            2. Analyze the request and plan changes respecting structure.
            3. Apply changes ONLY to text content or attributes like CSS classes.
            4. Save the modified file.
            Be careful with Jinja/Vue syntax.
            &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;self&lt;/span&gt;&lt;span class="p"&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;print_response&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;stream&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;stream&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="c1"&gt;# ... (Add verification logic here if desired) ...
&lt;/span&gt;        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. The Interface: Creating the CLI Command (&lt;code&gt;enferno/commands.py&lt;/code&gt;):&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is how you talk to the agent. We create a simple &lt;code&gt;flask agent template&lt;/code&gt; command using Click. When run:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  It prompts you for your request if you don't provide one directly.&lt;/li&gt;
&lt;li&gt;  It spins up the &lt;code&gt;DeveloperAgent&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;  It passes your request to the agent's &lt;code&gt;modify_template&lt;/code&gt; method.&lt;/li&gt;
&lt;li&gt;  &lt;em&gt;(Crucially, Enferno automatically finds and registers this command group – no manual &lt;code&gt;app.py&lt;/code&gt; wiring needed!)&lt;/em&gt;
&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="c1"&gt;# enferno/commands.py
&lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;click&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;flask.cli&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;with_appcontext&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;AppGroup&lt;/span&gt;
&lt;span class="c1"&gt;# Assuming your agent class is importable
&lt;/span&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;enferno.agents&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;DeveloperAgent&lt;/span&gt; 

&lt;span class="c1"&gt;# Create agent command group
&lt;/span&gt;&lt;span class="n"&gt;agent_cli&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;AppGroup&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;agent&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;help&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;AI-powered development tools&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nd"&gt;@agent_cli.command&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;template&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nd"&gt;@click.argument&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;request&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;required&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nd"&gt;@click.option&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;--template-path&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;default&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;index.html&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;help&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Path to the template file relative to templates/&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nd"&gt;@with_appcontext&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;template_cmd&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;template_path&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Modify a template using AI assistance (text/attributes).&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;request&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;click&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;prompt&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 changes would you like to make to the template?&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="c1"&gt;# Instantiate the agent
&lt;/span&gt;        &lt;span class="n"&gt;agent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;DeveloperAgent&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="c1"&gt;# Call the agent method
&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;modify_template&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;template_path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;click&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;echo&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;✨ Agent finished processing request for &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;template_path&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;. Check the file for changes.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;click&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;echo&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;Error processing agent request: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&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="n"&gt;err&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;(Note: Enferno automatically detects and registers &lt;code&gt;click.Command&lt;/code&gt; and &lt;code&gt;click.Group&lt;/code&gt; objects like &lt;code&gt;agent_cli&lt;/code&gt; defined in &lt;code&gt;enferno/commands.py&lt;/code&gt;, so no manual registration in &lt;code&gt;app.py&lt;/code&gt; is needed.)&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo: Modifying Homepage Content via CLI
&lt;/h2&gt;

&lt;p&gt;Let's see it in action! Here's our initial homepage:&lt;/p&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%2Fxphou61kitcihxyn06go.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%2Fxphou61kitcihxyn06go.png" alt=" "&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Initial homepage before modifications&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now, let's modify the content. Simply type:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;flask agent template
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The command will prompt you:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;What changes would you like to make to the template?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can then type your request:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Make the main card wider by adding a max-width class, then update the main title to 'The Great Monkey-Horse Adventure' and change the text below it to a fun story about 5 monkeys and a horse who go on an adventure together. Make it engaging and funny. Also, make the title text blue.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;The &lt;code&gt;DeveloperAgent&lt;/code&gt; processes your request and modifies the template. Here's the result:&lt;/p&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%2Fy7wxypubwsmaldtn28v8.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%2Fy7wxypubwsmaldtn28v8.png" alt=" "&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Homepage after applying the changes&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Just like that, we've transformed our homepage into an engaging story using a natural language command!&lt;/p&gt;

&lt;h2&gt;
  
  
  Your In-App "Mini-Cursor"
&lt;/h2&gt;

&lt;p&gt;This approach essentially embeds a specialized AI assistant within your application's framework. It understands the context, follows project-specific rules, and uses tools safely. It's like having a focused version of Cursor available directly via your application's CLI, accelerating specific development and content management tasks.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Future is Agentic
&lt;/h2&gt;

&lt;p&gt;This is just the beginning. Imagine extending this concept:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Agents for generating blog post drafts based on outlines.&lt;/li&gt;
&lt;li&gt;  Agents for managing user roles or permissions via commands.&lt;/li&gt;
&lt;li&gt;  Agents integrated into a web UI for non-developers to update content safely within predefined boundaries.&lt;/li&gt;
&lt;li&gt;  Agents helping automate database interactions based on high-level descriptions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The &lt;a href="https://github.com/level09/enferno" rel="noopener noreferrer"&gt;Enferno framework&lt;/a&gt; provides a flexible and accessible platform for experimenting with and building these next-generation, agentic web applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  Get the Code
&lt;/h2&gt;

&lt;p&gt;Explore the Enferno framework and its agentic potential. The code for this example can be found at:&lt;br&gt;
&lt;a href="https://github.com/level09/natcms.git" rel="noopener noreferrer"&gt;https://github.com/level09/natcms.git&lt;/a&gt; &lt;em&gt;(Note: This repo demonstrates the concept)&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;Let us know what you think! How would you improve this agent? What other agentic features would you like to see integrated into web frameworks? &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;P.S.&lt;/strong&gt; Want more wild ideas about the future of web dev, AI, and maybe even robot pets? Follow me on Twitter: &lt;a href="https://twitter.com/level09" rel="noopener noreferrer"&gt;@level09&lt;/a&gt;! 😉 &lt;/p&gt;

</description>
      <category>ai</category>
      <category>saas</category>
      <category>python</category>
      <category>agentaichallenge</category>
    </item>
    <item>
      <title>Flask Apps from the Future: Unleash Semantic Search and RAG in 10 Minutes or Less</title>
      <dc:creator>Level09</dc:creator>
      <pubDate>Sat, 01 Mar 2025 14:15:29 +0000</pubDate>
      <link>https://dev.to/level09/flask-apps-from-the-future-unleash-semantic-search-and-rag-in-10-minutes-or-less-4n61</link>
      <guid>https://dev.to/level09/flask-apps-from-the-future-unleash-semantic-search-and-rag-in-10-minutes-or-less-4n61</guid>
      <description>&lt;p&gt;In the era of AI-powered applications, the ability to search and retrieve information based on meaning rather than just keywords has become a game-changer. Enter Retrieval-Augmented Generation (RAG), a powerful approach that combines the precision of information retrieval with the flexibility of generative AI. Today, I'm excited to share how you can implement a complete RAG system in just 15 minutes using Enferno, a modern Flask framework.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Magic of Semantic Search
&lt;/h2&gt;

&lt;p&gt;Before diving into the implementation, let's understand why semantic search is revolutionary. Traditional keyword search is like looking for a book in a library using only the title—if the exact words aren't there, you're out of luck. Semantic search, on the other hand, understands the meaning behind your query, making it possible to find relevant information even when the exact keywords aren't present.&lt;/p&gt;

&lt;p&gt;Consider these examples from our demo application:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Query: "animals with amazing abilities"&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Result: Documents about cats' sleeping patterns and communication methods&lt;/li&gt;
&lt;li&gt;&lt;em&gt;No mention of "amazing abilities" in the document, but the semantic connection is made&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Query: "space phenomena that defy intuition"&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Result: Information about Venus's day being longer than its year and Saturn's density&lt;/li&gt;
&lt;li&gt;&lt;em&gt;The system understands the conceptual link between "defying intuition" and unusual space facts&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;This is the power of vector embeddings—transforming text into mathematical representations that capture meaning, not just words.&lt;/p&gt;

&lt;h2&gt;
  
  
  Enter Enferno: The Flask Framework on Steroids
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/level09/enferno" rel="noopener noreferrer"&gt;Enferno&lt;/a&gt; is a modern Python web framework built on Flask, designed for rapid development of secure and scalable applications. It combines best practices with pre-configured components, making it the perfect foundation for our RAG implementation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Building RAG with Enferno: A 15-Minute Journey
&lt;/h2&gt;

&lt;p&gt;I've created a complete, ready-to-use RAG implementation that you can clone and run in minutes. The repository is available at &lt;a href="https://github.com/level09/rag" rel="noopener noreferrer"&gt;github.com/level09/rag&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Let's walk through the key components that make this possible:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Vector Storage with PostgreSQL and pgvector
&lt;/h3&gt;

&lt;p&gt;The heart of our RAG system is the ability to store and query vector embeddings efficiently. PostgreSQL with the pgvector extension provides a powerful solution:&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;class&lt;/span&gt; &lt;span class="nc"&gt;Document&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Model&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;__tablename__&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;documents&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
    &lt;span class="c1"&gt;# ...
&lt;/span&gt;    &lt;span class="n"&gt;embedding&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Column&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Vector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;384&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;  &lt;span class="c1"&gt;# 384-dimensional embeddings
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This simple model definition enables us to store document embeddings directly in our database, making them queryable using vector similarity operations.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Generating Embeddings with Sentence Transformers
&lt;/h3&gt;

&lt;p&gt;To convert text into meaningful vector representations, we use the sentence-transformers library:&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;sentence_transformers&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;SentenceTransformer&lt;/span&gt;
&lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;SentenceTransformer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;all-MiniLM-L6-v2&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;device&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;cpu&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Generate embedding
&lt;/span&gt;&lt;span class="n"&gt;embedding&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;normalize_embeddings&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;all-MiniLM-L6-v2&lt;/code&gt; model is a lightweight yet powerful transformer that generates 384-dimensional embeddings, capturing the semantic essence of text in a compact form.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Vector Search with PostgreSQL
&lt;/h3&gt;

&lt;p&gt;The magic happens when we search for documents using vector similarity:&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;query_embedding&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;search_query&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;normalize_embeddings&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;# SQL query using cosine distance
&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt; &lt;span class="o"&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;
    SELECT 
        id, title, content,
        embedding &amp;lt;=&amp;gt; &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;query_embedding_str&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;::vector as distance
    FROM documents
    ORDER BY embedding &amp;lt;=&amp;gt; &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;query_embedding_str&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;::vector
    LIMIT :limit
&lt;/span&gt;&lt;span class="sh"&gt;'''&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;&amp;lt;=&amp;gt;&lt;/code&gt; operator computes the cosine distance between vectors, allowing us to find the most semantically similar documents to our query.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. A Beautiful UI for Interaction
&lt;/h3&gt;

&lt;p&gt;What good is powerful search without an intuitive interface? Our implementation includes a clean, responsive UI built with Vue.js and Vuetify:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Document creation form for adding content&lt;/li&gt;
&lt;li&gt;Search interface with adjustable similarity threshold&lt;/li&gt;
&lt;li&gt;Results display with color-coded similarity scores&lt;/li&gt;
&lt;li&gt;One-click sample data seeding&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Real-World Applications: Beyond the Demo
&lt;/h2&gt;

&lt;p&gt;While our demo focuses on a simple document search system, the applications of this technology are vast:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Customer Support Knowledge Bases&lt;/strong&gt;: Help agents find relevant information even when customer queries don't match documentation exactly&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Legal Document Analysis&lt;/strong&gt;: Search through case law and contracts based on concepts, not just keywords&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Research Assistants&lt;/strong&gt;: Help researchers find relevant papers across disciplines with different terminology&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;E-commerce Search&lt;/strong&gt;: Understand what customers are looking for even when they use non-standard descriptions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Content Recommendation&lt;/strong&gt;: Suggest related articles based on semantic similarity rather than tag matching&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Getting Started in 5 Simple Steps
&lt;/h2&gt;

&lt;p&gt;Ready to try it yourself? Follow these steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Clone and Setup&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   git clone https://github.com/level09/rag.git
   &lt;span class="nb"&gt;cd &lt;/span&gt;rag
   ./setup.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Configure PostgreSQL with pgvector&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nb"&gt;sudo&lt;/span&gt; &lt;span class="nt"&gt;-u&lt;/span&gt; postgres psql
   CREATE DATABASE enferno_rag&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="se"&gt;\c&lt;/span&gt; enferno_rag
   CREATE EXTENSION IF NOT EXISTS vector&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Update your &lt;code&gt;.env&lt;/code&gt; file&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   SQLALCHEMY_DATABASE_URI=postgresql://postgres:postgres@localhost/enferno_rag
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Initialize the Application&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   flask create-db
   flask &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Run and Explore&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   flask run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Visit &lt;a href="http://localhost:5000" rel="noopener noreferrer"&gt;http://localhost:5000&lt;/a&gt; and start exploring the power of semantic search!&lt;/p&gt;

&lt;h2&gt;
  
  
  The Future of RAG with Enferno
&lt;/h2&gt;

&lt;p&gt;This implementation is just the beginning. The combination of Enferno's rapid development capabilities with modern AI techniques opens up exciting possibilities:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Multi-modal RAG&lt;/strong&gt;: Extend the system to handle images and other media types&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hybrid Search&lt;/strong&gt;: Combine vector search with traditional keyword search for even better results&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LLM Integration&lt;/strong&gt;: Connect the retrieval system to large language models for complete RAG pipelines&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fine-tuned Embeddings&lt;/strong&gt;: Train domain-specific embedding models for specialized applications&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion: The 15-Minute Revolution
&lt;/h2&gt;

&lt;p&gt;Building a RAG system used to require deep expertise in machine learning, vector databases, and web development. With Enferno and the power of modern Python libraries, we've reduced this to a 15-minute implementation that anyone with basic Flask knowledge can understand and extend.&lt;/p&gt;

&lt;p&gt;The repository at &lt;a href="https://github.com/level09/rag" rel="noopener noreferrer"&gt;github.com/level09/rag&lt;/a&gt; provides a complete, production-ready starting point for your semantic search journey. Clone it, customize it, and supercharge your applications with the power of meaning-based search.&lt;/p&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Want to learn more about Enferno? Visit the &lt;a href="https://enferno.readthedocs.io" rel="noopener noreferrer"&gt;official documentation&lt;/a&gt; or check out the &lt;a href="https://github.com/level09/enferno" rel="noopener noreferrer"&gt;main repository&lt;/a&gt;.&lt;/em&gt; &lt;/p&gt;

</description>
      <category>flask</category>
      <category>ai</category>
      <category>saas</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
