Find answers from the community

Updated last month

Filtering by boolean values in vector store metadata

At a glance

The community member who posted the original question is wondering if the LI (likely referring to Langchain) library supports filtering by boolean values in Vector Store metadata. The comments suggest that the ExactMatchFilter class may not support boolean values, and instead, the community members propose using integer or string matching as alternatives.

Hey, y'all! Does LI not support filtering by boolean values in Vector Store metadata? Looking at the MetadataFilter class, it doesn't look like it works rn.
L
H
7 comments
Hmm I don't think so. But exact match would get the same effect?
Maybe it will.
No, the ExactMatchFilter was defined as this:
Plain Text
class ExactMatchFilter(BaseModel):
    key: str
    value: Union[StrictInt, StrictFloat, StrictStr]


And it's currently being set to the same def as MetadataFilter:
Plain Text
ExactMatchFilter = MetadataFilter


This is in vector_stores/types.py
Sorry, I meant, rather than matching bools, just match a zero or a one lol
or string matching
Plain Text
node = TextNode(text="text", metadata={"match": 1})

filters = MetadataFilters(filters=MetadataFilter(key="match", value=1))
Add a reply
Sign up and join the conversation on Discord