Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion docs/guide/embedding.md
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
10 changes: 4 additions & 6 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ const session = new LlamaChatSession({
contextSequence: context.getSequence()
});


const q1 = "Hi there, how are you?";
console.log("User: " + q1);

Expand All @@ -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);
```

Expand Down
Loading