Recipe: Search + Chat Hybrid

Combine semantic recipe search with a conversational AI assistant that remembers your pantry, dietary restrictions, and taste preferences across sessions.

Architecture Overview

Search Pipeline

  • • Embedding index via pgvector
  • • Hybrid BM25 + dense retrieval
  • • Faceted filters (cuisine, time, diet)
  • • Ingredient substitution graph

Chat Layer

  • • Streaming SSE responses
  • • Tool-calling for search dispatch
  • • Session-scoped user profile
  • • Markdown + structured recipe cards

Example Interaction

User

I have chicken thighs, coconut milk, and spinach. What can I make in under 30 minutes?

Nimbus

Found 3 matches. Top pick: Thai Coconut Chicken (22 min, 4.8★).

Sear chicken 6 min → simmer coconut milk + curry paste 10 min → wilt spinach 2 min. Serve with rice.

Key Endpoints

POST /api/recipes/search   { query, filters, top_k }
POST /api/chat/stream      { messages[], session_id }
GET  /api/profile/prefs    { session_id }

The chat endpoint streams tool-call events. When the model emits a search_recipes tool call, the backend dispatches to the search pipeline and injects results into the conversation context before the next completion chunk.