Goldfish
Sample · typescript

Bento /v1/ask — minimal client

Twelve lines of TypeScript to ask a Bento memory store a grounded question.

Matt Yonkovit

Requires: node >= 20

type BentoAnswer = { answer: string; citations: { id: string; score: number }[] };

async function ask(baseUrl: string, token: string, q: string): Promise<BentoAnswer> {
  const res = await fetch(`${baseUrl}/v1/ask`, {
    method: 'POST',
    headers: { authorization: `Bearer ${token}`, 'content-type': 'application/json' },
    body: JSON.stringify({ q }),
  });
  if (!res.ok) throw new Error(`bento /v1/ask: ${res.status}`);
  return res.json() as Promise<BentoAnswer>;
}

That’s it. The endpoint does the embedding, the retrieval, the synthesis, and returns citations. Honest about what it pulled, in the same database your app already uses.