Skip to main content

Text embedding

The text embedding search step is a single task, executable within POST /search requests.

It turns a text into a vector with an embedding provider of the configuration, e.g. for the kNN query of a later Elasticsearch step. It does not search itself. See the vector search example.

Security aspects

Every call of this step is a request to the embedding provider, which can cost money. The step therefore requires a token with the capability embedding.create, see roles and capabilities. Requests without it, including anonymous ones, are answered with 403 Forbidden.

Input parameters

  • provider: Required, string. The name of the embedding provider. Use the provider which calculated the vectors that are searched: vectors of different models can not be compared.

Input query

The query is the text, a non-empty string of at most 8192 characters. It can also be an expression in {{ }}, which returns the text, e.g. {{ text }} for a saved search with the parameter text.

Step result

  • vector: List of numbers, the vector of the text.
  • provider: Name of the embedding provider.
  • dimensions: Number of dimensions of the vector.
{
"vector": [
-0.0441,
0.0613,
0.0249,
"..."
],
"provider": "test",
"dimensions": 384
}

Later steps read the vector from their parameters, e.g. with the expression {{ stepResults[0].vector }}.

Errors

  • 400 Bad Request: The provider is not configured, or the text is missing, empty or too long.
  • 403 Forbidden: The token does not have the capability embedding.create.
  • 503 Service Unavailable: The provider could not be reached or failed. The request to the provider is limited by the timeoutInSeconds of the provider.