kn0sys / valentinus

next generation vector db built with lmdb bindings
https://docs.rs/valentinus
Apache License 2.0
6 stars 0 forks source link

Enhance the metadata filter #9

Open kn0sys opened 1 month ago

kn0sys commented 1 month ago

Should be able to perform filtering on a struct with numerical/string values. See example python below.

filtering on an array of string values

query_results = collection.query(
...     query_texts=["Teach me about music history"],
...     where={"genre": {"$in": ["music", "history"]}},
...     n_results=2,
... )

greater than, less than, equal to, etc. functionality

good_reviews = collection.query(
...     query_texts=[question],
...     n_results=10,
...     include=["documents"],
...     where={"Rating": {"$gte": 3}},
... )

Reference: real python

kn0sys commented 1 month ago

initial version release on v0.3.0. Needs testing.

https://github.com/kn0sys/valentinus/blob/main/src/md2f.rs