langchain-postgres 0.0.4__tar.gz → 0.0.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: langchain-postgres
3
- Version: 0.0.4
3
+ Version: 0.0.5
4
4
  Summary: An integration package connecting Postgres and LangChain
5
5
  Home-page: https://github.com/langchain-ai/langchain-postgres
6
6
  License: MIT
@@ -66,6 +66,7 @@ SPECIAL_CASED_OPERATORS = {
66
66
  "$in",
67
67
  "$nin",
68
68
  "$between",
69
+ "$exists",
69
70
  }
70
71
 
71
72
  TEXT_OPERATORS = {
@@ -702,13 +703,24 @@ class PGVector(VectorStore):
702
703
  if operator in {"$in"}:
703
704
  return queried_field.in_([str(val) for val in filter_value])
704
705
  elif operator in {"$nin"}:
705
- return queried_field.nin_([str(val) for val in filter_value])
706
+ return ~queried_field.in_([str(val) for val in filter_value])
706
707
  elif operator in {"$like"}:
707
708
  return queried_field.like(filter_value)
708
709
  elif operator in {"$ilike"}:
709
710
  return queried_field.ilike(filter_value)
710
711
  else:
711
712
  raise NotImplementedError()
713
+ elif operator == "$exists":
714
+ if not isinstance(filter_value, bool):
715
+ raise ValueError(
716
+ "Expected a boolean value for $exists "
717
+ f"operator, but got: {filter_value}"
718
+ )
719
+ condition = func.jsonb_exists(
720
+ self.EmbeddingStore.cmetadata,
721
+ field,
722
+ )
723
+ return ~condition if filter_value else condition
712
724
  else:
713
725
  raise NotImplementedError()
714
726
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "langchain-postgres"
3
- version = "0.0.4"
3
+ version = "0.0.5"
4
4
  description = "An integration package connecting Postgres and LangChain"
5
5
  authors = []
6
6
  readme = "README.md"