OpenAI
Structured outputs
Zod
Schema validation
Algolia
Precise query generation
150+
Real-world queries tuned
The Challenge
The Solution
Features
Free-text queries
Designers type how they think, e.g. '6x9 Scandinavian under $5000 in beige', instead of using filters.
NL to Algolia
OpenAI structured outputs translate the phrase into a precise Algolia query object.
Schema-validated
Zod constrains the model's output so only valid, well-typed queries reach Algolia.
Attribute-aware
Maps language to real attributes: size, material, color, price, and stock status.
Team-editable
Built so non-technical teammates can adjust the mapping logic.
Production automation
Reliably delivers precise results without hand-built filter UIs.
System Architecture
Input
Free-text query
API
Next.js API
AI
OpenAI + Zod
Search
Algolia
Output
Ranked results
Technology Stack
Frontend & Framework
AI & Validation
Search & Data
Key Learnings
- •Constraining the model with Zod turned free-form AI output into reliable, well-typed Algolia queries.
- •Mapping natural language to real product attributes mattered more than the prompt, the schema was the contract.
- •Tuning against 150+ real-world queries surfaced the edge cases that made it production-ready.
