<?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: Sathnindu Kottage</title>
    <description>The latest articles on DEV Community by Sathnindu Kottage (@sathninduk).</description>
    <link>https://dev.to/sathninduk</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%2F697853%2Fa6f73e24-8dc5-4246-9ac9-0ba919e428e4.jpeg</url>
      <title>DEV Community: Sathnindu Kottage</title>
      <link>https://dev.to/sathninduk</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sathninduk"/>
    <language>en</language>
    <item>
      <title>ChatsAPI — The World’s Fastest AI Agent Framework</title>
      <dc:creator>Sathnindu Kottage</dc:creator>
      <pubDate>Sun, 08 Dec 2024 12:54:29 +0000</pubDate>
      <link>https://dev.to/sathninduk/revolutionizing-ai-interactions-meet-chatsapi-the-worlds-fastest-ai-agent-framework-1lmp</link>
      <guid>https://dev.to/sathninduk/revolutionizing-ai-interactions-meet-chatsapi-the-worlds-fastest-ai-agent-framework-1lmp</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/chatsapi/ChatsAPI" rel="noopener noreferrer"&gt;https://github.com/chatsapi/ChatsAPI&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Library:&lt;/strong&gt; &lt;a href="https://pypi.org/project/chatsapi/" rel="noopener noreferrer"&gt;https://pypi.org/project/chatsapi/&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Artificial Intelligence has transformed industries, but deploying it effectively remains a daunting challenge. Complex frameworks, slow response times, and steep learning curves create barriers for businesses and developers alike. Enter ChatsAPI — a groundbreaking, high-performance AI agent framework designed to deliver unmatched speed, flexibility, and simplicity.&lt;/p&gt;

&lt;p&gt;In this article, we’ll uncover what makes ChatsAPI unique, why it’s a game-changer, and how it empowers developers to build intelligent systems with unparalleled ease and efficiency.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Makes ChatsAPI Unique?
&lt;/h2&gt;

&lt;p&gt;ChatsAPI is not just another AI framework; it’s a revolution in AI-driven interactions. Here’s why:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Unmatched Performance
ChatsAPI leverages SBERT embeddings, HNSWlib, and BM25 Hybrid Search to deliver the fastest query-matching system ever built.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Speed&lt;/strong&gt;: With sub-millisecond response times, ChatsAPI is the world’s fastest AI agent framework. Its HNSWlib-powered search ensures lightning-fast retrieval of routes and knowledge, even with large datasets.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Efficiency&lt;/strong&gt;: The hybrid approach of SBERT and BM25 combines semantic understanding with traditional ranking systems, ensuring both speed and accuracy.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Seamless Integration with LLMs&lt;br&gt;
ChatsAPI supports state-of-the-art Large Language Models (LLMs) like OpenAI, Gemini, LlamaAPI, and Ollama. It simplifies the complexity of integrating LLMs into your applications, allowing you to focus on building better experiences.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Dynamic Route Matching&lt;br&gt;
ChatsAPI uses natural language understanding (NLU) to dynamically match user queries to predefined routes with unparalleled precision.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Register routes effortlessly with decorators like @trigger.&lt;/p&gt;

&lt;p&gt;Use parameter extraction with @extract to simplify input handling, no matter how complex your use case.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Simplicity in Design
We believe that power and simplicity can coexist. With ChatsAPI, developers can build robust AI-driven systems in minutes. No more wrestling with complicated setups or configurations.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Advantages of ChatsAPI
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;High-Performance Query Handling&lt;/strong&gt;&lt;br&gt;
Traditional AI systems struggle with either speed or accuracy — ChatsAPI delivers both. Whether it’s finding the best match in a vast knowledge base or handling high volumes of queries, ChatsAPI excels.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Flexible Framework&lt;/strong&gt;&lt;br&gt;
ChatsAPI adapts to any use case, whether you’re building:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Customer support chatbots.&lt;/li&gt;
&lt;li&gt;Intelligent search systems.&lt;/li&gt;
&lt;li&gt;AI-powered assistants for e-commerce, healthcare, or education.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Built for Developers
&lt;/h2&gt;

&lt;p&gt;Designed by developers, for developers, ChatsAPI offers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Quick Start&lt;/strong&gt;: Set up your environment, define routes, and go live in just a few steps.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Customization&lt;/strong&gt;: Tailor the behavior with decorators and fine-tune performance for your specific needs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Easy LLM Integration&lt;/strong&gt;: Switch between supported LLMs like OpenAI or Gemini with minimal effort.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How Does ChatsAPI Work?
&lt;/h2&gt;

