langchain-ai / langchain

🦜🔗 Build context-aware reasoning applications
https://python.langchain.com
MIT License
95.36k stars 15.47k forks source link

FAISS filter is not working #26379

Open yairTray opened 2 months ago

yairTray commented 2 months ago

Checked other resources

Example Code

k=2

combined_filter = { "$and": [ schema_filter, handler_filter, ] } base_retriever = vectorstore.as_retriever( search_kwargs={"k": k, "filter": combined_filter} ) filtered_docs = await base_retriever.ainvoke(query)

Error Message and Stack Trace (if applicable)

No response

Description

i see that the faiss vectorstore include documents with the right schema_type and handler_type but no documents are return in the filtered_docs variable.

System Info

langchain version : 0.2.16 langchaion_community version : 0.2.16

keenborder786 commented 2 months ago

Can you share the schema_filter and handler_filter definition?

yairTray commented 2 months ago

sure. schema_filter = {"schema_type": {"$eq": schema_type}} handler_filter = {"handler_type": {"$eq": handler_type}}

RuofanChen03 commented 1 month ago

Hi, I was able to replicate the issue. Were you able to resolve this issue?

yairTray commented 1 month ago

no, the problem still happen.

RuofanChen03 commented 1 month ago

Hi, my group (@vincentzhang15 @TANYAL77 @LikeWang10067) and I (students from UofT for a course) are working on a fix, which would allow filters to be built with your desired syntax. Hoping to fix this soon!