mindgraph 0.5.0 → 0.6.0
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/dist/index.d.mts +36 -2
- package/dist/index.d.ts +36 -2
- package/dist/index.js +5 -1
- package/dist/index.mjs +5 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -30,6 +30,29 @@ interface SearchResult {
|
|
|
30
30
|
node_type: string;
|
|
31
31
|
score: number;
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* One retrieval leg's contribution to a fused hybrid result — the
|
|
35
|
+
* "why retrieved" detail. The fused score reconstructs exactly as
|
|
36
|
+
* `Σ 1/(60 + rank)` over a result's legs.
|
|
37
|
+
*/
|
|
38
|
+
interface LegContribution {
|
|
39
|
+
/** Which leg surfaced the result: `"fts"` (keyword/BM25) or `"vec"` (vector). */
|
|
40
|
+
leg: string;
|
|
41
|
+
/** 1-based within-leg rank the fusion used. */
|
|
42
|
+
rank: number;
|
|
43
|
+
/**
|
|
44
|
+
* The leg's raw score (BM25 relevance for `fts`, cosine similarity for
|
|
45
|
+
* `vec`). Not comparable across legs — RRF fuses by rank, not score.
|
|
46
|
+
*/
|
|
47
|
+
score: number;
|
|
48
|
+
}
|
|
49
|
+
/** A `/retrieve` hybrid result: the full node plus the fused RRF score. */
|
|
50
|
+
interface HybridSearchResult {
|
|
51
|
+
node: GraphNode;
|
|
52
|
+
score: number;
|
|
53
|
+
/** Per-leg contributions; present only when the request set `explain: true`. */
|
|
54
|
+
legs?: LegContribution[];
|
|
55
|
+
}
|
|
33
56
|
interface SearchChunk {
|
|
34
57
|
chunk_uid: string;
|
|
35
58
|
content: string;
|
|
@@ -329,6 +352,12 @@ interface RetrieveRequest {
|
|
|
329
352
|
salience_min?: number;
|
|
330
353
|
limit?: number;
|
|
331
354
|
offset?: number;
|
|
355
|
+
/**
|
|
356
|
+
* Hybrid action only: attach per-leg contributions (`legs`) to each
|
|
357
|
+
* result — the "why retrieved" detail. Requires server ≥ 1.2.0; older
|
|
358
|
+
* servers ignore the field.
|
|
359
|
+
*/
|
|
360
|
+
explain?: boolean;
|
|
332
361
|
}
|
|
333
362
|
interface TraverseRequest {
|
|
334
363
|
action: "chain" | "neighborhood" | "path" | "subgraph";
|
|
@@ -1038,12 +1067,17 @@ declare class MindGraph {
|
|
|
1038
1067
|
include_edges?: boolean;
|
|
1039
1068
|
include_chunks?: boolean;
|
|
1040
1069
|
}): Promise<SearchResult[] | EnrichedSearchResponse>;
|
|
1041
|
-
/**
|
|
1070
|
+
/**
|
|
1071
|
+
* Hybrid BM25 + vector search with reciprocal rank fusion. Pass
|
|
1072
|
+
* `explain: true` to get per-leg contributions (`legs`) on each result —
|
|
1073
|
+
* the "why retrieved" detail (server ≥ 1.2.0; older servers ignore it).
|
|
1074
|
+
*/
|
|
1042
1075
|
hybridSearch(query: string, opts?: {
|
|
1043
1076
|
k?: number;
|
|
1044
1077
|
node_types?: string[];
|
|
1045
1078
|
layer?: string;
|
|
1046
|
-
|
|
1079
|
+
explain?: boolean;
|
|
1080
|
+
}): Promise<HybridSearchResult[]>;
|
|
1047
1081
|
getNodes(params?: {
|
|
1048
1082
|
node_type?: string;
|
|
1049
1083
|
layer?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -30,6 +30,29 @@ interface SearchResult {
|
|
|
30
30
|
node_type: string;
|
|
31
31
|
score: number;
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* One retrieval leg's contribution to a fused hybrid result — the
|
|
35
|
+
* "why retrieved" detail. The fused score reconstructs exactly as
|
|
36
|
+
* `Σ 1/(60 + rank)` over a result's legs.
|
|
37
|
+
*/
|
|
38
|
+
interface LegContribution {
|
|
39
|
+
/** Which leg surfaced the result: `"fts"` (keyword/BM25) or `"vec"` (vector). */
|
|
40
|
+
leg: string;
|
|
41
|
+
/** 1-based within-leg rank the fusion used. */
|
|
42
|
+
rank: number;
|
|
43
|
+
/**
|
|
44
|
+
* The leg's raw score (BM25 relevance for `fts`, cosine similarity for
|
|
45
|
+
* `vec`). Not comparable across legs — RRF fuses by rank, not score.
|
|
46
|
+
*/
|
|
47
|
+
score: number;
|
|
48
|
+
}
|
|
49
|
+
/** A `/retrieve` hybrid result: the full node plus the fused RRF score. */
|
|
50
|
+
interface HybridSearchResult {
|
|
51
|
+
node: GraphNode;
|
|
52
|
+
score: number;
|
|
53
|
+
/** Per-leg contributions; present only when the request set `explain: true`. */
|
|
54
|
+
legs?: LegContribution[];
|
|
55
|
+
}
|
|
33
56
|
interface SearchChunk {
|
|
34
57
|
chunk_uid: string;
|
|
35
58
|
content: string;
|
|
@@ -329,6 +352,12 @@ interface RetrieveRequest {
|
|
|
329
352
|
salience_min?: number;
|
|
330
353
|
limit?: number;
|
|
331
354
|
offset?: number;
|
|
355
|
+
/**
|
|
356
|
+
* Hybrid action only: attach per-leg contributions (`legs`) to each
|
|
357
|
+
* result — the "why retrieved" detail. Requires server ≥ 1.2.0; older
|
|
358
|
+
* servers ignore the field.
|
|
359
|
+
*/
|
|
360
|
+
explain?: boolean;
|
|
332
361
|
}
|
|
333
362
|
interface TraverseRequest {
|
|
334
363
|
action: "chain" | "neighborhood" | "path" | "subgraph";
|
|
@@ -1038,12 +1067,17 @@ declare class MindGraph {
|
|
|
1038
1067
|
include_edges?: boolean;
|
|
1039
1068
|
include_chunks?: boolean;
|
|
1040
1069
|
}): Promise<SearchResult[] | EnrichedSearchResponse>;
|
|
1041
|
-
/**
|
|
1070
|
+
/**
|
|
1071
|
+
* Hybrid BM25 + vector search with reciprocal rank fusion. Pass
|
|
1072
|
+
* `explain: true` to get per-leg contributions (`legs`) on each result —
|
|
1073
|
+
* the "why retrieved" detail (server ≥ 1.2.0; older servers ignore it).
|
|
1074
|
+
*/
|
|
1042
1075
|
hybridSearch(query: string, opts?: {
|
|
1043
1076
|
k?: number;
|
|
1044
1077
|
node_types?: string[];
|
|
1045
1078
|
layer?: string;
|
|
1046
|
-
|
|
1079
|
+
explain?: boolean;
|
|
1080
|
+
}): Promise<HybridSearchResult[]>;
|
|
1047
1081
|
getNodes(params?: {
|
|
1048
1082
|
node_type?: string;
|
|
1049
1083
|
layer?: string;
|
package/dist/index.js
CHANGED
|
@@ -397,7 +397,11 @@ var MindGraph = class {
|
|
|
397
397
|
async search(query, opts) {
|
|
398
398
|
return this.post("/search", { query, ...opts });
|
|
399
399
|
}
|
|
400
|
-
/**
|
|
400
|
+
/**
|
|
401
|
+
* Hybrid BM25 + vector search with reciprocal rank fusion. Pass
|
|
402
|
+
* `explain: true` to get per-leg contributions (`legs`) on each result —
|
|
403
|
+
* the "why retrieved" detail (server ≥ 1.2.0; older servers ignore it).
|
|
404
|
+
*/
|
|
401
405
|
async hybridSearch(query, opts) {
|
|
402
406
|
return this.post("/retrieve", {
|
|
403
407
|
action: "hybrid",
|
package/dist/index.mjs
CHANGED
|
@@ -370,7 +370,11 @@ var MindGraph = class {
|
|
|
370
370
|
async search(query, opts) {
|
|
371
371
|
return this.post("/search", { query, ...opts });
|
|
372
372
|
}
|
|
373
|
-
/**
|
|
373
|
+
/**
|
|
374
|
+
* Hybrid BM25 + vector search with reciprocal rank fusion. Pass
|
|
375
|
+
* `explain: true` to get per-leg contributions (`legs`) on each result —
|
|
376
|
+
* the "why retrieved" detail (server ≥ 1.2.0; older servers ignore it).
|
|
377
|
+
*/
|
|
374
378
|
async hybridSearch(query, opts) {
|
|
375
379
|
return this.post("/retrieve", {
|
|
376
380
|
action: "hybrid",
|