Skip to content
Jeremy Ayza
All cases

Work at CasaMarket

Voice search with embeddings in the browser

Voice search for products in the sale flow of a POS. The vector search runs in the browser, on the catalog the POS already keeps there.

Problem

The POS needed voice search for products in the sale flow, used with the company’s in-store hardware. During a sale, the search has to answer fast.

Decision

The flow has four steps: audio, transcription (gpt-4o-mini-transcribe), vector search for candidates, and product choice with gpt-4o-mini.

I decided to run the vector search in the browser, for three reasons:

  • Speed. There is no network trip for each search.
  • Cost. There is no embeddings service or vector database to pay for or maintain.
  • The catalog was already there. The POS keeps it in the browser to sell offline.
The four steps. Only the vector search runs in the browser. A flow with four steps: audio, transcription with gpt-4o-mini-transcribe, vector search for candidates, and product choice with gpt-4o-mini. The vector search runs in the browser, in a Web Worker, with Transformers.js and an Orama index. Transcription and product choice need a connection. Audio voice command Transcription gpt-4o-mini-transcribe needs connection Vector search all-MiniLM-L6 · Transformers.js Web Worker · Orama index Product choice gpt-4o-mini needs connection in the browser candidates
The four steps. Only the vector search runs in the browser.

The embeddings (all-MiniLM-L6) are computed with Transformers.js in a Web Worker. The index is an Orama index stored in the browser.

Result

It handles several products in one command, tracks usage with GA4 and loads only for companies that have it turned on. It is live in production, behind a per-company switch.

The search on this portfolio uses the same idea: open it from the header.

Limit

Transcription and product choice need a connection. Only the vector search is local.

Search this portfolio

The embeddings are computed in your browser. Nothing is sent to a server.