Files
Lyra/worker/lyra_worker/similarity/base.py
T
Jonathan 889e33355f feat(discovery): SimilaritySource protocol + FakeSimilaritySource
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-12 00:03:45 +02:00

23 lines
483 B
Python

from dataclasses import dataclass
from typing import Protocol, runtime_checkable
@dataclass(frozen=True)
class SimilarArtist:
mbid: str
name: str
score: float
@runtime_checkable
class SimilaritySource(Protocol):
name: str
def health(self) -> bool:
"""Is this source reachable right now?"""
...
def similar_artists(self, mbid: str) -> list[SimilarArtist]:
"""Artists similar to the given artist MBID (MBID-native)."""
...