[Fix]: Docker server does not decode ContentRelevanceFilter #1648
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1642
List of files changed and why
crawl4ai/__init__.pyI added the missing
./deep_crawlingobjectsContentRelevanceFilterandContentTypeScorer. This was the simplest fix as it avoids the need to enhance the deserialization logic.crawl4ai/async_configsI implemented some of part one of the suggested fix. This isn't strictly necessary given the above change. However, it will make it easier to make further changes to enhance the deserialization logic.
importlibfrom_serializable_dict()to make it possible search multiple modules in order. However, given the above change, it is still currently only search in thecrawl4aimoduleFilterChaininfrom_serializable_dict()since it isn't necessary.crawl4ai/deep_crawling/filters.pyHere
ContentRelevanceFilterwas updated to address part two of the suggested fix.__slots__for serialization support__init__()to accept both list and string for querycrawl4ai/docker_clientFor testing purposes I needed to be able to pass a timeout parameter to
self._request. The parameterhooks_defaulthas a default value that I didn't change, so this won't affect production.tests/docker/test_filter_deep_crawl.pyI added three test cases involving the
ContentRelevanceFilterto reproduce the issue and then confirm that my updates to the code fixed the issue. There are now five test cases in total.How Has This Been Tested?
IMAGE=local-test docker compose uppython ~/crawl4ai/tests/docker/test_filter_deep_crawl.pyChecklist: