12 lines
579 B
Python
12 lines
579 B
Python
"""Taste-profile compression: raw listening data to a prompt-sized summary."""
|
|
|
|
from app.domain.models import TasteProfile
|
|
|
|
|
|
def compress_taste_profile(profile: TasteProfile, artist_limit: int = 15) -> str:
|
|
"""Render a profile as compact prompt text, bounded in size."""
|
|
return (
|
|
f"Top artists (long term): {', '.join(profile.top_artists_long_term[:artist_limit])}. "
|
|
f"Top artists (recent): {', '.join(profile.top_artists_short_term[:artist_limit])}. "
|
|
f"Recent favourite tracks: {', '.join(profile.top_tracks_short_term[:artist_limit])}."
|
|
)
|