Fixing E-commerce AI Hallucinations: Vector Search and Assertive Prompting
nikhilthadani · reddit · 2026-08-05
A developer building an e-commerce AI agent from scratch encountered an embarrassing bug: when asked for smartphones, the agent confidently replied they had none, completely ignoring the iPhones in stock.
The issues lay in retrieval and prompting:
- Rigid String Matching: Simple .includes() failed to grasp that an iPhone is a smartphone. Switching to OpenAI embeddings with LanceDB for similarity search allowed the agent to match by meaning rather than letters.
- Model Ignoring Tools: Even after fixing search, the model answered from its own knowledge. The developer realized the tool description was too passive. Changing it to use assertive commands with ALWAYS and NEVER forced the model to comply immediately.
The takeaway: tool descriptions act as rules for the model, and being strict with them works better.
More from coding & agent
- NeurIPS 2026 Call for Papers: Focus on Responsible Meta-Agents — RobertTLange · 2026-08-05
- Spring Evals: Benchmarking LLMs on Real-World Spring Boot 4 Code with Hidden Tests — therealdanvega · 2026-08-05
- Local Coding Benchmark: Qwen3.5-122B Rivals DeepSeek at a Fraction of the Cost — returnity · 2026-08-05
- Navigating SAP's Agent Architecture: MCP for Tool Execution, A2A for Orchestration — SillyDot3305 · 2026-08-05
- YC's Multiplayer Agent Harness: Great Decoupled Architecture, But It Kills KV Cache — Instance_Not_Found · 2026-08-05
- The 'oh-my' Configuration Trend in Open-Source Coding Agents — HarveenChadha · 2026-08-05