Skip to content

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

Closed

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

Activity

  1. FullFran commented on Jan 26, 2026

    @FullFran
    OwnerAuthor

    Sigue abierta. El todavía vive en infraestructura () y se usa como default en ; no está integrado un en el flujo de aplicación. Dejo abierta.

  2. FullFran commented on Jan 26, 2026

    @FullFran
    OwnerAuthor

    Corrijo comentario anterior (el backtick se interpretó en shell).

    Sigue abierta. El threshold todavía vive en infraestructura (SupabaseRepository.__init__) y se usa como default en semantic_search; no está integrado un SearchOptions en el flujo de aplicación.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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