Skip to content

Commit

Permalink
x
Browse files Browse the repository at this point in the history
  • Loading branch information
eyurtsev committed Jun 10, 2024
1 parent 73d16ea commit 82f14ba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 18 deletions.
5 changes: 5 additions & 0 deletions langchain_postgres/vectorstores.py
Original file line number Diff line number Diff line change
Expand Up @@ -1074,6 +1074,11 @@ def _handle_field_filter(
f"Unsupported type: {type(val)} for value: {val}"
)

if isinstance(val, bool): # b/c bool is an instance of int
raise NotImplementedError(
f"Unsupported type: {type(val)} for value: {val}"
)

queried_field = self.EmbeddingStore.cmetadata[field].astext

if operator in {"$in"}:
Expand Down
18 changes: 0 additions & 18 deletions tests/unit_tests/fixtures/filtering_test_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,24 +218,6 @@
{"id": {"$nin": [1, 2]}},
[3],
),
# With boolean fields
(
{"is_active": {"$in": [True]}},
[1, 3],
),
(
{"is_active": {"$nin": [True]}},
[2],
),
# With null fields
(
{"happiness": {"$in": [None]}},
[3],
),
(
{"happiness": {"$nin": [None]}},
[1, 2],
),
]

TYPE_5_FILTERING_TEST_CASES = [
Expand Down

0 comments on commit 82f14ba

Please sign in to comment.