MemberJunction / MemberJunction/MJ
AI Prompt form does not expose Temperature or any sampling parameter
- Dominant language
- TSQL
- Stars
- 29
- Forks
- 6
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 323
Description
## Summary
`MJ: AI Prompts`' custom record form renders **none** of the model sampling parameters. `Temperature`, `TopP`, `TopK`, `MinP`, `Seed`, `FrequencyPenalty` and `PresencePenalty` are columns on `__mj.AIPrompt` and are honoured at runtime by `AIPromptRunner`, but there is no way to see or set any of them in Explorer.
The practical effect is that a prompt's decoding behaviour is invisible in the UI and can only be inspected or changed through SQL, Data Explorer, or a migration.
## Evidence
The custom form that overrides the generated one is `@memberjunction/ng-core-entity-forms/dist/lib/custom/AIPrompts/ai-prompt-form.component.js` (v5.51.0). Occurrence counts of each parameter in that component:
```
Temperature 0
TopP 0
TopK 0
MinP 0
Seed 0
FrequencyPenalty 0
PresencePenalty 0
```
The fields do exist on the entity — `Temperature` appears 27 times in `@memberjunction/core-entities/dist/generated/entity_subclasses.js` — and a generated `MJAIPrompt` form exists under `dist/lib/generated/Entities/`, which would render them. The custom form supersedes it, so they are dropped.
Observed in Explorer against MJ 5.51.0: the record page for an AI Prompt shows **Models**, **Advanced Configuration**, **Prefill & Output Control**, **Template Parameters**, **Execution History** and **Related Items**, and no sampling section. "Advanced Configuration" holds Parallelization Mode, Output Type, Validation Behavior, Enable Caching and Result Selector Prompt.
## Why it matters
`NULL` is not a neutral value for these columns — the provider substitutes its own default, so an unset `Temperature` means the prompt runs sampled at whatever the vendor picks (1.0 on Gemini). Whether a prompt is deterministic is therefore invisible in the UI, and the difference is not cosmetic:
We hit this on an evaluation scorer whose `Temperature` was NULL. One **frozen** transcript — same rubric, same prompt, same model — scored 62.9, 68.1, 74.3, 79.0 and 81.4 across five runs, flipping the resulting disposition. The swing was 18.5 points on a borderline input versus 2.1 on an obvious one, which is the signature of sampling rather than of a bad rubric. Diagnosing that meant reading the column out of the database, because the form gives no indication it exists.
Two consequences worth separating:
1. **Diagnosis.** Someone debugging non-deterministic prompt output cannot see the one field that explains it.
2. **Remediation.** An operator who wants to pin a value has no supported UI path, so the change has to be made in SQL or shipped in a migration.
## Suggested fix
Surface the sampling parameters in the custom form — a "Sampling" / "Model Parameters" group alongside "Advanced Configuration" would fit the existing layout. Two details that matter more than the placement:
- **Distinguish NULL from 0.** They mean different things (`NULL` = provider default, `0` = greedy), so a numeric input defaulting an empty box to `0` would silently change behaviour. An explicit unset state is needed.
- **Show the effective value**, or at least label NULL as "provider default", so the form answers "is this prompt deterministic?" without the reader knowing the fallback rules.
Worth noting that not every provider accepts these: Anthropic rejects a `temperature` parameter on some models (`temperature is deprecated for this model`) with a 400, and the runner does not fail over on a 400 — so a UI that makes pinning easy should probably warn when a pinned value meets a model that will reject it.
## Environment
- `@memberjunction/ng-core-entity-forms` 5.51.0
- MJ Explorer 5.51.0, SQL Server
Contributor guide
Research direction
Start with @memberjunction/ng-core-entity-forms/dist/lib/custom/AIPrompts/ai-prompt-form.component.js and compare it with the generated MJAIPrompt form under dist/lib/generated/Entities/; use entity_subclasses.js to confirm the seven sampling fields. The Explorer form is done when all parameters are visible, with NULL clearly distinct from 0 and provider-default behavior represented without silently changing values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, javascript, sql
- Domain
- database, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100