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() we used in chapter 1. Same import, same options, same modelId pattern. The only thing that changes is the constant we hand to modelSrc.
GTE_LARGE_FP16 is the SDK's embedding model. The call is the same loadModel from chapter 1, with GTE_LARGE_FP16 in 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.
main(), call loadModel with { modelSrc: GTE_LARGE_FP16 }.await the result and store it in a variable called modelId. Log modelId to stdout.$ Run your code to see results
$