From 6fd9811c12a4afa24f73d3f83fcbf6fcd30a14a1 Mon Sep 17 00:00:00 2001 From: Isaac Ahouma Date: Wed, 11 Feb 2026 14:33:24 -0800 Subject: [PATCH 1/3] Add deprecation notes for topK, temperature, and params --- README.md | 25 ++++++++++++++++++++++--- index.bs | 6 ++++++ 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index aace534..67e8959 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,17 @@ The following are potential goals we are not yet certain of: Both of these potential goals could pose challenges to interoperability, so we want to investigate more how important such functionality is to developers to find the right tradeoff. +### Deprecation Notice + +The following features of the LanguageModel API are **deprecated** and their functionality is now restricted to Chrome Extension contexts only: + +* The static method `LanguageModel.params()` +* The instance attributes `languageModel.topK` and `languageModel.temperature` +* The `LanguageModelParams` interface and all its attributes (`defaultTopK`, `maxTopK`, `defaultTemperature`, `maxTemperature`) +* The `topK` and `temperature` options within `LanguageModel.create()` + +These features may be completely removed in the future. This change is intended to simplify the API and address inconsistencies in parameter support across various models. + ## Examples ### Zero-shot prompting @@ -422,16 +433,22 @@ Note that `append()` can also cause [overflow](#tokenization-context-window-leng ### Configuration of per-session parameters -In addition to the `initialPrompts` option shown above, the currently-configurable model parameters are [temperature](https://huggingface.co/blog/how-to-generate#sampling) and [top-K](https://huggingface.co/blog/how-to-generate#top-k-sampling). The `params()` API gives the default and maximum values for these parameters. +In addition to the `initialPrompts` option shown above, in extension contexts, the currently-configurable model parameters are [temperature](https://huggingface.co/blog/how-to-generate#sampling) and [top-K](https://huggingface.co/blog/how-to-generate#top-k-sampling). The `params()` API gives the default and maximum values for these parameters. -_However, see [issue #42](https://github.com/webmachinelearning/prompt-api/issues/42): sampling hyperparameters are not universal among models._ +**Deprecation Notice:** The `topK` and `temperature` options for `LanguageModel.create()`, the `LanguageModel.params()` static method, and the `languageModel.topK` and `languageModel.temperature` instance attributes are now **deprecated**. These features are only functional within Chrome Extension contexts and will be ignored or unavailable in standard web page contexts. They may be completely removed in a future release. + +The `LanguageModel.params()` API, only available in extensions, can be used to query the default and maximum values for these parameters. + +_The limited applicability and non-universal nature of these sampling hyperparameters are discussed further in [issue #42](https://github.com/webmachinelearning/prompt-api/issues/42): sampling hyperparameters are not universal among models._ ```js +// The topK and temperature members of the options object are deprecated. They will only be considered when LanguageModel.create() is called +// from within a Chrome Extension. In web page contexts, they are ignored. const customSession = await LanguageModel.create({ temperature: 0.8, topK: 10 }); - +// Deprecated: This interface and all its attributes (`defaultTopK`, `maxTopK`, `defaultTemperature`, `maxTemperature`) are now only available within Chrome Extension contexts. Web pages can no longer call this method. const params = await LanguageModel.params(); const conditionalSession = await LanguageModel.create({ temperature: isCreativeTask ? params.defaultTemperature * 1.1 : params.defaultTemperature * 0.8, @@ -706,6 +723,8 @@ The method will return a promise that fulfills with one of the following availab An example usage is the following: ```js +// The topK and temperature members of the options object are deprecated. They will only be considered when LanguageModel.create() is called +// from within a Chrome Extension. In web page contexts, they are ignored. const options = { expectedInputs: [ { type: "text", languages: ["en", "es"] }, diff --git a/index.bs b/index.bs index 7f7bdb1..68cd354 100644 --- a/index.bs +++ b/index.bs @@ -37,6 +37,7 @@ These APIs are part of a family of APIs expected to be powered by machine learni interface LanguageModel : EventTarget { static Promise create(optional LanguageModelCreateOptions options = {}); static Promise availability(optional LanguageModelCreateCoreOptions options = {}); + // **DEPRECATED**: This method is only available in extension contexts. static Promise params(); // These will throw "NotSupportedError" DOMExceptions if role = "system" @@ -61,13 +62,16 @@ interface LanguageModel : EventTarget { readonly attribute unrestricted double inputQuota; attribute EventHandler onquotaoverflow; + // **DEPRECATED**: This attribute is only available in extension contexts. readonly attribute unsigned long topK; + // **DEPRECATED**: This attribute is only available in extension contexts. readonly attribute float temperature; Promise clone(optional LanguageModelCloneOptions options = {}); undefined destroy(); }; +// **DEPRECATED**: This interface and its attributes are only available in extension contexts. [Exposed=Window, SecureContext] interface LanguageModelParams { readonly attribute unsigned long defaultTopK; @@ -92,7 +96,9 @@ dictionary LanguageModelTool { dictionary LanguageModelCreateCoreOptions { // Note: these two have custom out-of-range handling behavior, not in the IDL layer. // They are unrestricted double so as to allow +Infinity without failing. + // **DEPRECATED**: This option is only allowed in extension contexts. unrestricted double topK; + // **DEPRECATED**: This option is only allowed in extension contexts. unrestricted double temperature; sequence expectedInputs; From 93b9eda7c7b3bf7d8629f2b98ca3feb53c910ad3 Mon Sep 17 00:00:00 2001 From: Isaac Ahouma Date: Wed, 11 Feb 2026 14:41:31 -0800 Subject: [PATCH 2/3] Update spec and README with deprecation notes for topK, temperature, and params --- README.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 67e8959..00af6c8 100644 --- a/README.md +++ b/README.md @@ -442,13 +442,14 @@ The `LanguageModel.params()` API, only available in extensions, can be used to q _The limited applicability and non-universal nature of these sampling hyperparameters are discussed further in [issue #42](https://github.com/webmachinelearning/prompt-api/issues/42): sampling hyperparameters are not universal among models._ ```js -// The topK and temperature members of the options object are deprecated. They will only be considered when LanguageModel.create() is called -// from within a Chrome Extension. In web page contexts, they are ignored. +// The topK and temperature members of the options object are deprecated. They will only be considered when +// LanguageModel.create() is called from within a Chrome Extension. In web page contexts, they are ignored. const customSession = await LanguageModel.create({ temperature: 0.8, topK: 10 }); -// Deprecated: This interface and all its attributes (`defaultTopK`, `maxTopK`, `defaultTemperature`, `maxTemperature`) are now only available within Chrome Extension contexts. Web pages can no longer call this method. +// Deprecated: This interface and all its attributes (`defaultTopK`, `maxTopK`, `defaultTemperature`, `maxTemperature`) +// are now only available within Chrome Extension contexts. Web pages can no longer call this method. const params = await LanguageModel.params(); const conditionalSession = await LanguageModel.create({ temperature: isCreativeTask ? params.defaultTemperature * 1.1 : params.defaultTemperature * 0.8, @@ -723,8 +724,8 @@ The method will return a promise that fulfills with one of the following availab An example usage is the following: ```js -// The topK and temperature members of the options object are deprecated. They will only be considered when LanguageModel.create() is called -// from within a Chrome Extension. In web page contexts, they are ignored. +// The topK and temperature members of the options object are deprecated. They will only be considered when +// LanguageModel.create() is called from within a Chrome Extension. In web page contexts, they are ignored. const options = { expectedInputs: [ { type: "text", languages: ["en", "es"] }, From d6becd43669eca6c8687cd1f5f0132ee62bda0ad Mon Sep 17 00:00:00 2001 From: Isaac Ahouma Date: Wed, 11 Feb 2026 14:43:26 -0800 Subject: [PATCH 3/3] Update spec and README with deprecation notes for topK, temperature, and params --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 00af6c8..a371a98 100644 --- a/README.md +++ b/README.md @@ -448,7 +448,7 @@ const customSession = await LanguageModel.create({ temperature: 0.8, topK: 10 }); -// Deprecated: This interface and all its attributes (`defaultTopK`, `maxTopK`, `defaultTemperature`, `maxTemperature`) +// This interface and all its attributes (`defaultTopK`, `maxTopK`, `defaultTemperature`, `maxTemperature`) // are now only available within Chrome Extension contexts. Web pages can no longer call this method. const params = await LanguageModel.params(); const conditionalSession = await LanguageModel.create({