Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/geremyjampiersalasgarcia-eng/Caso_Practico_Semillero_IA/llms.txt

Use this file to discover all available pages before exploring further.

All configuration for the Mesa de Ayuda IA backend is loaded from a .env file located in the backend/ directory. To get started, copy the provided template and fill in your values:
cp backend/.env.example backend/.env
GOOGLE_API_KEY is required. Without a valid Gemini API key, no agent in the system will function — the classifier, all RAG agents, the multimodal agent, and embedding generation all depend on this key.

Google Gemini API

GOOGLE_API_KEY
string
required
Your Google Gemini API key. Generate one for free at https://aistudio.google.com/apikey. This key is used by all agents (ChatGoogleGenerativeAI) and by the embedding pipeline (GoogleGenerativeAIEmbeddings).

LLM Configuration

LLM_MODEL_NAME
string
default:"gemini-flash-lite-latest"
The Gemini model used by all RAG and action agents. The default gemini-flash-lite-latest offers a good balance of speed and quality for sales help-desk workloads. You can substitute any model available in your Gemini quota (e.g. gemini-1.5-flash, gemini-1.5-pro).
EMBEDDING_MODEL_NAME
string
default:"models/gemini-embedding-001"
The Gemini embedding model used during both document ingestion and retrieval. This value must stay consistent between ingestion runs — changing it without re-ingesting will cause vector-space mismatches.
LLM_TEMPERATURE
float
default:"0.1"
Sampling temperature applied to agent responses. Lower values produce more deterministic, factual answers suitable for a sales assistant. Note that the classifier node always uses 0.0 regardless of this setting, to ensure consistent intent routing.

ChromaDB

CHROMA_PERSIST_DIR
string
default:"data/chroma_db"
Path where ChromaDB stores its persistent vector collections, relative to the backend/ directory. The three collections (col_catalogo, col_politicas, col_proceso_ventas) will all be written here after running the ingestion script.

RAG Configuration

CHUNK_SIZE
integer
default:"1000"
Maximum size of each text chunk in characters produced by RecursiveCharacterTextSplitter during ingestion. Smaller values yield more granular retrieval; larger values preserve more context per chunk.
CHUNK_OVERLAP
integer
default:"200"
Number of characters that overlap between consecutive chunks. Overlap prevents context loss at chunk boundaries — particularly important for numbered lists and price tables in the catalog document.
RETRIEVAL_TOP_K
integer
default:"4"
Number of ChromaDB chunks retrieved per query during inference. Each RAG agent fetches this many chunks from its dedicated collection before generating an answer.

API Configuration

API_HOST
string
default:"0.0.0.0"
Network interface the FastAPI/Uvicorn server binds to. Use 0.0.0.0 to accept connections from any interface (required when running inside Docker or behind a reverse proxy).
API_PORT
integer
default:"8000"
TCP port the API server listens on. The frontend expects this to be 8000 by default (NEXT_PUBLIC_API_BASE_URL=http://localhost:8000/api/v1).
API_DEBUG
boolean
default:"true"
Enables FastAPI debug mode, which activates auto-reload and more verbose error pages. Set to false for production deployments.

CORS

CORS_ORIGINS
JSON array
default:"[\"http://localhost:3000\"]"
A JSON-encoded list of allowed origins for Cross-Origin Resource Sharing. Add any additional frontend URLs here when deploying to staging or production. Example for a remote deployment:
CORS_ORIGINS=["https://app.patito.com","http://localhost:3000"]

Observability

LOG_LEVEL
string
default:"INFO"
Minimum log level emitted by structlog. Accepted values: DEBUG, INFO, WARNING, ERROR, CRITICAL. Use DEBUG during development to see detailed agent-step traces.
PHOENIX_PROJECT_NAME
string
default:"Patito_SA_Ventas"
Project name shown in the Arize Phoenix observability UI. All LLM traces and spans generated by the agent graph are grouped under this name, making it easy to filter by project in the Phoenix dashboard at http://localhost:6006.

Database

DATABASE_URL
string
Full PostgreSQL connection string used to persist conversation history and CRM audit records. The port 5433 (not 5432) is because the Docker Compose setup maps the container’s 5432 to 5433 on the host to avoid conflicts with any locally installed PostgreSQL instance.If the PostgreSQL service is unreachable at startup, the backend automatically falls back to a local SQLite database so development can continue without Docker.

Complete sample .env file

# ==================================================
# Environment Variables — Mesa de Ayuda IA
# Copy from .env.example and fill in your values
# ==================================================

# --- Google Gemini API ---
# Get your key from: https://aistudio.google.com/apikey
GOOGLE_API_KEY=AIzaSy...your_key_here...

# --- LLM Configuration ---
LLM_MODEL_NAME=gemini-flash-lite-latest
EMBEDDING_MODEL_NAME=models/gemini-embedding-001
LLM_TEMPERATURE=0.1

# --- ChromaDB ---
CHROMA_PERSIST_DIR=data/chroma_db

# --- RAG Configuration ---
CHUNK_SIZE=1000
CHUNK_OVERLAP=200
RETRIEVAL_TOP_K=4

# --- API Configuration ---
API_HOST=0.0.0.0
API_PORT=8000
API_DEBUG=true

# --- CORS ---
CORS_ORIGINS=["http://localhost:3000"]

# --- Observability ---
LOG_LEVEL=INFO
PHOENIX_PROJECT_NAME=Patito_SA_Ventas

# --- Database (PostgreSQL via Docker) ---
# If PostgreSQL is unavailable, SQLite is used as automatic fallback
DATABASE_URL=postgresql://mesa_ayuda_user:[email protected]:5433/mesa_ayuda_db
The backend/.env file is listed in .gitignore and is never committed to version control. Only the .env.example template (with empty or default values) is tracked by Git. Always manage secrets outside the repository — for example through a secrets manager or CI/CD environment injection.

Build docs developers (and LLMs) love