langchainjs icon indicating copy to clipboard operation
langchainjs copied to clipboard

Supabase Index/Retriever - custom fields & filter

Open ShantanuNair opened this issue 2 years ago • 1 comments

  1. In order to partition/index effectively, say by tenant, we would need to be able to pass in additional fields to the embeddings table. If exposed, we could pass those in as args and ensure that addVectors(vectors, documents) takes in a third arg that passes in those extra fields to update on the table.

  2. In order retrieve filtered embeddings effectively, we would need to pass in filter. In VectorStore class:

async similaritySearchWithScore(query, k = 4, filter = undefined) {
       return this.similaritySearchVectorWithScore(await this.embeddings.embedQuery(query), k, filter);
   }

we have support for that last filter arg, but in supabaseVectorStore implementation it is not used anywhere:

async similaritySearchVectorWithScore(query, k) {
       ...
       ...
       return result;
   }

I can potentially work on adding these or help out some, given I have free time, but I'm also having issues making this work for us since we are on supabase v1, and the peer deps are already causing us difficulties.

ShantanuNair avatar Apr 13 '23 12:04 ShantanuNair

Threw out a PR for this https://github.com/hwchase17/langchainjs/pull/905

mishkinf avatar Apr 20 '23 05:04 mishkinf

Hi, @ShantanuNair! 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 my understanding, you requested the ability to pass additional fields to the embeddings table and a filter for retrieving filtered embeddings. It seems that you were facing difficulties due to the version of Supabase you were using. However, I'm happy to inform you that this issue has been resolved. mishkinf has submitted a pull request (PR) for this issue at https://github.com/hwchase17/langchainjs/pull/905.

Before we close this issue, we would like to confirm if it 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 please don't hesitate to reach out if you have any further questions or concerns!

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