def sorted_unique_documents(self, step: int):
    """Unique documents seen until 'step' ordered by mr score."""
    documents = []
    seen_contents = set()

    for entry in self.history[:step]:
      for doc in entry.documents:
        if doc.content not in seen_contents:
          documents.append(doc)
          seen_contents.add(doc.content)

    # sort the documents according to the MR score of its extracted answer
    sorted_documents = sorted(
        documents,
        key=lambda doc: doc.answer.mr_score if doc.answer else -15.,
        reverse=True)
    return sorted_documents
Unique documents seen until 'step' ordered by mr score.
language/search_agents/muzero/types.py