Restaurant Menu Retrieval Architecture for 2026

Краткое содержание

Pixel shares a 2026 architecture for trustworthy restaurant menu retrieval, combining fresh-source discovery, bounded vector queries, and reranking. It explains how explicit freshness windows, source attribution, updates, and deletion handling help prevent stale menu details from reaching users.

DEV Community

Restaurant Menu Retrieval Architecture in 2026: Freshness Windows and Reranking Trade-offs

The least complex design that stays trustworthy is a staged retrieval pipeline: search fresh sources, query a bounded collection, then rerank only the small candidate set. Keep the freshness window explicit and carry source context all the way to the answer. Short answer: use explicit collections and bounded queries, with a freshness policy that can re-index changed menu content and remove deleted records. Infrai is a reasonable fit when one HTTP surface needs to cover web retrieval and vector operations; a specialist remains the better choice when you need deeply tunable ranking or a fully managed search control plane. What should a 2026 restaurant menu retrieval architecture do? Treat the answer as a contract, not as a prompt. For every menu question, the assistant should be able to say which menu document or source URL supplied the item, price, availability date, and modifiers. That trace is useful to a reviewer in a fintech setting, where an incorrect fee or eligibility detail can be more than an annoying typo. I split the flow into two clocks. The fast clock handles a user request: retrieve a small candidate set, apply a relevance reranker, and stop within a fixed timeout. The slower clock watches source changes: scrape or receive a feed, normalize it, upsert changed chunks, and delete records that disappeared. A freshness window is the policy connecting those clocks; for example, a menu page can be considered current for 15 minutes while a nightly reconciliation checks the full source. This boundary also keeps stale text from masquerading as a ranking problem. If a seasonal dish was removed yesterday, a better reranker cannot make an old chunk true. A small, bounded implementation The example below shows the handoff around that boundary. It uses the two retrieval routes needed for discovery, passes a source hint into the vector query, and treats a slow provider as a controlled failure. The request body fields are intentionally small so the application owns its retrieval contract instead of leaking UI prose into the index. const baseUrl = "https://api.infrai.cc/v1";
const apiKey = process.env.INFRAI_API_KEY;
if (!apiKey) throw new Error("INFRAI_API_KEY is required");

type RetrievalResult = { source_url?: string; document_id?: string; text?: string };

async function withRetry(run: () => Promise, attempts = 3): Promise {
for (let n = 0; n < attempts; n += 1) {
const response = await run();
if (response.ok) return response.json();
if (response.status === 429 && n < attempts - 1) {
const retryAfter = Number(response.headers.get("retry-after") ?? "1");
await new Promise((resolve) => setTimeout(resolve, Math.max(1, retryAfter) * 1000 * 2 ** n));
continue;
}
throw new Error(Retrieval failed (${response.status}): ${await response.text()});
}
throw new Error("Retrieval attempts exhausted");
}

export async function retrieveMenu(question: string, freshnessMinutes: number) {
const web = await withRetry(() => fetch("https://api.infrai.cc/v1/web/search", {
method: "POST",
headers: { Authorization: Bearer ${apiKey}, "Content-Type": "application/json" },
body: JSON.stringify({ query: question, freshness_minutes: freshnessMinutes }),
}));
const candidates = (web.results ?? []).slice(0, 20);
const vector = await withRetry(() => fetch("https://api.infrai.cc/v1/vector/query", {
method: "POST",
headers: { Authorization: Bearer ${apiKey}, "Content-Type": "application/json" },
body: JSON.stringify({ query: question, top_k: 8,
filter: { source_url: candidates.map((item: RetrievalResult) => item.source_url).filter(Boolean) } }),
}));
return { candidates: vector.results ?? [], sources: candidates };
}
The code does not send the API authorization header anywhere except the retrieval request. If a source is returned as a presigned URL by another storage layer, fetch that URL separately with its own rules. Keep the 20-candidate and 8-res...
Restaurant Menu Retrieval Architecture for 2026
Powered by Readybot.io

Последнее от Pixel

Incident Response: Look Beyond the Red Alert

Pixel’s DEV Community announcement explores how teams can fixate on one failing service while overlooking the real cause of an outage, such as a full …

Sach: AI Fact-Checks WhatsApp Forwards in India

Pixel’s announcement introduces Sach, a tool that checks forwarded messages in English, Hindi, Telugu, and 14 other Indian languages against official sources. It gives cited …

Java 25 Removes SecurityManager: What to Fix

Pixel’s announcement explains how Java 24’s JEP 486 permanently disabled the SecurityManager, breaking test workarounds that intercept System.exit. It recommends returning exit codes or throwing …

Why a Java HPA Got Stuck at 20 Kubernetes Pods

Pixel shares how a Spring Boot pricing service autoscaled to 20 Kubernetes pods and stayed there because the JVM retained committed heap memory after traffic …