fix(memory): align QAT default docs/tests (#15429) (thanks @azade-c)

This commit is contained in:
Peter Steinberger
2026-02-14 02:46:11 +01:00
parent 5219f74615
commit 61b5133264
3 changed files with 8 additions and 2 deletions

View File

@@ -313,6 +313,7 @@ describe("local embedding normalization", () => {
it("normalizes local embeddings to magnitude ~1.0", async () => {
const unnormalizedVector = [2.35, 3.45, 0.63, 4.3, 1.2, 5.1, 2.8, 3.9];
const resolveModelFileMock = vi.fn(async () => "/fake/model.gguf");
importNodeLlamaCppMock.mockResolvedValue({
getLlama: async () => ({
@@ -324,7 +325,7 @@ describe("local embedding normalization", () => {
}),
}),
}),
resolveModelFile: async () => "/fake/model.gguf",
resolveModelFile: resolveModelFileMock,
LlamaLogLevel: { error: 0 },
});
@@ -340,6 +341,10 @@ describe("local embedding normalization", () => {
const magnitude = Math.sqrt(embedding.reduce((sum, x) => sum + x * x, 0));
expect(magnitude).toBeCloseTo(1.0, 5);
expect(resolveModelFileMock).toHaveBeenCalledWith(
"hf:ggml-org/embeddinggemma-300m-qat-q8_0-GGUF/embeddinggemma-300m-qat-Q8_0.gguf",
undefined,
);
});
it("handles zero vector without division by zero", async () => {