# Embedding

Native embeddings convert your documents and queries into vectors as you read
from and write to turbopuffer. You don't need to write any code to integrate
with an embedding provider. Instead, turbopuffer handles embedding your data on
writes and queries.

Native embeddings are stored as a vector alongside the data that was embedded.
You can read and export the source data and the native embedding vectors like
you can any other field. You always own the data you store in turbopuffer.

To enable native embedding, use the `embed` property on an attribute's schema to
specify an embedding model. Writes and queries to that attribute are turned into
vectors on the fly.

<!-- multilang -->
```python
import turbopuffer

tpuf = turbopuffer.Turbopuffer(
    region="gcp-us-central1",  # pick a region: https://turbopuffer.com/docs/regions
)

# create a new namespace with native embeddings
ns = tpuf.namespace(f'embedding-intro-py')
ns.write(
    upsert_rows=[
        {
            "id": 1,
            "text": "A cat sleeping on a windowsill",
            "category": "animal",
        },
        {
            "id": 2,
            "text": "A playful kitten chasing a toy",
            "category": "animal",
        },
    ],
    distance_metric="cosine_distance",
    schema={
        "text": {
            "type": "string",
            # use native embeddings by setting the `embed` property on a text
            # attribute to your favorite model
            "embed": "nvidia/nemotron-3-embed-8b",
        },
    },
)
```
```typescript
import { Turbopuffer } from "@turbopuffer/turbopuffer";

const tpuf = new Turbopuffer({
  region: "gcp-us-central1", // pick a region: https://turbopuffer.com/docs/regions
});

// create a new namespace with native embeddings
const ns = tpuf.namespace(`embedding-intro-ts`);
await ns.write({
  upsert_rows: [
    {
      id: 1,
      text: "A cat sleeping on a windowsill",
      category: "animal",
    },
    {
      id: 2,
      text: "A playful kitten chasing a toy",
      category: "animal",
    },
  ],
  distance_metric: "cosine_distance",
  schema: {
    text: {
      type: "string",
      // use native embeddings by setting the `embed` property on a text
      // attribute to your favorite model
      embed: "nvidia/nemotron-3-embed-8b",
    },
  },
});
```
```rust
use turbopuffer::Client;
use turbopuffer::types::{AttributeSchemaConfig, DistanceMetric, Row};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // The API key is read from TURBOPUFFER_API_KEY. Create one here: https://turbopuffer.com/dashboard
    let client = Client::builder()
        .region("gcp-us-central1") // choose best region: https://turbopuffer.com/docs/regions
        .build()?;

    // create a new namespace with native embeddings
    let ns = client.namespace("embedding-intro-rs");
    ns.write()
        .upsert_rows([
            Row::new(1)
                .insert("text", "A cat sleeping on a windowsill")
                .insert("category", "animal"),
            Row::new(2)
                .insert("text", "A playful kitten chasing a toy")
                .insert("category", "animal"),
        ])
        .distance_metric(DistanceMetric::CosineDistance)
        .schema([(
            "text",
            AttributeSchemaConfig::new("string")
                // use native embeddings by setting `embed` on a text attribute
                // to your favorite model
                .embed("nvidia/nemotron-3-embed-8b"),
        )])
        .send()
        .await?;

    Ok(())
}
```
<!-- /multilang -->

## Pricing

