langchain
langchain copied to clipboard
Supabase vectorstore does not support $in in a filter to match to a list of ids
Checked other resources
- [X] I added a very descriptive title to this issue.
- [X] I searched the LangChain documentation with the integrated search.
- [X] I used the GitHub search to find a similar question and didn't find it.
- [X] I am sure that this is a bug in LangChain rather than my code.
- [X] The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
Example Code
from langchain_community.vectorstores import SupabaseVectorStore
vector_store = SupabaseVectorStore(table_name="documents",
query_name="match_documents",
embedding=cached_embedding,
client=supabase
)
policy_ids = ['20bac4b3-5964-47cf-a2a9-06e888c14add', '6004585c-624a-417c-91b5-ff4b9374b0fd']
vector_store.similarity_search_with_relevance_scores(
question,
filter = {"file_id": {"$in": policy_ids}},
)
### Error Message and Stack Trace (if applicable)
None
### Description
I'm using Superbase as a vector store. I want to filter the similarity search to just the rows where metadata-> file_id is in a list of file_ids
According to the documentation I should be able to use filter = {"file_id": {"$in": policy_ids}}, however this results in no rows being returned.
If I use filter = {"file_id": policy_ids[0} I get the match for the first policy_id
The issue seems to be $in is not supported in Superbase
### System Info
System Information
------------------
> OS: Linux
> OS Version: #1 SMP PREEMPT_DYNAMIC Wed, 23 Oct 2024 21:23:44 +0000
> Python Version: 3.11.2 (main, Aug 26 2024, 07:20:54) [GCC 12.2.0]
Package Information
-------------------
> langchain_core: 0.3.10
> langchain: 0.3.3
> langchain_community: 0.3.2
> langsmith: 0.1.134
> langchain_anthropic: 0.2.3
> langchain_openai: 0.2.2
> langchain_text_splitters: 0.3.0
Optional packages not installed
-------------------------------
> langgraph
> langserve
Other Dependencies
------------------
> aiohttp: 3.10.10
> anthropic: 0.36.0
> async-timeout: Installed. No version info available.
> dataclasses-json: 0.6.7
> defusedxml: 0.7.1
> httpx: 0.27.2
> jsonpatch: 1.33
> numpy: 1.26.4
> openai: 1.51.2
> orjson: 3.10.7
> packaging: 24.1
> pydantic: 2.9.2
> pydantic-settings: 2.5.2
> PyYAML: 6.0.2
> requests: 2.32.3
> requests-toolbelt: 1.0.0
> SQLAlchemy: 2.0.35
> tenacity: 8.5.0
> tiktoken: 0.8.0
> typing-extensions: 4.12.2