refactor: section the config and make prompts a module
This commit is contained in:
parent
5c3ba8d6ec
commit
e970bdf542
6 changed files with 205 additions and 44 deletions
|
|
@ -12,7 +12,11 @@ _SUFFIX_PATTERN = re.compile(r"(?:\s*(?:\([^)]*\)|\[[^]]*\]))+\s*$")
|
|||
|
||||
@dataclass(frozen=True)
|
||||
class MatchVerdict:
|
||||
"""Explain whether a Spotify track safely matches a proposed candidate."""
|
||||
"""Match decision plus the two signals it was derived from.
|
||||
|
||||
A rejection is attributable: either title_similarity fell below the
|
||||
caller's threshold, or is_artist_match is false, or both.
|
||||
"""
|
||||
|
||||
is_match: bool
|
||||
title_similarity: float
|
||||
|
|
|
|||
|
|
@ -5,6 +5,9 @@ from app.domain.models import CompressedTasteProfile, TasteProfile, Track
|
|||
|
||||
def compress_taste_profile(profile: TasteProfile) -> CompressedTasteProfile:
|
||||
"""Build compact prompt text and the complete known track identifier set."""
|
||||
# No genre section on purpose: Spotify deprecated the artist genres
|
||||
# field for new apps, so there is no reliable genre source left in the
|
||||
# API. Artist and track names are the genre evidence the model reads.
|
||||
sections = (
|
||||
_line("Short-term top artists", profile.short_term_artists),
|
||||
_line("Long-term top artists", profile.long_term_artists),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue