Repository navigation
Conversation
AgenticSearchTool passes its mode weight into RetrievalRequest.KeywordsSimilarityWeight, which is the keyword share of the fusion. The constants were copied from the Python tools, where the same numbers were vector_similarity_weight, so all three modes ran with the legs inverted: vector_search dropped the embedding model, bm25_search ran dense-only, and hybrid_search used 30/70 instead of the Python default of 70/30. Use keyword shares 0.7, 0.0 and 1.0 for the hybrid, vector and bm25 tools, and add a regression test that asserts both the requested weight and the derived nlp request for every mode.
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Mode-specific keyword weights internal/agent/tool/agentic_search.go, internal/agent/tool/agentic_search_test.go |
The constructor and weight documentation use keyword-similarity weights for each search mode. The new test checks the weights and derived request settings. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers: qinling0210, yuzhichang
Merge Risk: 
Minimal · up to 7b770
-
The search-mode weights align with their intended meanings. No merge-blocking issue is identified.
Pre-merge checks: 
5
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 2 files.
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
A rabbit checks each search mode,
And weighs the keywords on the road.
Hybrid gets seven tenths just right,
Vector none, BM25 all bright.
Tests keep each setting in its place.
Comment @coderabbitai help to get the list of available commands.
Summary
The three agentic search tools pass their mode weight into
RetrievalRequest.KeywordsSimilarityWeight. That field is the keyword share of the hybrid fusion:nlpRequestFromRetrievalderives the vector share as1 - weight, requests the dense leg alone when the keyword share is zero, and drops the embedding model when it is one. The numbers inNewAgenticSearchToolmatch the Python tools'vector_similarity_weightvalues (1.0 forvector_search, 0 forbm25_search, 0.3 for hybrid), i.e. the vector share, so all three modes were inverted:vector_searchused keyword weight1.0: the embedding model was removed, so the "vector" tool ran keyword-only.bm25_searchused keyword weight0.0: the request becameVectorOnly, so the "BM25" tool ran dense-only.hybrid_searchused keyword weight0.3: 30% keyword / 70% vector, the inverse of Python's 30% vector / 70% keyword.This restores the keyword shares:
hybrid_search0.7,vector_search0.0,bm25_search1.0. The hybrid value now also matches the other Go agentic call sites (search_chunksdefaults to keyword weight 0.7).Tests
Added
TestAgenticSearchKeywordWeightsininternal/agent/tool/agentic_search_test.go. It drives each mode through a capturing retrieval service and asserts both the requestedKeywordsSimilarityWeightand the derived nlp request (VectorOnly, embedding presence, vector weight).96ab55d), all three cases fail (0.3/1/0vs0.7/0/1).go test ./internal/agent/tool/passes with the tokenizer table present.go vet ./internal/agent/tool/,-count=5and-shuffle=onare clean.Notes
Found while reading the agentic search path; I did not find an existing issue for it. Happy to file one if the project wants a record.