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
- query text goes to page function
/api/vector-search - function calls workers ai (
bge-base-en-v1.5) to embed the query into a 768-dim vector - function calls
env.VEC.query(vector, { topK: 5 })on the vectorize index - results include cosine similarity scores and the metadata we attached at insert time
# config
| index | site-vectorize-index |
| dimensions | 768 |
| metric | cosine |
| embedding model | @cf/baai/bge-base-en-v1.5 |
| binding | VEC |