MixedbreadAIEmbeddings
Defined in: .build/typescript/packages/providers/mixedbread/src/MixedbreadAIEmbeddings.ts:81
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.
Examples
Section titled “Examples”const mxbai = new MixedbreadAIEmbeddings(\{ apiKey: 'your-api-key' \});const texts = ["Baking bread is fun", "I love baking"];const result = await mxbai.getTextEmbeddings(texts);console.log(result);
const mxbai = new MixedbreadAIEmbeddings(\{ apiKey: 'your-api-key', model: 'mixedbread-ai/mxbai-embed-large-v1', encodingFormat: MixedbreadAI.EncodingFormat.Binary, dimensions: 512, normalized: true,\});const query = "Represent this sentence for searching relevant passages: Is baking bread fun?";const result = await mxbai.getTextEmbedding(query);console.log(result);
Extends
Section titled “Extends”BaseEmbedding
MixedbreadAIEmbeddings<
Options
>(nodes
,options?
):Promise
Defined in: .build/typescript/packages/providers/mixedbread/src/MixedbreadAIEmbeddings.ts:81
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.
Type Parameters
Section titled “Type Parameters”Options
Section titled “Options”Options
extends Record
<string
, unknown
>
Parameters
Section titled “Parameters”BaseNode
<Metadata
>[]
options?
Section titled “options?”Options
Returns
Section titled “Returns”Promise
Examples
Section titled “Examples”const mxbai = new MixedbreadAIEmbeddings(\{ apiKey: 'your-api-key' \});const texts = ["Baking bread is fun", "I love baking"];const result = await mxbai.getTextEmbeddings(texts);console.log(result);
const mxbai = new MixedbreadAIEmbeddings(\{ apiKey: 'your-api-key', model: 'mixedbread-ai/mxbai-embed-large-v1', encodingFormat: MixedbreadAI.EncodingFormat.Binary, dimensions: 512, normalized: true,\});const query = "Represent this sentence for searching relevant passages: Is baking bread fun?";const result = await mxbai.getTextEmbedding(query);console.log(result);
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new MixedbreadAIEmbeddings(
params?
):MixedbreadAIEmbeddings
Defined in: .build/typescript/packages/providers/mixedbread/src/MixedbreadAIEmbeddings.ts:92
Constructor for MixedbreadAIEmbeddings.
Parameters
Section titled “Parameters”params?
Section titled “params?”Partial
<MixedbreadAIEmbeddingsParams
>
An optional object with properties to configure the instance.
Returns
Section titled “Returns”MixedbreadAIEmbeddings
Throws
Section titled “Throws”If the API key is not provided or found in the environment variables.
Throws
Section titled “Throws”If the batch size exceeds 256.
Overrides
Section titled “Overrides”BaseEmbedding.constructor
Properties
Section titled “Properties”requestParams
Section titled “requestParams”requestParams:
EmbeddingsRequestWithoutInput
Defined in: .build/typescript/packages/providers/mixedbread/src/MixedbreadAIEmbeddings.ts:82
requestOptions
Section titled “requestOptions”requestOptions:
RequestOptions
Defined in: .build/typescript/packages/providers/mixedbread/src/MixedbreadAIEmbeddings.ts:83
Methods
Section titled “Methods”getTextEmbedding()
Section titled “getTextEmbedding()”getTextEmbedding(
text
):Promise
<number
[]>
Defined in: .build/typescript/packages/providers/mixedbread/src/MixedbreadAIEmbeddings.ts:150
Generates an embedding for a single text.
Parameters
Section titled “Parameters”string
A string to generate an embedding for.
Returns
Section titled “Returns”Promise
<number
[]>
A Promise that resolves to an array of numbers representing the embedding.
Example
Section titled “Example”const query = "Represent this sentence for searching relevant passages: Is baking bread fun?";const result = await mxbai.getTextEmbedding(text);console.log(result);
Overrides
Section titled “Overrides”BaseEmbedding.getTextEmbedding
getTextEmbeddings()
Section titled “getTextEmbeddings()”getTextEmbeddings(
texts
):Promise
<number
[][]>
Defined in: .build/typescript/packages/providers/mixedbread/src/MixedbreadAIEmbeddings.ts:164
Generates embeddings for an array of texts.
Parameters
Section titled “Parameters”string
[]
An array of strings to generate embeddings for.
Returns
Section titled “Returns”Promise
<number
[][]>
A Promise that resolves to an array of embeddings.
Example
Section titled “Example”const texts = ["Baking bread is fun", "I love baking"];const result = await mxbai.getTextEmbeddings(texts);console.log(result);
Overrides
Section titled “Overrides”BaseEmbedding.getTextEmbeddings