@@ -301,6 +301,41 @@ class PGVector(VectorStore):
301
301
* langchain_postgres now accept async connections. If you want to use the async
302
302
version, you need to set `async_mode=True` when initializing the store or
303
303
use an async engine.
304
+
305
+ Supported filter operators:
306
+
307
+ * $eq: Equality operator
308
+ * $ne: Not equal operator
309
+ * $lt: Less than operator
310
+ * $lte: Less than or equal operator
311
+ * $gt: Greater than operator
312
+ * $gte: Greater than or equal operator
313
+ * $in: In operator
314
+ * $nin: Not in operator
315
+ * $between: Between operator
316
+ * $exists: Exists operator
317
+ * $like: Like operator
318
+ * $ilike: Case insensitive like operator
319
+ * $and: Logical AND operator
320
+ * $or: Logical OR operator
321
+
322
+ Example:
323
+
324
+ .. code-block:: python
325
+
326
+ vectorstore.similarity_search('kitty', k=10, filter={
327
+ 'id': {'$in': [1, 5, 2, 9]}
328
+ })
329
+ #%% md
330
+
331
+ If you provide a dict with multiple fields, but no operators,
332
+ the top level will be interpreted as a logical **AND** filter
333
+
334
+ vectorstore.similarity_search('ducks', k=10, filter={
335
+ 'id': {'$in': [1, 5, 2, 9]},
336
+ 'location': {'$in': ["pond", "market"]}
337
+ })
338
+
304
339
"""
305
340
306
341
def __init__ (
0 commit comments