-
Notifications
You must be signed in to change notification settings - Fork 80
/
Copy pathwriting-assistance-apis.idl
183 lines (146 loc) · 5.54 KB
/
writing-assistance-apis.idl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
// GENERATED CONTENT - DO NOT EDIT
// Content was automatically extracted by Reffy into webref
// (https://github.com/w3c/webref)
// Source: Writing Assistance APIs (https://webmachinelearning.github.io/writing-assistance-apis/)
partial interface WindowOrWorkerGlobalScope {
[Replaceable, SecureContext] readonly attribute AI ai;
};
[Exposed=(Window,Worker), SecureContext]
interface AI {};
[Exposed=(Window,Worker), SecureContext]
interface AICreateMonitor : EventTarget {
attribute EventHandler ondownloadprogress;
};
callback AICreateMonitorCallback = undefined (AICreateMonitor monitor);
enum AIAvailability {
"unavailable",
"downloadable",
"downloading",
"available"
};
interface mixin AIDestroyable {
undefined destroy();
};
partial interface AI {
readonly attribute AISummarizerFactory summarizer;
};
[Exposed=(Window,Worker), SecureContext]
interface AISummarizerFactory {
Promise<AISummarizer> create(optional AISummarizerCreateOptions options = {});
Promise<AIAvailability> availability(optional AISummarizerCreateCoreOptions options = {});
};
[Exposed=(Window,Worker), SecureContext]
interface AISummarizer {
Promise<DOMString> summarize(
DOMString input,
optional AISummarizerSummarizeOptions options = {}
);
ReadableStream summarizeStreaming(
DOMString input,
optional AISummarizerSummarizeOptions options = {}
);
readonly attribute DOMString sharedContext;
readonly attribute AISummarizerType type;
readonly attribute AISummarizerFormat format;
readonly attribute AISummarizerLength length;
readonly attribute FrozenArray<DOMString>? expectedInputLanguages;
readonly attribute FrozenArray<DOMString>? expectedContextLanguages;
readonly attribute DOMString? outputLanguage;
};
AISummarizer includes AIDestroyable;
dictionary AISummarizerCreateCoreOptions {
AISummarizerType type = "key-points";
AISummarizerFormat format = "markdown";
AISummarizerLength length = "short";
sequence<DOMString> expectedInputLanguages;
sequence<DOMString> expectedContextLanguages;
DOMString outputLanguage;
};
dictionary AISummarizerCreateOptions : AISummarizerCreateCoreOptions {
AbortSignal signal;
AICreateMonitorCallback monitor;
DOMString sharedContext;
};
dictionary AISummarizerSummarizeOptions {
AbortSignal signal;
DOMString context;
};
enum AISummarizerType { "tl;dr", "teaser", "key-points", "headline" };
enum AISummarizerFormat { "plain-text", "markdown" };
enum AISummarizerLength { "short", "medium", "long" };
[Exposed=(Window,Worker), SecureContext]
interface AIWriterFactory {
Promise<AIWriter> create(optional AIWriterCreateOptions options = {});
Promise<AIAvailability> availability(optional AIWriterCreateCoreOptions options = {});
};
[Exposed=(Window,Worker), SecureContext]
interface AIWriter {
Promise<DOMString> write(DOMString writingTask, optional AIWriterWriteOptions options = {});
ReadableStream writeStreaming(DOMString writingTask, optional AIWriterWriteOptions options = {});
readonly attribute DOMString sharedContext;
readonly attribute AIWriterTone tone;
readonly attribute AIWriterFormat format;
readonly attribute AIWriterLength length;
readonly attribute FrozenArray<DOMString>? expectedInputLanguages;
readonly attribute FrozenArray<DOMString>? expectedContextLanguages;
readonly attribute DOMString? outputLanguage;
};
AIWriter includes AIDestroyable;
dictionary AIWriterCreateCoreOptions {
AIWriterTone tone = "neutral";
AIWriterFormat format = "markdown";
AIWriterLength length = "short";
sequence<DOMString> expectedInputLanguages;
sequence<DOMString> expectedContextLanguages;
DOMString outputLanguage;
};
dictionary AIWriterCreateOptions : AIWriterCreateCoreOptions {
AbortSignal signal;
AICreateMonitorCallback monitor;
DOMString sharedContext;
};
dictionary AIWriterWriteOptions {
DOMString context;
AbortSignal signal;
};
enum AIWriterTone { "formal", "neutral", "casual" };
enum AIWriterFormat { "plain-text", "markdown" };
enum AIWriterLength { "short", "medium", "long" };
[Exposed=(Window,Worker), SecureContext]
interface AIRewriterFactory {
Promise<AIRewriter> create(optional AIRewriterCreateOptions options = {});
Promise<AIAvailability> availability(optional AIRewriterCreateCoreOptions options = {});
};
[Exposed=(Window,Worker), SecureContext]
interface AIRewriter {
Promise<DOMString> rewrite(DOMString input, optional AIRewriterRewriteOptions options = {});
ReadableStream rewriteStreaming(DOMString input, optional AIRewriterRewriteOptions options = {});
readonly attribute DOMString sharedContext;
readonly attribute AIRewriterTone tone;
readonly attribute AIRewriterFormat format;
readonly attribute AIRewriterLength length;
readonly attribute FrozenArray<DOMString>? expectedInputLanguages;
readonly attribute FrozenArray<DOMString>? expectedContextLanguages;
readonly attribute DOMString? outputLanguage;
};
AIRewriter includes AIDestroyable;
dictionary AIRewriterCreateCoreOptions {
AIRewriterTone tone = "as-is";
AIRewriterFormat format = "as-is";
AIRewriterLength length = "as-is";
sequence<DOMString> expectedInputLanguages;
sequence<DOMString> expectedContextLanguages;
DOMString outputLanguage;
};
dictionary AIRewriterCreateOptions : AIRewriterCreateCoreOptions {
AbortSignal signal;
AICreateMonitorCallback monitor;
DOMString sharedContext;
};
dictionary AIRewriterRewriteOptions {
DOMString context;
AbortSignal signal;
};
enum AIRewriterTone { "as-is", "more-formal", "more-casual" };
enum AIRewriterFormat { "as-is", "plain-text", "markdown" };
enum AIRewriterLength { "as-is", "shorter", "longer" };