mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-01 00:49:25 +00:00
langchain_community: updated query constructor for Databricks Vector Search due to LangChainDeprecationWarning: filters
was deprecated since langchain-community 0.2.11 and will be removed in 0.3. Please use filter
instead. (#27974)
- **Description:** Updated the kwargs for the structured query from filters to filter due to deprecation of 'filters' for Databricks Vector Search. Also changed the error messages as the allowed operators and comparators are different which can cause issues with functions such as get_query_constructor_prompt() - **Issue:** Fixes the Key Error for filters due to deprecation in favor for 'filter': LangChainDeprecationWarning: DatabricksVectorSearch received a key `filters` in search_kwargs. `filters` was deprecated since langchain-community 0.2.11 and will be removed in 0.3. Please use `filter` instead. - **Dependencies:** N/A - **Twitter handle:** N/A --------- Co-authored-by: Erick Friis <erick@langchain.dev>
This commit is contained in:
parent
6e607bb237
commit
15e7353168
@ -90,5 +90,5 @@ class DatabricksVectorSearchTranslator(Visitor):
|
||||
if structured_query.filter is None:
|
||||
kwargs = {}
|
||||
else:
|
||||
kwargs = {"filters": structured_query.filter.accept(self)}
|
||||
kwargs = {"filter": structured_query.filter.accept(self)}
|
||||
return structured_query.query, kwargs
|
||||
|
@ -109,7 +109,7 @@ def test_visit_structured_query_with_one_arg_filter() -> None:
|
||||
filter=comp,
|
||||
)
|
||||
|
||||
expected = (query, {"filters": {"country": "France"}})
|
||||
expected = (query, {"filter": {"country": "France"}})
|
||||
|
||||
actual = DEFAULT_TRANSLATOR.visit_structured_query(structured_query)
|
||||
assert expected == actual
|
||||
@ -134,7 +134,7 @@ def test_visit_structured_query_with_multiple_arg_filter_and_operator() -> None:
|
||||
|
||||
expected = (
|
||||
query,
|
||||
{"filters": {"country": "France", "year >=": 1888, "year <=": 1900}},
|
||||
{"filter": {"country": "France", "year >=": 1888, "year <=": 1900}},
|
||||
)
|
||||
|
||||
actual = DEFAULT_TRANSLATOR.visit_structured_query(structured_query)
|
||||
|
Loading…
Reference in New Issue
Block a user