&lt;p&gt;At its core, ChatsAPI operates through a three-step process:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Register Routes&lt;/strong&gt;: Use the @trigger decorator to define routes and associate them with your functions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Search and Match&lt;/strong&gt;: ChatsAPI uses SBERT embeddings and BM25 Hybrid Search to match user inputs with the right routes dynamically.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Extract Parameters&lt;/strong&gt;: With the @extract decorator, ChatsAPI automatically extracts and validates parameters, making it easier to handle complex inputs.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The result? A system that’s fast, accurate, and ridiculously easy to use.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Customer Support&lt;/strong&gt;&lt;br&gt;
Automate customer interactions with blazing-fast query resolution. ChatsAPI ensures users get relevant answers instantly, improving satisfaction and reducing operational costs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Knowledge Base Search&lt;/strong&gt;&lt;br&gt;
Empower users to search vast knowledge bases with semantic understanding. The hybrid SBERT-BM25 approach ensures accurate, context-aware results.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Conversational AI&lt;/strong&gt;&lt;br&gt;
Build conversational AI agents that understand and adapt to user inputs in real-time. ChatsAPI integrates seamlessly with top LLMs to deliver natural, engaging conversations.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why Should You Care?
&lt;/h2&gt;

&lt;p&gt;Other frameworks promise flexibility or performance — but none can deliver both like ChatsAPI. We’ve created a framework that’s:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Faster&lt;/strong&gt; than anything else in the market.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Simpler&lt;/strong&gt; to set up and use.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Smarter&lt;/strong&gt;, with its unique hybrid search engine that blends semantic and keyword-based approaches.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;ChatsAPI empowers developers to unlock the full potential of AI, without the headaches of complexity or slow performance.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Get Started
&lt;/h2&gt;

&lt;p&gt;Getting started with ChatsAPI is easy:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install the framework:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install chatsapi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Define your routes:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from chatsapi import ChatsAPI  

chat = ChatsAPI()  

@chat.trigger("Hello")  
async def greet(input_text):  
    return "Hi there!"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Extract some data from the message
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from chatsapi import ChatsAPI  

chat = ChatsAPI()  

@chat.trigger("Need help with account settings.")
@chat.extract([
    ("account_number", "Account number (a nine digit number)", int, None),
    ("holder_name", "Account holder's name (a person name)", str, None)
])
async def account_help(chat_message: str, extracted: dict):
    return {"message": chat_message, "extracted": extracted}
Run your message (with no LLM)
@app.post("/chat")
async def message(request: RequestModel, response: Response):
    reply = await chat.run(request.message)
    return {"message": reply}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Conversations (with LLM) — Full Example
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import os
from dotenv import load_dotenv
from fastapi import FastAPI, Request, Response
from pydantic import BaseModel
from chatsapi.chatsapi import ChatsAPI

# Load environment variables from .env file
load_dotenv()

app = FastAPI()                 # instantiate FastAPI or your web framework
chat = ChatsAPI(                # instantiate ChatsAPI
    llm_type="gemini",
    llm_model="models/gemini-pro",
    llm_api_key=os.getenv("GOOGLE_API_KEY"),
)

# chat trigger - 1
@chat.trigger("Want to cancel a credit card.")
@chat.extract([("card_number", "Credit card number (a 12 digit number)", str, None)])
async def cancel_credit_card(chat_message: str, extracted: dict):
    return {"message": chat_message, "extracted": extracted}

# chat trigger - 2
@chat.trigger("Need help with account settings.")
@chat.extract([
    ("account_number", "Account number (a nine digit number)", int, None),
    ("holder_name", "Account holder's name (a person name)", str, None)
])
async def account_help(chat_message: str, extracted: dict):
    return {"message": chat_message, "extracted": extracted}

# request model
class RequestModel(BaseModel):
    message: str

# chat conversation
@app.post("/chat")
async def message(request: RequestModel, response: Response, http_request: Request):
    session_id = http_request.cookies.get("session_id")
    reply = await chat.conversation(request.message, session_id)

    return {"message": f"{reply}"}

