Build a context relevance scorer for filtering retrieved documents before generation. ## Relevance Criteria {{relevance_criteria}} ## Query Types {{query_types}} ## Filtering Goals {{filtering_goals}} Implement relevance scoring: ```python class ContextRelevanceScorer: def score_document(self, query: str, document: str) -> float: """ Scoring signals: - Query-document similarity - Keyword overlap - Entity matching - Topic relevance """ pass def score_batch(self, query: str, documents: List[str]) -> List[float]: """Efficient batch scoring""" pass def filter_by_threshold(self, query: str, documents: List[str], threshold: float) -> List[str]: """Filter irrelevant documents""" pass def explain_score(self, query: str, document: str, score: float) -> str: """Explain scoring decision""" pass ``` Include: - LLM-based scoring option - Lightweight model alternative - Threshold calibration - Explainability features
Forked from Context Relevance Scorer by @samira-el-masri
Context Relevance Scorer
Build a context relevance scorer combining similarity, keyword, entity, and topic signals to filter retrieved documents before LLM generation.
0 copies0 forks
Share this prompt:
Details
Created Updated Shared