-
Notifications
You must be signed in to change notification settings - Fork 76
Expose max_distance as an optional setting in multi vector queries #478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
b731542
45898df
6d239f9
3624f42
618c31d
f5b47a3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -24,6 +24,7 @@ class Vector(BaseModel): | |||||
| field_name: str | ||||||
| dtype: str = "float32" | ||||||
| weight: float = 1.0 | ||||||
| max_distance: float = 2.0 | ||||||
|
justin-cechmanek marked this conversation as resolved.
Outdated
|
||||||
|
|
||||||
|
justin-cechmanek marked this conversation as resolved.
|
||||||
| @field_validator("dtype") | ||||||
| @classmethod | ||||||
|
|
@@ -36,6 +37,15 @@ def validate_dtype(cls, dtype: str) -> str: | |||||
| ) | ||||||
| return dtype | ||||||
|
|
||||||
| @field_validator("max_distance") | ||||||
| @classmethod | ||||||
| def validate_max_distance(cls, max_distance: float) -> float: | ||||||
| if not isinstance(max_distance, float) or isinstance(max_distance, int): | ||||||
|
justin-cechmanek marked this conversation as resolved.
Outdated
|
||||||
| raise ValueError("max_distance must be a value between 0.0 and 2.0") | ||||||
|
Comment on lines
+50
to
+51
|
||||||
| if not isinstance(max_distance, (float, int)): | |
| raise ValueError("max_distance must be a value between 0.0 and 2.0") |
Copilot
AI
Feb 21, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
validate_max_distance currently rejects infinities but will still allow NaN (all comparisons to NaN are false, so it passes through). NaN would produce an invalid VECTOR_RANGE radius in the query string. Consider explicitly rejecting non-finite values (and also disallowing bool, since it’s an int subclass).
Copilot
AI
Feb 21, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes the multi-vector query from OR semantics (|) to AND semantics when combining vector range clauses. That’s a behavior change beyond “expose max_distance” and could be breaking for existing callers. If the AND behavior is intentional, it should be called out in the PR description/release notes (or consider preserving prior behavior via an option).
Uh oh!
There was an error while loading. Please reload this page.