Skip to content

Commit

Permalink
FilterSearch -> QdrantSearch, Readme fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
NickyHavoc committed Oct 30, 2023
1 parent 719818e commit d00a77c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ cd src/examples && poetry run jupyter lab

## How to use this in your project

To install this as a dependency in your project, you will need to get a [Github access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens).
To install this as a dependency in your project, you need a [Github access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens).

Set your access token:

Expand All @@ -66,7 +66,7 @@ Let's install the package:
pip install git+https://$GITHUB_TOKEN@github.com/aleph-alpha-intelligence-layer/intelligence-layer.git
```

Now, the intelligence layer should be available and ready to use as a Python package.
Now the Intelligence Layer should be available as a Python package and ready to use.

```py
from intelligence_layer.core.task import Task
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ class EmbeddingBasedClassify(Task[ClassifyInput, ClassifyOutput]):
scoring: Configure how to calculate the final score.
Attributes:
METADATA_LABEL_NAME: The metadata field for label name for the `InMemoryRetriever`
instance.
METADATA_LABEL_NAME: The metadata field name for 'label' in the retriever.
Example:
>>> labels_with_examples = [
Expand Down Expand Up @@ -101,7 +100,7 @@ def __init__(
k=top_k_per_label,
retriever_type=RetrieverType.SYMMETRIC,
)
self._filter_search = QdrantSearch(retriever)
self._qdrant_search = QdrantSearch(retriever)

def run(self, input: ClassifyInput, logger: DebugLogger) -> ClassifyOutput:
self._validate_input_labels(input)
Expand Down Expand Up @@ -147,7 +146,7 @@ def _label_search(
]
),
)
return self._filter_search.run(search_input, logger)
return self._qdrant_search.run(search_input, logger)

def _calculate_scores(
self, results_per_label: Sequence[SearchOutput]
Expand Down
8 changes: 4 additions & 4 deletions src/intelligence_layer/use_cases/search/qdrant_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


class QdrantSearchInput(BaseModel):
"""The input for a `FilterSearch` task.
"""The input for a `QdrantSearch` task.
Attributes:
query: The text to be searched with.
Expand Down Expand Up @@ -39,8 +39,8 @@ class QdrantSearch(Task[QdrantSearchInput, SearchOutput]):
>>> )
>>> ]
>>> retriever = InMemoryRetriever(client, documents)
>>> task = FilterSearch(retriever)
>>> input = FilterSearchInput(
>>> task = QdrantSearch(retriever)
>>> input = QdrantSearchInput(
>>> query="When did East and West Germany reunite?"
>>> filter=models.Filter(
>>> must=[
Expand All @@ -51,7 +51,7 @@ class QdrantSearch(Task[QdrantSearchInput, SearchOutput]):
>>> ]
>>> )
>>> )
>>> logger = InMemoryLogger(name="Filter Search")
>>> logger = InMemoryLogger(name="Qdrant Search")
>>> output = task.run(input, logger)
"""

Expand Down
4 changes: 3 additions & 1 deletion tests/use_cases/search/test_qdrant_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ def in_memory_retriever_documents() -> Sequence[Document]:


@fixture
def filter_search(asymmetric_in_memory_retriever: QdrantInMemoryRetriever) -> QdrantSearch:
def filter_search(
asymmetric_in_memory_retriever: QdrantInMemoryRetriever,
) -> QdrantSearch:
return QdrantSearch(asymmetric_in_memory_retriever)


Expand Down

0 comments on commit d00a77c

Please sign in to comment.