mirror of
https://github.com/hwchase17/langchain
synced 2024-10-29 17:07:25 +00:00
5171c3bcca
Description: This pull request aims to support generating the correct generic relevancy scores for different vector stores by refactoring the relevance score functions and their selection in the base class and subclasses of VectorStore. This is especially relevant with VectorStores that require a distance metric upon initialization. Note many of the current implenetations of `_similarity_search_with_relevance_scores` are not technically correct, as they just return `self.similarity_search_with_score(query, k, **kwargs)` without applying the relevant score function Also includes changes associated with: https://github.com/hwchase17/langchain/pull/6564 and https://github.com/hwchase17/langchain/pull/6494 See more indepth discussion in thread in #6494 Issue: https://github.com/hwchase17/langchain/issues/6526 https://github.com/hwchase17/langchain/issues/6481 https://github.com/hwchase17/langchain/issues/6346 Dependencies: None The changes include: - Properly handling score thresholding in FAISS `similarity_search_with_score_by_vector` for the corresponding distance metric. - Refactoring the `_similarity_search_with_relevance_scores` method in the base class and removing it from the subclasses for incorrectly implemented subclasses. - Adding a `_select_relevance_score_fn` method in the base class and implementing it in the subclasses to select the appropriate relevance score function based on the distance strategy. - Updating the `__init__` methods of the subclasses to set the `relevance_score_fn` attribute. - Removing the `_default_relevance_score_fn` function from the FAISS class and using the base class's `_euclidean_relevance_score_fn` instead. - Adding the `DistanceStrategy` enum to the `utils.py` file and updating the imports in the vector store classes. - Updating the tests to import the `DistanceStrategy` enum from the `utils.py` file. --------- Co-authored-by: Hanit <37485638+hanit-com@users.noreply.github.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_clarifai.py | ||
test_clickhouse.py | ||
test_deeplake.py | ||
test_elasticsearch.py | ||
test_faiss.py | ||
test_hologres.py | ||
test_lancedb.py | ||
test_marqo.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 |