Overview
Contextualized embeddings generate embeddings for document chunks that share context awareness. Unlike standard embeddings where each text is embedded independently, contextualized embeddings understand that chunks belong to the same document and incorporate that relationship.Use contextualized embeddings when embedding chunks from the same document (e.g., paragraphs, sections). Use standard embeddings for independent texts like search queries or standalone sentences.
Models
| Model | Dimensions | Context | MRL | Quantization | Price ($/1M tokens) |
|---|---|---|---|---|---|
pplx-embed-context-v1-0.6b | 1024 | 32K | Yes | INT8/BINARY | $0.008 |
pplx-embed-context-v1-4b | 2560 | 32K | Yes | INT8/BINARY | $0.05 |
Basic Usage
Pass documents as nested arrays where each inner array represents chunks from a single document:Response
Response
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
input | array[array[string]] | Yes | - | Nested array: each inner array contains chunks from one document. Max 512 documents, 16,000 total chunks. |
model | string | Yes | - | Model identifier: pplx-embed-context-v1-0.6b or pplx-embed-context-v1-4b |
dimensions | integer | No | Full | Matryoshka dimension (128-1024 for 0.6b, 128-2560 for 4b) |
encoding_format | string | No | base64_int8 | Output encoding: base64_int8 (signed int8) or base64_binary (packed bits) |
Golden Chunk Retrieval Example
Build a chunk retrieval system where chunks from the same document share context:When to Use Contextualized vs Standard
| Use Case | Recommendation |
|---|---|
| Independent sentences | Standard embeddings |
| FAQ entries | Standard embeddings |
| General-purpose retrieval | Standard embeddings |
| Document paragraphs | Contextualized embeddings |
| PDF sections | Contextualized embeddings |
| Article chunks | Contextualized embeddings |
| Code file segments | Contextualized embeddings |
Related Resources
Quickstart
Get started with standard embeddings.
Best Practices
Batch processing, caching, and RAG patterns.