v148 · AI · Prompt API
Creative Parameter Explorer
See the same prompt through three lenses: deterministic (temperature=0), balanced (temperature=0.7, topK=40), and maximally creative (temperature=1.2, topP=0.95). Chrome 148 adds temperature, topK, and topP as first-class parameters to LanguageModel.create().
API check: Checking for LanguageModel API…
Without the real API, outputs are generated by a Markov chain simulator so the demo is fully functional even without Chrome AI.
Without the real API, outputs are generated by a Markov chain simulator so the demo is fully functional even without Chrome AI.
Deterministic
temperature=0 · topK=1
Click "Run all three" to generate
Balanced
temperature=0.7 · topK=40
Click "Run all three" to generate
Creative
temperature=1.2 · topP=0.95
Click "Run all three" to generate
Custom parameter panel
Dial in your own settings and test them against the same prompt.
Custom parameters
0.80
0 (det.)2 (chaos)
40
1 (greedy)100 (broad)
0.90
0.11.0
Output appears here
The API
// Chrome 148 adds temperature, topK, topP as first-class params
const session = await LanguageModel.create({
temperature: 0.7, // 0 = deterministic, 2 = chaotic
topK: 40, // candidate token pool size
// topP: 0.95 // nucleus sampling (alternative to topK)
});
// Read what the model is actually using:
console.log(session.temperature); // → 0.7
console.log(session.topK); // → 40
// Query model defaults / limits:
const params = await LanguageModel.params();
console.log(params.defaultTemperature); // e.g. 0.8
console.log(params.defaultTopK); // e.g. 40
console.log(params.maxTopK); // e.g. 128
see also
- ChromeStatus entry
- Explainer: sampling parameters
- Sampling Playground — sibling demo
implementation reference
Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