rhocfsandbox.com

demo: vectorize semantic search

a tiny corpus of cloudflare product descriptions has been embedded with @cf/baai/bge-base-en-v1.5 (768 dimensions) and stored in a vectorize index. the search box below embeds your query the same way, then queries the index for the nearest neighbors by cosine similarity. unlike keyword search, "how do i keep bad traffic out" will match on firewall/waf docs even though it doesn't mention those words.

example queries:

search something…

# architecture

  1. query text goes to page function /api/vector-search
  2. function calls workers ai (bge-base-en-v1.5) to embed the query into a 768-dim vector
  3. function calls env.VEC.query(vector, { topK: 5 }) on the vectorize index
  4. results include cosine similarity scores and the metadata we attached at insert time

# config

indexsite-vectorize-index
dimensions768
metriccosine
embedding model@cf/baai/bge-base-en-v1.5
bindingVEC