Skip to content

The agent engineering platform.

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

Geoffrey HARRAZI76bce4262955
diff --git a/docs/docs/integrations/vectorstores/google_bigquery_vector_search.ipynb b/docs/docs/integrations/vectorstores/google_bigquery_vector_search.ipynb
index 8287bb04ca..f5cc0e92c4 100644
--- a/docs/docs/integrations/vectorstores/google_bigquery_vector_search.ipynb
+++ b/docs/docs/integrations/vectorstores/google_bigquery_vector_search.ipynb
@@ -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": {