Embedding is billed based on the number of tokens embedded by a model. How your
document translates into tokens is model dependent. A rough rule of thumb is
that 4 bytes of English text is about 1 token. The number of tokens embedded is
included in both the [query](/docs/query#responsefield-performance) and
[write](/docs/write#responsefield-performance) responses.

See the [list of available models](/docs/embedding#models) for pricing.

Use the calculator below to estimate monthly embedding cost from document size,
query size, model price, and write/query volume.

## Limitations

Native embeddings have a few limitations. Like our [other limits](/docs/limits),
there is nothing here that we can't improve if prioritized. If your native
embeddings use case is blocked by one of these limits, [contact us](/contact).

- Native embeddings always store the source document in turbopuffer, along with
  the embedding vector.

- Conditional upserts do not defer native embedding. If a row omits its target
  vector, turbopuffer embeds the source attribute before evaluating
  `upsert_condition`. Embedding tokens are billed and rate limits apply even if
  the condition skips the write. Supply the target vector to avoid native
  embedding for that row.

- You're constrained by our rate limits. We work tirelessly with our partners to
  make sure turbopuffer can embed as fast as it can index, but there may be
  situations where we have to rate-limit and return 429s. We keep a close eye on
  our capacity and scale up within and across providers to make sure you can
  keep puffin'. We treat any period of prolonged rate-limiting as a bug.

- Setting `embed` on an attribute does not yet automatically re-embed it with
  the specified model. Only subsequent writes are affected, so if you decide to
  change your embedding model you have to re-ingest the data in your namespaces.

- Multi-modal support is a work-in-progress. There is no dedicated
  [type](/docs/write#param-type) for image or video data, so to use multi-modal
  embeddings your source data must be stored as a base64 encoded `string`
  attribute.

- We don't yet support contextual models that chunk their inputs and produce a
  variable number of vectors. We want to get the API right before we make them
  available.

### Rate Limits

We manage rate limits at the organization level to provide [tenant
isolation](/docs/architecture). We currently limit new organizations to 1024
requests per minute and 2M tokens per minute for each model we support, but aim
to increase this over time. [Contact us](/contact) at any time and we'll raise
your rate limit to match your workload.

Rate limits are opaque - there is no way to know how close you are to your
limits. When limited, the API will return an HTTP `429 Too Many Requests`
response with an appropriate message to let you know you've been rate limited.
Each request is accepted or rate limited in full. For example, a large batch write may exceed your remaining capacity even when a smaller query would be accepted.

## Models

The following models are available for native embeddings. Click on a model in
the table for detailed information, and use the region selector above the table
to see which models are available in each [region](/docs/regions). If you'd like
to use a model that isn't listed here, please [get in touch](/contact).

**`baai/bge-m3`**

- Price ($/1M tokens): $0.01
- RTEB: 56.39
- Type: text
- Dimensions: 1024 (default)
- Data types: f16, f32
- Context length: 8,192 tokens
- Availability by inference location:
  - US: `aws-ca-central-1`, `aws-us-east-1`, `aws-us-east-2`, `aws-us-west-2`, `gcp-us-central1`, `gcp-us-east1`, `gcp-us-west1`, `gcp-us-east4`, `gcp-northamerica-northeast2`
    - BAA: Yes
  - EU: `aws-eu-central-1`, `aws-eu-west-1`, `aws-eu-west-2`, `gcp-europe-west3`, `gcp-europe-west1`
    - BAA: Yes

**`cohere/embed-v4.0`**

- Price ($/1M tokens): $0.12
- RTEB: 72.99
- Type: text
- Dimensions: 256, 512, 1024, 1536 (default)
- Data types: f16, f32
- Context length: 128,000 tokens
- Availability by inference location:
  - AWS ap-northeast-1: `aws-ap-southeast-2`, `aws-ap-southeast-1`
    - BAA: Yes
  - US: `aws-ca-central-1`, `aws-us-east-1`, `aws-us-east-2`, `aws-us-west-2`, `gcp-us-central1`, `gcp-us-east1`, `gcp-us-west1`, `gcp-us-east4`
    - BAA: Yes
  - EU: `aws-eu-central-1`, `aws-eu-west-1`, `aws-eu-west-2`, `gcp-europe-west3`, `gcp-europe-west1`
    - BAA: Yes

**`google/embeddinggemma-2`**

- Price ($/1M tokens): $0.01
- RTEB: —
- Type: text
- Dimensions: 128, 256, 512, 768 (default)
- Data types: f16, f32
- Context length: 8,192 tokens
- Availability by inference location:
  - US: `aws-ca-central-1`, `aws-us-east-1`, `aws-us-east-2`, `aws-us-west-2`, `gcp-us-central1`, `gcp-us-east1`, `gcp-us-west1`, `gcp-us-east4`, `gcp-northamerica-northeast2`
    - BAA: Yes
  - EU: `aws-eu-central-1`, `aws-eu-west-1`, `aws-eu-west-2`, `gcp-europe-west3`, `gcp-europe-west1`
    - BAA: Yes

**`google/gemini-embedding-2`**

- Price ($/1M tokens): $0.20
- RTEB: 68.40
- Type: multimodal (coming soon)
- Dimensions: 768, 1536 (default), 3072
- Data types: f16, f32
- Context length: 8,192 tokens
- Availability by inference location:
  - US: `aws-ca-central-1`, `aws-us-east-1`, `aws-us-east-2`, `aws-us-west-2`, `gcp-us-central1`, `gcp-us-east1`, `gcp-us-west1`, `gcp-us-east4`, `gcp-northamerica-northeast2`
    - BAA: Yes
  - EU: `aws-eu-central-1`, `aws-eu-west-1`, `aws-eu-west-2`, `gcp-europe-west3`, `gcp-europe-west1`
    - BAA: Yes

**`nvidia/nemotron-3-embed-1b`**

- Price ($/1M tokens): $0.02
- RTEB: —
- Type: text
- Dimensions: 512, 1024, 2048 (default)
- Data types: f16, f32
- Context length: 32,768 tokens
- Availability by inference location:
  - US: `aws-ca-central-1`, `aws-us-east-1`, `aws-us-east-2`, `aws-us-west-2`, `gcp-us-central1`, `gcp-us-east1`, `gcp-us-west1`, `gcp-us-east4`, `gcp-northamerica-northeast2`
    - BAA: Yes
  - EU: `aws-eu-central-1`, `aws-eu-west-1`, `aws-eu-west-2`, `gcp-europe-west3`, `gcp-europe-west1`
    - BAA: Yes

**`nvidia/nemotron-3-embed-8b`**

- Price ($/1M tokens): $0.05
- RTEB: —
- Type: text
- Dimensions: 512, 1024, 2048, 4096 (default)
- Data types: f16, f32
- Context length: 32,768 tokens
- Availability by inference location:
  - US: `aws-ca-central-1`, `aws-us-east-1`, `aws-us-east-2`, `aws-us-west-2`, `gcp-us-central1`, `gcp-us-east1`, `gcp-us-west1`, `gcp-us-east4`, `gcp-northamerica-northeast2`
    - BAA: Yes
  - EU: `aws-eu-central-1`, `aws-eu-west-1`, `aws-eu-west-2`, `gcp-europe-west3`, `gcp-europe-west1`
    - BAA: Yes

**`nvidia/nemotron-3.5-embed-1b`**

- Price ($/1M tokens): $0.02
- RTEB: —
- Type: text
- Dimensions: 512, 1024, 2048 (default)
- Data types: f16, f32
- Context length: 32,768 tokens
- Availability by inference location:
  - US: `aws-ca-central-1`, `aws-us-east-1`, `aws-us-east-2`, `aws-us-west-2`, `gcp-us-central1`, `gcp-us-east1`, `gcp-us-west1`, `gcp-us-east4`, `gcp-northamerica-northeast2`
    - BAA: Yes
  - EU: `aws-eu-central-1`, `aws-eu-west-1`, `aws-eu-west-2`, `gcp-europe-west3`, `gcp-europe-west1`
    - BAA: Yes

**`nvidia/nemotron-3.5-embed-8b`**

- Price ($/1M tokens): $0.05
- RTEB: —
- Type: text
- Dimensions: 512, 1024, 2048, 4096 (default)
- Data types: f16, f32
- Context length: 32,768 tokens
- Availability by inference location:
  - US: `aws-ca-central-1`, `aws-us-east-1`, `aws-us-east-2`, `aws-us-west-2`, `gcp-us-central1`, `gcp-us-east1`, `gcp-us-west1`, `gcp-us-east4`, `gcp-northamerica-northeast2`
    - BAA: Yes
  - EU: `aws-eu-central-1`, `aws-eu-west-1`, `aws-eu-west-2`, `gcp-europe-west3`, `gcp-europe-west1`
    - BAA: Yes

**`openai/text-embedding-3-large`**

- Price ($/1M tokens): $0.13
- RTEB: —
- Type: text
- Dimensions: 256, 512, 1024, 1536, 3072 (default)
- Data types: f16, f32
- Context length: 8,191 tokens
- Availability by inference location:
  - Global: `aws-ca-central-1`, `aws-eu-central-1`, `aws-eu-west-1`, `aws-eu-west-2`, `aws-us-east-1`, `aws-us-east-2`, `aws-us-west-2`, `gcp-us-central1`, `gcp-us-east1`, `gcp-us-west1`, `gcp-us-east4`, `gcp-northamerica-northeast2`, `gcp-europe-west3`, `gcp-europe-west1`
    - BAA: Yes

**`openai/text-embedding-3-small`**

- Price ($/1M tokens): $0.02
- RTEB: —
- Type: text
- Dimensions: 256, 512, 768, 1024, 1536 (default)
- Data types: f16, f32
- Context length: 8,191 tokens
- Availability by inference location:
  - Global: `aws-ca-central-1`, `aws-eu-central-1`, `aws-eu-west-1`, `aws-eu-west-2`, `aws-us-east-1`, `aws-us-east-2`, `aws-us-west-2`, `gcp-us-central1`, `gcp-us-east1`, `gcp-us-west1`, `gcp-us-east4`, `gcp-northamerica-northeast2`, `gcp-europe-west3`, `gcp-europe-west1`
    - BAA: Yes

**`openai/text-embedding-ada-002`**

- Price ($/1M tokens): $0.10
- RTEB: —
- Type: text
- Dimensions: 1536 (default)
- Data types: f16, f32
- Context length: 8,191 tokens
- Availability by inference location:
  - Global: `aws-ca-central-1`, `aws-eu-central-1`, `aws-eu-west-1`, `aws-eu-west-2`, `aws-us-east-1`, `aws-us-east-2`, `aws-us-west-2`, `gcp-us-central1`, `gcp-us-east1`, `gcp-us-west1`, `gcp-us-east4`, `gcp-northamerica-northeast2`, `gcp-europe-west3`, `gcp-europe-west1`
    - BAA: Yes

**`qwen/qwen3-embedding-0p6b`**

- Price ($/1M tokens): $0.01
- RTEB: —
- Type: text
- Dimensions: 256, 384, 512, 768, 1024 (default)
- Data types: i8, f16, f32
- Context length: 32,768 tokens
- Availability by inference location:
  - US: `aws-ca-central-1`, `aws-us-east-1`, `aws-us-east-2`, `aws-us-west-2`, `gcp-us-central1`, `gcp-us-east1`, `gcp-us-west1`, `gcp-us-east4`, `gcp-northamerica-northeast2`
    - BAA: Yes
  - EU: `aws-eu-central-1`, `aws-eu-west-1`, `aws-eu-west-2`, `gcp-europe-west3`, `gcp-europe-west1`
    - BAA: Yes

**`qwen/qwen3-embedding-4b`**

- Price ($/1M tokens): $0.02
- RTEB: —
- Type: text
- Dimensions: 512, 1024 (default), 1536, 2048, 2560
- Data types: i8, f16, f32
- Context length: 32,768 tokens
- Availability by inference location:
  - US: `aws-ca-central-1`, `aws-us-east-1`, `aws-us-east-2`, `aws-us-west-2`, `gcp-us-central1`, `gcp-us-east1`, `gcp-us-west1`, `gcp-us-east4`, `gcp-northamerica-northeast2`
    - BAA: Yes
  - EU: `aws-eu-central-1`, `aws-eu-west-1`, `aws-eu-west-2`, `gcp-europe-west3`, `gcp-europe-west1`
    - BAA: Yes

**`qwen/qwen3-embedding-8b`**

- Price ($/1M tokens): $0.07
- RTEB: 72.43
- Type: text
- Dimensions: 512, 1024 (default), 1536, 2048, 3072, 4096
- Data types: i8, f16, f32
- Context length: 32,768 tokens
- Availability by inference location:
  - US: `aws-ca-central-1`, `aws-eu-central-1`, `aws-us-east-1`, `gcp-us-central1`, `gcp-us-east4`, `gcp-northamerica-northeast2`, `gcp-europe-west3`
    - BAA: Yes

**`voyage/voyage-4`**

- Price ($/1M tokens): $0.06
- RTEB: 77.94
- Type: text
- Dimensions: 256, 512, 1024 (default), 2048
- Data types: i8, f16, f32
- Context length: 32,000 tokens
- Availability by inference location:
  - Global: `aws-ca-central-1`, `aws-eu-central-1`, `aws-eu-west-1`, `aws-eu-west-2`, `aws-us-east-1`, `aws-us-east-2`, `aws-us-west-2`, `gcp-us-central1`, `gcp-us-east1`, `gcp-us-west1`, `gcp-us-east4`, `gcp-northamerica-northeast2`, `gcp-europe-west3`, `gcp-europe-west1`
    - BAA: Yes

**`voyage/voyage-4-large`**

- Price ($/1M tokens): $0.12
- RTEB: 79.70
- Type: text
- Dimensions: 256, 512, 1024 (default), 2048
- Data types: i8, f16, f32
- Context length: 32,000 tokens
- Availability by inference location:
  - Global: `aws-ca-central-1`, `aws-eu-central-1`, `aws-eu-west-1`, `aws-eu-west-2`, `aws-us-east-1`, `aws-us-east-2`, `aws-us-west-2`, `gcp-us-central1`, `gcp-us-east1`, `gcp-us-west1`, `gcp-us-east4`, `gcp-northamerica-northeast2`, `gcp-europe-west3`, `gcp-europe-west1`
    - BAA: Yes

**`voyage/voyage-4-lite`**

- Price ($/1M tokens): $0.02
- RTEB: 75.07
- Type: text
- Dimensions: 256, 512, 1024 (default), 2048
- Data types: i8, f16, f32
- Context length: 32,000 tokens
- Availability by inference location:
  - Global: `aws-ca-central-1`, `aws-eu-central-1`, `aws-eu-west-1`, `aws-eu-west-2`, `aws-us-east-1`, `aws-us-east-2`, `aws-us-west-2`, `gcp-us-central1`, `gcp-us-east1`, `gcp-us-west1`, `gcp-us-east4`, `gcp-northamerica-northeast2`, `gcp-europe-west3`, `gcp-europe-west1`
    - BAA: Yes

**`voyage/voyage-4-nano`**

- Price ($/1M tokens): $0.016
- RTEB: —
- Type: text
- Dimensions: 256, 512, 1024 (default), 2048
- Data types: f16, f32
- Context length: 32,000 tokens
- Availability by inference location:
  - US: `aws-ca-central-1`, `aws-us-east-1`, `aws-us-east-2`, `aws-us-west-2`, `gcp-us-central1`, `gcp-us-east1`, `gcp-us-west1`, `gcp-us-east4`, `gcp-northamerica-northeast2`
    - BAA: Yes
  - EU: `aws-eu-central-1`, `aws-eu-west-1`, `aws-eu-west-2`, `gcp-europe-west3`, `gcp-europe-west1`
    - BAA: Yes

**`voyage/voyage-code-3`**

- Price ($/1M tokens): $0.18
- RTEB: 23.15
- Type: text
- Dimensions: 256, 512, 1024 (default), 2048
- Data types: i8, f16, f32
- Context length: 32,000 tokens
- Availability by inference location:
  - Global: `aws-ca-central-1`, `aws-eu-central-1`, `aws-eu-west-1`, `aws-eu-west-2`, `aws-us-east-1`, `aws-us-east-2`, `aws-us-west-2`, `gcp-us-central1`, `gcp-us-east1`, `gcp-us-west1`, `gcp-us-east4`, `gcp-northamerica-northeast2`, `gcp-europe-west3`, `gcp-europe-west1`
    - BAA: Yes

**`voyage/voyage-code-4`**

- Price ($/1M tokens): $0.12
- RTEB: —
- Type: text
- Dimensions: 256, 512, 1024 (default), 2048
- Data types: i8, f16, f32
- Context length: 32,000 tokens
- Availability by inference location:
  - Global: `aws-ca-central-1`, `aws-eu-central-1`, `aws-eu-west-1`, `aws-eu-west-2`, `aws-us-east-1`, `aws-us-east-2`, `aws-us-west-2`, `gcp-us-central1`, `gcp-us-east1`, `gcp-us-west1`, `gcp-us-east4`, `gcp-northamerica-northeast2`, `gcp-europe-west3`, `gcp-europe-west1`
    - BAA: Yes

**`zeroentropy/zembed-1`**

- Price ($/1M tokens): $0.05
- RTEB: —
- Type: text
- Dimensions: 40, 80, 160, 320, 640, 1280 (default), 2560
- Data types: f16, f32
- Context length: 32,768 tokens
- Availability by inference location:
  - US: `aws-ca-central-1`, `aws-us-east-1`, `aws-us-east-2`, `aws-us-west-2`, `gcp-us-central1`, `gcp-us-east1`, `gcp-us-west1`, `gcp-us-east4`, `gcp-northamerica-northeast2`
    - BAA: Yes
  - EU: `aws-eu-central-1`, `aws-eu-west-1`, `aws-eu-west-2`, `gcp-europe-west3`, `gcp-europe-west1`
    - BAA: Yes

The [embedding changelog](/docs/embedding/changelog) tracks the models we've
added, deprecated, and repriced over time. A few more things to know about the
models above:

- Context length is the maximum number of input tokens a model will consider
  in an individual embedding input.

- Inputs longer than a model's context length are **truncated by default**, so a
  long document is embedded from its beginning rather than rejected.

- Models that distinguish queries from documents are prompted for you: we send
  the right input type, or prepend the model's own prompt prefix, depending on
  whether the text comes from a write or a query. You don't have to add
  anything to your text.

- The dimension marked `(default)` is the model's default output dimension.

- The listed [RTEB](https://huggingface.co/spaces/embedding-benchmark/RTEB)
  score is the overall score. 

- Every model runs with zero data retention: our
  [inference providers](/docs/security/subprocessors) do not store the content
  you send, and do not train on it.

### Recommendations

Picking an embedding model can deeply impact the quality, cost, and latency of
your retrieval pipeline. Unfortunately, it's both a difficult decision and one
that's hard to change (though we're working on making it easy). The quality of
an embedding model is highly dependent on exactly what you're searching over.
The best way to choose an embedding model is to [run an
eval](https://georgianailab.substack.com/p/evaluating-retrieval-without-ground)
that measures how an embedding model affects your application. If you can't do
that, the [RTEB](https://huggingface.co/spaces/embedding-benchmark/RTEB)
scores in the table above are an ok guide.

When picking a model, we recommend thinking about the quality, cost, and latency
tradeoffs in your application. It may be tempting to always pick the "best"
model, but if you need interactive search your users may be more sensitive to
latency than they are to slightly worse recall. Conversely, if you're powering a
search agent it may be better to spend more up-front on an embedding model to
reduce the number of tokens the agent needs to answer questions. 
Every [query](/docs/query#responsefield-performance) and
[write](/docs/write#responsefield-performance) response reports the time spent
embedding as `embedding_ms`, so you can measure a model's latency against your
own data before committing to it.

### Deprecated models

The following models are available in native embeddings but are marked
deprecated. We'll support these models as long as we can to make migration easy,
but we strongly recommend against using them for new namespaces.

The deprecation date listed on a model is the earliest date at which we'll
remove support for a model.

**`google/gemini-embedding-001`**

- Price ($/1M tokens): $0.15
- RTEB: 75.85
- Type: text
- Dimensions: 768, 1536 (default), 3072
- Data types: f16, f32
- Context length: 2,048 tokens
- Availability by inference location:
  - GCP us-east4: `aws-ca-central-1`, `aws-us-east-1`, `aws-us-east-2`, `aws-us-west-2`, `gcp-us-east4`, `gcp-northamerica-northeast2`
    - BAA: Yes
  - GCP europe-west3: `aws-eu-central-1`, `aws-eu-west-1`, `aws-eu-west-2`, `gcp-europe-west3`
    - BAA: Yes
  - GCP us-central1: `gcp-us-central1`
    - BAA: Yes
  - GCP us-east1: `gcp-us-east1`
    - BAA: Yes
  - GCP us-west1: `gcp-us-west1`
    - BAA: Yes
  - GCP europe-west1: `gcp-europe-west1`
    - BAA: Yes

**`google/text-embedding-005`**

- Price ($/1M tokens): $0.025
- RTEB: —
- Type: text
- Dimensions: 256, 512, 768 (default)
- Data types: f16, f32
- Context length: 2,048 tokens
- Deprecation date: 2027-04-01
- Availability by inference location:
  - GCP us-east4: `aws-ca-central-1`, `aws-us-east-1`, `aws-us-east-2`, `aws-us-west-2`, `gcp-us-east4`, `gcp-northamerica-northeast2`
    - BAA: Yes
  - GCP europe-west3: `aws-eu-central-1`, `aws-eu-west-1`, `aws-eu-west-2`, `gcp-europe-west3`
    - BAA: Yes
  - GCP us-central1: `gcp-us-central1`
    - BAA: Yes
  - GCP us-east1: `gcp-us-east1`
    - BAA: Yes
  - GCP us-west1: `gcp-us-west1`
    - BAA: Yes
  - GCP europe-west1: `gcp-europe-west1`
    - BAA: Yes

**`voyage/voyage-3-large`**

- Price ($/1M tokens): $0.18
- RTEB: 78.26
- Type: text
- Dimensions: 256, 512, 1024 (default), 2048
- Data types: i8, f16, f32
- Context length: 32,768 tokens
- Availability by inference location:
  - Global: `aws-ca-central-1`, `aws-eu-central-1`, `aws-eu-west-1`, `aws-eu-west-2`, `aws-us-east-1`, `aws-us-east-2`, `aws-us-west-2`, `gcp-us-central1`, `gcp-us-east1`, `gcp-us-west1`, `gcp-us-east4`, `gcp-northamerica-northeast2`, `gcp-europe-west3`, `gcp-europe-west1`
    - BAA: Yes

**`voyage/voyage-3.5`**

- Price ($/1M tokens): $0.06
- RTEB: 74.66
- Type: text
- Dimensions: 256, 512, 1024 (default), 2048
- Data types: i8, f16, f32
- Context length: 32,768 tokens
- Availability by inference location:
  - Global: `aws-ca-central-1`, `aws-eu-central-1`, `aws-eu-west-1`, `aws-eu-west-2`, `aws-us-east-1`, `aws-us-east-2`, `aws-us-west-2`, `gcp-us-central1`, `gcp-us-east1`, `gcp-us-west1`, `gcp-us-east4`, `gcp-northamerica-northeast2`, `gcp-europe-west3`, `gcp-europe-west1`
    - BAA: Yes

**`voyage/voyage-3.5-lite`**

- Price ($/1M tokens): $0.02
- RTEB: —
- Type: text
- Dimensions: 256, 512, 1024 (default), 2048
- Data types: i8, f16, f32
- Context length: 32,768 tokens
- Availability by inference location:
  - Global: `aws-ca-central-1`, `aws-eu-central-1`, `aws-eu-west-1`, `aws-eu-west-2`, `aws-us-east-1`, `aws-us-east-2`, `aws-us-west-2`, `gcp-us-central1`, `gcp-us-east1`, `gcp-us-west1`, `gcp-us-east4`, `gcp-northamerica-northeast2`, `gcp-europe-west3`, `gcp-europe-west1`
    - BAA: Yes

## Examples

### Creating a new namespace

Create a new namespace with native embeddings on a `text` attribute.

<!-- multilang -->
```python
import turbopuffer

tpuf = turbopuffer.Turbopuffer(
    region="gcp-us-central1",  # pick a region: https://turbopuffer.com/docs/regions
)

# create a new namespace with native embeddings
ns = tpuf.namespace(f'embedding-new-namespace-py')
ns.write(
    upsert_rows=[
        {
            "id": 1,
            "text": "A cat sleeping on a windowsill",
            "category": "animal",
        },
        {
            "id": 2,
            "text": "A playful kitten chasing a toy",
            "category": "animal",
        },
    ],
    distance_metric="cosine_distance",
    schema={
        "text": {
            "type": "string",
            # use native embeddings to set an embedding model and the size
            # of the embedding vector
            "embed": {
                "model": "nvidia/nemotron-3-embed-8b",
                "dims": 1024,
            },
        },
    },
)

# future writes don't need to specify the schema or the `embed_text` attribute.
# the text attribute is turned into a vector on every write.
ns.write(
    upsert_rows=[
        {
            "id": 3,
            "text": "An airplane flying through clouds",
            "category": "vehicle",
        },
        {
            "id": 4,
            "text": "A shiny red sports car",
            "category": "vehicle",
        },
    ],
)

# use the Embed function with ANN or kNN to turn text input into a vector
ns.query(
    include_attributes=["id", "text", "embed_text"],
    rank_by=("text", "ANN", ("Embed", "something high energy")),
    limit=10,
)
```
```typescript
import { Turbopuffer } from "@turbopuffer/turbopuffer";

const tpuf = new Turbopuffer({
  region: "gcp-us-central1", // pick a region: https://turbopuffer.com/docs/regions
});

// create a new namespace with native embeddings
const ns = tpuf.namespace(`embedding-new-namespace-ts`);
await ns.write({
  upsert_rows: [
    {
      id: 1,
      text: "A cat sleeping on a windowsill",
      category: "animal",
    },
    {
      id: 2,
      text: "A playful kitten chasing a toy",
      category: "animal",
    },
  ],
  distance_metric: "cosine_distance",
  schema: {
    text: {
      type: "string",
      // use native embeddings to set an embedding model and the size
      // of the embedding vector
      embed: {
        model: "nvidia/nemotron-3-embed-8b",
        dims: 1024,
      }
    },
  },
});

// future writes don't need to specify the schema or the `embed_text` attribute.
// the text attribute is turned into a vector on every write.
await ns.write({
  upsert_rows: [
    {
      id: 3,
      text: "An airplane flying through clouds",
      category: "vehicle",
    },
    {
      id: 4,
      text: "A shiny red sports car",
      category: "vehicle",
    },
  ]
})

// use the Embed function with ANN or kNN to turn text input into a vector
await ns.query({
  include_attributes: ["id", "text", "embed_text"],
  rank_by: ["text", "ANN", ["Embed", "something high energy"]],
  limit: 10,
});
```
```rust
use turbopuffer::Client;
use turbopuffer::types::{
    AttributeEmbedConfig, AttributeSchemaConfig, DistanceMetric, Expr, RankBy, Row,
};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // The API key is read from TURBOPUFFER_API_KEY. Create one here: https://turbopuffer.com/dashboard
    let client = Client::builder()
        .region("gcp-us-central1") // choose best region: https://turbopuffer.com/docs/regions
        .build()?;

    // create a new namespace with native embeddings
    let ns = client.namespace("embedding-new-namespace-rs");
    ns.write()
        .upsert_rows([
            Row::new(1)
                .insert("text", "A cat sleeping on a windowsill")
                .insert("category", "animal"),
            Row::new(2)
                .insert("text", "A playful kitten chasing a toy")
                .insert("category", "animal"),
        ])
        .distance_metric(DistanceMetric::CosineDistance)
        .schema([(
            "text",
            AttributeSchemaConfig::new("string")
                // use native embeddings to set an embedding model and the size
                // of the embedding vector
                .embed(AttributeEmbedConfig::new("nvidia/nemotron-3-embed-8b").dims(1024)),
        )])
        .send()
        .await?;

    // future writes don't need to specify the schema or the `embed_text` attribute.
    // the text attribute is turned into a vector on every write.
    ns.write()
        .upsert_rows([
            Row::new(3)
                .insert("text", "An airplane flying through clouds")
                .insert("category", "vehicle"),
            Row::new(4)
                .insert("text", "A shiny red sports car")
                .insert("category", "vehicle"),
        ])
        .send()
        .await?;

    // use the Embed function with ANN or kNN to turn text input into a vector
    ns.query()
        .include_attributes(["id", "text", "embed_text"])
        .rank_by(RankBy::ann("text", Expr::embed("something high energy")))
        .limit(10)
        .send()
        .await?;

    Ok(())
}
```
<!-- /multilang -->

### Query-only native embeddings

If you've already invested in embedding a large batch of documents, you can
ingest them into turbopuffer and use native embeddings to query them.

<!-- multilang -->
```python
import random

import turbopuffer

tpuf = turbopuffer.Turbopuffer(
    region="gcp-us-central1",  # pick a region: https://turbopuffer.com/docs/regions
)

def embed(_text: str, n: int = 1024) -> list[float]:
    return [random.random() for _ in range(n)]

# creating a new namespace that uses your own embedding model to embed
# documents, and write a few documents into the namespace.
ns = tpuf.namespace(f'embedding-query-only-py')
ns.write(
    upsert_rows=[
        {
            "id": 1,
            "vector": embed("walrus narwhal"),
            "public": True,
            "text": "walrus narwhal",
        },
        {
            "id": 2,
            "vector": embed("pufferfish clownfish swordfish"),
            "public": False,
            "text": "pufferfish clownfish swordfish",
        },
    ],
    distance_metric="cosine_distance",
    schema={
        "text": {"type": "string", "full_text_search": True, "regex": True},
    },
)

# use the Embed function with an explicit model to let native embeddings handle
# the query embeddings. this should match the model you're using to embed
# documents or you might get some strange results.
ns.query(
    include_attributes=["id", "text", "vector"],
    rank_by=(
        "vector",
        "ANN",
        ("Embed", "something high energy", {"model": "nvidia/nemotron-3-embed-8b"}),
    ),
    limit=10,
)
```
```typescript
import { Turbopuffer } from "@turbopuffer/turbopuffer";

const tpuf = new Turbopuffer({
  region: "gcp-us-central1", // pick a region: https://turbopuffer.com/docs/regions
});

function embed(_text: string, n: number = 1024): number[] {
  return Array.from({ length: n }, () => Math.random());
}

// creating a new namespace that uses your own embedding model to embed
// documents, and write a few documents into the namespace.
const ns = tpuf.namespace(`embedding-query-only-ts`);
await ns.write({
  upsert_rows: [
    {
      id: 1,
      vector: embed("walrus narwhal"),
      public: true,
      text: "walrus narwhal",
    },
    {
      id: 2,
      vector: embed("pufferfish clownfish swordfish"),
      public: false,
      text: "pufferfish clownfish swordfish",
    },
  ],
  distance_metric: "cosine_distance",
  schema: {
    text: { type: "string", full_text_search: true, regex: true },
  },
});

// use the Embed function with an explicit model to let native embeddings handle
// the query embeddings. this should match the model you're using to embed
// documents or you might get some strange results.
await ns.query({
  include_attributes: ["id", "text", "vector"],
  rank_by: ["vector", "ANN", ["Embed", "something high energy", {model: "nvidia/nemotron-3-embed-8b"}]],
  limit: 10,
});
```
```rust
// $ cargo add turbopuffer tokio rand --features tokio/full
use turbopuffer::Client;
use turbopuffer::types::{AttributeSchemaConfig, DistanceMetric, EmbedParams, Expr, RankBy, Row};

/// Stand-in for your own embedding model.
fn embed(_text: &str) -> Vec<f32> {
    (0..1024).map(|_| rand::random()).collect()
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // The API key is read from TURBOPUFFER_API_KEY. Create one here: https://turbopuffer.com/dashboard
    let client = Client::builder()
        .region("gcp-us-central1") // choose best region: https://turbopuffer.com/docs/regions
        .build()?;

    // creating a new namespace that uses your own embedding model to embed
    // documents, and write a few documents into the namespace.
    let ns = client.namespace("embedding-query-only-rs");
    ns.write()
        .upsert_rows([
            Row::new(1)
                .vector(embed("walrus narwhal"))
                .insert("public", true)
                .insert("text", "walrus narwhal"),
            Row::new(2)
                .vector(embed("pufferfish clownfish swordfish"))
                .insert("public", false)
                .insert("text", "pufferfish clownfish swordfish"),
        ])
        .distance_metric(DistanceMetric::CosineDistance)
        .schema([(
            "text",
            AttributeSchemaConfig::new("string")
                .full_text_search(true)
                .regex(true),
        )])
        .send()
        .await?;

    // use the Embed function with an explicit model to let native embeddings handle
    // the query embeddings. this should match the model you're using to embed
    // documents or you might get some strange results.
    ns.query()
        .include_attributes(["id", "text", "vector"])
        .rank_by(RankBy::ann(
            "vector",
            Expr::embed_with_params(
                "something high energy",
                EmbedParams::new().model("nvidia/nemotron-3-embed-8b"),
            ),
        ))
        .limit(10)
        .send()
        .await?;

    Ok(())
}
```
<!-- /multilang -->

### Supplying your own vectors

With `embed` set, you can still provide a vector yourself. Each row that
includes a vector is stored as-is, and rows with no vector have one computed
by sending the attribute to an embedding provider.

That makes it possible to backfill vectors computed elsewhere while new
documents are embedded for you, and to roll a write path over to native
embeddings gradually instead of all at once.

<!-- multilang -->
```python
import random

import turbopuffer

tpuf = turbopuffer.Turbopuffer(
    region="gcp-us-central1",  # pick a region: https://turbopuffer.com/docs/regions
)

def embed(_text: str, n: int = 1024) -> list[float]:
    return [random.random() for _ in range(n)]

# create a namespace with native embeddings on `text`
ns = tpuf.namespace(f'embedding-supplied-vectors-py')
ns.write(
    upsert_rows=[
        {
            "id": 1,
            "text": "walrus narwhal",
        },
    ],
    distance_metric="cosine_distance",
    schema={
        "text": {
            "type": "string",
            "embed": {
                "model": "nvidia/nemotron-3-embed-8b",
                "attribute": "vector",
                "dims": 1024,
            },
        },
    },
)

# backfill documents you already embedded elsewhere. these are stored as sent,
# and are never sent to the embedding provider.
ns.write(
    upsert_rows=[
        {
            "id": 2,
            "vector": embed("pufferfish clownfish swordfish"),
            "text": "pufferfish clownfish swordfish",
        },
        {
            "id": 3,
            "vector": embed("zebra horse antelope"),
            "text": "zebra horse antelope",
        },
    ],
)

# you can mix and match pre-computed and native embeddings in the same write.
ns.write(
    upsert_rows=[
        {
            "id": 4,
            "vector": embed("manatee dugong"),
            "text": "manatee dugong",
        },
        {
            "id": 5,
            "text": "octopus cuttlefish",
        },
    ],
)

# queries are unaffected: every row has a vector either way
ns.query(
    include_attributes=["id", "text", "vector"],
    rank_by=("text", "ANN", ("Embed", "a pointy fish")),
    limit=10,
)
```
```typescript
import { Turbopuffer } from "@turbopuffer/turbopuffer";

const tpuf = new Turbopuffer({
  region: "gcp-us-central1", // pick a region: https://turbopuffer.com/docs/regions
});

function embed(_text: string, n: number = 1024): number[] {
  return Array.from({ length: n }, () => Math.random());
}

// create a namespace with native embeddings on `text`
const ns = tpuf.namespace(`embedding-supplied-vectors-ts`);
await ns.write({
  upsert_rows: [
    {
      id: 1,
      text: "walrus narwhal",
    },
  ],
  distance_metric: "cosine_distance",
  schema: {
    text: {
      type: "string",
      embed: {
        model: "nvidia/nemotron-3-embed-8b",
        attribute: "vector",
        dims: 1024,
      },
    },
  },
});

// backfill documents you already embedded elsewhere. these are stored as sent,
// and are never sent to the embedding provider.
await ns.write({
  upsert_rows: [
    {
      id: 2,
      vector: embed("pufferfish clownfish swordfish"),
      text: "pufferfish clownfish swordfish",
    },
    {
      id: 3,
      vector: embed("zebra horse antelope"),
      text: "zebra horse antelope",
    },
  ],
});

// you can mix and match pre-computed and native embeddings in the same write.
await ns.write({
  upsert_rows: [
    {
      id: 4,
      vector: embed("manatee dugong"),
      text: "manatee dugong",
    },
    {
      id: 5,
      text: "octopus cuttlefish",
    },
  ],
});

// queries are unaffected: every row has a vector either way
await ns.query({
  include_attributes: ["id", "text", "vector"],
  rank_by: ["text", "ANN", ["Embed", "a pointy fish"]],
  limit: 10,
});
```
```rust
// $ cargo add turbopuffer tokio rand --features tokio/full
use turbopuffer::Client;
use turbopuffer::types::{
    AttributeEmbedConfig, AttributeSchemaConfig, DistanceMetric, Expr, RankBy, Row,
};

/// Stand-in for your own embedding model.
fn embed(_text: &str) -> Vec<f32> {
    (0..1024).map(|_| rand::random()).collect()
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // The API key is read from TURBOPUFFER_API_KEY. Create one here: https://turbopuffer.com/dashboard
    let client = Client::builder()
        .region("gcp-us-central1") // choose best region: https://turbopuffer.com/docs/regions
        .build()?;

    // create a namespace with native embeddings on `text`
    let ns = client.namespace("embedding-supplied-vectors-rs");
    ns.write()
        .upsert_rows([Row::new(1).insert("text", "walrus narwhal")])
        .distance_metric(DistanceMetric::CosineDistance)
        .schema([(
            "text",
            AttributeSchemaConfig::new("string").embed(
                AttributeEmbedConfig::new("nvidia/nemotron-3-embed-8b")
                    .attribute("vector")
                    .dims(1024),
            ),
        )])
        .send()
        .await?;

    // backfill documents you already embedded elsewhere. these are stored as sent,
    // and are never sent to the embedding provider.
    ns.write()
        .upsert_rows([
            Row::new(2)
                .vector(embed("pufferfish clownfish swordfish"))
                .insert("text", "pufferfish clownfish swordfish"),
            Row::new(3)
                .vector(embed("zebra horse antelope"))
                .insert("text", "zebra horse antelope"),
        ])
        .send()
        .await?;

    // you can mix and match pre-computed and native embeddings in the same write.
    ns.write()
        .upsert_rows([
            Row::new(4)
                .vector(embed("manatee dugong"))
                .insert("text", "manatee dugong"),
            Row::new(5).insert("text", "octopus cuttlefish"),
        ])
        .send()
        .await?;

    // queries are unaffected: every row has a vector either way
    ns.query()
        .include_attributes(["id", "text", "vector"])
        .rank_by(RankBy::ann("text", Expr::embed("a pointy fish")))
        .limit(10)
        .send()
        .await?;

    Ok(())
}
```
<!-- /multilang -->

A vector you provide is stored exactly as sent. It has to match the vector
attribute's dimensionality and data type, but turbopuffer **does not** check that
it came from the configured model, or that it corresponds to the source text.

**Important:** Mixing vectors from different models in one attribute will degrade your search
results.

Rows that supply a vector don't need the source attribute at all, which lets you
ingest data you no longer have the original text for. Those rows can't be
re-embedded later, though, so prefer writing the source text when you have it.

### Migrating to native embeddings 

To migrate an existing namespace to native embeddings, first switch your
application's reads to use native embeddings [on
query](/docs/embedding#query-only-native-embeddings) and then switch writes by
[updating the `embed` attribute](/docs/write#updating-attributes) on the
attribute to embed. Future ANN queries can use the `Embed` function to rank by
the source field directly.

You can still send your own vectors on writes, or mix and match. So you don't
have to switch every writer over at once. See [supplying your own
vectors](/docs/embedding#supplying-your-own-vectors).

**Important:** Embedding an existing attribute into an existing vector checks that the
embedding model supports the shape and datatype of the existing vector. It
doesn't check that the vectors make sense together, and it doesn't re-embed the
namespace. Before enabling native embedding on a namespace, validate that the
model already in use is compatible with the native embedding model.

<!-- multilang -->
```python
import random

import turbopuffer

tpuf = turbopuffer.Turbopuffer(
    region="gcp-us-central1",  # pick a region: https://turbopuffer.com/docs/regions
)

def random_vector(_text: str, n: int = 1024) -> list[float]:
    return [random.random() for _ in range(n)]

# create a new namespace without native embeddings
ns = tpuf.namespace(f'embedding-enable-py')
ns.write(
    upsert_rows=[
        {
            "id": 1,
            "vector": random_vector("walrus narwhal"),
            "text": "walrus narwhal",
        },
        {
            "id": 2,
            "vector": random_vector("pufferfish clownfish swordfish"),
            "text": "pufferfish clownfish swordfish",
        },
    ],
    distance_metric="cosine_distance",
    schema={
        "text": {"type": "string", "full_text_search": True, "regex": True},
    },
)

# switch your queries to use query-time embedding
ns.query(
    include_attributes=["id", "text", "vector"],
    rank_by=(
        "vector",
        "ANN",
        ("Embed", "a pointy fish", {"model": "nvidia/nemotron-3-embed-8b"}),
    ),
    limit=10,
)

# update your schema in-place to enable native embeddings
ns.write(
    schema={
        "text": {
            "type": "string",
            "embed": {
                "model": "nvidia/nemotron-3-embed-8b",
                "attribute": "vector",
            },
        },
    },
)

# queries no longer need to specify a model
ns.query(
    include_attributes=["id", "text", "vector"],
    rank_by=("text", "ANN", ("Embed", "lots and lots of blubber")),
    limit=10,
)

# and writes no longer need to include a vector
ns.write(
    upsert_rows=[
        {
            "id": 3,
            "text": "zebra horse antelope",
        },
    ],
)
```
```typescript
import { Turbopuffer } from "@turbopuffer/turbopuffer";

const tpuf = new Turbopuffer({
  region: "gcp-us-central1", // pick a region: https://turbopuffer.com/docs/regions
});

function random_vector(_text: string, n: number = 1024): number[] {
  return Array.from({ length: n }, () => Math.random());
}

// create a new namespace without native embeddings
const ns = tpuf.namespace(`embedding-enable-ts`);
await ns.write({
  upsert_rows: [
    {
      id: 1,
      vector: random_vector("walrus narwhal"),
      text: "walrus narwhal",
    },
    {
      id: 2,
      vector: random_vector("pufferfish clownfish swordfish"),
      text: "pufferfish clownfish swordfish",
    },
  ],
  distance_metric: "cosine_distance",
  schema: {
    text: { type: "string", full_text_search: true, regex: true },
  },
});

// switch your queries to use query-time embedding
await ns.query({
  include_attributes: ["id", "text", "vector"],
  rank_by: ["vector", "ANN", ["Embed", "a pointy fish", {model: "nvidia/nemotron-3-embed-8b"}]],
  limit: 10,
});

// update your schema in-place to enable native embeddings
await ns.write({
  schema: {
    text: {
      type: "string",
      embed: {
        model: "nvidia/nemotron-3-embed-8b",
        attribute: "vector",
      },
    },
  },
});

// queries no longer need to specify a model
await ns.query({
  include_attributes: ["id", "text", "vector"],
  rank_by: ["text", "ANN", ["Embed", "lots and lots of blubber"]],
  limit: 10,
});

// and writes no longer need to include a vector
await ns.write({
  upsert_rows: [
    {
      id: 3,
      text: "zebra horse antelope",
    },
  ]
});
```
```rust
// $ cargo add turbopuffer tokio rand --features tokio/full
use turbopuffer::Client;
use turbopuffer::types::{
    AttributeEmbedConfig, AttributeSchemaConfig, DistanceMetric, EmbedParams, Expr, RankBy, Row,
};

/// Stand-in for your own embedding model.
fn random_vector(_text: &str) -> Vec<f32> {
    (0..1024).map(|_| rand::random()).collect()
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // The API key is read from TURBOPUFFER_API_KEY. Create one here: https://turbopuffer.com/dashboard
    let client = Client::builder()
        .region("gcp-us-central1") // choose best region: https://turbopuffer.com/docs/regions
        .build()?;

    // create a new namespace without native embeddings
    let ns = client.namespace("embedding-enable-rs");
    ns.write()
        .upsert_rows([
            Row::new(1)
                .vector(random_vector("walrus narwhal"))
                .insert("text", "walrus narwhal"),
            Row::new(2)
                .vector(random_vector("pufferfish clownfish swordfish"))
                .insert("text", "pufferfish clownfish swordfish"),
        ])
        .distance_metric(DistanceMetric::CosineDistance)
        .schema([(
            "text",
            AttributeSchemaConfig::new("string")
                .full_text_search(true)
                .regex(true),
        )])
        .send()
        .await?;

    // switch your queries to use query-time embedding
    ns.query()
        .include_attributes(["id", "text", "vector"])
        .rank_by(RankBy::ann(
            "vector",
            Expr::embed_with_params(
                "a pointy fish",
                EmbedParams::new().model("nvidia/nemotron-3-embed-8b"),
            ),
        ))
        .limit(10)
        .send()
        .await?;

    // update your schema in-place to enable native embeddings
    ns.write()
        .schema([(
            "text",
            AttributeSchemaConfig::new("string")
                .embed(AttributeEmbedConfig::new("nvidia/nemotron-3-embed-8b").attribute("vector")),
        )])
        .send()
        .await?;

    // queries no longer need to specify a model
    ns.query()
        .include_attributes(["id", "text", "vector"])
        .rank_by(RankBy::ann("text", Expr::embed("lots and lots of blubber")))
        .limit(10)
        .send()
        .await?;

    // and writes no longer need to include a vector
    ns.write()
        .upsert_rows([Row::new(3).insert("text", "zebra horse antelope")])
        .send()
        .await?;

    Ok(())
}
```
<!-- /multilang -->

### Disabling native embeddings 

To disable embedding, set `embed` to `null` on an attribute. After the write
succeeds, any future writes will require passing an explicit vector and any
future ANN queries will require passing a vector to `rank_by`. Any embedded
columns, including automatically generated embedding columns, are untouched
and can be queried as normal.

<!-- multilang -->
```python
import random

import turbopuffer

tpuf = turbopuffer.Turbopuffer(
    region="gcp-us-central1",  # pick a region: https://turbopuffer.com/docs/regions
)

def random_vector(_text: str, n: int = 1024) -> list[float]:
    return [random.random() for _ in range(n)]

# create a new namespace with native embeddings
ns = tpuf.namespace(f'embedding-disable-py')
ns.write(
    upsert_rows=[
        {
            "id": 1,
            "text": "A cat sleeping on a windowsill",
            "category": "animal",
        },
        {
            "id": 2,
            "text": "A playful kitten chasing a toy",
            "category": "animal",
        },
    ],
    distance_metric="cosine_distance",
    schema={
        "text": {
            "type": "string",
            "embed": {
                "model": "nvidia/nemotron-3-embed-8b",
                "dims": 1024,
            },
        },
    },
)

# disable native embeddings
ns.write(
    schema={
        "text": {
            "type": "string",
            "embed": None,
        },
    },
)

# any future write to this namespace requires writing the embed_text vector
ns.write(
    upsert_rows=[
        {
            "id": 1,
            "embed_text": random_vector("zebra horse antelope"),
            "text": "zebra horse antelope",
        },
    ],
)
```
```typescript
import { Turbopuffer } from "@turbopuffer/turbopuffer";

const tpuf = new Turbopuffer({
  region: "gcp-us-central1", // pick a region: https://turbopuffer.com/docs/regions
});

function random_vector(_text: string, n: number = 1024): number[] {
  return Array.from({ length: n }, () => Math.random());
}

// create a new namespace with native embeddings
const ns = tpuf.namespace(`embedding-disable-ts`);
await ns.write({
  upsert_rows: [
    {
      id: 1,
      text: "A cat sleeping on a windowsill",
      category: "animal",
    },
    {
      id: 2,
      text: "A playful kitten chasing a toy",
      category: "animal",
    },
  ],
  distance_metric: "cosine_distance",
  schema: {
    text: {
      type: "string",
      embed: {
        model: "nvidia/nemotron-3-embed-8b",
        dims: 1024,
      },
    },
  },
});

// disable native embeddings
await ns.write({
  schema: {
    text: {
      type: "string",
      embed: null,
    },
  },
});

// any future write to this namespace requires writing the embed_text vector
await ns.write({
  upsert_rows: [
    {
      id: 1,
      embed_text: random_vector("zebra horse antelope"),
      text: "zebra horse antelope",
    },
  ],
});
```
```rust
// $ cargo add turbopuffer tokio rand --features tokio/full
use turbopuffer::Client;
use turbopuffer::types::{
    AttributeEmbed, AttributeEmbedConfig, AttributeSchemaConfig, DistanceMetric, Row,
};

/// Stand-in for your own embedding model.
fn random_vector(_text: &str) -> Vec<f32> {
    (0..1024).map(|_| rand::random()).collect()
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // The API key is read from TURBOPUFFER_API_KEY. Create one here: https://turbopuffer.com/dashboard
    let client = Client::builder()
        .region("gcp-us-central1") // choose best region: https://turbopuffer.com/docs/regions
        .build()?;

    // create a new namespace with native embeddings
    let ns = client.namespace("embedding-disable-rs");
    ns.write()
        .upsert_rows([
            Row::new(1)
                .insert("text", "A cat sleeping on a windowsill")
                .insert("category", "animal"),
            Row::new(2)
                .insert("text", "A playful kitten chasing a toy")
                .insert("category", "animal"),
        ])
        .distance_metric(DistanceMetric::CosineDistance)
        .schema([(
            "text",
            AttributeSchemaConfig::new("string")
                .embed(AttributeEmbedConfig::new("nvidia/nemotron-3-embed-8b").dims(1024)),
        )])
        .send()
        .await?;

    // disable native embeddings
    ns.write()
        .schema([(
            "text",
            AttributeSchemaConfig::new("string").embed(AttributeEmbed::Null),
        )])
        .send()
        .await?;

    // any future write to this namespace requires writing the embed_text vector
    ns.write()
        .upsert_rows([Row::new(1)
            .insert("embed_text", random_vector("zebra horse antelope"))
            .insert("text", "zebra horse antelope")])
        .send()
        .await?;

    Ok(())
}
```
<!-- /multilang -->

## Security

We work with external partners to provide access to a wide range of embedding
models. When you use automatic embedding, your data is sent from our cloud
account to one of our embedding partners. The exact provider depends on the
[model you select](#models). A full list of embedding providers is
available on our [subprocessors](/docs/security/subprocessors) page.

Our embedding partners are contractually bound to the same or equivalent data
protections outlined in our [DPA](/dpa), and do not train models on your data.
Zero Data Retention (ZDR) is maintained for all models: our partners do not
retain your embedding inputs beyond the lifetime of each request.


---

This page: [/docs/embedding.md](https://turbopuffer.com/docs/embedding.md)

All documentation pages: [/llms.txt](https://turbopuffer.com/llms.txt)

All documentation in one file: [/llms-full.txt](https://turbopuffer.com/llms-full.txt)