# set chat session
@app.post("/set-session")
def set_session(response: Response):
    session_id = chat.set_session()
    response.set_cookie(key="session_id", value=session_id)
    return {"message": "Session set"}

# end chat session
@app.post("/end-session")
def end_session(response: Response, http_request: Request):
    session_id = http_request.cookies.get("session_id")
    chat.end_session(session_id)
    response.delete_cookie("session_id")
    return {"message": "Session ended"}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Routes adhering LLM queries — Single Query
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;await chat.query(request.message)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Benchmarks
&lt;/h2&gt;

&lt;p&gt;Traditional LLM (API)-based methods typically take around four seconds per request. In contrast, ChatsAPI processes requests in under one second, often within milliseconds, without making any LLM API calls.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Performing a chat routing task within 472ms (no cache)&lt;/strong&gt;&lt;br&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%2Fuu3nux51k24y4lwem3lb.jpeg" 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%2Fuu3nux51k24y4lwem3lb.jpeg" alt="Performing a chat routing task within 472ms (no cache)" width="440" height="292"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Performing a chat routing task within 21ms (after cache)&lt;/strong&gt;&lt;br&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%2Flhcsjkl9uvnrg6qorsju.jpeg" 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%2Flhcsjkl9uvnrg6qorsju.jpeg" alt="Performing a chat routing task within 21ms (after cache)" width="460" height="368"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Performing a chat routing + data extraction task within 862ms (no cache)&lt;/strong&gt;&lt;br&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%2Fyoy2y44oeez052sndewy.jpeg" 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%2Fyoy2y44oeez052sndewy.jpeg" alt="Performing a chat routing + data extraction task within 862ms (no cache)" width="800" height="289"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Demonstrating its conversational abilities with WhatsApp Cloud API&lt;/strong&gt;&lt;br&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%2Fievw8sm78euw3qpvzsou.jpeg" 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%2Fievw8sm78euw3qpvzsou.jpeg" alt="Demonstrating its conversational abilities with WhatsApp Cloud API" width="739" height="1600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ChatsAPI — Feature Hierarchy&lt;/strong&gt;&lt;br&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%2Fucy5dpt7smv5rjewrtki.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%2Fucy5dpt7smv5rjewrtki.png" alt="ChatsAPI — Feature Hierarchy" width="800" height="155"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;ChatsAPI is more than just a framework; it’s a paradigm shift in how we build and interact with AI systems. By combining speed, accuracy, and ease of use, ChatsAPI sets a new benchmark for AI agent frameworks.&lt;/p&gt;

&lt;p&gt;Join the revolution today and see why ChatsAPI is transforming the AI landscape.&lt;/p&gt;

&lt;p&gt;Ready to dive in? &lt;a href="https://github.com/chatsapi/ChatsAPI" rel="noopener noreferrer"&gt;Get started&lt;/a&gt; with ChatsAPI now and experience the future of AI development.&lt;/p&gt;

</description>
      <category>python</category>
      <category>ai</category>
      <category>programming</category>
      <category>opensource</category>
    </item>
    <item>
      <title>ChatWithSQL, The world's most secure and reliable Python library for querying SQL databases through LLMs.</title>
      <dc:creator>Sathnindu Kottage</dc:creator>
      <pubDate>Wed, 04 Dec 2024 13:31:59 +0000</pubDate>
      <link>https://dev.to/sathninduk/chatwithsql-the-worlds-most-secure-and-reliable-python-library-for-querying-sql-databases-through-165p</link>
      <guid>https://dev.to/sathninduk/chatwithsql-the-worlds-most-secure-and-reliable-python-library-for-querying-sql-databases-through-165p</guid>
      <description>&lt;div class="ltag__link"&gt;
  &lt;a href="/sathninduk" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&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%2Fuser%2Fprofile_image%2F697853%2Fa6f73e24-8dc5-4246-9ac9-0ba919e428e4.jpeg" alt="sathninduk"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="/sathninduk/chatwithsql-secure-schema-validated-text-to-sql-python-library-eliminating-arbitrary-query-lo1" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;ChatWithSQL — Secure, Schema-Validated Text-to-SQL Python Library, Eliminating Arbitrary Query Risks from LLMs&lt;/h2&gt;
      &lt;h3&gt;Sathnindu Kottage ・ Dec 4&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#python&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#sql&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#ai&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#programming&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
    </item>
    <item>
      <title>ChatWithSQL — Secure, Schema-Validated Text-to-SQL Python Library, Eliminating Arbitrary Query Risks from LLMs</title>
      <dc:creator>Sathnindu Kottage</dc:creator>
      <pubDate>Wed, 04 Dec 2024 13:30:20 +0000</pubDate>
      <link>https://dev.to/sathninduk/chatwithsql-secure-schema-validated-text-to-sql-python-library-eliminating-arbitrary-query-lo1</link>
      <guid>https://dev.to/sathninduk/chatwithsql-secure-schema-validated-text-to-sql-python-library-eliminating-arbitrary-query-lo1</guid>
      <description>&lt;p&gt;&lt;strong&gt;Library:&lt;/strong&gt; &lt;a href="https://pypi.org/project/chatwithsql" rel="noopener noreferrer"&gt;https://pypi.org/project/chatwithsql&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/sathninduk/chatwithsql" rel="noopener noreferrer"&gt;https://github.com/sathninduk/chatwithsql&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As software evolves, the demand for intuitive, secure, and efficient database interaction grows exponentially. Enter ChatWithSQL, a groundbreaking Python library that transforms how LLMs interact with SQL databases. By combining Natural Language Processing (NLP) with schema-validated SQL generation and data retrieval, ChatWithSQL sets a new benchmark for secure and efficient data retrieval via LLMs.&lt;/p&gt;
