Morph

no

Original Documentation

Documentation Index#

Fetch the complete documentation index at: https://docs.trychroma.com/llms.txt Use this file to discover all available pages before exploring further.

Chroma provides a convenient wrapper around Morph’s embedding API. This embedding function runs remotely on Morph’s servers and requires an API key. You can get an API key by signing up for an account at Morph.

This embedding function relies on the openai python package, which you can install with pip install openai.

    import chromadb.utils.embedding_functions as embedding_functions
    morph_ef = embedding_functions.MorphEmbeddingFunction(
        api_key="YOUR_API_KEY",  # or set MORPH_API_KEY environment variable
        model_name="morph-embedding-v2"
    )
    morph_ef(input=["def calculate_sum(a, b):\n    return a + b", "class User:\n    def __init__(self, name):\n        self.name = name"])
    ```
  <span class="tab-end"></span>

  <span class="tab-start" data-tab-title="TypeScript"></span>
```typescript
    // npm install @chroma-core/morph

    import { MorphEmbeddingFunction } from "@chroma-core/morph";

    const embedder = new MorphEmbeddingFunction({
        api_key: "apiKey", // or set MORPH_API_KEY environment variable
        model_name: "morph-embedding-v2",
    });

    // use directly
    const embeddings = embedder.generate([
        "function calculate(a, b) { return a + b; }",
        "class User { constructor(name) { this.name = name; } }",
    ]);

    // pass documents to the .add and .query methods
    const collection = await client.createCollection({
        name: "name",
        embeddingFunction: embedder,
    });
    const collectionGet = await client.getCollection({
        name: "name",
        embeddingFunction: embedder,
    });
    ```
  <span class="tab-end"></span>
<span class="tab-group-end"></span>

For further details on Morph's models check the [documentation](https://docs.morphllm.com/api-reference/endpoint/embedding?utm_source=docs.trychroma.com).
Link last verified June 7, 2026. View original ↗
Source: Chroma Docs
Link last verified: 2026-03-04