calculateQueryEmbedding
calculateQueryEmbedding(
item,embeddings):Promise<number[] |null>
Defined in: packages/core/src/embeddings/query.ts:30
Calculates query embeddings based on the content detail and available embedding functions.
Parameters
Section titled “Parameters”The message content detail (text or image)
embeddings
Section titled “embeddings”Map of modality type to embedding function
Returns
Section titled “Returns”Promise<number[] | null>
The query embedding as a number array, or null if no embedding could be calculated
Example
Section titled “Example”const textItem: MessageContentTextDetail = { type: "text", text: "What did the author do in college?"};
const embeddings = { text: getOpenAIEmbedding("text-embedding-3-small"),};
const queryEmbedding = await calculateQueryEmbedding(textItem, embeddings);