Skip to content

Commit

Permalink
renamed QdrntRetriever to QdrntEmbeddingRetriever (#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
sahusiddharth authored Jan 5, 2024
1 parent fae1e36 commit 3e314ea
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions integrations/qdrant/src/qdrant_haystack/retriever.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


@component
class QdrantRetriever:
class QdrantEmbeddingRetriever:
"""
A component for retrieving documents from an QdrantDocumentStore.
"""
Expand All @@ -20,7 +20,7 @@ def __init__(
return_embedding: bool = False, # noqa: FBT001, FBT002
):
"""
Create a QdrantRetriever component.
Create a QdrantEmbeddingRetriever component.
:param document_store: An instance of QdrantDocumentStore.
:param filters: A dictionary with filters to narrow down the search space. Default is None.
Expand Down Expand Up @@ -59,7 +59,7 @@ def to_dict(self) -> Dict[str, Any]:
return d

@classmethod
def from_dict(cls, data: Dict[str, Any]) -> "QdrantRetriever":
def from_dict(cls, data: Dict[str, Any]) -> "QdrantEmbeddingRetriever":
"""
Deserialize this component from a dictionary.
"""
Expand Down
14 changes: 7 additions & 7 deletions integrations/qdrant/tests/test_retriever.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@
)

from qdrant_haystack import QdrantDocumentStore
from qdrant_haystack.retriever import QdrantRetriever
from qdrant_haystack.retriever import QdrantEmbeddingRetriever


class TestQdrantRetriever(FilterableDocsFixtureMixin):
def test_init_default(self):
document_store = QdrantDocumentStore(location=":memory:", index="test")
retriever = QdrantRetriever(document_store=document_store)
retriever = QdrantEmbeddingRetriever(document_store=document_store)
assert retriever._document_store == document_store
assert retriever._filters is None
assert retriever._top_k == 10
assert retriever._return_embedding is False

def test_to_dict(self):
document_store = QdrantDocumentStore(location=":memory:", index="test")
retriever = QdrantRetriever(document_store=document_store)
retriever = QdrantEmbeddingRetriever(document_store=document_store)
res = retriever.to_dict()
assert res == {
"type": "qdrant_haystack.retriever.QdrantRetriever",
"type": "qdrant_haystack.retriever.QdrantEmbeddingRetriever",
"init_parameters": {
"document_store": {
"type": "qdrant_haystack.document_store.QdrantDocumentStore",
Expand Down Expand Up @@ -74,7 +74,7 @@ def test_to_dict(self):

def test_from_dict(self):
data = {
"type": "qdrant_haystack.retriever.QdrantRetriever",
"type": "qdrant_haystack.retriever.QdrantEmbeddingRetriever",
"init_parameters": {
"document_store": {
"init_parameters": {"location": ":memory:", "index": "test"},
Expand All @@ -86,7 +86,7 @@ def test_from_dict(self):
"return_embedding": True,
},
}
retriever = QdrantRetriever.from_dict(data)
retriever = QdrantEmbeddingRetriever.from_dict(data)
assert isinstance(retriever._document_store, QdrantDocumentStore)
assert retriever._document_store.index == "test"
assert retriever._filters is None
Expand All @@ -99,7 +99,7 @@ def test_run(self, filterable_docs: List[Document]):

document_store.write_documents(filterable_docs)

retriever = QdrantRetriever(document_store=document_store)
retriever = QdrantEmbeddingRetriever(document_store=document_store)

results: List[Document] = retriever.run(query_embedding=_random_embeddings(768))

Expand Down

0 comments on commit 3e314ea

Please sign in to comment.