Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PGVector filtering improvements to support self-querying #17064

Closed
4 tasks done
djo10 opened this issue Feb 5, 2024 · 1 comment
Closed
4 tasks done

PGVector filtering improvements to support self-querying #17064

djo10 opened this issue Feb 5, 2024 · 1 comment
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature Ɑ: vector store Related to vector store module

Comments

@djo10
Copy link
Contributor

djo10 commented Feb 5, 2024

Checked other resources

  • I added a very descriptive title to this issue.
  • I searched the LangChain documentation with the integrated search.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain rather than my code.

Example Code

The current code does not handle top-level conditions like the example below:

filter = {"or": [{"rating": {"gte": 8.5}}, {"genre": "animated"}]}
retriever = vectorstore.as_retriever(search_kwargs={"filter": filter})

The current implementation for this example will not find results.
The current implementation does not support GTE and LTE comparators in pgvector.

Error Message and Stack Trace (if applicable)

No response

Description

  • I am trying to filter documents based on metadata, including top level conditions with 'and', 'or' operators
  • I am trying to create more comprehensive metadata filtering with pgvector and to create the base for pgvector self querying.
  • I am trying to use GTE and LTE comparators in filter clause
  • Code for pgvector can be refactored, using already defined comparators and operators from langchain.chains.query_constructor.ir

System Info

langchain==0.1.5
langchain-community==0.0.17
langchain-core==0.1.18

Python 3.10.12

Copy link

dosubot bot commented Feb 5, 2024

🤖

It's great to see your interest in improving the PGVector filtering in LangChain! Your proposed improvements sound promising and could be very valuable for the community. If you're able to implement these changes and create a pull request, it would be a fantastic contribution to the project. Keep up the good work!


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

@dosubot dosubot bot added Ɑ: vector store Related to vector store module 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature labels Feb 5, 2024
@dosubot dosubot bot added the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label May 6, 2024
@dosubot dosubot bot closed this as not planned Won't fix, can't repro, duplicate, stale May 13, 2024
@dosubot dosubot bot removed the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature Ɑ: vector store Related to vector store module
Projects
None yet
Development

No branches or pull requests

1 participant