Filters¶
siglip2_toolkit.filters ¶
Serializable, general-purpose filters over mappings.
Filters are plain, JSON-serializable expressions over any dict-like subject
(typically a record's metadata, but nothing ties them to images, EXIF
schemas or storage engines). Example::
from siglip2_toolkit.filters import field, And, Not
f = And(
field("width").between(1000, 4000),
field("camera.make").contains("nikon"),
Not(field("tags").exists()),
)
matches({"width": 2000, "camera": {"make": "NIKON Z6"}}, f) # -> True
A missing field never matches (any operator, including !=); compose with
Not/Or when you want the opposite. Order comparisons coerce numeric
strings ("240.0" compares as a number) and fall back to lexicographic
comparison when both sides are strings. contains/startswith are
case-insensitive by default.