docs: Update Google BigQuery Vector Search with new SQL filter feature introduce in langchain-google-community 1.0.9 (#26184)

Hello,

fix: https://github.com/langchain-ai/langchain/issues/26183

Adding documentation regarding SQL like filter for Google BigQuery
Vector Search coming in next langchain-google-community 1.0.9 release.
Note: langchain-google-community==1.0.9 is not yet released

Question: There is no way to warn the user int the doc about the
availability of a feature after a specific package version ?

---------

Co-authored-by: Erick Friis <erick@langchain.dev>
This commit is contained in:
Geoffrey HARRAZI 2024-09-08 20:58:28 +02:00 committed by GitHub
parent bca51ca164
commit 76bce42629
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -325,7 +325,13 @@
"id": "20cf6074081b"
},
"source": [
"### Search for documents with metadata filter"
"### Searching Documents with Metadata Filters\n",
"The vectorstore supports two methods for applying filters to metadata fields when performing document searches:\n",
"\n",
"- Dictionary-based Filters\n",
" - You can pass a dictionary (dict) where the keys represent metadata fields and the values specify the filter condition. This method applies an equality filter between the key and the corresponding value. When multiple key-value pairs are provided, they are combined using a logical AND operation.\n",
"- SQL-based Filters\n",
" - Alternatively, you can provide a string representing an SQL WHERE clause to define more complex filtering conditions. This allows for greater flexibility, supporting SQL expressions such as comparison operators and logical operators."
]
},
{
@ -336,11 +342,24 @@
},
"outputs": [],
"source": [
"# Dictionary-based Filters\n",
"# This should only return \"Banana\" document.\n",
"docs = store.similarity_search_by_vector(query_vector, filter={\"len\": 6})\n",
"print(docs)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# SQL-based Filters\n",
"# This should return \"Banana\", \"Apples and oranges\" and \"Cars and airplanes\" documents.\n",
"docs = store.similarity_search_by_vector(query_vector, filter={\"len = 6 AND len > 17\"})\n",
"print(docs)"
]
},
{
"cell_type": "markdown",
"metadata": {