How lalithasree-2599/pricewise_ai works
Project type and purpose
• This is a specialized full-stack data/AI assistant for retail pricing, implemented as a Streamlit front end coupled with a Python-based backend “pricing agent.” It uses RAG (Retrieval-Augmented Generation) with ChromaDB + OpenAI embeddings, enforces semantic guardrails, and implements a risk-based approval workflow.
File structure
• Top level:
• context_notepads – reference PDFs/txts (design notes, guides)
• data – the raw product CSV and persisted Chroma SQLite vector store
• iteration_1 – the working code for v1:
– streamlit_app.py (UI entry point)
– requirements.txt
– src/ – core modules (data_loader, vector_store, simple_retriever, prompts, pricing_agent, guardrails, models)
– hybrid_guardrails_example.py & sample prompts
• Configuration files: .gitignore, .python-version, README.md
• Patterns: single-process app, modular backend components, clear data-vs-logic separation.
Key architecture details from README
• RAG pipeline: ChromaDB + OpenAI for retrieval & embeddings
• Hybrid guardrails: keyword + semantic checks
• Approval workflow: escalation tiers (Manager → Director → C-Level) based on price/risk thresholds
• Elasticity-based revenue optimization
• Tech stack: Python, LangChain, OpenAI GPT-4o, Streamlit, ChromaDB
Main components & their interactions
a. Frontend (Streamlit UI)
• Accepts user queries, displays recommendations & dashboards
• Triggers download/export
b. Pricing Agent Core
• Data Loader – ingests product CSV
• Vector Store – manages ChromaDB interactions
• Retriever – executes similarity searches via embeddings
• Prompts – templates for LLM calls
• LLM Service – OpenAI API → embeddings & completions
• Models – price elasticity & revenue calculations
c. Guardrails Layer
• Keyword filters (fast checks)
• Semantic validator (LLM-based fraud/topic checks)
• Configuration thresholds (min price, max change, etc.)
d. Approval Workflow
• Risk assessment → tier determination
• Escalation paths (Manager, Director, C-suite)
• Hook for human sign-off before final output
e. Data Persistence
• ChromaDB (SQLite) for vector store
• Optional CSV export
f. External Dependencies
• OpenAI API
• Host environment (Streamlit server)
Architectural patterns & design principles
• Modular layering: UI → service layer (pricing_agent) → persistence/third-party
• Separation of concerns: retrieval, modeling, guardrails, and approval decoupled
• Configuration-driven guardrails (inject thresholds via dict)
• RAG pattern: combine embeddings store + LLM for retrieval & generation
Final recommendations
• Be granular: break the “pricing_agent” into its sub-modules to show clear responsibilities
• Every component has a clear label, and group related modules within containers for readability