Feature: Qdrant filters supports (#5446)

# Support Qdrant filters

Qdrant has an [extensive filtering
system](https://qdrant.tech/documentation/concepts/filtering/) with rich
type support. This PR makes it possible to use the filters in Langchain
by passing an additional param to both the
`similarity_search_with_score` and `similarity_search` methods.

## Who can review?

@dev2049 @hwchase17

---------

Co-authored-by: Dev 2049 <dev.dev2049@gmail.com>
This commit is contained in:
Kacper Łukawski
2023-05-31 11:26:16 +02:00
committed by GitHub
parent f72bb966f8
commit 8bcaca435a
4 changed files with 82 additions and 5 deletions

View File

@@ -399,6 +399,31 @@
"print(f\"\\nScore: {score}\")"
]
},
{
"cell_type": "markdown",
"source": [
"### Metadata filtering\n",
"\n",
"Qdrant has an [extensive filtering system](https://qdrant.tech/documentation/concepts/filtering/) with rich type support. It is also possible to use the filters in Langchain, by passing an additional param to both the `similarity_search_with_score` and `similarity_search` methods."
],
"metadata": {
"collapsed": false
}
},
{
"cell_type": "markdown",
"source": [
"```python\n",
"from qdrant_client.http import models as rest\n",
"\n",
"query = \"What did the president say about Ketanji Brown Jackson\"\n",
"found_docs = qdrant.similarity_search_with_score(query, filter=rest.Filter(...))\n",
"```"
],
"metadata": {
"collapsed": false
}
},
{
"cell_type": "markdown",
"id": "c58c30bf",