<?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: PAWAN YADAV  (AI Engineer)</title>
    <description>The latest articles on DEV Community by PAWAN YADAV  (AI Engineer) (@2000pawan).</description>
    <link>https://dev.to/2000pawan</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3992255%2Fd2c0c2bf-31f6-46b5-bc3d-5b269fbeb450.jpg</url>
      <title>DEV Community: PAWAN YADAV  (AI Engineer)</title>
      <link>https://dev.to/2000pawan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/2000pawan"/>
    <language>en</language>
    <item>
      <title>Building a Centralized Vector Database Pipeline for Multi-Project RAG</title>
      <dc:creator>PAWAN YADAV  (AI Engineer)</dc:creator>
      <pubDate>Fri, 10 Jul 2026 09:57:10 +0000</pubDate>
      <link>https://dev.to/2000pawan/building-a-centralized-vector-database-pipeline-for-multi-project-rag-4ldf</link>
      <guid>https://dev.to/2000pawan/building-a-centralized-vector-database-pipeline-for-multi-project-rag-4ldf</guid>
      <description>&lt;p&gt;If you've worked on more than one Retrieval-Augmented Generation (RAG) project, you've probably run into the same annoying pattern: every project ends up with its own little vector store, its own embedding logic, its own duplicate code for chunking files, and its own inconsistent way of tracking what's actually been indexed.&lt;br&gt;
I got tired of that, so I built a centralized vector database service that every project in my organization can plug into. One backend, one embedding model, one clean set of endpoints - and every project gets its own isolated, admin-controlled storage space.&lt;br&gt;
Here's how it works.&lt;/p&gt;

&lt;p&gt;The Problem&lt;/p&gt;

&lt;p&gt;When you're running multiple RAG-powered projects at once, a few pain points show up fast:&lt;br&gt;
Every team reinvents chunking and embedding logic&lt;br&gt;
There's no single place to see what data lives where&lt;br&gt;
Deleting or updating stored documents becomes a manual, error-prone process&lt;br&gt;
Nobody has a clear picture of which files are indexed in which project&lt;/p&gt;

&lt;p&gt;I wanted one system that solves this once, for everyone.&lt;br&gt;
The Idea: One Service, Many Isolated Databases&lt;br&gt;
Instead of giving each project its own standalone vector database, I built a shared service where:&lt;br&gt;
Each project gets its own named storage directory&lt;br&gt;
All directories live under one base storage path&lt;br&gt;
An admin layer controls the full lifecycle - create, insert, update, delete, list - across every project's storage&lt;br&gt;
Every project only ever talks to a small set of simple endpoints to embed and retrieve its own data&lt;/p&gt;

&lt;p&gt;This means projects don't need to know anything about vector databases, embedding models, or similarity search internals. They just send text in and get relevant results back.&lt;br&gt;
Architecture Overview&lt;/p&gt;

&lt;p&gt;Here's the high-level flow:&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frq534xzajeq4bp5c3bvp.jpg" 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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frq534xzajeq4bp5c3bvp.jpg" alt=" " width="720" height="429"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In plain terms:&lt;br&gt;
A project sends a file or text to the service&lt;br&gt;
The service breaks it into clean text chunks&lt;br&gt;
Those chunks get embedded and stored (upserted) into that project's own FAISS index&lt;br&gt;
Later, the project sends a query, and the service returns the most similar stored chunks&lt;br&gt;
An admin layer sits on top of all of this, with full control to create, update, or delete data across any project's storage&lt;/p&gt;

