langchainjs icon indicating copy to clipboard operation
langchainjs copied to clipboard

Supabase vector search improvements

Open mosnicholas opened this issue 1 year ago • 5 comments

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).

mosnicholas avatar Mar 16 '23 15:03 mosnicholas

Hi this makes sense, we should add filtering ability to each of the vector stores that supports it

nfcampos avatar Mar 18 '23 07:03 nfcampos

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 avatar Apr 05 '23 05:04 mz1979

@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?

fletchertyler914 avatar Apr 13 '23 05:04 fletchertyler914

Continue discussion here?

https://github.com/hwchase17/langchainjs/issues/773

ShantanuNair avatar Apr 17 '23 08:04 ShantanuNair

I added a PR for this https://github.com/hwchase17/langchainjs/pull/905

mishkinf avatar Apr 20 '23 05:04 mishkinf

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!

dosubot[bot] avatar Aug 20 '23 16:08 dosubot[bot]