Skip to content

About

No description or website provided.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Tool RAG Demo

Graph Tool RAG — Smart Tool Selection

An AI assistant that uses Retrieval-Augmented Generation (RAG) to pick the right tool for any user question — instead of blindly calling every tool available.


How It Works

When a user asks a question, the system:

  1. Embeds the question into a vector
  2. Retrieves the most relevant tool from the database using vector similarity
  3. Expands the context by fetching related tools via a dependency graph
  4. Calls the LLM (Groq) to pick the right tool and extract arguments
  5. Executes the tool
  6. Calls the LLM again to turn the raw result into a human-friendly response

Tech Stack

Layer Technology
Backend .NET / C# (ASP.NET Core)
LLM Groq API
Vector Search pgvector (PostgreSQL extension)
Database PostgreSQL
Frontend React
Infra Docker Compose

Features

  • RAG-based tool selection — finds the right tool using vector similarity, not brute force
  • Tool dependency graph — links related tools together for richer context
  • Two-pass LLM calls — one to select & extract args, one to generate the final answer
  • Extensible tool system — add new tools by implementing IErpTool and dropping a class in /Tools
  • ERP data support — built-in schema for outlets, products, inventory, sales orders, and expenses

Project Structure

backend/
├── Tools/          # Tool implementations (e.g. GetRevenueTool)
├── Models/         # C# DTOs and data models
├── Orchestration/  # ChatOrchestrator — the main execution pipeline
├── Controllers/    # ChatController — HTTP entry point
├── Retrieval/      # Vector search logic
├── Execution/      # Tool runner
└── Scripts/        # SQL schema and seed data

Adding a New Tool

  1. Create a class in backend/Tools/ that implements IErpTool
  2. Decorate it with [ToolDefinition("tool_name", "Display Name", "Description")]
  3. Implement GetParametersJsonSchema() and ExecuteAsync()

That's it — the system picks it up automatically.


Database Tables

Tool graph (2 tables)

  • tool_embeddings — stores each tool with its vector representation
  • tool_dependencies — stores PINNED / SUGGESTED relationships between tools

Business / ERP data (7 tables)

  • outlets, suppliers, products, inventory, sales_orders, sales_order_items, expenses

About

No description or website provided.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages