Skip to main content

Embeddings

SvectorDB provides an API to calculate embeddings for text and images using popular models

Embeddings are a way to represent various entities, such as text or images, as an array of numbers. The distance between these arrays can be used to measure the similarity between the entities. For example, the cosine similarity between two text embeddings can be used to measure the similarity between two pieces of text.

Supported Models

ModelNameTextImagesNotes
sentence-transformers/all-MiniLM-L6-v2ALL_MINILM_L6_V2YesNo
openai/clip-vit-base-patch32CLIP_VIT_BASE_PATH32YesYesEmbeds text and images into a common space

Please reach out to us if you would like to see support for additional models

Usage

Text Embeddings

To calculate text embeddings, ensure that the input object contains the text key with the text you want to embed.

client.embed({
databaseId: databaseId,
model: EmbeddingModel.ALL_MINILM_L6_V2,
input: {
text: 'The quick brown fox jumps over the lazy dog.',
},
})

Image Embeddings

To calculate image embeddings, ensure that the input object contains the image key with the byte array of the image you want to embed. Images must be 6 MB or less in size. Images are expected to be in PNG or JPEG format.

client.embed({
databaseId: databaseId,
model: EmbeddingModel.CLIP_VIT_BASE_PATH32,
input: {
image: Buffer.from(...)
},
})

Pricing

Embeddings are currently available free of charge while in beta.