$ cat ~/projects/ai-sales-engine/README.md

AI Sales Engine

★ Featured

Commercial RAG engine

A salesperson that never sleeps: hybrid RAG (vectors + graph) with cost-aware model routing.

Status
In production
Role
AI & Backend Architect
Period
2024 — Actualidad
Client
FaberIT
View live demo ↗
2
retrieval sources (vector + graph)
↓ costo
via complexity-based routing
24/7
automated coverage

# Overview

AI Sales Engine is a RAG-powered lead capture engine. It combines vector search (pgvector) with a knowledge graph (Neo4j) to answer with precise context about products, pricing and cases, qualify leads and hand off to a human when needed. It includes model routing: simple queries go to cheap models and complex ones to powerful models, optimizing cost without sacrificing quality. Orchestrated with LangChain on FastAPI and deployed with Docker/Traefik.

! The problem

Sales prospecting burns hours answering the same questions and qualifying leads by hand. A generic chatbot makes up data (hallucinates) and doesn't know the real catalog or the relationships between products, plans and customers.

The solution

Hybrid RAG: vectors retrieve semantically close passages and the graph contributes explicit relationships (which plan includes what, which case applies to which industry). The model answers grounded in real sources, qualifies the lead and books or hands off. Cost-aware routing keeps spend under control at scale.

# Features

Hybrid vector + graph RAG

pgvector for semantic similarity and Neo4j for explicit domain relationships.

Cost-aware model routing

Classifies query difficulty and routes to the cheapest model that solves it well.

Lead qualification

Extracts intent, budget and urgency to prioritize human follow-up.

Sourced answers

Every answer is grounded in retrieved passages: traceability and less hallucination.

Integration-ready API

FastAPI with versioned endpoints and response streaming.

# Architecture

A query enters through FastAPI; a classifier decides the route and compute budget. The retriever queries pgvector (similarity) and Neo4j (relationships), fuses and re-ranks the context, and LangChain builds the source-grounded prompt. The generator answers via the router-selected model; the conversation and lead are persisted for follow-up.

Components
01 FastAPI Async API, streaming, versioned endpoints
02 pgvector Semantic passage search
03 Neo4j Domain knowledge graph
04 LangChain Retrieval and prompt orchestration
05 Model Router Model selection by cost/complexity

# Tech stack

Backend
FastAPIPythonPydanticasync
IA / RAG
LangChainEmbeddingsModel routingReranking
Datos
pgvectorNeo4jPostgreSQL
Infra
DockerTraefikVPS
Python 88%
Otros 12%

# Learnings

  • Graph and vectors don't compete: the vector finds what's similar, the graph guarantees what's correct. Together they cut hallucination.
  • Model routing is the biggest cost saver in production: not everything needs the most expensive model.
  • Traceability (answering with sources) is what makes a sales assistant trustworthy.

# Roadmap

Automated answer-quality evaluation (LLM-as-judge)
CRM connectors
Voice / WhatsApp Business

Useful for your business?

This solution can be adapted to your organization. Share the project or reach out to discuss it.

Let's talk →