fix: Preserve rrf_ranking_alpha=0.0 in MatchingEngineIndexEndpoint hybrid queries#6993
Open
copybara-service[bot] wants to merge 1 commit into
Open
fix: Preserve rrf_ranking_alpha=0.0 in MatchingEngineIndexEndpoint hybrid queries#6993copybara-service[bot] wants to merge 1 commit into
copybara-service[bot] wants to merge 1 commit into
Conversation
…brid queries
`HybridQuery.rrf_ranking_alpha` is an optional float that defaults to
`None`. Two call sites in `matching_engine_index_endpoint.py` previously
gated RRF wiring on the truthiness of this field
(`if query.rrf_ranking_alpha`), which incorrectly treated an explicit
`0.0` the same as an unset value. As a result, callers passing
`rrf_ranking_alpha=0.0` (pure sparse ranking) had the `rrf` submessage
silently omitted from the outgoing request, and the server fell back to
its default alpha instead of honoring the caller's intent.
Switch both sites to `is not None` so `0.0` is preserved end-to-end:
- `find_neighbors` (public path, `FindNeighborsRequest.Query.RRF`)
- `match` (private-service-access path, `MatchRequest.RRF`)
Extend `_TEST_HYBRID_QUERIES` with a sparse-only entry that sets
`rrf_ranking_alpha=0.0`, and update the two consumers
(`test_private_service_access_hybrid_search_match_queries` and
`test_index_public_endpoint_find_neighbors_queries`) to assert that the
resulting RPC contains `rrf { alpha: 0.0 }` (instead of no rrf at all).
Also switch the expected-side predicate in the private-service-access
test from truthiness to `is not None` for consistency with the SDK.
FUTURE_COPYBARA_INTEGRATE_REVIEW=#6967 from googleapis:release-please--branches--main 4a0d1d2
PiperOrigin-RevId: 948540018
fe9a098 to
d418ba1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix: Preserve rrf_ranking_alpha=0.0 in MatchingEngineIndexEndpoint hybrid queries
HybridQuery.rrf_ranking_alphais an optional float that defaults toNone. Two call sites inmatching_engine_index_endpoint.pypreviouslygated RRF wiring on the truthiness of this field
(
if query.rrf_ranking_alpha), which incorrectly treated an explicit0.0the same as an unset value. As a result, callers passingrrf_ranking_alpha=0.0(pure sparse ranking) had therrfsubmessagesilently omitted from the outgoing request, and the server fell back to
its default alpha instead of honoring the caller's intent.
Switch both sites to
is not Noneso0.0is preserved end-to-end:find_neighbors(public path,FindNeighborsRequest.Query.RRF)match(private-service-access path,MatchRequest.RRF)Extend
_TEST_HYBRID_QUERIESwith a sparse-only entry that setsrrf_ranking_alpha=0.0, and update the two consumers(
test_private_service_access_hybrid_search_match_queriesandtest_index_public_endpoint_find_neighbors_queries) to assert that theresulting RPC contains
rrf { alpha: 0.0 }(instead of no rrf at all).Also switch the expected-side predicate in the private-service-access
test from truthiness to
is not Nonefor consistency with the SDK.FUTURE_COPYBARA_INTEGRATE_REVIEW=#6967 from googleapis:release-please--branches--main 4a0d1d2