clip-search: migration + client + probe binary

Probe-phase scaffolding for CLIP semantic search. Adds the column
that will hold per-photo embeddings, the HTTP client to Apollo's
inference service, and a throwaway probe binary so we can eyeball
search-result quality on the live library before building the
persistence layer (backlog drain, /photos/search endpoint, UI).

- migrations/2026-05-14-000000_add_clip_embedding/ — adds
  image_exif.clip_embedding (BLOB) and clip_model_version (TEXT),
  plus a partial index on (clip_embedding IS NULL AND content_hash
  IS NOT NULL) for the future backfill drain.
- src/database/models.rs — extends ImageExif struct to match.
- src/ai/clip_client.rs — encode_image / encode_text / health,
  same Permanent/Transient/Disabled taxonomy as face_client.
- src/bin/probe_clip_search.rs — --query <q> --library N --limit M
  --top K. Encodes a sample and prints top-K cosine similarities.
  No DB writes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cameron Cordes
2026-05-14 12:54:07 -04:00
parent 26ffc15c8b
commit 8d9e76cf15
9 changed files with 711 additions and 0 deletions
+6
View File
@@ -1511,6 +1511,8 @@ mod tests {
date_taken_source,
original_date_taken: None,
original_date_taken_source: None,
clip_embedding: None,
clip_model_version: None,
}
}
@@ -1550,6 +1552,8 @@ mod tests {
date_taken_source: data.date_taken_source.clone(),
original_date_taken: None,
original_date_taken_source: None,
clip_embedding: None,
clip_model_version: None,
})
}
@@ -1596,6 +1600,8 @@ mod tests {
date_taken_source: data.date_taken_source.clone(),
original_date_taken: None,
original_date_taken_source: None,
clip_embedding: None,
clip_model_version: None,
})
}