feat: add to_query_object method (#2239)

This PR adds a `to_query_object` method to the various query builders
(except not hybrid queries yet). This makes it possible to inspect the
query that is built.

In addition this PR does some normalization between the sync and async
query paths. A few custom defaults were removed in favor of None (with
the default getting set once, in rust).

Also, the synchronous to_batches method will now actually stream results

Also, the remote API now defaults to prefiltering
This commit is contained in:
Weston Pace
2025-03-21 13:01:51 -07:00
committed by GitHub
parent b2a38ac366
commit 9403254442
8 changed files with 867 additions and 177 deletions

View File

@@ -315,7 +315,7 @@ def test_query_sync_minimal():
assert body == {
"distance_type": "l2",
"k": 10,
"prefilter": False,
"prefilter": True,
"refine_factor": None,
"lower_bound": None,
"upper_bound": None,
@@ -340,7 +340,7 @@ def test_query_sync_empty_query():
"filter": "true",
"vector": [],
"columns": ["id"],
"prefilter": False,
"prefilter": True,
"version": None,
}
@@ -478,7 +478,7 @@ def test_query_sync_hybrid():
assert body == {
"distance_type": "l2",
"k": 42,
"prefilter": False,
"prefilter": True,
"refine_factor": None,
"vector": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
"nprobes": 20,