Skip to main content

agrag.common.validation.require_valid_alpha

require_valid_alpha(alpha:float) -> None

Make sure that a hybrid_search alpha is a valid dense and keyword weight.

alpha is only meaningful in [0.0, 1.0]. 1.0 is pure dense and 0.0 is pure keyword. Outside that range, backends behave differently. Qdrant client-side blend still produces a mathematically well-defined but meaningless score, while a backend native ranker can reject the value outright.

Parameters:

  • alpha (float) – The dense/keyword balance to check.

Raises:

  • ValueError – alpha is outside [0.0, 1.0].