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.
When a user asks a question, the system:
- Embeds the question into a vector
- Retrieves the most relevant tool from the database using vector similarity
- Expands the context by fetching related tools via a dependency graph
- Calls the LLM (Groq) to pick the right tool and extract arguments
- Executes the tool
- Calls the LLM again to turn the raw result into a human-friendly response
| Layer | Technology |
|---|---|
| Backend | .NET / C# (ASP.NET Core) |
| LLM | Groq API |
| Vector Search | pgvector (PostgreSQL extension) |
| Database | PostgreSQL |
| Frontend | React |
| Infra | Docker Compose |
- 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
IErpTooland dropping a class in/Tools - ERP data support — built-in schema for outlets, products, inventory, sales orders, and expenses
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
- Create a class in
backend/Tools/that implementsIErpTool - Decorate it with
[ToolDefinition("tool_name", "Display Name", "Description")] - Implement
GetParametersJsonSchema()andExecuteAsync()
That's it — the system picks it up automatically.
Tool graph (2 tables)
tool_embeddings— stores each tool with its vector representationtool_dependencies— stores PINNED / SUGGESTED relationships between tools
Business / ERP data (7 tables)
outlets,suppliers,products,inventory,sales_orders,sales_order_items,expenses
