diff --git a/docs/guide/embedding.md b/docs/guide/embedding.md index 3f0282f9..fa6bbc28 100644 --- a/docs/guide/embedding.md +++ b/docs/guide/embedding.md @@ -122,7 +122,11 @@ const __dirname = path.dirname( const llama = await getLlama(); const model = await llama.loadModel({ - modelPath: path.join(__dirname, "my-model.gguf") + /* + You can also load quantized models such as "Meta-Llama-3.1-8B-Instruct.Q4_K_M.gguf", which generate embeddings + using their intermediate layers. However, specialized encoders models are generally more accurate for search. + */ + modelPath: path.join(__dirname, "nomic-embed-text-v1.5.f16.gguf") }); const context = await model.createEmbeddingContext(); diff --git a/docs/index.md b/docs/index.md index 899cc407..43c157f6 100644 --- a/docs/index.md +++ b/docs/index.md @@ -117,7 +117,6 @@ const session = new LlamaChatSession({ contextSequence: context.getSequence() }); - const q1 = "Hi there, how are you?"; console.log("User: " + q1); @@ -139,18 +138,17 @@ const __dirname = path.dirname( const llama = await getLlama(); const model = await llama.loadModel({ - modelPath: path.join(__dirname, "my-model.gguf") + modelPath: path.join(__dirname, "my-emb-model.gguf") }); -const context = await model.createEmbeddingContext(); - - - +const context = await model.createEmbeddingContext(); const text = "Hello world"; + console.log("Text:", text); const embedding = await context.getEmbeddingFor(text); + console.log("Embedding vector:", embedding.vector); ```