Now that we've finished chapter 2, we're going to start a new line of work: embeddings.
An embedding is a list of numbers that encodes what a piece of text means. A real model maps a sentence to a 1024-number array. We can't read the numbers, but we can compare them with math, and two similar sentences end up with similar numbers.
The QVAC SDK loads embedding models through the same loadModel() used for LLMs, with identical imports, options, and modelId pattern. The only thing that changes is the constant handed to modelSrc.
GTE_LARGE_FP16 is the SDK's embedding model constant. Pass it to modelSrc:
const modelId = await loadModel({ modelSrc: GTE_LARGE_FP16 });
console.log("modelId:", modelId);Save the modelId. The next lessons vectorize text against the same loaded model, and reloading between calls would be wasteful.
Note: the import line changes too. We'll have both
loadModelandGTE_LARGE_FP16in the sameimport { ... }statement, since they come from the same@qvac/sdkpackage.
Question 1 of 2
What changes when you load GTE_LARGE_FP16 instead of an LLM?
Question 2 of 2
What is the primary advantage of holding on to the modelId that loadModel returns, instead of loading a fresh model for each embedding request?
Run your code, check your answer, or ask a question. It all shows up here.