QVAC Logo

embed( )

Generates embeddings for a single text using a specified model.

function embed(params: { modelId: string; text: string }, options?: { forceNewConnection?: boolean; profiling?: { enabled?: boolean; includeServerBreakdown?: boolean; mode?: "summary" | "verbose" }; timeout?: number }): Promise

Parameters

NameTypeRequired?Description
params\{ modelId: string; text: string \}The parameters for the embedding
options`{ forceNewConnection?: boolean; profiling?: { enabled?: boolean; includeServerBreakdown?: boolean; mode?: "summary""verbose" }; timeout?: number }`

Returns

Promise

Throws

ErrorWhen
When the response type is invalid or when the embedding fails

Example

import { embed } from "@qvac/sdk";

const embedding = await embed({
  modelId: "my-embeddings-model",
  text: "The quick brown fox jumps over the lazy dog",
});

console.log("Embedding dimensions:", embedding.length);

On this page