Loading...
const results = await index.query(await embed(query), { topK: 5 });
return results;const results = await index.query(await embed(query), { topK: 5 });
return results.filter((r) => r.score >= MIN_SCORE);Dropping low-score matches avoids returning unrelated results when nothing in the index fits the query.
It can, with a multilingual embedding model that places similar meanings in different languages close together.
Embeddings capture general meaning, so rare tokens like error codes or SKUs may not stand out. Add keyword search for those.
Mostly. Semantic search is the goal, finding by meaning; vector search over embeddings is the usual way to do it.