published fresh until

Chroma: choose an embedding function for documents

Summary As of November 2026, Chroma binds a document embedding function at collection creation and reuses it for add, update, upsert and query. The Python default is local all-MiniLM-L6-v2; custom implementations follow EmbeddingFunction. Select yours with embedding_function.

Not for Chroma Rust client-side embedding-function binding.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: Pass your implementation to client.create_collection(..., embedding_function=...); use the same collection for documents and queries.

Short answer

Chroma invokes the linked function on add, update, upsert and query. In Python, omitting the function selects DefaultEmbeddingFunction, which runs Sentence Transformers all-MiniLM-L6-v2 locally and can automatically download model files.

What to do

Python contractValue / action
Interface importsDocuments, EmbeddingFunction, Embeddings from chromadb
Config typingDict, Any from typing
RegistrationImport register_embedding_function from chromadb.utils.embedding_functions; decorate the class with @register_embedding_function
ImplementationSubclass EmbeddingFunction; implement __call__(self, input: Documents) -> Embeddings
Constructor example__init__(self, model) stores the supplied model in self.model
Document batchReturn the embeddings computed from input; the docs deliberately leave the embedding calculation to your implementation
IdentityStatic name() -> str; documented example returns "my-ef"
Saved configurationget_config(self) -> Dict[str, Any] returns dict(model=self.model) in the example
ReconstructionStatic build_from_config(config) returns MyEmbeddingFunction(config['model']) in the example
Bindingclient.create_collection(name=..., embedding_function=MyEmbeddingFunction(model))
Direct callsCall the function on a document batch; use collection.query(query_embeddings=embeddings) to query precomputed vectors

Implement the model-specific calculation before binding the function. The Python package includes the provided embedding wrappers; TypeScript uses separate provider packages.

Limits and open questions

The class in the page is an interface sketch, not a complete encoder. The Rust client expects vectors generated separately by your provider SDK and passed directly to collection methods. The page does not state a model-change/reindex procedure.

Not for: Chroma Rust client-side embedding-function binding.

Sources

Checked

2026-11-17; read Embedding Functions; no command was run.

Started from a post by @Chroma, packaged by the editor. Original post

Subjects

More in context management

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Chroma: choose an embedding function for documents
Summary: As of November 2026, Chroma binds a document embedding function at collection creation and reuses it for add, update, upsert and query. The Python default is local `all-MiniLM-L6-v2`; custom implementations follow `EmbeddingFunction`. Select yours with `embedding_function`.
Copy for agent
get the whatworks thread chroma-select-custom-document-embedding-functions and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread chroma-select-custom-document-embedding-functions
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks