@forwardimpact/svcvector 0.1.111 → 0.1.113
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/package.json +8 -1
- package/proto/vector.proto +15 -0
- package/test/vector.test.js +0 -97
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forwardimpact/svcvector",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.113",
|
|
4
4
|
"description": "Vector similarity search service for Guide",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "D. Olsson <hi@senzilla.io>",
|
|
@@ -25,5 +25,12 @@
|
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@forwardimpact/libharness": "^0.1.5"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"proto/",
|
|
31
|
+
"server.js"
|
|
32
|
+
],
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
28
35
|
}
|
|
29
36
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package vector;
|
|
4
|
+
|
|
5
|
+
import "tool.proto";
|
|
6
|
+
|
|
7
|
+
service Vector {
|
|
8
|
+
rpc SearchContent(TextQuery) returns (tool.ToolCallResult);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
message TextQuery {
|
|
12
|
+
repeated string input = 1;
|
|
13
|
+
optional tool.QueryFilter filter = 2;
|
|
14
|
+
optional string llm_token = 3;
|
|
15
|
+
}
|
package/test/vector.test.js
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { test, describe, beforeEach } from "node:test";
|
|
2
|
-
import assert from "node:assert";
|
|
3
|
-
|
|
4
|
-
// Module under test
|
|
5
|
-
import { VectorService } from "../index.js";
|
|
6
|
-
import {
|
|
7
|
-
createMockConfig,
|
|
8
|
-
createMockLlmClient,
|
|
9
|
-
} from "@forwardimpact/libharness";
|
|
10
|
-
|
|
11
|
-
describe("vector service", () => {
|
|
12
|
-
describe("VectorService", () => {
|
|
13
|
-
test("exports VectorService class", () => {
|
|
14
|
-
assert.strictEqual(typeof VectorService, "function");
|
|
15
|
-
assert.ok(VectorService.prototype);
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
test("VectorService has SearchContent method", () => {
|
|
19
|
-
assert.strictEqual(
|
|
20
|
-
typeof VectorService.prototype.SearchContent,
|
|
21
|
-
"function",
|
|
22
|
-
);
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
test("VectorService constructor accepts expected parameters", () => {
|
|
26
|
-
// Test constructor signature by checking parameter count
|
|
27
|
-
assert.strictEqual(VectorService.length, 4); // config, contentIndex, llmClient, logFn
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
test("VectorService has proper method signatures", () => {
|
|
31
|
-
const methods = Object.getOwnPropertyNames(VectorService.prototype);
|
|
32
|
-
assert(methods.includes("SearchContent"));
|
|
33
|
-
assert(methods.includes("constructor"));
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
describe("VectorService business logic", () => {
|
|
38
|
-
let mockConfig;
|
|
39
|
-
let mockContentIndex;
|
|
40
|
-
let mockLlmClient;
|
|
41
|
-
|
|
42
|
-
beforeEach(() => {
|
|
43
|
-
mockConfig = createMockConfig("vector", {
|
|
44
|
-
threshold: 0.3,
|
|
45
|
-
limit: 10,
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
mockContentIndex = {
|
|
49
|
-
queryItems: async () => [{ toString: () => "msg1" }],
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
mockLlmClient = createMockLlmClient();
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
test("creates service instance with index", () => {
|
|
56
|
-
const service = new VectorService(
|
|
57
|
-
mockConfig,
|
|
58
|
-
mockContentIndex,
|
|
59
|
-
mockLlmClient,
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
assert.ok(service);
|
|
63
|
-
assert.strictEqual(service.config, mockConfig);
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
test("SearchContent queries content index", async () => {
|
|
67
|
-
const service = new VectorService(
|
|
68
|
-
mockConfig,
|
|
69
|
-
mockContentIndex,
|
|
70
|
-
mockLlmClient,
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
const result = await service.SearchContent({
|
|
74
|
-
text: "test query",
|
|
75
|
-
filter: { threshold: 0.3, limit: 10 },
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
assert.ok(result);
|
|
79
|
-
assert.ok(Array.isArray(result.identifiers));
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
test("SearchContent handles empty filters", async () => {
|
|
83
|
-
const service = new VectorService(
|
|
84
|
-
mockConfig,
|
|
85
|
-
mockContentIndex,
|
|
86
|
-
mockLlmClient,
|
|
87
|
-
);
|
|
88
|
-
|
|
89
|
-
const result = await service.SearchContent({
|
|
90
|
-
text: "test query",
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
assert.ok(result);
|
|
94
|
-
assert.ok(Array.isArray(result.identifiers));
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
});
|