Repository navigation
fix(studio): require a GLiNER model for the anonymizer entity detector [ASTD-336] - #957
Conversation
…r [ASTD-336] The detector role was defaulted to the general LLM when no GLiNER model was registered, which always produced a config that dies at detection: the library injects GLiNER-only params (labels, threshold, chunk_length, overlap, flat_ner) into whatever that role points at, and a chat endpoint rejects them with a 400. Restrict the picker to GLiNER models, drop the fallback so the role stays empty rather than pre-filled with something unusable, and say why in the empty state. An unset role already blocks submit through the existing role validation, so the failure now surfaces in the form instead of mid-run. Matching moves to a shared helper that checks the served model name as well as the entity id, since either may carry the name depending on how the model was registered. Signed-off-by: mschwab <mschwab@nvidia.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe Anonymizer Builder centralizes GLiNER model detection, separates GLiNER and LLM defaults, and applies role-specific model options and validation in the model settings selector. ChangesGLiNER model selection
Sequence Diagram(s)sequenceDiagram
participant ModelSettingsSection
participant isGlinerModel
participant ControlledSearchableSelect
ModelSettingsSection->>isGlinerModel: classify available models
isGlinerModel-->>ModelSettingsSection: identify GLiNER options
ModelSettingsSection->>ControlledSearchableSelect: provide role-specific options and validation
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
🔧 Fix failing CI
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
web/packages/studio/src/routes/AnonymizerBuilderRoute/utils.test.ts (1)
7-14: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winTest entity-ID matching explicitly.
The helper sets
idequal toname, so these tests do not verify the required ID-only case. A regression that ignoresmodel.idwould still pass.Proposed test fixture update
-const model = (name: string, servedModelName: string): DataDesignerModelOption => - ({ id: name, name, served_model_name: servedModelName }) as DataDesignerModelOption; +const model = (id: string, name: string, servedModelName: string): DataDesignerModelOption => + ({ id, name, served_model_name: servedModelName }) as DataDesignerModelOption; +expect(isGlinerModel(model('nvidia/gliner-pii', 'pii-detector', ''))).toBe(true);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/packages/studio/src/routes/AnonymizerBuilderRoute/utils.test.ts` around lines 7 - 14, Update the isGlinerModel test fixtures so at least one case uses a model id containing the GLiNER identifier while its name does not, explicitly verifying ID-only matching. Adjust the model helper or add a fixture that allows id and name to differ, while preserving the existing case-insensitive and served_model_name coverage.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@web/packages/studio/src/routes/AnonymizerBuilderRoute/useDefaultRoleModels.ts`:
- Around line 31-42: Update the default LLM selection in useDefaultRoleModels so
every fallback excludes models matching isGlinerModel, including the
suggested-name lookup and final fallback to models[0]. Keep gliner selection
unchanged for GLINER_ROLE, while ensuring non-detector roles never receive a
GLiNER model.
In `@web/packages/studio/src/routes/AnonymizerBuilderRoute/utils.ts`:
- Around line 10-11: Update isGlinerModel to match the GLiNER entity identifier
against model.id, while preserving the existing case-insensitive matching
behavior and optional handling for other model fields as appropriate.
---
Nitpick comments:
In `@web/packages/studio/src/routes/AnonymizerBuilderRoute/utils.test.ts`:
- Around line 7-14: Update the isGlinerModel test fixtures so at least one case
uses a model id containing the GLiNER identifier while its name does not,
explicitly verifying ID-only matching. Adjust the model helper or add a fixture
that allows id and name to differ, while preserving the existing
case-insensitive and served_model_name coverage.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: d4b854b0-01ae-40c6-aa93-885d83f1a7dd
📒 Files selected for processing (4)
web/packages/studio/src/routes/AnonymizerBuilderRoute/components/ModelSettingsSection.tsxweb/packages/studio/src/routes/AnonymizerBuilderRoute/useDefaultRoleModels.tsweb/packages/studio/src/routes/AnonymizerBuilderRoute/utils.test.tsweb/packages/studio/src/routes/AnonymizerBuilderRoute/utils.ts
|
…336] The explanation only appeared inside the detector's dropdown, so it was invisible until the menu was opened. It is now a field error on the input — red border plus message — visible as soon as Model Settings is shown. The menu keeps the plain no-models empty state. Signed-off-by: mschwab <mschwab@nvidia.com>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
web/packages/studio/src/routes/AnonymizerBuilderRoute/components/ModelSettingsSection.tsx (1)
57-57: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winClear stale detector values when the model is no longer GLiNER.
optionsForRole(role)only filters the dropdown;ControlledSearchableSelectkeeps the existing value, anduseDefaultRoleModels.tsskips any truthyroleModels.${role}.modelId. That lets an old non-GLiNERentity_detectorkeep itsmodel/providerand be submitted. Clear or revalidate the detector fields when its selected model is no longer GLiNER.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/packages/studio/src/routes/AnonymizerBuilderRoute/components/ModelSettingsSection.tsx` at line 57, Update the detector model handling in ModelSettingsSection and its ControlledSearchableSelect usage so changing away from a GLiNER model clears or revalidates the detector model and provider fields, rather than only filtering options via optionsForRole(role). Ensure stale entity_detector values cannot remain truthy and be submitted or bypass useDefaultRoleModels.ts defaults.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In
`@web/packages/studio/src/routes/AnonymizerBuilderRoute/components/ModelSettingsSection.tsx`:
- Line 57: Update the detector model handling in ModelSettingsSection and its
ControlledSearchableSelect usage so changing away from a GLiNER model clears or
revalidates the detector model and provider fields, rather than only filtering
options via optionsForRole(role). Ensure stale entity_detector values cannot
remain truthy and be submitted or bypass useDefaultRoleModels.ts defaults.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: e3741696-c973-4577-a19e-1e1b6a7af3fc
📒 Files selected for processing (1)
web/packages/studio/src/routes/AnonymizerBuilderRoute/components/ModelSettingsSection.tsx
pickDefaultModelName only filters NON_LLM_TERMS, which has no gliner entry, so a GLiNER model could win the suggested-name lookup or the array fallback and be seeded into the validator, augmenter and rewrite roles — the mirror of the bug this branch fixes. Draw those defaults from the non-GLiNER models only. Signed-off-by: mschwab <mschwab@nvidia.com>
Both helpers were single expressions used once, and the formFieldProps one repeated slotLabel/required across its branches. Signed-off-by: mschwab <mschwab@nvidia.com>
…r [ASTD-336] (#957) * fix(studio): require a GLiNER model for the anonymizer entity detector [ASTD-336] The detector role was defaulted to the general LLM when no GLiNER model was registered, which always produced a config that dies at detection: the library injects GLiNER-only params (labels, threshold, chunk_length, overlap, flat_ner) into whatever that role points at, and a chat endpoint rejects them with a 400. Restrict the picker to GLiNER models, drop the fallback so the role stays empty rather than pre-filled with something unusable, and say why in the empty state. An unset role already blocks submit through the existing role validation, so the failure now surfaces in the form instead of mid-run. Matching moves to a shared helper that checks the served model name as well as the entity id, since either may carry the name depending on how the model was registered. Signed-off-by: mschwab <mschwab@nvidia.com> * fix(studio): surface the missing GLiNER model as a field error [ASTD-336] The explanation only appeared inside the detector's dropdown, so it was invisible until the menu was opened. It is now a field error on the input — red border plus message — visible as soon as Model Settings is shown. The menu keeps the plain no-models empty state. Signed-off-by: mschwab <mschwab@nvidia.com> * fix(studio): keep GLiNER out of the chat-role defaults [ASTD-336] pickDefaultModelName only filters NON_LLM_TERMS, which has no gliner entry, so a GLiNER model could win the suggested-name lookup or the array fallback and be seeded into the validator, augmenter and rewrite roles — the mirror of the bug this branch fixes. Draw those defaults from the non-GLiNER models only. Signed-off-by: mschwab <mschwab@nvidia.com> * refactor(studio): inline the per-role model field props [ASTD-336] Both helpers were single expressions used once, and the formFieldProps one repeated slotLabel/required across its branches. Signed-off-by: mschwab <mschwab@nvidia.com> --------- Signed-off-by: mschwab <mschwab@nvidia.com>
Closes ASTD-336.
The builder defaulted
entity_detectorto the general LLM whenever the workspace had no GLiNER model:That fallback can never work. The library injects GLiNER-only inference params into whatever model the detector alias points at, with no model-type check:
so a chat endpoint rejects them and the job dies mid-run:
Affects all five strategies — every one runs detection. Pre-existing since ASTD-327.
Change
An unset role already fails the existing per-role validation, so submit is blocked with an inline error and the tab switches to Model Settings. The failure moves from a cryptic 400 mid-run to the form itself.
Matching moved to
utils.tsand now checks both the served model name and the entity id — the GLiNER model in my workspace registers asmodel_entity_id: default/nvidia-gliner-pii/served_model_name: nvidia/gliner-PII, and the old check looked at one field only, so a model carrying the name in the other would have been missed. Case-insensitive, as before.Testing
Verified both paths in a running Studio against a live platform:
default/nvidia-gliner-piiSelect a modelThe second row was produced by rewriting the providers response in-flight to strip GLiNER models, so it exercises the real component rather than a mock.
Not included
The ticket floated an optional warning on the Source tab for users who never open Model Settings. Left out — the submit-time validation already routes them there with an inline error, and a second surface for the same message seemed like noise. Easy to add if you disagree.
Summary by CodeRabbit