Commit Graph

10 Commits

Author SHA1 Message Date
2c6ba345b1 Fix pgvector embedding format in recommender query
profile.embedding was being passed as str(numpy_array) which produces
scientific notation format. pgvector needs [n1,n2,...] format. Now
explicitly formats as comma-separated float list.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 11:30:02 -06:00
6a2be93556 Fix CLAP embedding extraction for transformers 5.x
In transformers 5.x, ClapModel.get_audio_features() returns a
BaseModelOutputWithPooling instead of a raw tensor. The 512-dim
embedding is in .pooler_output[0], not directly indexed. Added
backward-compatible extraction with hasattr check.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 10:55:38 -06:00
e9cf1e9b17 Fix embedding dimensions and worker session management
Two issues:
1. CLAP model output needed .flatten() to produce a 1-D vector for
   pgvector. Without it, the nested array caused "expected ndim to be 1".
2. Worker now uses a fresh session per track instead of sharing one
   across a batch, preventing PendingRollbackError cascading from one
   failure to the next.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 10:43:44 -06:00
771f714384 Fix error handling in embedding worker: capture actual exception message
The except clause wasn't binding the exception to a variable, so
str(Exception) stored the class name "<class 'Exception'>" instead of
the actual error message. Now properly captures `as e` and stores str(e).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 10:34:11 -06:00
07e22550fe Fix CLAP processor: audios -> audio kwarg
transformers 5.x renamed the parameter.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 10:23:02 -06:00
92a75d6432 Add ForeignKey declarations to SQLAlchemy model columns
SQLAlchemy relationships require ForeignKey on the column definitions,
not just in the migration. Without them, mapper initialization fails.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 09:05:50 -06:00
f8c13daa11 Fix SQLAlchemy import: Real -> REAL
SQLAlchemy exports REAL (uppercase), not Real.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 08:59:10 -06:00
179071b817 Fix Dockerfile: copy source before pip install
The pyproject.toml references the package source, so src/ must be
present when pip resolves metadata.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 08:51:45 -06:00
7ff69449d6 Initial haunt-fm implementation
Full music recommendation pipeline: listening history capture via webhook,
Last.fm candidate discovery, iTunes preview download, CLAP audio embeddings
(512-dim), pgvector cosine similarity recommendations, playlist generation
with known/new track interleaving, and Music Assistant playback via HA.

Includes: FastAPI app, SQLAlchemy models, Alembic migrations, Docker Compose
with pgvector/pg17, status dashboard, and all API endpoints.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 08:36:36 -06:00
897d0fe1fb Initial commit 2026-02-22 14:04:01 +00:00