In Haystack 2.0, you’ll be able to create custom components simply by creating a class with a @component
decorator (and a few more steps). The Haystack elves have been in their workshops, busy with creating ready-made components for you to use. But they’ve forgotten quite an important one. They have nothing that ranks documents based on date.
This is quite an important one for Elf Stefano who is often drowning in meeting notes. So, in this challenge, he’s provided you with a few documents that contain meeting notes, with the date of the meeting in the meta
field of the documents. He needs a pipeline that summarizes the decisions that were taken in these meetings. But as you can imagine, the order in which decisions were made can be quite important for this task!
Your challenge is to create a custom DateRanker
that can take a list of documents List[Document]
and return them in ranked order: newest to oldest. This way, the pipeline the Haystack elves created for you will work as intended!
⏳ Hint: You can check out this article where we created a custom
HackerNewsFetcher
📚 Useful documentation:
💚 Here is the Starter Colab