Embedding models
Embedding models, which convert fragments and queries into vectors. Embedding models and text splitters describes the object type.
List embedding models
Returns a page of the embedding models that the key can read. Filters apply to the name, provider, description, number of dimensions (`size`) and timestamps. `order_by` accepts `id`, `created_at`, `updated_at`, `name` and `provider`. [API conventions](../01-api-conventions.md) describes pagination, filters and ordering.
Create an embedding model
Creates an embedding model: a configured instance of an embedding provider, with a model name and provider parameters. Before storing the embedding model, Foundation4 embeds a test string with the provider, so the request fails when the provider cannot load the model. A `size` of 0 stores the measured number of dimensions, and a nonzero `size` must equal the measured number. The number of dimensions, requested or measured, must be at most 2,000, the largest number that the vector search indexes support; `OpenAIEmbeddings` accepts a `dimensions` parameter that asks the model for shorter vectors. An `endpoint` parameter, and a model name that is a URL, must be an `http` or `https` URL with a host and without credentials. Private endpoints are accepted by default; when the API server configuration sets `app.allow_private_endpoints` to `false`, the host must resolve to public addresses only. Foundation4 encrypts credential parameters, such as `api_key`, before storage and returns them as `<redacted>`. After creation, only `name` and `description` can change.
Get an embedding model
Returns one embedding model: the provider, the model name, the number of dimensions and the provider parameters.
Update an embedding model
Changes the `name` or the `description` of an embedding model. Fields that the request omits keep their values, and `'description': null` removes the description. The provider, model name, size and parameters cannot change, and a request that names any other field is refused with HTTP 422. A different model or different parameters require a new embedding model.
Delete an embedding model
Deletes an embedding model. An embedding model that a vector index of a pipeline uses cannot be deleted: the request returns HTTP 409 until every vector index that uses the embedding model is deleted, with `DELETE /pipelines/{pipeline_id}/search-indexers/{indexer_id}` or with the pipeline.
Embed a text with an embedding model
Converts one text into a vector with the embedding model and returns the vector. Client applications use this operation to test an embedding model. The vector has `size` numbers, one for each dimension of the embedding model. Foundation4 embeds the text as given, with no prefix or instruction. The first request for an embedding model on each API server instance loads the model.