Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added new test to python
  • Loading branch information
SilasMarvin committed Aug 25, 2023
commit 2b3ba500187e9e1fb5cc63d54b84de7d157e2023
18 changes: 10 additions & 8 deletions pgml-sdks/rust/pgml/python/tests/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ def generate_dummy_documents(count: int) -> List[Dict[str, Any]]:
{
"id": i,
"text": "This is a test document: {}".format(i),
"some_random_thing": "This will be metadata on it",
"project": "a10",
"floating_uuid": i * 1.01,
"uuid": i * 10,
"name": "Test Document {}".format(i),
}
Expand Down Expand Up @@ -147,17 +148,18 @@ async def test_can_vector_search_with_query_builder_and_metadata_filtering():
results = (
await collection.query()
.vector_recall("Here is some query", pipeline)
.filter({
"metadata": {
"uuid": {
"$eq": 0
}
.filter(
{
"metadata": {
"$or": [{"uuid": {"$eq": 0}}, {"floating_uuid": {"$lt": 2}}],
"project": {"$eq": "a10"},
},
}
})
)
.limit(10)
.fetch_all()
)
assert len(results) == 1
assert len(results) == 2
await collection.archive()


Expand Down
2 changes: 1 addition & 1 deletion pgml-sdks/rust/pgml/src/filter_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ fn get_value_type(value: &serde_json::Value) -> String {
} else if value.is_string() {
"text".to_string()
} else if value.is_i64() {
"bigint".to_string()
"float8".to_string()
} else if value.is_f64() {
"float8".to_string()
} else if value.is_boolean() {
Expand Down