@o-lang/semantic-doc-search 1.0.36 → 1.0.37

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@o-lang/semantic-doc-search",
3
- "version": "1.0.36",
3
+ "version": "1.0.37",
4
4
  "description": "O-lang Semantic Document Search Resolver with hybrid search, embeddings, rerank, and streaming.",
5
5
  "main": "src/index.js",
6
6
  "type": "commonjs",
@@ -4,8 +4,18 @@ class VectorAdapter {
4
4
  this.dimension = config.dimension || null;
5
5
  }
6
6
 
7
+ /**
8
+ * Validates vector input.
9
+ * Accepts:
10
+ * - Plain arrays (e.g., [0.1, -0.2, ...])
11
+ * - TypedArrays (e.g., Float32Array)
12
+ */
7
13
  validateVector(vector) {
8
- if (!Array.isArray(vector)) throw new Error("Vector must be an array");
14
+ // Allow both Array and TypedArray (Float32Array, etc.)
15
+ if (!Array.isArray(vector) && !ArrayBuffer.isView(vector)) {
16
+ throw new Error("Vector must be an array or TypedArray");
17
+ }
18
+
9
19
  if (this.dimension && vector.length !== this.dimension) {
10
20
  throw new Error(
11
21
  `Vector dimension mismatch: expected ${this.dimension}, got ${vector.length}`
@@ -25,4 +35,4 @@ class VectorAdapter {
25
35
  }
26
36
  }
27
37
 
28
- module.exports = VectorAdapter;
38
+ module.exports = VectorAdapter;