fix(catalog): semantic search works again, and says why when it cannot - #54
Merged
Conversation
Sweeping the catalog commands found `catalog search --mode vss` and `--mode hybrid` failing with an unexplained HTTP 404 from the embedding provider — with a valid API key. The cause is outside the repo: Google retired text-embedding-004, so the endpoint we call no longer exists. `catalog build --embed` was broken the same way. The replacement is gemini-embedding-001, which returns 3072 dimensions by default where the catalog schema stores FLOAT[768], so the request asks for 768 explicitly and every existing catalog stays readable. Truncated vectors from that model are not unit length, unlike the ones text-embedding-004 returned, so they are normalised before storage — otherwise cosine similarity would be inconsistent between old and new rows. The model name is now read from ERPL_ADT_GEMINI_EMBED_MODEL when set, so the next retirement is a configuration change rather than a release, and a 404 from the provider now says which model was unavailable instead of surfacing a bare status. A second, quieter problem in the same command: a catalog built without --embed holds no vectors, and a semantic search over none returned an empty list — indistinguishable from "nothing matched". It now reports that the catalog has no embeddings and points at --mode fts or a rebuild. Verified against a 100 MB catalog: hybrid search returns ranked hits, and vss against an unembedded catalog explains itself rather than returning silence.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The audit's last group: the catalog commands. Two findings, one of them a live outage.
catalog search --mode vss|hybridwas broken by something outside this repoBoth failed with a bare HTTP 404 from the embedding provider — with a valid API key. The cause: Google retired
text-embedding-004, so the endpoint we call no longer exists.catalog build --embedwas broken the same way.gemini-embedding-001replaces it, with two details that matter:FLOAT[768], so the request asks for 768 explicitly — every existing catalog stays readable.text-embedding-004returned, so they are normalised before storage. Without that, cosine similarity would be inconsistent between rows written before and after this change.The model name now comes from
ERPL_ADT_GEMINI_EMBED_MODELwhen set, so the next retirement is a configuration change rather than a release, and a 404 from the provider names the unavailable model instead of surfacing a bare status.A quieter one in the same command
A catalog built without
--embedholds no vectors, and a semantic search over none returned an empty list — indistinguishable from "nothing matched", the same trap as the ADT commands in #52. It now says the catalog holds no embeddings and points at--mode ftsor a rebuild.Verified
Against a 100 MB catalog on this machine: hybrid search returns ranked hits, and
--mode vssagainst that (unembedded) catalog explains itself. 1349 unit tests pass.A correction worth recording
While fixing this I first "explained" the build failure as a GCC
-O3quirk and silenced it withinline. That was wrong: the compiler was right — a memberModelName()in the header shadowed the free function I had added, so my new model name was never used and the old one was still being sent. The member is now defined in the .cpp with the configurable logic, and the bogus comment is gone.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.