PriceHawk is an agentic e-commerce search engine that uses Retrieval-Augmented Generation (RAG) to answer product queries from two sources: an internal FAISS vector store (i.e. private documents) and an optional live web fallback via Tavily. The system uses a tool-calling ReAct-style loop where the LLM first retrieves relevant internal context, evaluates whether it’s sufficient, and only then invokes external web search if needed. This prevents hallucinations, keeps private data local, and ensures up-to-date answers when internal knowledge is incomplete.
An example user query is "Please find me a kindle under $100". The screenshot below demostrates the effectiveness of PriceHawk in using either an internal search or a web search to find the right products.
- Language: Python
- LLM: GPT-4o-mini
- RAG / Orchestration: LangChain (1.2.0, native tool-calling)
- Vector Store: FAISS
- Web Search: Tavily API
- UI: Gradio
- User submits a query.
- The system always retrieves from the internal FAISS knowledge base first.
- If the internal results are insufficient, the agent optionally falls back to live web search.
- The LLM generates a grounded response based on retrieved context.
- Create a
.envfile with:
OPENAI_API_KEY=...
TAVILY_API_KEY=...
- Place your FAISS index files inside
faiss_index/. - Install dependencies:
pip install -r requirements.txt
- Start the app:
python agent.py
The app is designed for deployment on AWS EC2 (e.g., Amazon Linux 2023):
- Provision an EC2 instance and open inbound traffic on port 7860.
- Clone the repo and set up a Python virtual environment.
- Install dependencies and run
python agent.py. - Access the Gradio UI via the instance’s public IP.
