Module

Vector

Semantic search over your own content, in your own Cloudflare account. Workers AI embeds, Vectorize indexes, D1 keeps the text.

@pithy-sh/vector

terminal
pithy add vector
Read the docs Source on GitHub

What it is for

Semantic search over your own content, in your own account. Ask a question in words and get back the passages that mean the same thing, rather than the ones that share a keyword.

What it sits on

Vectorize, Workers AI and D1.

Workers AI produces the embeddings, Vectorize holds the index, and D1 keeps the text so a result can be rendered without a second store.

  • Vectorize
  • Workers AI
  • D1

The honest bit

The interesting part is the metadata, and it will catch you out.

Vectorize makes filterable metadata a provisioning-time decision wearing the costume of a query-time one, and gives you no error when you get it wrong — the filter simply returns nothing.

This package makes the decision explicit in your schema and checks it at boot, which is the whole reason it exists rather than a Vectorize call in your handler.

If you build it yourself

The search is the easy half.

Embedding text is one call. Making the results filterable is where people lose a week.

Metadata is a provisioning-time decision

Vectorize decides which fields are filterable when the index is created, and a filter on anything else returns nothing — with no error to tell you why.

Chunking

How you side-by-side a document decides what the search can find. Too small loses context, too large loses precision.

Keeping text and vectors in step

The index holds the embedding; something has to hold the passage, and the two must not drift.

Re-embedding on model change

A new model means every vector is stale, and a migration you cannot do in place.

Hybrid results

Semantic search alone misses exact matches, so most real search is two queries and a merge.

terminal
pithy add vector

In the dashboard

Administer it from a browser, without building the screen.

Index size, what is filterable, and whether your schema still matches what was provisioned.

The dashboard is the admin interface for your own application: whatever this capability writes, your team can look up, check and act on from a browser. Reading is free, forever, with no time limit. Connect the project when you deploy.

Add it, and get on with the feature.

One command installs the package, wires its bindings into every environment your project declares, and runs its migrations.