Skip to content

Commit

Permalink
feat: Tweak CacheChecker output type (#6719)
Browse files Browse the repository at this point in the history
* specify cache checker output type

* (de)serialization

* tests

* add default value for type

* reno

* mypy

* feedback

* reduce diff

* reduce diff

* reno
  • Loading branch information
ZanSara authored Jan 11, 2024
1 parent 79d67b0 commit 60780ce
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion haystack/components/caching/cache_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "CacheChecker":
data["init_parameters"]["document_store"] = docstore
return default_from_dict(cls, data)

@component.output_types(hits=List[Document], misses=List[Any])
@component.output_types(hits=List[Document], misses=List)
def run(self, items: List[Any]):
"""
Checks if any document associated with the specified field is already present in the store. If matching documents
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
enhancements:
- Modify the output type of `CacheChecker` from `List[Any]` to `List` to make it possible to connect it in a Pipeline.
2 changes: 1 addition & 1 deletion test/components/caching/test_url_cache_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from haystack.components.caching.cache_checker import CacheChecker


class TestUrlCacheChecker:
class TestCacheChecker:
def test_to_dict(self):
mocked_docstore_class = document_store_class("MockedDocumentStore")
component = CacheChecker(document_store=mocked_docstore_class(), cache_field="url")
Expand Down

0 comments on commit 60780ce

Please sign in to comment.