&lt;h2&gt;
  
  
  🌟 What Makes ChatWithSQL Unique?
&lt;/h2&gt;

&lt;p&gt;Text-to-SQL tools are not new, but most have a glaring flaw: the potential to generate and execute arbitrary queries. This poses critical risks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Unauthorized data access.&lt;/li&gt;
&lt;li&gt;SQL injection vulnerabilities.&lt;/li&gt;
&lt;li&gt;Query inefficiencies.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;ChatWithSQL redefines safety and reliability by implementing a schema-based validation approach. By ensuring all queries adhere to a predefined schema, the library eliminates unauthorized access while maintaining unparalleled performance.&lt;/p&gt;
&lt;h2&gt;
  
  
  🗺️ Architecture
&lt;/h2&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%2Fywaao0d6okfbeqgy2wyk.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%2Fywaao0d6okfbeqgy2wyk.png" alt="Image description" width="800" height="1649"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  🔒 Security Beyond Compare
&lt;/h2&gt;

&lt;p&gt;Unlike traditional Text-to-SQL systems, ChatWithSQL validates each query against strict schema definitions before execution, ensuring:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No arbitrary SQL queries.&lt;/li&gt;
&lt;li&gt;Comprehensive parameter sanitization and validation.&lt;/li&gt;
&lt;li&gt;A secure pipeline that mitigates malicious input risks.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This security-first approach positions ChatWithSQL as the go-to solution for developers seeking both simplicity and trustworthiness.&lt;/p&gt;
&lt;h2&gt;
  
  
  🚀 Key Features
&lt;/h2&gt;
&lt;h3&gt;
  
  
  1. Intuitive Natural Language Interface
&lt;/h3&gt;

&lt;p&gt;Write prompts like:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Show me the details of the user with ID 5.”&lt;br&gt;
“Show me all the orders on 25th November 2024”&lt;br&gt;
“What is the Birth Day of user ID 34”&lt;br&gt;
“What are the orders higher than USD 500?”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And let ChatWithSQL handle the rest, converting it into actionable SQL.&lt;/p&gt;
&lt;h3&gt;
  
  
  2. Robust Schema Validation
&lt;/h3&gt;

