← Back to release summary

Prompt API Sampling Parameters

Category
Miscellaneous
Type
New or changed feature
Status
Proposed (Chrome Proposed)
Intent stage
None

Summary

The Prompt API Sampling Parameters allow developers to control the output variety of the built-in AI language model. Instead of exposing raw numerical parameters (e.g. topK and temperature) which can behave inconsistently across different underlying model families and versions, this feature introduces a categorical samplingMode enum. This allows the browser to handle the heavy lifting of mapping semantic presets to optimal raw parameters for a specific underlying model, providing developers with the necessary granularity to tune responses while maintaining cross-browser interoperability. enum AILanguageModelSamplingMode { "most-predictable", // For strict consistency/factual extraction "predictable", // For highly focused outputs "slightly-predictable", // For moderately focused, consistent outputs "balanced", // The default state for standard prompting "slightly-creative", // For moderately varied, expressive outputs "creative", // For tasks favoring variety over strict facts "most-creative" // For maximum token diversity and brainstorming };

Standards & signals

Explainers: https://github.com/webmachinelearning/prompt-api#sampling-parameters

View on chromestatus.com