from typing import Dict
from typing import List


def get_unique_relevant_docs_count(
    question_id_to_docs: Dict[str, List[dict]], relevance_threshold: float
) -> float:
    """Given a dictionary mapping a question id to a list of docs, find the number of unique relevant docs."""
    unique_relevant_docs = set()
    for qid, docs in question_id_to_docs.items():
        for doc in docs:
            if len(doc['answer']) > 0 and doc['f1'] >= relevance_threshold:
                unique_relevant_docs.add(doc['docid'])

    return len(unique_relevant_docs)