Skip to main content
Write a text embedding extractor in three Python files, test it offline, and search with it. The manifest builds the bucket, collection and retriever your extractor plugs into, with six sample articles.

Jump to the manifest

custom-extractor-quickstart.namespace.yaml: apply it with one API call, then read the walkthrough below to change it.

At a glance

How the pieces connect

Buckets hold what you upload, collections turn it into searchable documents, and retrievers answer queries over the collections.

Deploy it

1

Get the manifest

2

Validate it

Validate runs every check apply runs and creates nothing. Fix each entry in errors, then run it again.
3

Apply it

Apply creates every resource in one call. wait_for_seed=true also waits until the sample objects are processed, so the first query below has documents to return.
The response lists each resource with its outcome in resources. Apply refuses a resource that already exists and rolls the whole apply back, so to apply the file again over this namespace add ?mode=create_missing, which creates only what is missing.

Run the first query

Look up the namespace id by name, then run text-search. Check status and warnings along with documents: a run that times out still answers 200, with status degraded.

Add your own data

Each object you add to a bucket is processed by every collection that reads it. This adds one object to articles. NAMESPACE_ID is the id from the namespace lookup above.
The object is PENDING until processing finishes, then COMPLETED or FAILED. Buckets and objects covers object states, retries and duplicates.

Retrievers

Type a question or a description and get the articles whose meaning is closest. Stages: feature_search Searches: article-embeddings

Collections

Each collection runs one extractor over a bucket, or over another collection’s documents.
text_extractor@v1 over bucket articles: each article embedded whole. Feeds text-search.Reads bucket articles with text_extractor v1.Inputs: text ← textCopied onto each document: topic

The manifest

Every resource above comes from this file. Change it and apply it again with ?mode=upsert to update what exists. Manifests documents each field.
custom-extractor-quickstart.namespace.yaml

Hand it to an agent

Paste this prompt into Claude Code, Cursor or another coding agent. To give the agent this whole page instead, use Copy page in the menu at the top of the page, or point it at the page’s Markdown at https://mixpeek.com/docs/templates/custom-extractor-quickstart.md.
Prompt

How it works

The manifest builds the part of the pipeline that stays the same whichever extractor you use: the articles bucket, a collection that embeds each article whole with the builtin text_extractor, and a retriever over it. Your extractor replaces the embedding step. A custom extractor is a folder of three Python files. manifest.py declares what the extractor writes, pipeline.py computes it for every object at ingest, and realtime.py embeds the query at search time, so query and documents share one vector space.
The manifest’s extractors: section accepts a registry extractor, a model or a container image pinned by digest. A folder of Python files is none of these, so you upload it with the custom extractor API and create its collection with POST /v1/collections.

Write the extractor

Create a folder named text_embed with these three files. The example embeds text with a SHA-256 hash, so it needs only numpy and pandas.
1

manifest.py

The features list declares one 128-dimension embedding. inference_type = "embedding" says that realtime.py serves query embeddings.
text_embed/manifest.py
Use the key names feature_type, feature_name, embedding_dim and distance_metric. With name, type, dimensions or distance the collection gets no vector index, and nothing fails until a search returns nothing.
2

pipeline.py

build_steps returns the processors that run over each batch. The processor reads the data column (raw text for a text blob, a storage URL for a binary one) and writes one vector per row into the column named after the feature.
text_embed/pipeline.py
3

realtime.py

run_inference embeds the query text the same way the pipeline embeds an article.
text_embed/realtime.py
A hash matches only an exact copy of an article and ranks everything else at random. It proves the wiring; for search by meaning, see Embed by meaning.

Validate it locally

Both checks run offline. lint validates manifest.py and runs the security scanner. test runs pipeline.py through Ray Data map_batches with sample rows, the way ingest feeds it, and checks that every feature column is filled.
Lint and test
A passing run ends with Test passed and text_embed_v1_embedding: 3/3 rows populated. plugins.py is the client the Custom Extractor API reference names.

Deploy it

Deploying uploads the folder as a zip, scans it, and starts the pipeline as a batch step and realtime.py as a query endpoint. Where that can happen depends on your deployment: Its plugin id is text_embed_1_0_0 (name and version, dots as underscores). Wait until its status reads DEPLOYED.

Point a collection at your extractor

Add a second collection over the same bucket that runs text_embed, process the articles through it, and add a retriever. These calls go to your dedicated host, so set MIXPEEK_API_URL to it.
1

Create the collection

A collection takes bucket ids, so look the bucket up by name first.
cURL
Check that vector_indexes lists one index. An empty list means the features keys in manifest.py are wrong.
2

Process the articles already in the bucket

Trigger the collection to run the articles already in the bucket. The call answers 202 with a batch id and a task id.
cURL
3

Create a retriever and search

The feature_uri names your extractor, its version and the feature. If the search finds no index, copy the URI from the collection’s vector_indexes.
cURL
The query is the full text of the computing article, so the hash extractor returns it first with a score near 1.
The first search after a deploy can return an empty documents list while the query endpoint starts. Read status and warnings, and retry after a few seconds.

Change it

Embed by meaning

Swap the hash for a sentence-transformers model and set embedding_dim to its output size (384 for all-MiniLM-L6-v2).
text_embed/manifest.py
text_embed/pipeline.py, text_to_embedding only
Set self.embedding_dim = 384 in the processor, make realtime.py call the same model, and run lint and test again.

Ship a new version

Each version is its own extractor with its own id (text_embed_1_1_0) and feature URI (mixpeek://text_embed@1.1.0/text_embed_v1_embedding). Deploy it, create a collection and retriever for it as above, and compare against 1.0.0 before you switch. plugins.py rollback text_embed 1.0.0 restores the earlier version.

Keep the model, drop the code

When the extractor only runs a model, the manifest can declare it with no upload. Uncomment the extractors: block, which imports BAAI/bge-small-en-v1.5 pinned to a commit, and point the collection and retriever at it:
article-embeddings and text-search, on the imported model
Change feature_extractors on the namespace to bge_small_hf too. A collection’s extractor is fixed at creation, so apply this to a new namespace by renaming every custom-extractor-quickstart namespace first. Bring your own model runs this end to end.