mirror of
https://github.com/hwchase17/langchain
synced 2024-10-29 17:07:25 +00:00
e0605b464b
### Feature Using FAISS on a retrievalQA task, I found myself wanting to allow in multiple sources. From what I understood, the filter feature takes in a dict of form {key: value} which then will check in the metadata for the exact value linked to that key. I added some logic to be able to pass a list which will be checked against instead of an exact value. Passing an exact value will also work. Here's an example of how I could then use it in my own project: ``` pdfs_to_filter_in = ["file_A", "file_B"] filter_dict = { "source": [f"source_pdfs/{pdf_name}.pdf" for pdf_name in pdfs_to_filter_in] } retriever = db.as_retriever() retriever.search_kwargs = {"filter": filter_dict} ``` I added an integration test based on the other ones I found in `tests/integration_tests/vectorstores/test_faiss.py` under `test_faiss_with_metadatas_and_list_filter()`. It doesn't feel like this is worthy of its own notebook or doc, but I'm open to suggestions if needed. Co-authored-by: Dev 2049 <dev.dev2049@gmail.com> |
||
---|---|---|
.. | ||
cassettes | ||
docarray | ||
docker-compose | ||
fixtures | ||
__init__.py | ||
conftest.py | ||
fake_embeddings.py | ||
test_alibabacloud_opensearch.py | ||
test_analyticdb.py | ||
test_annoy.py | ||
test_atlas.py | ||
test_awadb.py | ||
test_azuresearch.py | ||
test_cassandra.py | ||
test_chroma.py | ||
test_clickhouse.py | ||
test_deeplake.py | ||
test_elasticsearch.py | ||
test_faiss.py | ||
test_hologres.py | ||
test_lancedb.py | ||
test_milvus.py | ||
test_mongodb_atlas.py | ||
test_myscale.py | ||
test_opensearch.py | ||
test_pgvector.py | ||
test_pinecone.py | ||
test_qdrant.py | ||
test_redis.py | ||
test_rocksetdb.py | ||
test_singlestoredb.py | ||
test_tair.py | ||
test_vectara.py | ||
test_weaviate.py | ||
test_zilliz.py |