/v1/contextualizedembeddingsCreate Contextualized EmbeddingsGenerate contextualized embeddings for document chunks. Chunks from the same document share context awareness, improving retrieval quality for document-based applications.
Request body
requiredapplication/json
Contextualized Embeddings Request
Request body for creating contextualized embeddings
dimensionsintegerNumber of dimensions for output embeddings (Matryoshka). Range: 128-1024 for pplx-embed-context-v1-0.6b, 128-2560 for pplx-embed-context-v1-4b. Defaults to full dimensions (1024 or 2560).
encoding_formatstringOutput encoding format for embeddings. base64_int8 returns base64-encoded signed int8 values. base64_binary returns base64-encoded packed binary (1 bit per dimension).
inputarray of array of stringrequiredNested array structure where each inner array contains chunks from a single document. Chunks within the same document are encoded with document-level context awareness. Maximum 512 documents. Total chunks across all documents must not exceed 16,000. Total tokens per document must not exceed 32K. All chunks in a single request must not exceed 120,000 tokens combined. Empty strings are not allowed.
Show child attributes
Show array items
modelstringrequiredThe contextualized embedding model to use
{
"dimensions": 0,
"encoding_format": "base64_int8",
"input": [
[
"string"
]
],
"model": "pplx-embed-context-v1-0.6b"
}Responses
Contextualized Embeddings Response
Response body for contextualized embeddings request
dataarray of objectList of contextualized embedding objects
Show child attributes
Show array items
A single contextualized embedding result
dataarray of objectList of embedding objects for chunks in this document
Show child attributes
Show array items
A single embedding result
embeddingstringBase64-encoded embedding vector. For base64_int8: decode to signed int8 array (length = dimensions). For base64_binary: decode to packed bits (length = dimensions / 8 bytes).
indexintegerThe index of the input text this embedding corresponds to
objectstringThe object type
indexintegerThe index of the document this chunk belongs to
objectstringThe object type
modelstringThe model used to generate embeddings
objectstringThe object type
usageobjectToken usage for the embeddings request
Show child attributes
costobjectCost breakdown for the request
Show child attributes
currencystringCurrency of the cost values
input_costnumberCost for input tokens in USD
total_costnumberTotal cost for the request in USD
prompt_tokensintegerNumber of tokens in the input texts
total_tokensintegerTotal number of tokens processed
{
"data": [
{
"data": [
{
"embedding": "string",
"index": 0,
"object": "embedding"
}
],
"index": 0,
"object": "list"
}
],
"model": "string",
"object": "list",
"usage": {
"cost": {
"currency": "USD",
"input_cost": 0,
"total_cost": 0
},
"prompt_tokens": 0,
"total_tokens": 0
}
}HTTPValidationError
detailarray of objectShow child attributes
Show array items
locarray of valuerequiredShow child attributes
Show array items
anyOf · 2 options
msgstringrequiredtypestringrequired{
"detail": [
{
"loc": [
0
],
"msg": "string",
"type": "string"
}
]
}