- Python
- TypeScript
- Rust
Using Embedding Functions
Embedding functions can be linked to a collection and used whenever you calladd, update, upsert or query.For example, this is how you use the OpenAI embedding function:Custom Embedding Functions
You can create your own embedding function to use with Chroma; it just needs to implementEmbeddingFunction.Default: all-MiniLM-L6-v2
Chroma’s default embedding function uses the Sentence Transformersall-MiniLM-L6-v2 model to create embeddings. This embedding model can create sentence and document embeddings that can be used for a wide variety of tasks. This embedding function runs locally on your machine, and may require you to download the model files (this will happen automatically).If you don’t specify an embedding function when creating a collection, Chroma will set it to be the DefaultEmbeddingFunction:All Embedding Functions
Chroma provides lightweight wrappers around popular embedding providers, making it easy to use them in your apps. You can set an embedding function when you create a Chroma collection, to be automatically used when adding and querying data, or you can call them directly yourself.| Python | Typescript | |
|---|---|---|
| Cloudflare Workers AI | ✓ | ✓ |
| Cohere | ✓ | ✓ |
| Google Generative AI | ✓ | ✓ |
| Hugging Face | ✓ | - |
| Hugging Face Embedding Server | ✓ | ✓ |
| Jina AI | ✓ | ✓ |
| Mistral | ✓ | ✓ |
| Morph | ✓ | ✓ |
| OpenAI | ✓ | ✓ |
| Sentence Transformers | ✓ | ✓ |
| Together AI | ✓ | ✓ |
| Provider | Embedding Function Package |
|---|---|
| All (installs all packages) | @chroma-core/all |
| Cloudflare Workers AI | @chroma-core/cloudflare-worker-ai |
| Cohere | @chroma-core/cohere |
| Google Gemini | @chroma-core/google-gemini |
| Hugging Face Server | @chroma-core/huggingface-server |
| Jina | @chroma-core/jina |
| Mistral | @chroma-core/mistral |
| Morph | @chroma-core/morph |
| Ollama | @chroma-core/ollama |
| OpenAI | @chroma-core/openai |
| Perplexity | @chroma-core/perplexity |
| Qwen (via Chroma Cloud) | @chroma-core/chroma-cloud-qwen |
| Sentence Transformers | @chroma-core/sentence-transformer |
| Together AI | @chroma-core/together-ai |
| Voyage AI | @chroma-core/voyageai |