class DeepInfraEmbeddingsA class for generating embeddings using the DeepInfra API.
The API token to use for authentication.
If not provided, it will be read from the DEEPINFRA_API_TOKEN environment variable.
Prompt processing batch size.
The async caller should be used by subclasses to make any async calls, which will thus benefit from the concurrency and retry logic.
Model name to use. Available options are: qwen-turbo, qwen-plus, qwen-max, or Other compatible models.
Alias for model
Method to generate embeddings for an array of documents. Splits the documents into batches and makes requests to the AlibabaTongyi API to generate embeddings.
Method to generate an embedding for a single document. Calls the embeddingWithRetry method with the document as the input.
// 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 });