Skip to content

fix: Preserve rrf_ranking_alpha=0.0 in MatchingEngineIndexEndpoint hybrid queries#6993

Open
copybara-service[bot] wants to merge 1 commit into
mainfrom
copybara_948540018
Open

fix: Preserve rrf_ranking_alpha=0.0 in MatchingEngineIndexEndpoint hybrid queries#6993
copybara-service[bot] wants to merge 1 commit into
mainfrom
copybara_948540018

Conversation

@copybara-service

Copy link
Copy Markdown
Contributor

fix: Preserve rrf_ranking_alpha=0.0 in MatchingEngineIndexEndpoint hybrid 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

@copybara-service copybara-service Bot requested a review from a team as a code owner July 16, 2026 00:07
@product-auto-label product-auto-label Bot added size: s Pull request size is small. api: vertex-ai Issues related to the googleapis/python-aiplatform API. labels Jul 16, 2026
…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
@copybara-service copybara-service Bot force-pushed the copybara_948540018 branch from fe9a098 to d418ba1 Compare July 16, 2026 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: vertex-ai Issues related to the googleapis/python-aiplatform API. google-contributor size: s Pull request size is small.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant