Skip to content

🟡 [DESIGN] threshold lives in infrastructure - should be SearchOptions #14

@FullFran

Description

@FullFran

Problem

Search threshold is configured in repository constructor:

def __init__(..., threshold: float = 0.3):
    self.threshold = threshold

This is retrieval POLICY, not infrastructure config.

Why It Matters

  • Can't vary threshold per query
  • Policy mixed with implementation
  • Hard to A/B test different thresholds

Solution

Move to Application layer as SearchOptions:

@dataclass
class SearchOptions:
    threshold: float = 0.3
    filters: dict | None = None
    
async def semantic_search(
    self, vector: List[float], limit: int, 
    options: SearchOptions | None = None
) -> List[SearchHit]:

Acceptance Criteria

  • threshold removed from repository constructor
  • SearchOptions created in application layer
  • semantic_search accepts options parameter

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions