v148 · origin trial · on-device AI · Prompt API
Creative Writing Studio
See how temperature and topK reshape the same prompt. High temperature produces wild, creative variations; low temperature returns consistent, predictable text. Use the presets or dial in your own values.
Checking Prompt API with sampling parameter support…
Presets
Manual tune
temperature: 1.0
topK: 40
topK: 40
Run A
—
Click "Generate ×2" to see two outputs with the current parameters.
Run B
—
Same prompt, same parameters — will the outputs differ?
How sampling parameters work
// Chrome 148: temperature and topK on LanguageModel.create()
const session = await LanguageModel.create({
temperature: 0.1, // 0 = deterministic, 2 = chaotic
topK: 1, // 1 = only the most likely token, 128 = full distribution
});
// Read back the clamped values the model actually uses
console.log(session.temperature, session.topK);
// Static defaults from the model
const caps = await LanguageModel.capabilities();
console.log(caps.defaultTemperature, caps.defaultTopK);
references
implementation reference
Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