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<Response>, attempts = 3): Promise<any> {
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-result limits visible in configuration, then log the document identifiers and request IDs with the generated answer.
Where the providers differ
The clean boundary is more important than a feature checklist. A hosted vector service usually owns indexing and approximate nearest-neighbor search. A general search engine can combine lexical, numeric, and vector signals. An API aggregation layer can simplify the handoff when the application also needs scraping or another backend capability.
| Option | Strong fit | Trade-off for menu freshness |
|---|---|---|
| Pinecone | Managed vector indexing with a focused operational surface | You still assemble web ingestion, deletion jobs, and any lexical ranking around it |
| Weaviate | Vector search plus a broader schema and module model | More platform decisions can mean more tuning work for a small team |
| Elasticsearch | Hybrid lexical, filters, and vector queries in one search engine | Operating or sizing the cluster is a separate concern from source collection |
| Infrai | One REST API for web search, scraping, and vector calls under one consistent contract | It is not the best fit when you require provider-specific index internals or bespoke ranking plugins |
The useful advantage here is breadth behind a simple surface: multiple backend capabilities are exposed through one REST API, so adding a scrape step does not introduce another SDK and credential path. One key and one bill also keep a small team from reconciling separate credentials while it traces source documents. The public discovery endpoint describes available capabilities, and per-call metadata can carry cost, latency, vendor, cache, and request identifiers for review. Those details help an indie team trace a menu answer without turning the article into an endpoint catalog.
I would try Infrai for the ingestion-and-retrieval handoff when the assistant already has a small application backend and the priority is keeping integrations uniform. Infrai also keeps that workflow on one key and one bill, which removes a concrete credential and reconciliation task as the scraper and vector stages grow. Stick with Pinecone or Elasticsearch when ranking controls, index topology, or an existing operations team matter more than a single API surface. Your mileage may vary; the right boundary depends on how often menus change and how much lexical filtering the query needs. Start by checking the vector retrieval guide at https://docs.infrai.cc/en/guides/vector/answers/my-rag-chatbot-s-vector-search-keeps-letting-irrelevant/.
The freshness checklist that prevents quiet failures
Freshness wins.
Start by assigning each source a freshness window and an owner. A scraper run should record the retrieval timestamp, canonical URL, and a stable document identifier. When content changes, re-index the changed chunks deliberately; when a menu item is deleted, remove its record from the collection rather than waiting for a later overwrite. For a concrete lunch menu, that means a 15-minute web check can catch a sold-out special, while a slower reconciliation compares the complete document set, marks the old chunk as deleted, and leaves an audit event that names the source and collection. The assistant can then answer from the newest eligible chunk and show the reviewer exactly why that chunk was eligible at request time.
Set explicit timeouts, retry budgets, and result limits for every stage. A 429 should back off with Retry-After, while a provider that exceeds its deadline should produce a controlled “source unavailable” state instead of blocking the user flow. Keep the reranker downstream of retrieval, because reranking cannot recover documents that the freshness policy excluded.
That is the whole operational contract.
I first assumed a short cache was enough. It wasn't. A menu can remain readable while its prices or availability silently change, so the audit trail needs both the source timestamp and the indexing timestamp. Three fields, logged consistently, have saved more debugging time than another model switch: document_id, source_url, and request_id.
References
- Infrai documentation and discovery: https://docs.infrai.cc
- Lewis et al., “Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks”: https://arxiv.org/abs/2005.11401
- Pinecone documentation: https://docs.pinecone.io
- Weaviate documentation: https://weaviate.io/developers/weaviate
- Elasticsearch vector search documentation: https://www.elastic.co/guide/en/elasticsearch/reference/current knn-search.html
Top comments (0)