class DeepInfraEmbeddingsA class for generating embeddings using the DeepInfra API.
Constructor for the DeepInfraEmbeddings class.
The API token to use for authentication.
If not provided, it will be read from the DEEPINFRA_API_TOKEN environment variable.
The maximum number of texts to embed in a single request. This is limited by the DeepInfra API to a maximum of 1024.
The async caller should be used by subclasses to make any async calls, which will thus benefit from the concurrency and retry logic.
The model ID to use for generating completions.
Default: sentence-transformers/clip-ViT-B-32
Generates embeddings for an array of texts.
Generates an embedding for a single text.
// Embed a query using the DeepInfraEmbeddings class
const model = new DeepInfraEmbeddings();
const res = await model.embedQuery(
"What would be a good company name for a company that makes colorful socks?",
);
console.log({ res });