lplalbert opened a new pull request, #412:
URL: https://github.com/apache/hugegraph-ai/pull/412
Refs #107 (Tiny Task: fix TODO/FIXME in LLM code)
## What
`VectorIndexQuery` (chunk retrieval in the GraphRAG pipeline) hard-coded
`dis_threshold=2`
and silently dropped the documented `VECTOR_DIS_THRESHOLD` knob (default
0.9), unlike its
sibling `SemanticIdQuery`. It also carried a TODO about validating result
format before
the downstream join/rerank. This wires the documented knob through and adds
the missing
format check, with the flow→operator contract tests the test-file FIXME
asked for.
## ⚠️ Behavior change (please weigh in)
Chunk retrieval now honors the configured threshold (default **0.9**)
instead of the
hard-coded **2.0**, so filtering is stricter by default. Set
`VECTOR_DIS_THRESHOLD=2.0` to
retain previous behavior. If you prefer to keep 2.0 as the effective
default, I can change
the constructor fallback or the setting default — happy to adjust.
## Changes
- `VectorIndexQuery` takes `vector_dis_threshold: Optional[float] = None`
and falls back to
`huge_settings.vector_dis_threshold` (same contract as `SemanticIdQuery`);
`VectorQueryNode` forwards `wk_input.vector_dis_threshold`.
- `run()` passes the threshold to `VectorStoreBase.search(...,
dis_threshold=...)`.
- `_check_results_format()` drops non-string entries with a warning so
downstream
`"\n".join`/rerank can rely on `List[str]`.
- Tests: rewrote `test_vector_index_query.py` (removes the FIXME) and added
`test_vector_query_node.py` proving topk and vector_dis_threshold are
passed through.
## Validation (actually run; offline only)
- `SKIP_EXTERNAL_SERVICES=true uv run pytest src/tests/operators/
src/tests/nodes/` → 17 passed
- `SKIP_EXTERNAL_SERVICES=true uv run pytest src/tests/` → 550 passed, 9
skipped, 2 failed —
the 2 failures are pre-existing on Windows (`test_external_config.py`
asserts POSIX 0600
file-mode bits) and unrelated to this diff
- integration suite → 8 passed (incl. real RAG pipelines against local
services)
- `uv run --extra dev ruff format --check .` / `ruff check .` → clean
- `uv run --extra dev ty check hugegraph-llm/src/hugegraph_llm` → 272
pre-existing on main,
+1 here (`wk_input.vector_dis_threshold` Optional deref, same pattern as
the adjacent
`max_items` line)
- Real-provider verification: none (offline tests only)
Refs #107
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]