You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
Example Code
vector_store=AzureCosmosDBNoSqlVectorSearch.from_texts( >whatever>)
dict_condition= {"property": "metadata.field", "operator":"IN", "value": ["A","B"]}
condition=Condition(**dict_condition)
pre_filter=PreFilter(conditions= [condition],logical_operator="$and")
query="look for some info in document"vector_store.similarity_search(query=query, k=100, pre_filter=pre_filter)
Error Message and Stack Trace (if applicable)
Traceback (most recent call last):
(...)
... /.venv/lib/python3.9/site-packages/langchain_core/retrievers.py", line 259, in invoke
result = self._get_relevant_documents(
... /.venv/lib/python3.9/site-packages/langchain_core/vectorstores/base.py", line 1073, in _get_relevant_documents
docs = self.vectorstore.similarity_search(query, **_kwargs)
... /.venv/lib/python3.9/site-packages/langchain_community/vectorstores/azure_cosmos_db_no_sql.py", line 528, in similarity_search
docs_and_scores = self.similarity_search_with_score(
... /.venv/lib/python3.9/site-packages/langchain_community/vectorstores/azure_cosmos_db_no_sql.py", line 500, in similarity_search_with_score
docs_and_scores = self._hybrid_search_with_score(
... /.venv/lib/python3.9/site-packages/langchain_community/vectorstores/azure_cosmos_db_no_sql.py", line 442, in _hybrid_search_with_score
query, parameters = self._construct_query(
... /.venv/lib/python3.9/site-packages/langchain_community/vectorstores/azure_cosmos_db_no_sql.py", line 628, in _construct_query
where_clause = self._build_where_clause(pre_filter)
... /.venv/lib/python3.9/site-packages/langchain_community/vectorstores/azure_cosmos_db_no_sql.py", line 770, in _build_where_clause
raise ValueError(f"Unsupported operator: {condition.operator}")
ValueError: Unsupported operator: IN
Description
When trying to apply a filter using an IN condition it raises a value error as it is not in the operator_map in AzureCosmosDBNoSqlVectorSearch. This is probably an error as the filter system allows to define a list (only string) as value in the filter conditions, but there is not valid operator for this.
The solution will be to add the IN operator to the operator_map.
System Info
System Information
OS: Linux
OS Version: #1 SMP Tue Nov 5 00:21:55 UTC 2024
Python Version: 3.9.20 (main, Oct 16 2024, 04:36:33)
[Clang 18.1.8 ]
aiohttp<4.0.0,>=3.8.3: Installed. No version info available.
async-timeout<5.0.0,>=4.0.0;: Installed. No version info available.
chromadb!=0.5.10,!=0.5.11,!=0.5.12,!=0.5.4,!=0.5.5,!=0.5.7,!=0.5.9,<0.7.0,>=0.4.0: Installed. No version info available.
cohere: 5.13.12
dataclasses-json<0.7,>=0.5.7: Installed. No version info available.
filetype: 1.2.0
google-generativeai: 0.8.4
httpx: 0.28.1
httpx-sse<1.0.0,>=0.4.0: Installed. No version info available.
jsonpatch<2.0,>=1.33: Installed. No version info available.
langchain-anthropic;: Installed. No version info available.
langchain-aws;: Installed. No version info available.
langchain-cohere;: Installed. No version info available.
langchain-community;: Installed. No version info available.
langchain-core!=0.3.0,!=0.3.1,!=0.3.10,!=0.3.11,!=0.3.12,!=0.3.13,!=0.3.14,!=0.3.2,!=0.3.3,!=0.3.4,!=0.3.5,!=0.3.6,!=0.3.7,!=0.3.8,!=0.3.9,<0.4.0,>=0.2.43: Installed. No version info available.
langchain-core<1.0.0,>=0.3.34: Installed. No version info available.
langchain-deepseek;: Installed. No version info available.
langchain-fireworks;: Installed. No version info available.
langchain-google-genai;: Installed. No version info available.
langchain-google-vertexai;: Installed. No version info available.
langchain-groq;: Installed. No version info available.
langchain-huggingface;: Installed. No version info available.
langchain-mistralai;: Installed. No version info available.
langchain-ollama;: Installed. No version info available.
langchain-openai;: Installed. No version info available.
langchain-text-splitters<1.0.0,>=0.3.6: Installed. No version info available.
langchain-together;: Installed. No version info available.
langchain<1.0.0,>=0.3.18: Installed. No version info available.
langsmith-pyo3: Installed. No version info available.
langsmith<0.4,>=0.1.125: Installed. No version info available.
langsmith<0.4,>=0.1.17: Installed. No version info available.
numpy<2,>=1.26.4;: Installed. No version info available.
numpy<2.0.0,>=1.22.4;: Installed. No version info available.
numpy<2.0.0,>=1.26.2;: Installed. No version info available.
numpy<3,>=1.26.2;: Installed. No version info available.
openai<2.0.0,>=1.58.1: Installed. No version info available.
orjson: 3.10.15
packaging<25,>=23.2: Installed. No version info available.
pydantic: 2.10.6
pydantic-settings<3.0.0,>=2.4.0: Installed. No version info available.
pydantic<3.0.0,>=2.5.2;: Installed. No version info available.
pydantic<3.0.0,>=2.7.4: Installed. No version info available.
pydantic<3.0.0,>=2.7.4;: Installed. No version info available.
pytest: 8.3.4
PyYAML>=5.3: Installed. No version info available.
requests: 2.32.3
requests-toolbelt: 1.0.0
requests<3,>=2: Installed. No version info available.
rich: 13.9.4
SQLAlchemy<3,>=1.4: Installed. No version info available.
tenacity!=8.4.0,<10,>=8.1.0: Installed. No version info available.
tenacity!=8.4.0,<10.0.0,>=8.1.0: Installed. No version info available.
tiktoken<1,>=0.7: Installed. No version info available.
types-pyyaml: 6.0.12.20241230
typing-extensions>=4.7: Installed. No version info available.
zstandard: 0.23.0
The text was updated successfully, but these errors were encountered:
Checked other resources
Example Code
Error Message and Stack Trace (if applicable)
Traceback (most recent call last):
(...)
... /.venv/lib/python3.9/site-packages/langchain_core/retrievers.py", line 259, in invoke
result = self._get_relevant_documents(
... /.venv/lib/python3.9/site-packages/langchain_core/vectorstores/base.py", line 1073, in _get_relevant_documents
docs = self.vectorstore.similarity_search(query, **_kwargs)
... /.venv/lib/python3.9/site-packages/langchain_community/vectorstores/azure_cosmos_db_no_sql.py", line 528, in similarity_search
docs_and_scores = self.similarity_search_with_score(
... /.venv/lib/python3.9/site-packages/langchain_community/vectorstores/azure_cosmos_db_no_sql.py", line 500, in similarity_search_with_score
docs_and_scores = self._hybrid_search_with_score(
... /.venv/lib/python3.9/site-packages/langchain_community/vectorstores/azure_cosmos_db_no_sql.py", line 442, in _hybrid_search_with_score
query, parameters = self._construct_query(
... /.venv/lib/python3.9/site-packages/langchain_community/vectorstores/azure_cosmos_db_no_sql.py", line 628, in _construct_query
where_clause = self._build_where_clause(pre_filter)
... /.venv/lib/python3.9/site-packages/langchain_community/vectorstores/azure_cosmos_db_no_sql.py", line 770, in _build_where_clause
raise ValueError(f"Unsupported operator: {condition.operator}")
ValueError: Unsupported operator: IN
Description
When trying to apply a filter using an IN condition it raises a value error as it is not in the operator_map in AzureCosmosDBNoSqlVectorSearch. This is probably an error as the filter system allows to define a list (only string) as value in the filter conditions, but there is not valid operator for this.
The solution will be to add the IN operator to the operator_map.
System Info
System Information
Package Information
Optional packages not installed
Other Dependencies
The text was updated successfully, but these errors were encountered: