langchainjs
langchainjs copied to clipboard
Supabase vector search improvements
Hey all -- love the work & support for Supabase. It seems that the vector search is only enabled across an entire table. It would be really helpful to query just a subset of the table based on input parameters (eg. specific ids).
Hi this makes sense, we should add filtering ability to each of the vector stores that supports it
Filtering is already built in the base similaritySearch function which calls the Supabase similarityVectorWithScore function where the filter param is missing. I think it's just a matter of adding a filter object as parameter here (line 69). We could use a json object to list all filter criteria and feed it into the RPC match_document function as input parameter. Then the RPC function would just apply the filter as it matches document embeddings. This way we could filter by document name, type, and even user id!
@mz1979 I just ran into an issue where it would be so nice to be able to store documents with an associated user id. This would allow me to embed documents per user in the same table, instead of having to create a map table.
Could this also be extended to theSupabaseHybridSearch
?
Continue discussion here?
https://github.com/hwchase17/langchainjs/issues/773
I added a PR for this https://github.com/hwchase17/langchainjs/pull/905
Hi, @mosnicholas! I'm here to help the LangChain team manage their backlog and I wanted to let you know that we are marking this issue as stale.
Based on the comments and discussions on this issue, it seems that there have been suggestions for improving Supabase's vector search feature. Specifically, there have been suggestions to add filtering ability to each of the vector stores that support it, as well as adding a filter object as a parameter to the base similaritySearch function.
Before we close this issue, we wanted to check with you if this issue is still relevant to the latest version of the LangChain repository. If it is, please let us know by commenting on the issue. Otherwise, feel free to close the issue yourself or it will be automatically closed in 7 days.
Thank you for your contribution and we appreciate your understanding!