How lamhotsiagian/retail_rag_sim works
This repository is an OpenAI-backed retail customer-service RAG application. A user asks in the Streamlit UI; the LangGraph workflow plans the request, executes model-selected retrieval or business tools, then verifies grounding and confidence before returning an answer with citations. Separate capabilities include KB indexing, local/hosted evaluation, and optional experiment logging. The graph follows the sampled call sites and README; the API tool’s HTTP wiring is not shown in the excerpts, so that connection is marked unverified.
Main entry points: graph.py Agent workflow · run_langsmith_eval.py LangSmith evaluation · retriever.py Hybrid retrieval · app.py Chat UI
Components 20
Conversation workflow
- Chat UI
ui/app.py - Agent workflow
src/retail_rag_sim/agents/graph.py - Agent prompts
src/retail_rag_sim/agents/prompts.py - OpenAI models
src/retail_rag_sim/llms/factory.py
Knowledge retrieval
- KB ingestion
src/retail_rag_sim/retrieval/ingest.py - Hybrid retrieval
src/retail_rag_sim/retrieval/retriever.py - Cross-encoder reranker
src/retail_rag_sim/retrieval/reranker.py - Chroma index
Business tools
- SQL query tool
src/retail_rag_sim/tools/db.py - SQLite database
- Retail API tool
src/retail_rag_sim/tools/api.py - Dummy tools API
api/dummy_api.py - Email tool
src/retail_rag_sim/tools/email.py
Evaluation and observability
- Local evaluation
src/retail_rag_sim/eval/run_local_eval.py - LangSmith evaluation
src/retail_rag_sim/eval/run_langsmith_eval.py - Evaluation metrics
src/retail_rag_sim/eval/metrics.py - Experiment logging
src/retail_rag_sim/ops/observability.py
Other components
- Customer
- Gmail SMTP
- LangSmith
Connections 23
- Customer → Chat UI: asks
ui/app.py - Chat UI → Agent workflow: calls chat
ui/app.py - Agent workflow → Chat UI: returns answer
ui/app.py - Agent workflow → Agent prompts: uses instructions
src/retail_rag_sim/agents/graph.py - Agent workflow → OpenAI models: gets models
src/retail_rag_sim/agents/graph.py - Agent workflow → Hybrid retrieval: retrieves documents
src/retail_rag_sim/agents/graph.py - Agent workflow → Cross-encoder reranker: reranks results
src/retail_rag_sim/agents/graph.py - KB ingestion → OpenAI models: gets embeddings
src/retail_rag_sim/retrieval/ingest.py - KB ingestion → Chroma index: writes chunks
src/retail_rag_sim/retrieval/ingest.py - Hybrid retrieval → OpenAI models: gets embeddings
src/retail_rag_sim/retrieval/retriever.py - Hybrid retrieval → Chroma index: reads index
src/retail_rag_sim/retrieval/retriever.py - Agent workflow → SQL query tool: runs queries
src/retail_rag_sim/agents/graph.py - SQL query tool → SQLite database: reads rows
src/retail_rag_sim/tools/db.py - Agent workflow → Retail API tool: calls tool
src/retail_rag_sim/agents/graph.py - Retail API tool → Dummy tools API: requests endpoints
- Agent workflow → Email tool: sends messages
src/retail_rag_sim/agents/graph.py - Email tool → Gmail SMTP: sends email
- Local evaluation → Agent workflow: evaluates answers
src/retail_rag_sim/eval/run_local_eval.py - Local evaluation → Evaluation metrics: scores outputs
src/retail_rag_sim/eval/run_local_eval.py - LangSmith evaluation → Agent workflow: evaluates answers
src/retail_rag_sim/eval/run_langsmith_eval.py - LangSmith evaluation → Evaluation metrics: scores outputs
src/retail_rag_sim/eval/run_langsmith_eval.py - LangSmith evaluation → LangSmith: submits evaluation
src/retail_rag_sim/eval/run_langsmith_eval.py - LangSmith evaluation → Experiment logging: logs summaries
src/retail_rag_sim/eval/run_langsmith_eval.py