Embed Value
Embeddings convert data, like text, into compact vector representations, capturing their essence in a way that's useful for AI tasks.
Usage
embed
Generate an embedding for a single value.
With OpenAI text embeddings
import { embed, openai } from "modelfusion";
const embedding = await embed({
model: openai.TextEmbedder(/* ... */),
value: "At first, Nox didn't know what to do with the pup.",
});
embedMany
Generate embeddings for multiple values.
With OpenAI text embeddings
const embeddings = await embedMany({
model: openai.TextEmbedder({
/* ... */
}),
values: [
"At first, Nox didn't know what to do with the pup.",
"He keenly observed and absorbed everything around him, from the birds in the sky to the trees in the forest.",
],
});