Skip to main content

Embeddings

Breaking Changes to the Embeddings Format

Important: The Context API v2 introduces a breaking change in the format of embeddings results for both text and image embeddings.

Using the Backward-Compatible API Format in v1

When using "version": "context.api/v1" or "version": null:

  • textEmbeddings: Returns List<List<float>> (nested array format)
  • imageEmbeddings: Returns List<List<float>> (nested array format)

Example v1 response:

{
"textEmbeddings": {
"isSuccess": true,
"result": [
[0.016712822, 0.034525357, 0.037581384, -0.005103662, 0.03855827]
]
}
}

Using the API Format in V2 with New Behavior

When using "version": "context.api/v2":

  • textEmbeddings: Returns List<float> (flat array format)
  • imageEmbeddings: Returns List<float> (flat array format)

Example v2 response:

{
"textEmbeddings": {
"isSuccess": true,
"result": [-0.021741372, 0.005967313, -0.02682978, -0.030900504, 0.01471012]
}
}