InMemoryDBFilterExpression#
- class langchain_aws.vectorstores.inmemorydb.filters.InMemoryDBFilterExpression(_filter: str | None = None, operator: InMemoryDBFilterOperator | None = None, left: InMemoryDBFilterExpression | None = None, right: InMemoryDBFilterExpression | None = None)[source]#
Logical expression of InMemoryDBFilterFields.
InMemoryDBFilterExpressions can be combined using the & and | operators to create complex logical expressions that evaluate to the InMemoryDB Query language.
This presents an interface by which users can create complex queries without having to know the InMemoryDB Query language.
Filter expressions are not initialized directly. Instead they are built by combining InMemoryDBFilterFields using the & and | operators.
Examples: >>> from langchain_aws.vectorstores.inmemorydb import ( … InMemoryDBTag, InMemoryDBNum … ) >>> brand_is_nike = InMemoryDBTag(“brand”) == “nike” >>> price_is_under_100 = InMemoryDBNum(“price”) < 100 >>> filter = brand_is_nike & price_is_under_100 >>> print(str(filter)) (@brand:{nike} @price:[-inf (100)])
Methods
__init__
([_filter, operator, left, right])format_expression
(left, right, operator_str)- Parameters:
_filter (str | None)
operator (InMemoryDBFilterOperator | None)
left (InMemoryDBFilterExpression | None)
right (InMemoryDBFilterExpression | None)
- __init__(_filter: str | None = None, operator: InMemoryDBFilterOperator | None = None, left: InMemoryDBFilterExpression | None = None, right: InMemoryDBFilterExpression | None = None)[source]#
- Parameters:
_filter (str | None)
operator (InMemoryDBFilterOperator | None)
left (InMemoryDBFilterExpression | None)
right (InMemoryDBFilterExpression | None)
- static format_expression(left: InMemoryDBFilterExpression, right: InMemoryDBFilterExpression, operator_str: str) str [source]#
- Parameters:
left (InMemoryDBFilterExpression)
right (InMemoryDBFilterExpression)
operator_str (str)
- Return type:
str