AI-powered e-commerce shopping assistant that answers product-related questions using LLM APIs.
- Natural language product Q&A over a sample catalog
- Switchable LLM backend (OpenAI, Google Gemini) via environment variable
- Clean provider abstraction -- easy to add new LLM providers
- Type-safe configuration with Pydantic
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e .cp .env.example .envEdit .env with your API key:
LLM_PROVIDER=gemini
LLM_MODEL=gemini-2.0-flash
API_KEY=your-api-key-here
Gemini (free tier): Get a key at Google AI Studio (aistudio.google.com/apikey)
OpenAI: Set LLM_PROVIDER=openai, LLM_MODEL=gpt-4o-mini, and use your OpenAI key.
python -m src.mainShopSmart Assistant (gemini/gemini-2.0-flash)
Type 'quit' to exit.
You: Do you have red shoes under $50?
Assistant: Yes! We have the **Classic Canvas Sneaker** in red for $39.99.
It comes in sizes 7-11. Would you like to know more?
You: What sizes are available for the Leather Ankle Boot?
Assistant: The **Leather Ankle Boot** is available in sizes 6, 7, 8, and 9.
It comes in black and brown, priced at $89.99.
src/
main.py # CLI entry point
config.py # Settings from .env
models.py # Product data model
product_store.py # Product loading and formatting
prompts.py # System prompt template
llm/
base.py # LLMProvider protocol
openai_provider.py # OpenAI implementation
gemini_provider.py # Gemini implementation
factory.py # Provider factory
data/
products.json # Sample product catalog
Change LLM_PROVIDER and LLM_MODEL in your .env file:
| Provider | LLM_PROVIDER | LLM_MODEL | Notes |
|---|---|---|---|
| Gemini | gemini | gemini-2.0-flash | Free tier available |
| OpenAI | openai | gpt-4o-mini | Requires paid API key |