Skip to content

Commit bd837ce

Browse files
authored
Update availability values and add "downloading"
See #29.
1 parent cd39299 commit bd837ce

File tree

2 files changed

+82
-108
lines changed

2 files changed

+82
-108
lines changed

README.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -185,20 +185,21 @@ In the simple case, web developers should call `create()`, and handle failures g
185185

186186
The method will return a promise that fulfills with one of the following availability values:
187187

188-
* "`no`" means that the implementation does not support the requested options.
189-
* "`after-download`" means that the implementation supports the requested options, but it will have to download something (e.g. a machine learning model or fine-tuning) before it can do anything.
190-
* "`readily`" means that the implementation supports the requested options without requiring any new downloads.
188+
* "`unavailable`" means that the implementation does not support the requested options.
189+
* "`downloadable`" means that the implementation supports the requested options, but it will have to download something (e.g. a machine learning model or fine-tuning) before it can do anything.
190+
* "`downloading`" means that the implementation supports the requested options, but it will have to finish an ongoing download before it can do anything.
191+
* "`available`" means that the implementation supports the requested options without requiring any new downloads.
191192

192193
An example usage is the following:
193194

194195
```js
195196
const options = { type: "teaser", expectedInputLanguages: ["ja"] };
196197

197-
const supportsOurUseCase = await ai.summarizer.availability(options);
198+
const availability = await ai.summarizer.availability(options);
198199

199-
if (supportsOurUseCase !== "no") {
200+
if (availability !== "unavailable") {
200201
// We're good! Let's do the summarization using the built-in API.
201-
if (supportsOurUseCase === "after-download") {
202+
if (availability !== "available") {
202203
console.log("Sit tight, we need to do some downloading...");
203204
}
204205

@@ -327,8 +328,6 @@ However, we believe that streaming input would not be a good fit for these APIs.
327328

328329
In [the TAG review of the translation and language detection APIs](https://github.com/w3ctag/design-reviews/issues/948), some TAG members suggested slightly different patterns than the `ai.something.create()` pattern, such as `AISomething.create()` or `Something.create()`.
329330

330-
Similarly, in [an issue on the translation and language detection APIs repository](https://github.com/webmachinelearning/translation-api/issues/12), a member of the W3C Internationalization Working Group suggested that the word "readily" might not be understood easily by non-native English speakers, and something less informative but more common (such as "yes") might be better. And in [another issue](https://github.com/webmachinelearning/translation-api/issues/7), we're wondering if the empty string would be better than `"no"`, since the empty string is falsy.
331-
332331
We are open to such surface-level tweaks to the API entry points, and intend to gather more data from web developers on what they find more understandable and clear.
333332

334333
### Directly exposing a "prompt API"
@@ -353,7 +352,7 @@ Finally, we intend to prohibit (in the specification) any use of user-specific i
353352

354353
### Detecting available options
355354

356-
The [`availability()` API](#testing-available-options-before-creation) specified here provide some bits of fingerprinting information, since the availability status of each option and language can be one of three values, and those values are expected to be shared across a user's browser or browsing profile. In theory, this could be up to ~5.5 bits for the current set of summarizer options, plus an unknown number more based on the number of supported languages, and then this would be roughly tripled by including writer and rewriter.
355+
The [`availability()` API](#testing-available-options-before-creation) specified here provide some bits of fingerprinting information, since the availability status of each option and language can be one of four values, and those values are expected to be shared across a user's browser or browsing profile. In theory, this could be up to ~6.6 bits for the current set of summarizer options, plus an unknown number more based on the number of supported languages, and then this would be roughly tripled by including writer and rewriter. <!-- log_2(4 (availability) * 4 (type) * 3 (length) * 2 (format)) = ~6.6 -->
357356

358357
In practice, we expect the number of bits to be much smaller, as implementations will likely not have separate, independently-downloadable pieces of collateral for each option value. (For example, in Chrome's case, we anticipate having a single download for all three APIs.) But we need the API design to be robust to a variety of implementation choices, and have purposefully designed it to allow such independent-download architectures so as not to lock implementers into a single strategy.
359358

@@ -365,7 +364,7 @@ There are a variety of solutions here, with varying tradeoffs, such as:
365364

366365
We'll continue to investigate the best solutions here. And the specification will at a minimum allow user agents to add prompts and UI, or reject downloads entirely, as they see fit to preserve privacy.
367366

368-
It's also worth noting that a download cannot be evicted by web developers. Thus the availability states can only be toggled in one direction, from `"after-download"` to `"readily"`. And it doesn't provide an identifier that is very stable over time, as by browsing other sites, users will gradually toggle more and more of the availability states to `"readily"`.
367+
It's also worth noting that a download cannot be evicted by web developers. Thus the availability states can only be toggled in one direction, from `"downloadable"` to `"downloading"` to `"available"`. And it doesn't provide an identifier that is very stable over time, as by browsing other sites, users will gradually toggle more and more of the availability states to `"availale"`.
369368

370369
## Stakeholder feedback
371370

0 commit comments

Comments
 (0)