Fix: the embedding model default breaks one deployment or the other - #174
Merged
Conversation
EMBEDDING_MODEL defaulted to the literal "bge-m3", which OpenAI has no such model for, so any deployment that did not set the variable got a 404 on its first query: The model `bge-m3` does not exist or you do not have access to it. Confirmed against the API. This arrived on main with the plantreactome merge earlier today; the lint and type gates cannot see it because it is a runtime configuration mismatch, and nothing exercised it. Queries are embedded and compared against vectors already in Chroma, so the model that built the bundle is the only correct answer -- not a constant kept in sync by hand. resolve_embedding_model() now reads it from the installed bundle, falls back to text-embedding-3-large when nothing is installed, and still honours EMBEDDING_MODEL. A configured value that disagrees with the bundle is logged as an error, because that combination produces meaningless retrieval rather than an obvious failure. Note EmbeddingEnvironment.get_model raises KeyError for a database that is not installed, while its sibling get_dir returns None for the same condition. Handled at the call site rather than changed, since it is a shared API. Five tests, including one asserting the default is never "bge-m3" specifically. env_template and the beta template now document both model variables. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…ctome's Corrects the previous commit, which hardcoded the Reactome bundle and so would have broken Plant Reactome instead. "bge-m3" is not a bad model -- it is the right one for Plant Reactome, which serves it from a self-hosted OpenAI-compatible endpoint via OPENAI_BASE_URL. It is wrong only as a *default*, because every bundle published for Reactome uses text-embedding-3-large and gets a 404 from api.openai.com. Hardcoding either model breaks the other deployment, so neither is hardcoded: the bundle path records which model built it, and that is the source of truth. AgentGraph builds one embedding shared by every profile, so all installed bundles must agree. Bundles built with different models are now reported as the misconfiguration they are, rather than one of them silently returning nonsense. The default arrived in a8aa04c, "Initial commit of adding PlantReactome profile", which reached main through the integration PR without ever having had a pull request of its own. Seven tests: Reactome resolves to text-embedding-3-large, Plant Reactome to bge-m3, an override is honoured, an override disagreeing with the bundle is reported, mixed bundles are reported, and nothing installed falls back. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Current
mainfails on the first query for any Reactome deployment that does not setEMBEDDING_MODEL.What is actually wrong
graph.pydefaulted to the literal"bge-m3". Againstapi.openai.com:But bge-m3 is not a bad model. It is the correct one for Plant Reactome, which serves it from a self-hosted OpenAI-compatible endpoint via
OPENAI_BASE_URL— the bundle isopenai/bge-m3/plantreactome/Release68. It is wrong only as a default, because every bundle published for Reactome usestext-embedding-3-large.So hardcoding either model breaks the other deployment. My first attempt at this fix hardcoded the Reactome bundle and would have broken Plant Reactome; this corrects that.
The fix
The bundle path records the model that built it, which makes it the source of truth rather than a constant kept in sync by hand.
resolve_embedding_model():AgentGraphbuilds one embedding shared by every profile, so bundles built with different models cannot all be servedEMBEDDING_MODELas an override, and logs an error when the override disagrees with the bundle, since that gives meaningless retrieval rather than an obvious failuretext-embedding-3-largeonly when nothing is installedVerified against the real Release95 bundle: resolves to
text-embedding-3-large.Where it came from, and a process point
The default arrived in
a8aa04c— "Initial commit of adding PlantReactome profile", Justin Elser, 2026-08-19.That branch has no pull request, in any state. It reached
maintoday through the integration PR #167 without ever having had a review of its own, and it carried a default that breaks the primary deployment. Neither the lint nor the type gate can see this: it is a runtime configuration mismatch, and nothing exercised it.Plant Reactome is unaffected in every configuration, verified:
EMBEDDING_MODELopenai/bge-m3/plantreactome/Release68bge-m3bge-m3bge-m3It is in fact more robust than before: it previously relied on a hardcoded default that happened to match, so changing that default for Reactome would have silently broken Plant Reactome. It now derives from the bundle actually installed.
Also
EmbeddingEnvironment.get_modelraisesKeyErrorfor an uninstalled database while its siblingget_dirreturnsNone. Not changed here — it is a shared API — but worth knowing.Tests
Seven: Reactome resolves to
text-embedding-3-large, Plant Reactome tobge-m3, override honoured, override-disagrees reported, mixed bundles reported, nothing-installed falls back, and one asserting the default is specifically neverbge-m3when a Reactome bundle is installed.Deployed instances
beta.reactome.org/chatand production both run imagee398a37, which predates this code, so neither is affected.🤖 Generated with Claude Code