Coverage for src/qdrant_loader_mcp_server/search/enhanced/cdi/interfaces.py: 100%

14 statements  

« prev     ^ index     » next       coverage.py v7.10.6, created at 2025-09-08 06:06 +0000

1from __future__ import annotations 

2 

3from collections.abc import Awaitable 

4from typing import Protocol 

5 

6from ...components.search_result_models import HybridSearchResult 

7from ...models import SearchResult 

8from .models import ( 

9 ClusteringStrategy, 

10 ComplementaryContent, 

11 ConflictAnalysis, 

12 DocumentCluster, 

13 DocumentSimilarity, 

14) 

15 

16 

17class EntityExtractor(Protocol): 

18 def extract(self, result: SearchResult) -> list[str]: ... 

19 

20 

21class RelationExtractor(Protocol): 

22 def extract(self, results: list[SearchResult]) -> list[tuple[str, str, str]]: ... 

23 

24 

25class GraphBuilder(Protocol): 

26 def build(self, results: list[SearchResult]) -> object: ... 

27 

28 

29class Ranker(Protocol): 

30 def rank(self, results: list[HybridSearchResult]) -> list[HybridSearchResult]: ... 

31 

32 

33class Clusterer(Protocol): 

34 def cluster( 

35 self, 

36 results: list[SearchResult], 

37 strategy: ClusteringStrategy | None = None, 

38 max_clusters: int | None = None, 

39 min_cluster_size: int | None = None, 

40 ) -> list[DocumentCluster]: ... 

41 

42 

43class SimilarityComputer(Protocol): 

44 def compute(self, a: SearchResult, b: SearchResult) -> DocumentSimilarity: ... 

45 

46 

47class Recommender(Protocol): 

48 def recommend( 

49 self, target: SearchResult, pool: list[SearchResult] 

50 ) -> ComplementaryContent: ... 

51 

52 

53class ConflictDetector(Protocol): 

54 def detect( 

55 self, results: list[SearchResult] 

56 ) -> ConflictAnalysis | Awaitable[ConflictAnalysis]: ...