writing-assistance-apis.idl (5621B)
1 // GENERATED CONTENT - DO NOT EDIT 2 // Content was automatically extracted by Reffy into webref 3 // (https://github.com/w3c/webref) 4 // Source: Writing Assistance APIs (https://webmachinelearning.github.io/writing-assistance-apis/) 5 6 [Exposed=Window, SecureContext] 7 interface Summarizer { 8 static Promise<Summarizer> create(optional SummarizerCreateOptions options = {}); 9 static Promise<Availability> availability(optional SummarizerCreateCoreOptions options = {}); 10 11 Promise<DOMString> summarize( 12 DOMString input, 13 optional SummarizerSummarizeOptions options = {} 14 ); 15 ReadableStream summarizeStreaming( 16 DOMString input, 17 optional SummarizerSummarizeOptions options = {} 18 ); 19 20 readonly attribute DOMString sharedContext; 21 readonly attribute SummarizerType type; 22 readonly attribute SummarizerFormat format; 23 readonly attribute SummarizerLength length; 24 25 readonly attribute FrozenArray<DOMString>? expectedInputLanguages; 26 readonly attribute FrozenArray<DOMString>? expectedContextLanguages; 27 readonly attribute DOMString? outputLanguage; 28 29 Promise<double> measureInputUsage( 30 DOMString input, 31 optional SummarizerSummarizeOptions options = {} 32 ); 33 readonly attribute unrestricted double inputQuota; 34 }; 35 Summarizer includes DestroyableModel; 36 37 dictionary SummarizerCreateCoreOptions { 38 SummarizerType type = "key-points"; 39 SummarizerFormat format = "markdown"; 40 SummarizerLength length = "short"; 41 42 sequence<DOMString> expectedInputLanguages; 43 sequence<DOMString> expectedContextLanguages; 44 DOMString outputLanguage; 45 }; 46 47 dictionary SummarizerCreateOptions : SummarizerCreateCoreOptions { 48 AbortSignal signal; 49 CreateMonitorCallback monitor; 50 51 DOMString sharedContext; 52 }; 53 54 dictionary SummarizerSummarizeOptions { 55 AbortSignal signal; 56 DOMString context; 57 }; 58 59 enum SummarizerType { "tldr", "teaser", "key-points", "headline" }; 60 enum SummarizerFormat { "plain-text", "markdown" }; 61 enum SummarizerLength { "short", "medium", "long" }; 62 63 [Exposed=Window, SecureContext] 64 interface Writer { 65 static Promise<Writer> create(optional WriterCreateOptions options = {}); 66 static Promise<Availability> availability(optional WriterCreateCoreOptions options = {}); 67 68 Promise<DOMString> write( 69 DOMString input, 70 optional WriterWriteOptions options = {} 71 ); 72 ReadableStream writeStreaming( 73 DOMString input, 74 optional WriterWriteOptions options = {} 75 ); 76 77 readonly attribute DOMString sharedContext; 78 readonly attribute WriterTone tone; 79 readonly attribute WriterFormat format; 80 readonly attribute WriterLength length; 81 82 readonly attribute FrozenArray<DOMString>? expectedInputLanguages; 83 readonly attribute FrozenArray<DOMString>? expectedContextLanguages; 84 readonly attribute DOMString? outputLanguage; 85 86 Promise<double> measureInputUsage( 87 DOMString input, 88 optional WriterWriteOptions options = {} 89 ); 90 readonly attribute unrestricted double inputQuota; 91 }; 92 Writer includes DestroyableModel; 93 94 dictionary WriterCreateCoreOptions { 95 WriterTone tone = "neutral"; 96 WriterFormat format = "markdown"; 97 WriterLength length = "short"; 98 99 sequence<DOMString> expectedInputLanguages; 100 sequence<DOMString> expectedContextLanguages; 101 DOMString outputLanguage; 102 }; 103 104 dictionary WriterCreateOptions : WriterCreateCoreOptions { 105 AbortSignal signal; 106 CreateMonitorCallback monitor; 107 108 DOMString sharedContext; 109 }; 110 111 dictionary WriterWriteOptions { 112 DOMString context; 113 AbortSignal signal; 114 }; 115 116 enum WriterTone { "formal", "neutral", "casual" }; 117 enum WriterFormat { "plain-text", "markdown" }; 118 enum WriterLength { "short", "medium", "long" }; 119 120 [Exposed=Window, SecureContext] 121 interface Rewriter { 122 static Promise<Rewriter> create(optional RewriterCreateOptions options = {}); 123 static Promise<Availability> availability(optional RewriterCreateCoreOptions options = {}); 124 125 Promise<DOMString> rewrite( 126 DOMString input, 127 optional RewriterRewriteOptions options = {} 128 ); 129 ReadableStream rewriteStreaming( 130 DOMString input, 131 optional RewriterRewriteOptions options = {} 132 ); 133 134 readonly attribute DOMString sharedContext; 135 readonly attribute RewriterTone tone; 136 readonly attribute RewriterFormat format; 137 readonly attribute RewriterLength length; 138 139 readonly attribute FrozenArray<DOMString>? expectedInputLanguages; 140 readonly attribute FrozenArray<DOMString>? expectedContextLanguages; 141 readonly attribute DOMString? outputLanguage; 142 143 Promise<double> measureInputUsage( 144 DOMString input, 145 optional RewriterRewriteOptions options = {} 146 ); 147 readonly attribute unrestricted double inputQuota; 148 }; 149 Rewriter includes DestroyableModel; 150 151 dictionary RewriterCreateCoreOptions { 152 RewriterTone tone = "as-is"; 153 RewriterFormat format = "as-is"; 154 RewriterLength length = "as-is"; 155 156 sequence<DOMString> expectedInputLanguages; 157 sequence<DOMString> expectedContextLanguages; 158 DOMString outputLanguage; 159 }; 160 161 dictionary RewriterCreateOptions : RewriterCreateCoreOptions { 162 AbortSignal signal; 163 CreateMonitorCallback monitor; 164 165 DOMString sharedContext; 166 }; 167 168 dictionary RewriterRewriteOptions { 169 DOMString context; 170 AbortSignal signal; 171 }; 172 173 enum RewriterTone { "as-is", "more-formal", "more-casual" }; 174 enum RewriterFormat { "as-is", "plain-text", "markdown" }; 175 enum RewriterLength { "as-is", "shorter", "longer" }; 176 177 [Exposed=Window, SecureContext] 178 interface CreateMonitor : EventTarget { 179 attribute EventHandler ondownloadprogress; 180 }; 181 182 callback CreateMonitorCallback = undefined (CreateMonitor monitor); 183 184 enum Availability { 185 "unavailable", 186 "downloadable", 187 "downloading", 188 "available" 189 }; 190 191 interface mixin DestroyableModel { 192 undefined destroy(); 193 };