Embeddings_
Generate text embeddings with Appwrite VectorsDB. Turn text into vector embeddings with built-in models and store them in your documents for vector search.
3 min read
An embedding is a list of numbers that represents the meaning of a piece of text. Appwrite generates embeddings for you with built-in models, so you can turn text into vectors and store them in a collection without running a separate embedding service.
The typical flow is two steps: generate an embedding from your text, then store that embedding in a document's embeddings field. Once stored, you can run vector search over your documents.
Generate embeddings
Embeddings come from the Embeddings service rather than the VectorsDB service, and generating them doesn't involve a database or collection at all.
Use the createTextEmbeddings method to turn one or more strings into vector embeddings. Pass an array of texts and, optionally, a model. When you omit model, Appwrite uses the default nomic-embed-text model. Appwrite Server SDKs require an API key with the embeddings.write scope.
The response is an embedding list. The embeddings array holds one entry per input text, in the same order you passed them.
{ "total": 1, "embeddings": [ { "model": "nomic-embed-text", "dimension": 768, "embedding": [-0.012246467, 0.02621112, -0.15247375, ...], "error": "" } ]}Each entry contains:
| Field | Description |
|---|---|
model | The model that generated this embedding. |
dimension | The number of values in the embedding vector. |
embedding | The embedding vector as an array of floats. If generation fails, this is an empty array. |
error | An error message if this text could not be embedded. An empty string means there was no error. |
Available models
Appwrite ships with the following text embedding models. The dimension of a model is the length of the vector it produces, and it must match the dimension you set on the collection where you store the embeddings.
| Model | Dimension | Provider | Languages | Best for | Notes |
|---|---|---|---|---|---|
nomic-embed-text | 768 | Nomic AI | English | General-purpose retrieval over long English documents | Default. 8K context window, so long documents embed in one call. |
embedding-gemma | 768 | 100+ | Multilingual search and cross-language retrieval | A query in one language matches content in another. | |
all-minilm | 384 | Sentence Transformers | English | High-volume workloads where speed and storage matter most | Fast to generate and cheap to store, at some cost to accuracy. |
bge-small | 384 | BAAI | English | Ranking and reranking short English passages | Tuned for ranking quality over speed. |
Pick a model before you create your collection. In the Console you pick the model and the collection takes its dimension. Through an SDK you set dimension to the model's dimension. Every document in a collection uses vectors of the same length, so a collection only works with models that match its dimension.
Store embeddings
Once you have an embedding, store it in a document's embeddings field. The collection's dimension must match the embedding's dimension. You can store any related data alongside the vector in the document's metadata field.
You can pass several strings in one createTextEmbeddings call to embed them together. The response returns one entry per input text, in order, so you can map each embedding back to its source text before storing.
Next steps
With embeddings stored in your documents, you can find the most similar documents to a query vector with vector search.
Was this page helpful?
Share what worked or what we should fix. Once approved, our agents automatically apply suggested updates to the docs.