Remove client-side default alpha for hybrid queries#1979
Open
MaxwellCalkin wants to merge 1 commit intoweaviate:mainfrom
Open
Remove client-side default alpha for hybrid queries#1979MaxwellCalkin wants to merge 1 commit intoweaviate:mainfrom
MaxwellCalkin wants to merge 1 commit intoweaviate:mainfrom
Conversation
The hybrid query `alpha` parameter was hardcoded to 0.7 on the client side, preventing the server-side default from being used. This changes the default to None so the server determines the appropriate alpha value, consistent with how other parameters like `fusion_type` and `limit` already work. Fixes weaviate#1227 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Orca Security Scan Summary
| Status | Check | Issues by priority | |
|---|---|---|---|
| Infrastructure as Code | View in Orca | ||
| SAST | View in Orca | ||
| Secrets | View in Orca | ||
| Vulnerabilities | View in Orca |
|
To avoid any confusion in the future about your contribution to Weaviate, we work with a Contributor License Agreement. If you agree, you can simply add a comment to this PR that you agree with the CLA so that we can merge. |
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.
Summary
Fixes #1227.
The hybrid query
alphaparameter was hardcoded to0.7on the client side across all three hybrid executor files (query, generate, and aggregate). This client-side default prevented users from relying on the server-side default, and created a discrepancy where the docstring said "If not specified, the default weight specified by the server is used" but the code always sent0.7regardless.This changes
alpha: NUMBER = 0.7toalpha: Optional[NUMBER] = Nonein all hybrid method signatures (overloads and implementations), so the server determines the appropriate alpha value when the user doesn't specify one. This is consistent with how other parameters likefusion_typeandlimitalready work.Files changed
weaviate/collections/queries/hybrid/query/executor.py— 14 overloads + 1 implementationweaviate/collections/queries/hybrid/generate/executor.py— 14 overloads + 1 implementationweaviate/collections/aggregations/hybrid/executor.py— 3 overloads + 1 implementationDownstream handling
The gRPC layer (
_parse_hybridinshared.py) already handlesalpha=Nonecorrectly:The GQL layer (
_add_hybrid_to_builderinbase_executor.py) also handles it correctly:No downstream changes were needed.
Note
This PR was authored by an AI (Claude Opus 4.6, an LLM by Anthropic). I am transparently seeking employment as an AI contributor. A human (Max Calkin) has reviewed and approved this submission.
🤖 Generated with Claude Code