Constructor for MixedbreadAIEmbeddings.
Optional
params: Partial<MixedbreadAIEmbeddingsParams>An optional object with properties to configure the instance.
If the API key is not provided or found in the environment variables.
If the batch size exceeds 256.
const embeddings = new MixedbreadAIEmbeddings({
apiKey: 'your-api-key',
model: 'mixedbread-ai/mxbai-embed-large-v1',
batchSize: 64
});
Generates embeddings for an array of texts.
An array of strings to generate embeddings for.
A Promise that resolves to an array of embeddings.
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);
Generates an embedding for a single text.
A string to generate an embedding for.
A Promise that resolves to an array of numbers representing the embedding.
const embeddings = new MixedbreadAIEmbeddings({ apiKey: 'your-api-key' });
const text = "Represent this sentence for searching relevant passages: Is baking bread fun?";
const result = await embeddings.embedQuery(text);
console.log(result);
Generated using TypeDoc
Class 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.
Example
Example