memo-grafter 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +81 -73
- package/USER_GUIDE.md +158 -30
- package/dist/MemoGrafterAgent.d.ts +8 -3
- package/dist/MemoGrafterAgent.d.ts.map +1 -1
- package/dist/MemoGrafterAgent.js +75 -23
- package/dist/MemoGrafterAgent.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/pipeline/IngestPipeline.d.ts +2 -0
- package/dist/pipeline/IngestPipeline.d.ts.map +1 -1
- package/dist/pipeline/IngestPipeline.js +93 -17
- package/dist/pipeline/IngestPipeline.js.map +1 -1
- package/dist/store/GraphStore.d.ts +13 -1
- package/dist/store/GraphStore.d.ts.map +1 -1
- package/dist/store/postgres-pgvector/GraphStore.d.ts +17 -1
- package/dist/store/postgres-pgvector/GraphStore.d.ts.map +1 -1
- package/dist/store/postgres-pgvector/GraphStore.js +255 -0
- package/dist/store/postgres-pgvector/GraphStore.js.map +1 -1
- package/dist/types.d.ts +34 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/drift/cosineSimilarity.test.d.ts +2 -0
- package/dist/utils/drift/cosineSimilarity.test.d.ts.map +1 -0
- package/dist/utils/drift/cosineSimilarity.test.js +25 -0
- package/dist/utils/drift/cosineSimilarity.test.js.map +1 -0
- package/dist/utils/drift/vectorAvg.test.d.ts +2 -0
- package/dist/utils/drift/vectorAvg.test.d.ts.map +1 -0
- package/dist/utils/drift/vectorAvg.test.js +36 -0
- package/dist/utils/drift/vectorAvg.test.js.map +1 -0
- package/dist/utils/text/normalizeText.test.d.ts +2 -0
- package/dist/utils/text/normalizeText.test.d.ts.map +1 -0
- package/dist/utils/text/normalizeText.test.js +23 -0
- package/dist/utils/text/normalizeText.test.js.map +1 -0
- package/dist/utils/vector/vectorLiteral.test.d.ts +2 -0
- package/dist/utils/vector/vectorLiteral.test.d.ts.map +1 -0
- package/dist/utils/vector/vectorLiteral.test.js +28 -0
- package/dist/utils/vector/vectorLiteral.test.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { parseVector, toVectorLiteral } from "./vectorLiteral.js";
|
|
3
|
+
describe("toVectorLiteral", () => {
|
|
4
|
+
it("converts a numeric vector into a pgvector literal", () => {
|
|
5
|
+
expect(toVectorLiteral([1, 2, 3])).toBe("[1,2,3]");
|
|
6
|
+
});
|
|
7
|
+
it("handles decimal numbers", () => {
|
|
8
|
+
expect(toVectorLiteral([1.25, 0.5, 3.75])).toBe("[1.25,0.5,3.75]");
|
|
9
|
+
});
|
|
10
|
+
it("handles negative numbers", () => {
|
|
11
|
+
expect(toVectorLiteral([-1, -2.5, 3])).toBe("[-1,-2.5,3]");
|
|
12
|
+
});
|
|
13
|
+
it("throws for an empty vector", () => {
|
|
14
|
+
expect(() => toVectorLiteral([])).toThrow("Cannot serialize an empty embedding.");
|
|
15
|
+
});
|
|
16
|
+
it("documents current behavior for non-finite values", () => {
|
|
17
|
+
expect(toVectorLiteral([Number.NaN, Infinity, -Infinity])).toBe("[NaN,Infinity,-Infinity]");
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
describe("parseVector", () => {
|
|
21
|
+
it("parses a pgvector literal into numbers", () => {
|
|
22
|
+
expect(parseVector("[1,2.5,-3]")).toEqual([1, 2.5, -3]);
|
|
23
|
+
});
|
|
24
|
+
it("filters non-finite values from strings", () => {
|
|
25
|
+
expect(parseVector("[NaN,Infinity,-Infinity,4]")).toEqual([4]);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=vectorLiteral.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vectorLiteral.test.js","sourceRoot":"","sources":["../../../src/utils/vector/vectorLiteral.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ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