&lt;p&gt;Define exactly what queries are permissible:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;query_schema = [
    {
        "description": "Fetch user data by ID",
        "name": "get_user_data",
        "sql": "SELECT * FROM users WHERE id = ?",
        "params": {"id": {"type": "int", "default": None}},
    },
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Only queries within this schema are executed, eliminating risks of misuse.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Seamless Integration with Top LLMs
&lt;/h3&gt;

&lt;p&gt;ChatWithSQL supports leading Language Learning Models (LLMs), including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;OpenAI: GPT-4, GPT-3.5&lt;/li&gt;
&lt;li&gt;Gemini&lt;/li&gt;
&lt;li&gt;LlamaAPI&lt;/li&gt;
&lt;li&gt;Ollama&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Switching between these LLMs is as simple as a configuration change.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Dynamic Query Parameters
&lt;/h3&gt;

&lt;p&gt;ChatWithSQL dynamically extracts, validates, and maps query parameters to ensure accurate results every time.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Database Agnostic
&lt;/h3&gt;

&lt;p&gt;Whether you’re using PostgreSQL, MySQL, SQLite, or any other SQL database, ChatWithSQL supports it via a universal URI format.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Built-In Observability
&lt;/h3&gt;

&lt;p&gt;With detailed logging, ChatWithSQL makes debugging a breeze:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Spot malformed prompts.&lt;/li&gt;
&lt;li&gt;Validate query construction.&lt;/li&gt;
&lt;li&gt;Track every interaction with your database.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  📦 Quick Installation and Setup
&lt;/h2&gt;

&lt;p&gt;Install ChatWithSQL&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 chatwithsql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Initialize Your Instance&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from chat_with_sql import ChatWithSQL
chat_with_sql = ChatWithSQL(
    database_url="your_database_url",
    llm="openai",
    model="gpt-3.5-turbo",
    llm_api_key="your_llm_api_key",
    query_schema=[
        {
            "description": "Fetch user by ID",
            "name": "get_user",
            "sql": "SELECT * FROM users WHERE id = ?",
            "params": {"id": {"type": "int", "default": None}},
        },
    ],
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Execute a Query&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;response = chat_with_sql.load_data("Get user details for ID 10.")
print(response)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🔧 Designed for Developers, Built for Scale
&lt;/h2&gt;

&lt;p&gt;Use Cases&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Analytics Dashboards: Enable non-technical teams to query databases securely.&lt;/li&gt;
&lt;li&gt;Enterprise Applications: Add intelligent query capabilities to apps while maintaining strict controls.&lt;/li&gt;
&lt;li&gt;Data Exploration: Empower analysts with natural language access to structured data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Advanced Query Schema Example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;query_schema = [
    {
        "description": "Fetch user details by date of birth",
        "name": "get_user_by_dob",
        "sql": "SELECT * FROM users WHERE dob = ?",
        "params": {"dob": {"type": "date", "default": None}},
    },
    {
        "description": "Count orders by status",
        "name": "count_orders_by_status",
        "sql": "SELECT COUNT(*) FROM orders WHERE status = ?",
        "params": {"status": {"type": "str", "default": "pending"}},
    },
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🌐 Why Developers Love ChatWithSQL
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Security: No other Text-to-SQL solution offers such rigorous validation.&lt;/li&gt;
&lt;li&gt;Flexibility: Use it with your favorite LLMs and databases.&lt;/li&gt;
&lt;li&gt;Simplicity: A single library that transforms natural language into database power.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🛣️ Roadmap
&lt;/h2&gt;

&lt;p&gt;Currently, ChatWithSQL supports only &lt;code&gt;SELECT&lt;/code&gt; queries, but there are plans to extend support to other SQL operations, including &lt;code&gt;INSERT&lt;/code&gt;, &lt;code&gt;UPDATE&lt;/code&gt;, and &lt;code&gt;DELETE&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Additionally, this library is the first component of a broader initiative to develop a comprehensive, free, and open-source framework for AI Chat Agents. This framework addresses a significant business need in the nowadays software engineering industry by simplifying complex requirements into a few simple steps.&lt;/p&gt;

&lt;p&gt;🤝 Join the ChatWithSQL Revolution&lt;/p&gt;

&lt;p&gt;Ready to experience the next level of database interaction? Start using ChatWithSQL today, and empower your applications with intelligent, secure, and efficient query handling.&lt;/p&gt;

&lt;p&gt;GitHub Repository: &lt;a href="https://github.com/sathninduk/ChatWithSQL" rel="noopener noreferrer"&gt;ChatWithSQL&lt;/a&gt;&lt;br&gt;
Support Email: &lt;a href="//mailto:hello@bysatha.com"&gt;hello@bysatha.com&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Contribute and Collaborate
&lt;/h2&gt;

&lt;p&gt;We welcome contributions! Submit pull requests or report issues to help shape the future of ChatWithSQL.&lt;/p&gt;

&lt;p&gt;With ChatWithSQL, natural language meets SQL in a way that’s secure, reliable, and game-changing. Join the movement, and take your applications to the next level today!&lt;/p&gt;

</description>
      <category>python</category>
      <category>sql</category>
      <category>ai</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
