class MixedbreadAIEmbeddingsClass for generating embeddings using the Mixedbread AI API.
This class leverages the model "mixedbread-ai/mxbai-embed-large-v1" to generate embeddings for text documents. The embeddings can be used for various NLP tasks such as similarity comparison, clustering, or as features in machine learning models.
Constructor for MixedbreadAIEmbeddings.
The async caller should be used by subclasses to make any async calls, which will thus benefit from the concurrency and retry logic.
Generates embeddings for an array of texts.
Generates an embedding for a single text.
const embeddings = new MixedbreadAIEmbeddings({ apiKey: 'your-api-key' });
const texts = ["Baking bread is fun", "I love baking"];
const result = await embeddings.embedDocuments(texts);
console.log(result);const embeddings = new MixedbreadAIEmbeddings({
apiKey: 'your-api-key',
model: 'mixedbread-ai/mxbai-embed-large-v1',
encodingFormat: MixedbreadAI.EncodingFormat.Binary,
dimensions: 512,
normalized: true,
});
const texts = ["Baking bread is fun", "I love baking"];
const result = await embeddings.embedDocuments(texts);
console.log(result);