Rename Rhesis Default model to Rhesis - #2385
Conversation
Display name changes from "Rhesis Default"/"Rhesis Default Embedding" to "Rhesis"/"Rhesis Embedding", and model_name from "default" to "rhesis-managed" (composite id becomes rhesis/rhesis-managed). Includes a data migration for existing org rows.
There was a problem hiding this comment.
Improvement: Tighten the embedding fallback and migration predicates.
get_default_embedding_model()now prefers a more generic name ("Rhesis Embedding")—consider ensuring it can’t accidentally select a user-created model with the same name.- Alembic migration matches only on
name+is_protected; consider additionally matching on expectedmodel_name/provider/model_type so upgrade/downgrade are safer against unexpected duplicates.
| .filter( | ||
| models.Model.organization_id == org_uuid, | ||
| models.Model.name == "Rhesis Default Embedding", | ||
| models.Model.name == "Rhesis Embedding", |
There was a problem hiding this comment.
Improvement: get_default_embedding_model() now prefers the org model named "Rhesis Embedding".
If a user creates a non-protected embedding model with the same name, this will pick that one first (.first()), which seems like an easy footgun now that the name is more generic.
Fix: Consider adding
models.Model.is_protected.is_(True)(and/or joining provider_type == "rhesis") to theby_namequery as well, so the fallback is guaranteed to pick the system model.
There was a problem hiding this comment.
Confirmed fix: adding is_protected.is_(True) to the org-name fallback avoids collisions with user-created models named "Rhesis Embedding". Thanks!
| model_name = 'default', | ||
| description = 'Default Rhesis language model.' | ||
| WHERE name = 'Rhesis' | ||
| AND is_protected = TRUE |
There was a problem hiding this comment.
Improvement: The migration renames rows purely by name + is_protected = TRUE.
If an org ever ends up with multiple protected Rhesis models called "Rhesis" (or "Rhesis Embedding") from prior partial runs/manual fixes, the downgrade() would flip all matching rows back to model_name='default'.
Fix: Consider tightening the WHERE clauses to also include provider (join on
provider_type_id→ type_value = 'rhesis') and the expectedmodel_type, or at least match on the old/newmodel_namevalues too (e.g. upgrade WHEREmodel_name='default', downgrade WHEREmodel_name='rhesis-managed').
There was a problem hiding this comment.
Much safer with the provider_type_id (= rhesis) predicate added. Optional extra hardening: also constrain by the expected model_name (upgrade model_name='default', downgrade model_name='rhesis-managed') and/or model_type, so a future additional protected Rhesis model named "Rhesis" doesn’t get flipped on downgrade.
There was a problem hiding this comment.
Leaving as-is for now — name + is_protected + provider=rhesis already uniquely identifies these rows given the current data model (one protected rhesis-provider model per org per type today). Adding a model_name guard would only matter for a hypothetical future protected model also named "Rhesis" with a different `model_name", so not worth the extra complexity right now. Thanks for flagging it though.
There was a problem hiding this comment.
Makes sense — with provider=rhesis + is_protected (and given the current “one protected rhesis model per org per type” invariant), the migration scope is already pretty tight.
If you keep it as-is, one small suggestion would be to add a brief comment in the migration noting that assumption, so future us knows why we didn’t also guard on model_name/model_type. Otherwise I’m good with this.
Require is_protected in the embedding-model by-name lookup so a user-created model can't shadow the system default. Add a provider_type join to the rename migration's WHERE clauses so upgrade/downgrade only ever touch rhesis-provider protected rows.
|
Update after 13c866d:
Remaining (non-blocking) hardening suggestion: in the Alembic migration, also constrain upgrade/downgrade by the expected |
Purpose
The Rhesis-hosted default model was named "Rhesis Default" with model_name "default", which reads oddly in the UI now that other Rhesis-hosted models exist (Polyphemus). It's being renamed to "Rhesis" with model_name "rhesis-managed" to read more cleanly, matching the updated design.
What Changed
model_namefrom "default" to "rhesis-managed" for both, so the composite id becomesrhesis/rhesis-managed(wasrhesis/rhesis-default)ModelSettings), SDK defaults (sdk/src/rhesis/sdk/models/defaults.py), the explorer embedding fallback lookup, chatbot app defaults, Helm chart values, and.env.exampleto the new composite idb7e3a1c9d2f6to rename existing org rows in themodeltable (with a downgrade path back to the old names)Additional Context
dev-rhesis-default-polyphemus-url) are left as-is — those are GCP Secret Manager key names for Polyphemus, unrelated to this model's identifier, and changing them needs coordinated infra work.Testing
uv run pytest ../../tests/backend/services/test_organization.py ../../tests/backend/app/test_settings.py ../../tests/backend/routes/test_explorer.py ../../tests/backend/services/explorer/fromapps/backend— 358 passed, 1 skipped (pre-existing skip)uv run pytest ../tests/sdk/models/test_model_factory.py ../tests/sdk/connector/test_serializer_integration.pyfromsdk— 64 passeduv run alembic upgrade head) and confirmed all 131 org rows updated:Rhesis/rhesis-managedandRhesis Embedding/rhesis-managed, with no leftover "Rhesis Default" rows