Skip to content

Remove client-side default alpha for hybrid queries#1979

Open
MaxwellCalkin wants to merge 1 commit intoweaviate:mainfrom
MaxwellCalkin:fix/remove-client-side-alpha-default
Open

Remove client-side default alpha for hybrid queries#1979
MaxwellCalkin wants to merge 1 commit intoweaviate:mainfrom
MaxwellCalkin:fix/remove-client-side-alpha-default

Conversation

@MaxwellCalkin
Copy link

Summary

Fixes #1227.

The hybrid query alpha parameter was hardcoded to 0.7 on 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 sent 0.7 regardless.

This changes alpha: NUMBER = 0.7 to alpha: Optional[NUMBER] = None in 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 like fusion_type and limit already work.

Files changed

  • weaviate/collections/queries/hybrid/query/executor.py — 14 overloads + 1 implementation
  • weaviate/collections/queries/hybrid/generate/executor.py — 14 overloads + 1 implementation
  • weaviate/collections/aggregations/hybrid/executor.py — 3 overloads + 1 implementation

Downstream handling

The gRPC layer (_parse_hybrid in shared.py) already handles alpha=None correctly:

alpha=float(alpha) if alpha is not None else None,

The GQL layer (_add_hybrid_to_builder in base_executor.py) also handles it correctly:

if alpha is not None:
    payload["alpha"] = alpha

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

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>
Copy link

@orca-security-eu orca-security-eu bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

@weaviate-git-bot
Copy link

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.

beep boop - the Weaviate bot 👋🤖

PS:
Are you already a member of the Weaviate Forum?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default client-side alpha for hybrid queries should be removed

2 participants