Skip to content

Commit

Permalink
docs: Update Google BigQuery Vector Search with new SQL filter featur…
Browse files Browse the repository at this point in the history
…e introduce in langchain-google-community 1.0.9 (#26184)

Hello,

fix: #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 <[email protected]>
  • Loading branch information
Freezaa9 and efriis authored Sep 8, 2024
1 parent bca51ca commit 76bce42
Showing 1 changed file with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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."
]
},
{
Expand All @@ -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": {
Expand Down

0 comments on commit 76bce42

Please sign in to comment.