&lt;p&gt;What's Under the&amp;nbsp;Hood&lt;br&gt;
Embedding model: a lightweight sentence-transformer model, chosen for speed and low resource usage&lt;br&gt;
Vector engine: FAISS, for fast similarity search at scale&lt;br&gt;
Backend framework: a modern Python web framework built for speed and simplicity&lt;br&gt;
Storage layout: every project's database lives in its own folder, containing:&lt;br&gt;
the FAISS index itself&lt;br&gt;
a metadata/pickle file for the index&lt;br&gt;
a tracked-files registry (so you always know what's indexed)&lt;br&gt;
a source map (so you always know how many chunks came from each file)&lt;/p&gt;

&lt;p&gt;Each project is fully sandboxed. Nothing bleeds across storage directories.&lt;br&gt;
The Core&amp;nbsp;Workflow&lt;br&gt;
Every project follows the same simple lifecycle:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a storage directory
A new, isolated space is created for the project. Invalid or unsafe directory names are automatically rejected.&lt;/li&gt;
&lt;li&gt;Process a file into&amp;nbsp;chunks
Upload a document (PDF, TXT, DOCX, or Markdown) and it comes back as clean, ready-to-embed text chunks. This step doesn't store anything yet - it just prepares the data.&lt;/li&gt;
&lt;li&gt;Upsert the&amp;nbsp;chunks
The chunks get embedded and stored. If the project's index doesn't exist yet, it's created automatically. If it does exist, new vectors are simply appended. Duplicate sources are automatically prevented.&lt;/li&gt;
&lt;li&gt;Search
A query comes in, gets embedded the same way, and the service returns the top-k most similar chunks - along with which source file they came from. A similarity score threshold filters out weak matches.&lt;/li&gt;
&lt;li&gt;Manage the&amp;nbsp;data
At any point, an admin can:
List every database in the system, with file counts and tracked sources
Delete a specific file's vectors from a project's index
Have all of this triggered externally through a single webhook event, so other systems can kick off any step of this pipeline programmatically&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Why This&amp;nbsp;Matters&lt;br&gt;
The real win here isn't the vector search itself - FAISS and sentence-transformers are well-understood tools. The win is centralization with isolation:&lt;br&gt;
One codebase to maintain instead of N duplicated ones&lt;br&gt;
One admin view into every project's stored data&lt;br&gt;
Every project gets embedding and retrieval "for free," without owning any of the infrastructure&lt;br&gt;
Adding a brand-new project to RAG-powered search takes minutes: create a directory, start upserting&lt;/p&gt;

&lt;p&gt;It turns "set up a vector database" from an infrastructure task into a two-endpoint integration for whoever's building the next project.&lt;br&gt;
What's Next&lt;br&gt;
A few directions I'm considering for this pipeline:&lt;br&gt;
Authentication and per-project access scoping&lt;br&gt;
Async batch processing for very large files&lt;br&gt;
Pluggable embedding models per project (not just one global model)&lt;br&gt;
A lightweight admin dashboard on top of the existing list/delete endpoints&lt;/p&gt;

&lt;p&gt;If you're building multiple RAG projects and keep rebuilding the same vector storage logic every time, this pattern - one shared service, isolated storage per project, centralized admin control - is worth stealing.&lt;/p&gt;




&lt;p&gt;Have you built something similar, or run into different tradeoffs with multi-project RAG infrastructure? I'd love to hear how you approached it.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Building a Self-Hosted RAG Chatbot with a Dual-Agent LLM Pipeline (and Automatic LLM Failover)</title>
      <dc:creator>PAWAN YADAV  (AI Engineer)</dc:creator>
      <pubDate>Fri, 19 Jun 2026 12:50:59 +0000</pubDate>
      <link>https://dev.to/2000pawan/building-a-self-hosted-rag-chatbot-with-a-dual-agent-llm-pipeline-and-automatic-llm-failover-137c</link>
      <guid>https://dev.to/2000pawan/building-a-self-hosted-rag-chatbot-with-a-dual-agent-llm-pipeline-and-automatic-llm-failover-137c</guid>
      <description>&lt;p&gt;Over the past few weeks I built a Retrieval-Augmented Generation (RAG) chatbot from the ground up — one that answers strictly from a knowledge base I control, supports role-based access for regular users vs. admins, and never makes things up. In this post I want to walk through the architecture, the design decisions, and one piece that took real engineering effort: automatically switching to a backup LLM when the primary one is busy or rate-limited, so a query never just fails.&lt;/p&gt;

&lt;p&gt;This isn’t a toy demo — it’s a full pipeline with authentication, a vector database, a two-stage reasoning process, and an admin console for managing the knowledge base. Here’s how it all fits together.&lt;/p&gt;

&lt;p&gt;The Problem I Was Solving&lt;br&gt;
Most “just call an LLM API” chatbots have two issues:&lt;/p&gt;

&lt;p&gt;They hallucinate. Ask a generic LLM a domain-specific question and it will confidently make something up if it doesn’t actually know the answer.&lt;br&gt;
They have a single point of failure. If your one LLM provider is rate-limited, down, or just slow at that moment, your whole app stalls.&lt;br&gt;
I wanted a system where:&lt;/p&gt;

&lt;p&gt;Every answer is grounded in real, embedded documents — no hallucination.&lt;br&gt;
Two different roles (regular users and admins) get different capabilities.&lt;br&gt;
If the LLM serving a request is unavailable, the system transparently retries on a different model instead of erroring out.&lt;br&gt;
High-Level Architecture&lt;br&gt;
The system has three user-facing surfaces and one processing core:&lt;/p&gt;

&lt;p&gt;Signup / Identification Page — the user enters an email; the backend checks it against a list of approved admin addresses and routes accordingly.&lt;br&gt;
User View — query-only. Regular users can ask questions but cannot touch the knowledge base.&lt;br&gt;
Admin View — everything a user can do, plus the ability to upload documents/URLs, view what’s been embedded, and trigger re-indexing.&lt;br&gt;
Here’s the high-level flow:&lt;/p&gt;

&lt;p&gt;flowchart TD&lt;br&gt;
    A[Signup Page - Enter Email] --&amp;gt; B{Role Check}&lt;br&gt;
    B --&amp;gt;|Regular Email| C[User View - Query Only]&lt;br&gt;
    B --&amp;gt;|Admin Email| D[Admin View - Manage + Query]&lt;br&gt;
    C --&amp;gt; E[Query Pipeline]&lt;br&gt;
    D --&amp;gt; E&lt;br&gt;
    E --&amp;gt; F[Agent 1: Tool &amp;amp; Argument Selection]&lt;br&gt;
    F --&amp;gt; G[Execute Retrieval Tool]&lt;br&gt;
    G --&amp;gt; H[Raw Retrieved Chunks]&lt;br&gt;
    H --&amp;gt; I[Agent 2: Refinement]&lt;br&gt;
    I --&amp;gt; J[Final Answer Returned]&lt;br&gt;
If your blogging platform doesn’t render Mermaid diagrams (Medium, for instance, won’t render this natively), here’s the same flow as plain text:&lt;/p&gt;

&lt;p&gt;Signup Page&lt;br&gt;
   |&lt;br&gt;
   v&lt;br&gt;
Role Check (User or Admin?)&lt;br&gt;
   |---------------------|&lt;br&gt;
   v                      v&lt;br&gt;
User View             Admin View&lt;br&gt;
(Query Only)        (Manage + Query)&lt;br&gt;
   |---------------------|&lt;br&gt;
              v&lt;br&gt;
        Query Pipeline&lt;br&gt;
              v&lt;br&gt;
   Agent 1: Tool &amp;amp; Argument Selection&lt;br&gt;
              v&lt;br&gt;
      Execute Retrieval Tool&lt;br&gt;
              v&lt;br&gt;
       Raw Retrieved Chunks&lt;br&gt;
              v&lt;br&gt;
       Agent 2: Refinement&lt;br&gt;
              v&lt;br&gt;
        Final Answer Returned&lt;/p&gt;

&lt;p&gt;Why Two Agents Instead of One?&lt;br&gt;
A single LLM call trying to both decide what to retrieve and how to phrase the final answer tends to produce messier output. So I split the reasoning into two sequential agents, orchestrated as a small graph of steps rather than one big prompt:&lt;/p&gt;

&lt;p&gt;Agent 1 — Tool Decision Takes the raw user query and decides which retrieval tool to call and with what arguments. It returns a small, strict structure like:&lt;/p&gt;

&lt;p&gt;[{"name": "retrieval_tool", "arguments": {"query": "your parsed query here"}}]&lt;br&gt;
A lightweight Python handler parses this output, extracts the tool name and arguments, and manually executes the retrieval step — no need to trust the LLM to “just run the function,” which keeps things deterministic and debuggable.&lt;/p&gt;

&lt;p&gt;Agent 2 — Refinement Takes whatever raw chunks came back from retrieval and turns them into a clear, well-formatted, professional answer. This is also the layer that keeps responses grounded — it’s instructed to work only with what was retrieved, not to add outside knowledge.&lt;/p&gt;

&lt;p&gt;sequence Diagram&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;participant U as User/Admin
participant A1 as Agent 1 (Tool Decision)
participant T as Retrieval Tool
participant V as Vector Store
participant A2 as Agent 2 (Refinement)

U-&amp;gt;&amp;gt;A1: Submits query
A1-&amp;gt;&amp;gt;A1: Decide tool + arguments
A1-&amp;gt;&amp;gt;T: Call retrieval tool
T-&amp;gt;&amp;gt;V: Similarity search
V--&amp;gt;&amp;gt;T: Top-K relevant chunks
T--&amp;gt;&amp;gt;A2: Raw chunks + sources
A2-&amp;gt;&amp;gt;A2: Refine into polished answer
A2--&amp;gt;&amp;gt;U: Final answer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The Retrieval Layer&lt;br&gt;
Documents and URLs go through a standard but carefully tuned pipeline:&lt;/p&gt;

&lt;p&gt;Loading — PDFs, Word docs, plain text, and Markdown files are parsed with format-specific loaders; web pages are scraped and cleaned.&lt;br&gt;
Chunking — content is split into ~400-character chunks using a recursive character splitter, with each chunk tagged with its source (filename or URL) for traceability.&lt;br&gt;
Embedding — each chunk is converted into a vector using an embedding model.&lt;br&gt;
Storage — vectors go into a local vector index that supports fast similarity search and incremental updates (you don’t need to rebuild the whole index every time you add a new file).&lt;br&gt;
Retrieval — when a query comes in, the index returns the top-K most similar chunks, filtered by a minimum similarity score threshold so irrelevant matches get dropped before they ever reach the LLM.&lt;/p&gt;

&lt;p&gt;Two tunable parameters matter a lot here:&lt;/p&gt;

&lt;p&gt;score_threshold — the minimum similarity score a chunk needs to be considered relevant. Raise it for stricter, more precise retrieval; lower it if the bot is being too conservative and saying "I don't know" too often.&lt;br&gt;
k — how many top chunks get passed into the refinement agent. Too low and you risk missing context; too high and you risk diluting the answer with noise (and burning more tokens).&lt;br&gt;
Admin Controls&lt;br&gt;
Admins get a dedicated panel to manage the knowledge base directly:&lt;/p&gt;

&lt;p&gt;Upload new files (PDF, Word, text, Markdown) for embedding.&lt;br&gt;
Submit URLs to scrape and embed.&lt;br&gt;
View every currently embedded source and a running count.&lt;br&gt;
Run test queries against the live index.&lt;br&gt;
Trigger a manual reload of the retriever so newly embedded content becomes searchable immediately, without restarting the whole service.&lt;br&gt;
Regular users never see any of this — they only get a query box. Role detection is based on a simple, server-side check against a list of approved admin emails at signup time, and every admin-only route re-checks that role before doing anything destructive or data-modifying.&lt;/p&gt;

&lt;p&gt;Now, the Interesting Part: Automatic LLM Failover&lt;br&gt;
Here’s the piece I want to focus on, since it’s the part most tutorials skip. If you’ve ever called a single LLM provider in production, you’ve hit this: rate limits, timeouts, momentary outages, or a model that’s just slow to respond under load. If your whole app depends on one model, one bad moment takes everything down with it.&lt;/p&gt;

&lt;p&gt;Become a Medium member&lt;br&gt;
The fix is a failover-aware LLM router sitting in front of both agents. Instead of hardcoding “always call Model A,” every LLM call goes through a small dispatcher that:&lt;/p&gt;

&lt;p&gt;Tries the primary model first.&lt;br&gt;
If that call fails, times out, or comes back with a rate-limit / “server busy” type error, it automatically retries the same request on the next model in a prioritized list — no user-facing error, no manual restart.&lt;br&gt;
Logs which model actually served the request (useful for debugging and for tracking cost/usage per provider).&lt;br&gt;
Optionally applies a short backoff before retrying the original model on the next query, so it isn’t hammered immediately after a failure.&lt;br&gt;
Press enter or click to view image in full size&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F24qfgwh3khn7cuwczn8c.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F24qfgwh3khn7cuwczn8c.png" alt=" " width="640" height="716"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;How to actually manage this on the server&lt;br&gt;
Practically, here’s the setup that works well:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Define a prioritized list of models, not a single model.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;LLM_PRIORITY = [&lt;br&gt;
    {"name": "primary_llm", "provider": "provider_a", "model": "model-a-large"},&lt;br&gt;
    {"name": "secondary_llm", "provider": "provider_b", "model": "model-b-large"},&lt;br&gt;
    {"name": "fallback_llm", "provider": "provider_c", "model": "model-c-small"},&lt;br&gt;
]&lt;br&gt;
Order them by quality/cost first, reliability second. The first entry is your “ideal” answer quality; the rest exist purely so a request never just dies.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Wrap every call in a router function that catches specific failure types.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;import time&lt;br&gt;
def call_llm_with_failover(prompt, models=LLM_PRIORITY, max_retries_per_model=1):&lt;br&gt;
    last_error = None&lt;br&gt;
    for model_config in models:&lt;br&gt;
        for attempt in range(max_retries_per_model):&lt;br&gt;
            try:&lt;br&gt;
                response = call_provider(&lt;br&gt;
                    provider=model_config["provider"],&lt;br&gt;
                    model=model_config["model"],&lt;br&gt;
                    prompt=prompt,&lt;br&gt;
                    timeout=15  # seconds — don't let one model hang the whole pipeline&lt;br&gt;
                )&lt;br&gt;
                # Success — record which model actually answered&lt;br&gt;
                log_model_usage(model_config["name"])&lt;br&gt;
                return response&lt;br&gt;
            except RateLimitError:&lt;br&gt;
                last_error = "rate_limited"&lt;br&gt;
                break  # don't retry the same rate-limited model, move to next one&lt;br&gt;
            except TimeoutError:&lt;br&gt;
                last_error = "timeout"&lt;br&gt;
                continue  # maybe worth one retry on the same model&lt;br&gt;
            except ServerBusyError:&lt;br&gt;
                last_error = "busy"&lt;br&gt;
                break&lt;br&gt;
    raise AllModelsUnavailableError(f"All models exhausted. Last error: {last_error}")&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Use this wrapper for both agents, not just one. Agent 1 (tool decision) and Agent 2 (refinement) should each go through the same failover router independently — it’s entirely possible for the model serving Agent 1 to be busy while the model serving Agent 2 is fine, or vice versa.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add a circuit breaker so you don’t keep hammering a model that’s clearly down. A simple in-memory counter works for small-to-medium traffic:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;from collections import defaultdict&lt;br&gt;
from time import time&lt;br&gt;
failure_counts = defaultdict(list)&lt;br&gt;
COOLDOWN_SECONDS = 60&lt;br&gt;
FAILURE_THRESHOLD = 3&lt;br&gt;
def is_model_in_cooldown(model_name):&lt;br&gt;
    now = time()&lt;br&gt;
    recent_failures = [t for t in failure_counts[model_name] if now - t &amp;lt; COOLDOWN_SECONDS]&lt;br&gt;
    failure_counts[model_name] = recent_failures&lt;br&gt;
    return len(recent_failures) &amp;gt;= FAILURE_THRESHOLD&lt;br&gt;
def record_failure(model_name):&lt;br&gt;
    failure_counts[model_name].append(time())&lt;br&gt;
Check is_model_in_cooldown() before attempting a model in the priority list — if it's in cooldown, skip straight to the next one instead of wasting a request and a timeout window on a model you already know is struggling.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Make the model list configurable, not hardcoded. Keep it in an environment variable or a small config file so you can reorder priority, swap providers, or add a new model without touching code:&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  .env
&lt;/h1&gt;

&lt;p&gt;LLM_PRIORITY_ORDER=primary_llm,secondary_llm,fallback_llm&lt;br&gt;
PRIMARY_LLM_PROVIDER=provider_a&lt;br&gt;
SECONDARY_LLM_PROVIDER=provider_b&lt;br&gt;
FALLBACK_LLM_PROVIDER=provider_c&lt;br&gt;
REQUEST_TIMEOUT_SECONDS=15&lt;br&gt;
COOLDOWN_SECONDS=60&lt;br&gt;
This is the difference between “I have to redeploy to change providers” and “I edit one line in .env and restart the service."&lt;/p&gt;

&lt;p&gt;Why this matters in production&lt;br&gt;
With this in place, a query never just hangs or errors out because one provider happened to be under load at that exact second. The user experience stays consistent — they get an answer, possibly from a slightly different underlying model, but they’re never staring at a spinner that times out. And because every fallback event is logged, you get visibility into how often your primary model is actually struggling, which is useful data for deciding whether to renegotiate rate limits, add a fourth fallback, or just accept the current setup.&lt;/p&gt;

&lt;p&gt;flowchart TD&lt;br&gt;
    Q[Incoming Query] --&amp;gt; P[Try Primary LLM]&lt;br&gt;
    P --&amp;gt;|Success| R[Return Answer]&lt;br&gt;
    P --&amp;gt;|Rate Limited / Busy / Timeout| S[Try Secondary LLM]&lt;br&gt;
    S --&amp;gt;|Success| R&lt;br&gt;
    S --&amp;gt;|Failure| T[Try Fallback LLM]&lt;br&gt;
    T --&amp;gt;|Success| R&lt;br&gt;
    T --&amp;gt;|Failure| U[Raise Controlled Error]&lt;br&gt;
Technology Choices&lt;br&gt;
For anyone curious about the stack, at a glance:&lt;/p&gt;

&lt;p&gt;Backend: Python web framework with async support, SQL-backed database for user/role data, secure session handling, password hashing for any stored credentials.&lt;br&gt;
Agent orchestration: a graph-based orchestration library to define the two-agent sequence cleanly, with a tool/document-processing framework underneath.&lt;br&gt;
Embeddings &amp;amp; retrieval: open embedding models for vectorization, a local vector index for similarity search, recursive text chunking, and a set of format-specific document loaders (PDF, Word, text, Markdown, web pages).&lt;br&gt;
Frontend: plain HTML/CSS/JS with a utility-first CSS framework, server-rendered templates.&lt;br&gt;
Backups: periodic backup of the embedding store to cloud object storage.&lt;br&gt;
Concurrency: thread pools and async I/O so embedding jobs and queries don’t block each other.&lt;br&gt;
What’s Next&lt;br&gt;
A few things on the roadmap:&lt;/p&gt;

&lt;p&gt;Letting admins delete individual files or specific vectors from the index, instead of only adding to it.&lt;br&gt;
Tightening retrieval accuracy by experimenting with chunk size and embedding model choice.&lt;br&gt;
Possibly collapsing the two-agent pipeline into a single, faster agent once latency becomes a bigger priority than the clean separation of concerns.&lt;br&gt;
Expanding the failover router to support weighted load balancing across models even when all of them are healthy, not just failover when one is down.&lt;br&gt;
Closing Thoughts&lt;br&gt;
The biggest lesson from this project: a RAG chatbot is “easy” to build to a demo-quality bar, and genuinely hard to build to a doesn’t-fall-over-in-production bar. The retrieval and refinement pipeline gets you accurate, grounded answers. The failover router is what keeps the lights on when your LLM provider has a bad five minutes. Both matter — and most tutorials only show you the first one.&lt;/p&gt;

&lt;p&gt;If you’re building something similar, start with the dual-agent retrieval pipeline to get accuracy right, then treat your LLM calls as a resource pool rather than a single dependency from day one. Retrofitting failover later is a lot more painful than designing for it up front.&lt;/p&gt;

</description>
      <category>rag</category>
      <category>agents</category>
      <category>agenticrag</category>
      <category>llm</category>
    </item>
    <item>
      <title>Prompt-Driven Tool-Calling for Lightweight Open Source LLMs</title>
      <dc:creator>PAWAN YADAV  (AI Engineer)</dc:creator>
      <pubDate>Fri, 19 Jun 2026 09:36:01 +0000</pubDate>
      <link>https://dev.to/2000pawan/prompt-driven-tool-calling-for-lightweight-open-source-llms-1hfh</link>
      <guid>https://dev.to/2000pawan/prompt-driven-tool-calling-for-lightweight-open-source-llms-1hfh</guid>
      <description>&lt;p&gt;🚀 How Lightweight LLMs Can Use Tools Without Large Compute: A Prompt-Driven Tool-Calling Approach&lt;/p&gt;

&lt;h1&gt;
  
  
  AI #LLM #MachineLearning #AIAgents #PromptEngineering #OpenSourceAI
&lt;/h1&gt;

&lt;p&gt;🚀 Introduction&lt;/p&gt;

&lt;p&gt;Large Language Models (LLMs) like GPT-4 or Claude are extremely powerful, but they come with a major limitation:&lt;br&gt;
they require huge computational resources.&lt;/p&gt;

&lt;p&gt;But what if smaller, open-source models could also perform complex reasoning tasks—without needing massive GPUs?&lt;/p&gt;

&lt;p&gt;This question led to my research:&lt;/p&gt;

&lt;p&gt;“Prompt-Driven Tool-Calling for Lightweight Open Source LLMs”&lt;/p&gt;

&lt;p&gt;🧠 The Problem&lt;/p&gt;

&lt;p&gt;Today’s AI systems face three key challenges:&lt;/p&gt;

&lt;p&gt;Small models lack strong reasoning ability&lt;br&gt;
Tool usage (calculators, APIs, search engines) is not native&lt;br&gt;
Large models are expensive and difficult to deploy everywhere&lt;/p&gt;

&lt;p&gt;So the gap is clear:&lt;/p&gt;

&lt;p&gt;👉 We need efficient AI agents that don’t rely on large models&lt;/p&gt;

&lt;p&gt;⚙️ The Idea: Prompt-Driven Tool Calling&lt;/p&gt;

&lt;p&gt;Instead of forcing a model to “learn everything,” we guide it using structured prompts that allow it to:&lt;/p&gt;

&lt;p&gt;Decide when to use a tool&lt;br&gt;
Select the correct tool&lt;br&gt;
Combine outputs from multiple steps&lt;br&gt;
In simple terms:&lt;/p&gt;

&lt;p&gt;The model becomes a controller, not a knowledge storage system.&lt;/p&gt;

&lt;p&gt;🔧 How It Works&lt;/p&gt;

&lt;p&gt;This system enables lightweight LLMs to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Understand user intent&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The prompt helps the model break the problem into steps.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Decide tool usage&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Instead of answering directly, the model selects tools such as:&lt;/p&gt;

&lt;p&gt;Calculator&lt;br&gt;
Search engine&lt;br&gt;
API call&lt;br&gt;
External functions&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Execute multi-step reasoning&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Flow:&lt;/p&gt;

&lt;p&gt;User Question → LLM → Tool Selection → Tool Execution → Final Answer&lt;/p&gt;

&lt;p&gt;💡 Key Benefits&lt;/p&gt;

&lt;p&gt;This approach enables:&lt;/p&gt;

&lt;p&gt;✅ Smaller models to behave like intelligent agents&lt;br&gt;
✅ Reduced dependency on large proprietary LLMs&lt;br&gt;
✅ Lower compute cost&lt;br&gt;
✅ Deployment on CPUs and edge devices&lt;br&gt;
✅ More practical real-world AI systems&lt;br&gt;
🌍 Why This Matters&lt;/p&gt;

&lt;p&gt;We are moving toward a future where:&lt;/p&gt;

&lt;p&gt;Intelligence is not about model size, but about system design.&lt;/p&gt;

&lt;p&gt;Instead of scaling parameters, we scale:&lt;/p&gt;

&lt;p&gt;Tool integration&lt;br&gt;
Reasoning workflows&lt;br&gt;
System-level intelligence&lt;/p&gt;

&lt;p&gt;This makes AI:&lt;/p&gt;

&lt;p&gt;More accessible&lt;br&gt;
More affordable&lt;br&gt;
More deployable in real-world environments&lt;br&gt;
📊 My Research Contribution&lt;/p&gt;

&lt;p&gt;This work proposes a prompt-driven framework that:&lt;/p&gt;

&lt;p&gt;Enables tool-calling in lightweight open-source LLMs&lt;br&gt;
Improves multi-step reasoning capability&lt;br&gt;
Reduces dependency on large models&lt;br&gt;
Moves toward practical AI agent systems&lt;br&gt;
📄 Publication Details&lt;/p&gt;

&lt;p&gt;📌 Published in: AIS2C2 2025&lt;br&gt;
📚 Pages: 493–497&lt;/p&gt;

&lt;p&gt;🔗 Paper Link:&lt;br&gt;
&lt;a href="https://www.aiscindia.co.in/wp-content/uploads/2026/06/ilovepdf_merged-4.pdf" rel="noopener noreferrer"&gt;https://www.aiscindia.co.in/wp-content/uploads/2026/06/ilovepdf_merged-4.pdf&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🚀 Final Thoughts&lt;/p&gt;

&lt;p&gt;The future of AI is not just about building bigger models.&lt;/p&gt;

&lt;p&gt;It is about building smarter systems around smaller models.&lt;/p&gt;

&lt;p&gt;Prompt-driven tool-calling is one step toward that direction.&lt;/p&gt;

&lt;p&gt;🤝 Let’s Connect&lt;/p&gt;

&lt;p&gt;I’m always open to discussions around:&lt;/p&gt;

&lt;p&gt;LLMs and AI agents&lt;br&gt;
Tool-calling systems&lt;br&gt;
Open-source AI development&lt;br&gt;
Practical AI engineering&lt;br&gt;
🔖 Tags&lt;/p&gt;

&lt;h1&gt;
  
  
  ArtificialIntelligence #LLM #AIAgents #PromptEngineering #MachineLearning #DeepLearning #OpenSourceAI
&lt;/h1&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvt3ac69qurcflbod7k6a.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvt3ac69qurcflbod7k6a.jpeg" alt=" " width="610" height="787"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>machinelearning</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
