mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 11:47:41 +00:00
fix(memory): align QAT default docs/tests (#15429) (thanks @azade-c)
This commit is contained in:
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user