fix: extraction, multi-hop traversal, and aggregate result shape (BR-ADV-FEATURES-BUN)
Three advanced-API correctness fixes, all reproducible on Node (not Bun-specific):
- Entity/concept extraction returned []. SmartExtractor combined agreeing signals
with a weighted sum compared against an absolute 0.60 gate, so a confident
low-weight signal lost selection to a mediocre high-weight one that then failed
the gate, dropping the whole result. Select and gate on a normalized weighted
average instead. The public `confidence` option now controls the threshold (was
a dead hardcoded 0.60), and the embedding-signal timeout is raised 100ms -> 2000ms
so the neural signal is not silently dropped on slower runtimes.
- Multi-hop find({ connected }) returned only the 1-hop neighbour. executeGraphSearch
ignored depth/via; it now delegates to the depth-aware neighbors() BFS.
- find({ aggregate }) hid groupKey/metrics/count under .metadata, so callers
expecting AggregateResult saw empty rows. Expose those fields at the top level.
Adds real-embedding regression tests in tests/integration/advanced-apis-regression.test.ts.
This commit is contained in:
parent
07754d135a
commit
0a9d1d9a17
8 changed files with 297 additions and 74 deletions
|
|
@ -118,10 +118,11 @@ describe('NaturalLanguageProcessor', () => {
|
|||
expect(extraction).toBeDefined()
|
||||
expect(Array.isArray(extraction)).toBe(true)
|
||||
|
||||
// Entity extraction uses neural matching with type embeddings
|
||||
// Extraction quality depends on text context and entity similarity to known types
|
||||
// For simple text without rich context, extraction may return empty array
|
||||
// This is correct behavior - it's better to return nothing than false positives
|
||||
// This unit suite runs with mock (zero-vector) embeddings, so the neural embedding
|
||||
// signal can't fire here — only the array shape is asserted. Real, non-empty extraction
|
||||
// is verified against actual embeddings in
|
||||
// tests/integration/advanced-apis-regression.test.ts (BR-ADV-FEATURES-BUN). An empty
|
||||
// result here reflects the mock embeddings, not expected production behaviour.
|
||||
})
|
||||
|
||||
it('should extract topics and concepts', async () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue