@saplingai/sapling-js 1.0.52 → 1.0.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +346 -4
- package/package.json +2 -2
- package/sapling/client.d.ts +717 -44
- package/sapling/client.js +1070 -53
- package/sapling/sapling-sdk.min.js +1 -1
package/sapling/client.d.ts
CHANGED
|
@@ -24,10 +24,42 @@ export type ConstructorOptions = {
|
|
|
24
24
|
timeout?: number,
|
|
25
25
|
hostname?: string,
|
|
26
26
|
pathname?: string,
|
|
27
|
+
/**
|
|
28
|
+
* When true, every request carries the API's `return_usage: true` flag and
|
|
29
|
+
* every successful JSON-object response additionally reports the usage the
|
|
30
|
+
* request submitted for metering as a top-level `usage` field (see
|
|
31
|
+
* `ApiUsage`). Defaults to false.
|
|
32
|
+
*/
|
|
33
|
+
returnUsage?: boolean,
|
|
27
34
|
}
|
|
28
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Usage a request submitted for metering, reported when the client is
|
|
38
|
+
* constructed with `returnUsage: true`. `characters` is the count the request
|
|
39
|
+
* submitted for billing (one count per DISTINCT item of a batch request;
|
|
40
|
+
* 0 for unbilled requests). It is captured before the billing pipeline's
|
|
41
|
+
* dedup window applies, so it is an upper bound on the final charge.
|
|
42
|
+
*/
|
|
43
|
+
export type ApiUsage = {
|
|
44
|
+
characters: number;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* A top-level API response with the optional `usage` report attached
|
|
49
|
+
* (present only on successful responses when the client was constructed with
|
|
50
|
+
* `returnUsage: true`). Batch responses carry it on the wrapper object, not
|
|
51
|
+
* on the per-item results.
|
|
52
|
+
*/
|
|
53
|
+
export type WithUsage<T> = T & { usage?: ApiUsage };
|
|
54
|
+
|
|
55
|
+
/** English varieties the API accepts for `variety`. `string & {}` keeps the
|
|
56
|
+
* literals as autocomplete hints while still accepting any string. */
|
|
57
|
+
export type EnglishVariety = 'us-variety' | 'gb-variety' | 'au-variety' | 'ca-variety'
|
|
58
|
+
| 's-variety' | 't-variety' | 'null-variety' | (string & {});
|
|
59
|
+
|
|
29
60
|
export type EditOptions = {
|
|
30
|
-
variety
|
|
61
|
+
/** English variety to enforce. The API rejects other values with a 400. */
|
|
62
|
+
variety?: EnglishVariety,
|
|
31
63
|
autoApply?: boolean,
|
|
32
64
|
lang?: string,
|
|
33
65
|
medical?: boolean,
|
|
@@ -37,8 +69,235 @@ export type EditOptions = {
|
|
|
37
69
|
includeErrorCategories?: boolean,
|
|
38
70
|
}
|
|
39
71
|
|
|
72
|
+
/** One suggested edit. `start`/`end` are offsets into `sentence`; add
|
|
73
|
+
* `sentence_start` to get offsets into the submitted text. */
|
|
74
|
+
export type SpellcheckEdit = {
|
|
75
|
+
/** Opaque edit id; pass to acceptEdit()/rejectEdit(). */
|
|
76
|
+
id: string,
|
|
77
|
+
/** The unedited sentence containing the edit. */
|
|
78
|
+
sentence: string,
|
|
79
|
+
sentence_start: number,
|
|
80
|
+
start: number,
|
|
81
|
+
end: number,
|
|
82
|
+
replacement: string,
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export type Edit = SpellcheckEdit & {
|
|
86
|
+
/** Error type (see the API's Error Categories page). Omitted when
|
|
87
|
+
* `includeErrorCategories` is false. */
|
|
88
|
+
error_type?: string,
|
|
89
|
+
general_error_type?: string,
|
|
90
|
+
/** Explanation for some edits; advanced edits carry their own (may be null). */
|
|
91
|
+
description?: string | null,
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** Why some sentences are missing model edits. */
|
|
95
|
+
export type DegradedReason = 'model_timeout' | 'model_unavailable' | 'model_error';
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Present only on a partial result: a model stage could not process some
|
|
99
|
+
* sentences in time, so those sentences may be missing some or all of their
|
|
100
|
+
* edits. Counts only: the response does not say which sentences, so retry the
|
|
101
|
+
* whole request after a short backoff for a complete result. A total failure
|
|
102
|
+
* is an HTTP 503 with `Retry-After` instead.
|
|
103
|
+
*/
|
|
104
|
+
export type Degraded = {
|
|
105
|
+
sentences_degraded: number,
|
|
106
|
+
sentences_total: number,
|
|
107
|
+
reason: DegradedReason,
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** A sentence the API skipped without checking. */
|
|
111
|
+
export type IgnoredSentence = {
|
|
112
|
+
sentence: string,
|
|
113
|
+
reason: 'SENTENCE_EXCEEDS_MAX_LENGTH' | 'UNRECOGNIZED_CHARACTER_SET' | 'INVALID_TOKENS_FOUND',
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export type EditsResponse = {
|
|
117
|
+
/** Sorted by position in the text. */
|
|
118
|
+
edits: Edit[],
|
|
119
|
+
/** The detected language; only when `lang: 'auto'` was sent. */
|
|
120
|
+
lang?: string,
|
|
121
|
+
/** The text with every edit applied; only when `autoApply: true`. Advanced edits
|
|
122
|
+
* are never applied. */
|
|
123
|
+
applied_text?: string,
|
|
124
|
+
/** Set with `applied_text` when the text contains HTML tags, which auto-apply
|
|
125
|
+
* does not account for. */
|
|
126
|
+
warning?: string,
|
|
127
|
+
'ignored-sentences'?: IgnoredSentence[],
|
|
128
|
+
degraded?: Degraded,
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export type SpellcheckResponse = {
|
|
132
|
+
edits: SpellcheckEdit[],
|
|
133
|
+
/** The detected language; only when `lang: 'auto'` was sent. */
|
|
134
|
+
lang?: string,
|
|
135
|
+
/** Misspelled word -> ranked candidate corrections; only with `multipleEdits: true`
|
|
136
|
+
* (empty when the neural spellchecker served the request). */
|
|
137
|
+
candidates?: Record<string, string[]>,
|
|
138
|
+
/** Echo of the `userData` option, when sent. */
|
|
139
|
+
user_data?: unknown,
|
|
140
|
+
/** Only when `autoApply: true`. */
|
|
141
|
+
applied_text?: string,
|
|
142
|
+
warning?: string,
|
|
143
|
+
degraded?: Degraded,
|
|
144
|
+
}
|
|
145
|
+
|
|
40
146
|
export type AIDetectOptions = {
|
|
147
|
+
/** Include `sentence_scores` (server default true). */
|
|
41
148
|
sent_scores?: boolean,
|
|
149
|
+
/** Include `score_string`, an HTML heatmap of the scored text. */
|
|
150
|
+
score_string?: boolean,
|
|
151
|
+
/** Pin a detector model version (e.g. `'20251027'`, or `'ml20261009'` for the multilingual
|
|
152
|
+
* model); omitted = current default, with text detected as `es`/`pt`/`fr`/`de`/`it`/`nl`/`ja`
|
|
153
|
+
* routed to the multilingual model. A pin always wins over that routing and over `lang`. */
|
|
154
|
+
version?: string,
|
|
155
|
+
/** Language of the text: `'en'`, `'es'`, `'pt'`, `'fr'`, `'de'`, `'it'`, `'nl'` or `'ja'`
|
|
156
|
+
* (case-insensitive; region subtags such as `'pt-BR'` are accepted). Picks that language's
|
|
157
|
+
* model instead of relying on detection, which helps with short texts; omit it (or pass
|
|
158
|
+
* `'auto'`) to detect.
|
|
159
|
+
* Other languages are rejected with a 400. Applies to every item of a batch. */
|
|
160
|
+
lang?: string,
|
|
161
|
+
/** Keep no copy of the text: the result is still scored and billed (repeats within the
|
|
162
|
+
* deduplication window are still not billed twice), but it is not written to the shared
|
|
163
|
+
* result cache and usage is logged without the text. Default false; always on for teams with
|
|
164
|
+
* data retention disabled. Applies to every item of a batch. */
|
|
165
|
+
zero_retention?: boolean,
|
|
166
|
+
/** Also save the result as a shareable report and return its link in `report`. A single
|
|
167
|
+
* text only (not a batch). The report is saved to your AI detector history, where you can
|
|
168
|
+
* revoke the link; anyone with the link can view the text and its scores until it is
|
|
169
|
+
* revoked or expires 90 days after creation. Requires your private API key (OAuth access
|
|
170
|
+
* tokens and public API keys get a 400, as does combining it with `zero_retention`). When
|
|
171
|
+
* no report can be made, `report` is null and `report_skip_reason` says why; the request
|
|
172
|
+
* is still scored and billed. */
|
|
173
|
+
create_report?: boolean,
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/** aidetect() batch options: `create_report` is single-text only. */
|
|
177
|
+
export type AIDetectBatchOptions = Omit<AIDetectOptions, 'create_report'>;
|
|
178
|
+
|
|
179
|
+
export type AIDetectSentenceScore = {
|
|
180
|
+
sentence: string;
|
|
181
|
+
/** Same model, 0–1 scale and 0.5 threshold as the overall `score`. */
|
|
182
|
+
score: number;
|
|
183
|
+
/** Offsets into the response `text` (`end` exclusive), counted in Unicode
|
|
184
|
+
* code points — slice with `Array.from(text)` if it may contain emoji. */
|
|
185
|
+
start: number;
|
|
186
|
+
end: number;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export type AIDetectLanguage = {
|
|
190
|
+
code: string;
|
|
191
|
+
/** English display name; null for codes without one. */
|
|
192
|
+
name: string | null;
|
|
193
|
+
confidence: number;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/** A run of consecutive sentences scoring >= 0.5. */
|
|
197
|
+
export type AIDetectSegment = {
|
|
198
|
+
/** Offsets into the response `text` (`end` exclusive), in Unicode code points like
|
|
199
|
+
* `AIDetectSentenceScore`. */
|
|
200
|
+
start: number;
|
|
201
|
+
end: number;
|
|
202
|
+
/** Mean score of the run's sentences, weighted by their length. */
|
|
203
|
+
score: number;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/** `short_text`: under 500 characters. `list_format`: mostly bullet or numbered lines. */
|
|
207
|
+
export type AIDetectLowConfidenceReason = 'short_text' | 'list_format';
|
|
208
|
+
|
|
209
|
+
export type AIDetectResponse = {
|
|
210
|
+
/** 0 (likely human-written) to 1 (likely AI-generated). */
|
|
211
|
+
score: number;
|
|
212
|
+
/** Share of the text in sentences scoring >= 0.5 (flags partially
|
|
213
|
+
* AI-written documents); null when nothing could be scored. */
|
|
214
|
+
ai_fraction: number | null;
|
|
215
|
+
/** Plain-language summary of `score` and `ai_fraction`: `'ai'` when `ai_fraction` >= 0.8
|
|
216
|
+
* and `score` >= 0.5; otherwise `'mixed'` when `ai_fraction` >= 0.2 or `score` >= 0.5;
|
|
217
|
+
* otherwise `'human'` (with a null `ai_fraction`, `'ai'` or `'human'` by `score` alone).
|
|
218
|
+
* Omitted when the text could not be scored. */
|
|
219
|
+
verdict?: 'human' | 'mixed' | 'ai';
|
|
220
|
+
/** The AI-scored passages, in text order; empty when no sentence scores >= 0.5. Also sent
|
|
221
|
+
* with `sent_scores: false`; omitted when sentence offsets are unavailable. */
|
|
222
|
+
segments?: AIDetectSegment[];
|
|
223
|
+
/** True when the input is of a kind with a higher false-positive rate (see
|
|
224
|
+
* `low_confidence_reasons`), so hedge the result rather than show a bare score. */
|
|
225
|
+
low_confidence: boolean;
|
|
226
|
+
/** Empty when `low_confidence` is false. */
|
|
227
|
+
low_confidence_reasons: AIDetectLowConfidenceReason[];
|
|
228
|
+
text: string;
|
|
229
|
+
tokens: string[];
|
|
230
|
+
token_probs: number[];
|
|
231
|
+
/** The pinned `version` when one was requested; `'ml20261009'` when unpinned text was
|
|
232
|
+
* detected as (or `lang` named) `es`/`pt`/`fr`/`de`/`it`/`nl`/`ja` and scored by the
|
|
233
|
+
* multilingual model; otherwise an opaque identifier of the default model — log it, don't
|
|
234
|
+
* parse it. */
|
|
235
|
+
version: string;
|
|
236
|
+
/** Present unless `sent_scores: false`. */
|
|
237
|
+
sentence_scores?: AIDetectSentenceScore[];
|
|
238
|
+
/** Present when `score_string: true`. */
|
|
239
|
+
score_string?: string;
|
|
240
|
+
/** Advisory detected language; omitted unless detection is high-confidence. Always the
|
|
241
|
+
* detected language, even when `lang` was sent, so a mismatch is visible.
|
|
242
|
+
* English plus `es`, `pt`, `fr`, `de`, `it`, `nl` and `ja` (routed to the multilingual
|
|
243
|
+
* model) are supported; other languages are scored by the English model and are less
|
|
244
|
+
* reliable. */
|
|
245
|
+
language?: AIDetectLanguage;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/** The public report link minted by `create_report: true`. */
|
|
249
|
+
export type AIDetectReport = {
|
|
250
|
+
/** AI detector history entry id (the report is listed in your dashboard history). */
|
|
251
|
+
id: string;
|
|
252
|
+
/** Public report link. */
|
|
253
|
+
url: string;
|
|
254
|
+
/** ISO 8601 timestamp. */
|
|
255
|
+
shared_at: string;
|
|
256
|
+
/** ISO 8601 timestamp: when the link stops resolving unless revoked or deleted sooner. */
|
|
257
|
+
expires_at: string;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/** Why `report` is null: `nonpersist` (team keeps no data), `disabled` (AI detector history
|
|
261
|
+
* off), `text_not_retained` (history keeps no text), `unconfirmed_email`, `quota` (history
|
|
262
|
+
* full), `unscorable`, `error`. */
|
|
263
|
+
export type AIDetectReportSkipReason = 'nonpersist' | 'disabled' | 'text_not_retained'
|
|
264
|
+
| 'unconfirmed_email' | 'quota' | 'unscorable' | 'error';
|
|
265
|
+
|
|
266
|
+
/** Added to single-text responses only when `create_report: true` was sent. */
|
|
267
|
+
export type AIDetectReportFields = {
|
|
268
|
+
/** null when no report was made (see `report_skip_reason`). */
|
|
269
|
+
report?: AIDetectReport | null;
|
|
270
|
+
/** Present only when `report` is null. */
|
|
271
|
+
report_skip_reason?: AIDetectReportSkipReason;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/** fileAidetect() always scores with sentence scores and score_string enabled. */
|
|
275
|
+
export type FileAIDetectResponse = AIDetectResponse
|
|
276
|
+
& Required<Pick<AIDetectResponse, 'sentence_scores' | 'score_string'>>
|
|
277
|
+
& AIDetectReportFields;
|
|
278
|
+
|
|
279
|
+
export type URLAIDetectSource = {
|
|
280
|
+
/** Final URL after redirects. */
|
|
281
|
+
url: string;
|
|
282
|
+
/** The page's og:title, <title> or first <h1> (a linked document's file name); empty
|
|
283
|
+
* when there is none. */
|
|
284
|
+
title: string;
|
|
285
|
+
/** The response's media type, e.g. `'text/html'` or `'application/pdf'`. */
|
|
286
|
+
content_type: string;
|
|
287
|
+
/** Characters scored (and billed). */
|
|
288
|
+
characters: number;
|
|
289
|
+
/** True when the page (2MB of HTML), document (15MB) or text (200,000 characters) was cut
|
|
290
|
+
* off, so only a prefix was scored. */
|
|
291
|
+
truncated: boolean;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/** urlAidetect(): the aidetect() response plus where the scored text came from. */
|
|
295
|
+
export type URLAIDetectResponse = AIDetectResponse & AIDetectReportFields & {
|
|
296
|
+
source: URLAIDetectSource;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export type AIDetectBatchResponse = {
|
|
300
|
+
results: AIDetectResponse[];
|
|
42
301
|
}
|
|
43
302
|
|
|
44
303
|
export type StyleguideRule = string | { name: string; description?: string };
|
|
@@ -136,6 +395,85 @@ export type AccountStatusResponse = {
|
|
|
136
395
|
};
|
|
137
396
|
}
|
|
138
397
|
|
|
398
|
+
export type ReportingWindowOptions = {
|
|
399
|
+
/** Days before today the window starts (non-negative integer). */
|
|
400
|
+
start_days_back?: number,
|
|
401
|
+
/** Days before today the window ends (non-negative integer). Defaults to 0. */
|
|
402
|
+
end_days_back?: number,
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
export type ApiUsageKeySummary = {
|
|
406
|
+
/** Masked id, `****<last4>-<hash8>`; the raw key is never returned. */
|
|
407
|
+
api_key: string;
|
|
408
|
+
tag: string;
|
|
409
|
+
/** Characters in the window. */
|
|
410
|
+
characters: number;
|
|
411
|
+
/** Monthly character limit; -1 for none. */
|
|
412
|
+
monthly_limit: number | null;
|
|
413
|
+
/** Characters this calendar month. */
|
|
414
|
+
monthly_usage: number;
|
|
415
|
+
/** null when there is no limit. */
|
|
416
|
+
remaining_quota: number | null;
|
|
417
|
+
quota_exceeded: boolean;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
export type ApiUsageResponse = {
|
|
421
|
+
/** Inclusive ISO dates of the resolved window. */
|
|
422
|
+
start_date: string;
|
|
423
|
+
end_date: string;
|
|
424
|
+
total_characters: number;
|
|
425
|
+
/** At list prices, per (endpoint, month). */
|
|
426
|
+
total_cost_usd: number;
|
|
427
|
+
currency: string;
|
|
428
|
+
/** Keyed by masked key id. */
|
|
429
|
+
by_api_key: Record<string, ApiUsageKeySummary>;
|
|
430
|
+
/** Keyed by endpoint name, e.g. `EDIT`. */
|
|
431
|
+
by_endpoint: Record<string, { characters: number; cost_usd: number }>;
|
|
432
|
+
/** Masked key id → `YYYY-MM-DD` → characters. */
|
|
433
|
+
daily_usage: Record<string, Record<string, number>>;
|
|
434
|
+
/** Masked key id → `YYYY-MM` → characters. */
|
|
435
|
+
monthly_usage: Record<string, Record<string, number>>;
|
|
436
|
+
/** ISO timestamp of the latest usage row in the window, or null. */
|
|
437
|
+
last_updated: string | null;
|
|
438
|
+
/** Omitted for team-scoped keys. Same object as accountStatus()'s `credits`. */
|
|
439
|
+
credit_balance_data?: AccountCreditSummary;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
export type ApiEndpointUsageInterval = 'Daily' | 'Weekly' | 'Monthly';
|
|
443
|
+
|
|
444
|
+
export type ApiEndpointUsageOptions = ReportingWindowOptions & {
|
|
445
|
+
/** Defaults to 'Daily'. */
|
|
446
|
+
interval?: ApiEndpointUsageInterval,
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
export type ApiEndpointUsageResponse = {
|
|
450
|
+
/** Endpoint name → bucket start (days before today, as a string key) → characters. */
|
|
451
|
+
data: Record<string, Record<string, number>>;
|
|
452
|
+
last_updated: string | null;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
export type ApiQuotaUsageResponse = {
|
|
456
|
+
/** Monthly character limit; -1 for none. */
|
|
457
|
+
quota: number;
|
|
458
|
+
/** Characters in the window. */
|
|
459
|
+
usage: number;
|
|
460
|
+
/** Suggestions accepted / ignored via acceptEdit()/rejectEdit() since the first of the month. */
|
|
461
|
+
accepts: number;
|
|
462
|
+
ignores: number;
|
|
463
|
+
/** Unix epoch seconds. */
|
|
464
|
+
last_updated: number;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
export type ApiUserActivityResponse = {
|
|
468
|
+
edits_shown: number;
|
|
469
|
+
edits_accepted: number;
|
|
470
|
+
edits_ignored: number;
|
|
471
|
+
active_users: {
|
|
472
|
+
logged_in: number;
|
|
473
|
+
anonymous: number;
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
|
|
139
477
|
export type SimplifyReadingLevel = 'plain' | 'elementary' | 'middle_school' | 'high_school';
|
|
140
478
|
|
|
141
479
|
export type SimplifyOptions = {
|
|
@@ -168,6 +506,43 @@ export type LangdetectOptions = {
|
|
|
168
506
|
segments?: boolean,
|
|
169
507
|
}
|
|
170
508
|
|
|
509
|
+
export type LangdetectCandidate = {
|
|
510
|
+
lang: string;
|
|
511
|
+
conf: number;
|
|
512
|
+
name: string | null;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
export type LangdetectResult = {
|
|
516
|
+
/** ISO 639-1 code of the most likely language. */
|
|
517
|
+
lang: string;
|
|
518
|
+
conf: number;
|
|
519
|
+
name: string | null;
|
|
520
|
+
/** The recommended trust bar: true only when the confidence is high and the text has enough
|
|
521
|
+
* letters. Short inputs like "OK" or "Hola" are never reliable. */
|
|
522
|
+
reliable: boolean;
|
|
523
|
+
/** Dominant writing system as an ISO 15924 code (`Latn`, `Cyrl`, `Arab`, `Hani`, `Jpan`,
|
|
524
|
+
* `Hang`, ...). `Zzzz` when the letters are in an unmapped script; null when the text has no
|
|
525
|
+
* letters. */
|
|
526
|
+
script: string | null;
|
|
527
|
+
/** The top_k most likely languages, best first. */
|
|
528
|
+
candidates: LangdetectCandidate[];
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
export type LangdetectSegment = LangdetectResult & {
|
|
532
|
+
start: number;
|
|
533
|
+
end: number;
|
|
534
|
+
text: string;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
export type LangdetectResponse = LangdetectResult & {
|
|
538
|
+
/** Present only when the request sent segments: true. */
|
|
539
|
+
segments?: LangdetectSegment[];
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
export type LangdetectBatchResponse = {
|
|
543
|
+
results: LangdetectResponse[];
|
|
544
|
+
}
|
|
545
|
+
|
|
171
546
|
export type ClassifyLabel = string | { name: string; description?: string };
|
|
172
547
|
|
|
173
548
|
export type ClassifyOptions = {
|
|
@@ -274,7 +649,12 @@ export type QualityBatchResponse = {
|
|
|
274
649
|
results: QualityResponse[];
|
|
275
650
|
}
|
|
276
651
|
|
|
277
|
-
export type
|
|
652
|
+
export type PIIDeterministicType = 'email' | 'phone' | 'ssn' | 'credit_card' | 'ip_address' | 'iban' | 'us_bank_routing';
|
|
653
|
+
// Opt-in, LLM-backed named-entity PII types: detected only when listed in
|
|
654
|
+
// `types` explicitly (a request without them stays deterministic-only), and
|
|
655
|
+
// the text is then capped at 10,000 characters rather than 20,000.
|
|
656
|
+
export type PIINerType = 'person' | 'organization' | 'location';
|
|
657
|
+
export type PIIType = PIIDeterministicType | PIINerType;
|
|
278
658
|
|
|
279
659
|
export type PIIOptions = {
|
|
280
660
|
types?: PIIType[],
|
|
@@ -319,6 +699,35 @@ export type NERBatchResponse = {
|
|
|
319
699
|
results: NERResponse[];
|
|
320
700
|
}
|
|
321
701
|
|
|
702
|
+
export type InclusiveCategory = 'gender' | 'race_ethnicity' | 'disability' | 'age' |
|
|
703
|
+
'lgbtq' | 'religion' | 'socioeconomic' | 'appearance';
|
|
704
|
+
|
|
705
|
+
export type InclusiveSeverity = 'low' | 'medium' | 'high';
|
|
706
|
+
|
|
707
|
+
export type InclusiveOptions = {
|
|
708
|
+
categories?: InclusiveCategory[],
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
export type InclusiveIssue = {
|
|
712
|
+
category: InclusiveCategory;
|
|
713
|
+
severity: InclusiveSeverity;
|
|
714
|
+
text: string;
|
|
715
|
+
start: number | null;
|
|
716
|
+
end: number | null;
|
|
717
|
+
note: string;
|
|
718
|
+
suggestion: string;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
export type InclusiveResponse = {
|
|
722
|
+
issues: InclusiveIssue[];
|
|
723
|
+
categories: InclusiveCategory[];
|
|
724
|
+
inclusive: boolean;
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
export type InclusiveBatchResponse = {
|
|
728
|
+
results: InclusiveResponse[];
|
|
729
|
+
}
|
|
730
|
+
|
|
322
731
|
export type SafetyCategory = 'toxicity' | 'profanity' | 'harassment' | 'hate_speech' |
|
|
323
732
|
'self_harm' | 'sexual' | 'violence';
|
|
324
733
|
|
|
@@ -352,7 +761,9 @@ export type SpellcheckOptions = {
|
|
|
352
761
|
multipleEdits?: boolean,
|
|
353
762
|
lang?: string,
|
|
354
763
|
autoApply?: boolean,
|
|
355
|
-
variety
|
|
764
|
+
/** English variety to enforce. The API rejects other values with a 400. */
|
|
765
|
+
variety?: EnglishVariety,
|
|
766
|
+
/** Arbitrary JSON echoed back as `user_data` on the response. */
|
|
356
767
|
userData?: any,
|
|
357
768
|
}
|
|
358
769
|
|
|
@@ -389,6 +800,36 @@ export type ExtractBatchResponse = {
|
|
|
389
800
|
results: ExtractResponse[];
|
|
390
801
|
}
|
|
391
802
|
|
|
803
|
+
/** A document for fileAidetect()/fileExtract()/fileSummarize(): a Blob/File, or the file's bytes (Buffer,
|
|
804
|
+
* Uint8Array, ArrayBuffer). The API picks the format by file extension (.pdf, .docx, .pptx,
|
|
805
|
+
* .odt, .txt, .md, .html, .htm; up to 30MB), so bytes need `options.filename`. */
|
|
806
|
+
export type UploadFile = Blob | ArrayBuffer | ArrayBufferView;
|
|
807
|
+
|
|
808
|
+
export type FileUploadOptions = {
|
|
809
|
+
/** Required unless `file` is a File (whose own name is used otherwise), e.g. 'report.pdf'. */
|
|
810
|
+
filename?: string,
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
export type FileExtractOptions = ExtractOptions & FileUploadOptions;
|
|
814
|
+
|
|
815
|
+
export type FileAIDetectOptions = FileUploadOptions & Pick<AIDetectOptions, 'zero_retention' | 'create_report'>;
|
|
816
|
+
|
|
817
|
+
export type FileExtractDocument = {
|
|
818
|
+
/** The extension the document was read as, e.g. 'pdf'. */
|
|
819
|
+
file_type: string,
|
|
820
|
+
/** Characters of text extracted from the file. */
|
|
821
|
+
characters: number,
|
|
822
|
+
/** Characters read for extraction (at most 10,000) and billed. */
|
|
823
|
+
characters_used: number,
|
|
824
|
+
/** True when the text was cut to its first 10,000 characters; fields stated only
|
|
825
|
+
* later in the document are reported missing. */
|
|
826
|
+
truncated: boolean,
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
export type FileExtractResponse = ExtractResponse & {
|
|
830
|
+
document: FileExtractDocument,
|
|
831
|
+
}
|
|
832
|
+
|
|
392
833
|
export type TranslateOptions = {
|
|
393
834
|
source_lang?: string,
|
|
394
835
|
formality?: 'formal' | 'informal',
|
|
@@ -422,6 +863,196 @@ export type SummarizeBatchResponse = {
|
|
|
422
863
|
results: SummarizeResponse[];
|
|
423
864
|
}
|
|
424
865
|
|
|
866
|
+
export type FileSummarizeOptions = SummarizeOptions & FileUploadOptions;
|
|
867
|
+
|
|
868
|
+
export type FileSummarizeDocument = {
|
|
869
|
+
/** The extension the document was read as, e.g. 'pdf'. */
|
|
870
|
+
file_type: string,
|
|
871
|
+
/** Characters of text extracted from the file. */
|
|
872
|
+
characters: number,
|
|
873
|
+
/** Characters summarized (at most 20,000) and billed. */
|
|
874
|
+
characters_used: number,
|
|
875
|
+
/** True when the text was cut to its first 20,000 characters; the summary covers
|
|
876
|
+
* only that part of the document. */
|
|
877
|
+
truncated: boolean,
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
export type FileSummarizeResponse = SummarizeResponse & {
|
|
881
|
+
document: FileSummarizeDocument,
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
export type RephraseMapping =
|
|
885
|
+
'paraphrase' | 'passive_to_active' | 'active_to_passive' | 'informal_to_formal' |
|
|
886
|
+
'formal_to_informal' | 'sentence_split' | 'reword' | 'generate_title' | 'generate_acronym' |
|
|
887
|
+
'generate_meta_description' | 'summarize' | 'expand' | 'shorten' | 'switch_tone' | 'switch_tense';
|
|
888
|
+
|
|
889
|
+
export type RephraseToneMapping =
|
|
890
|
+
'straightforward' | 'confident' | 'friendly' | 'empathetic' | 'professional' | 'casual' |
|
|
891
|
+
'diplomatic' | 'persuasive';
|
|
892
|
+
|
|
893
|
+
export type RephraseTenseMapping =
|
|
894
|
+
'simple past' | 'past perfect' | 'past continuous' | 'past perfect continuous' |
|
|
895
|
+
'simple present' | 'present perfect' | 'present continuous' | 'present perfect continuous' |
|
|
896
|
+
'simple future' | 'future perfect' | 'future continuous' | 'future perfect continuous';
|
|
897
|
+
|
|
898
|
+
export type RephraseOptions = {
|
|
899
|
+
/** Defaults to 'paraphrase'. */
|
|
900
|
+
mapping?: RephraseMapping,
|
|
901
|
+
/** Only used with mapping 'switch_tone'. Defaults to 'straightforward'. */
|
|
902
|
+
tone_mapping?: RephraseToneMapping,
|
|
903
|
+
/** Only used with mapping 'switch_tense'. Defaults to 'simple past'. */
|
|
904
|
+
tense_mapping?: RephraseTenseMapping,
|
|
905
|
+
/** Number of alternatives, 1-8 (default 5). Honored by paraphrase, informal_to_formal,
|
|
906
|
+
* formal_to_informal, generate_title and generate_acronym. */
|
|
907
|
+
num_results?: number,
|
|
908
|
+
session_id?: string,
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
export type RephraseResult = {
|
|
912
|
+
hash: string,
|
|
913
|
+
original: string,
|
|
914
|
+
replacement: string,
|
|
915
|
+
rephrase_type: RephraseMapping,
|
|
916
|
+
model_version: string,
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
export type RephraseResponse = {
|
|
920
|
+
results: RephraseResult[],
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
export type CompleteResponse = {
|
|
924
|
+
/** The predicted continuation of `query`. */
|
|
925
|
+
output: string,
|
|
926
|
+
/** The part of the sent query the prediction continues: the API keeps only the text
|
|
927
|
+
* after the last run of three spaces. */
|
|
928
|
+
query: string,
|
|
929
|
+
/** Pass to acceptComplete() as `completeUUID`, with this `query` and `output`. */
|
|
930
|
+
hash: string,
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
export type AcceptCompleteResponse = {
|
|
934
|
+
result: 'success',
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
/** [probability, tone name, emoji] triples, e.g. [1.0, 'neutral', '😐']. */
|
|
938
|
+
export type ToneScores = Array<[number, string, string]>;
|
|
939
|
+
|
|
940
|
+
export type ToneResponse = {
|
|
941
|
+
/** Up to 3 tones for the whole text, most likely first; the probabilities sum to 1. */
|
|
942
|
+
overall: ToneScores,
|
|
943
|
+
/** One entry per sentence, aligned with `sents`. */
|
|
944
|
+
results: ToneScores[],
|
|
945
|
+
sents: string[],
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
export type SentimentLabel = 'POSITIVE' | 'NEUTRAL' | 'NEGATIVE';
|
|
949
|
+
|
|
950
|
+
/** [probability, label] pairs, most likely first. */
|
|
951
|
+
export type SentimentScores = Array<[number, SentimentLabel]>;
|
|
952
|
+
|
|
953
|
+
export type SentimentResponse = {
|
|
954
|
+
overall: SentimentScores,
|
|
955
|
+
/** One entry per sentence, aligned with `sents`. */
|
|
956
|
+
results: SentimentScores[],
|
|
957
|
+
sents: string[],
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
export type StatisticsLang = 'en' | 'de' | 'es' | 'fr' | 'it' | 'nl' | 'pl' | 'ru' | 'ar' | 'auto';
|
|
961
|
+
|
|
962
|
+
export type StatisticsOptions = {
|
|
963
|
+
/** Defaults to 'en'. */
|
|
964
|
+
lang?: StatisticsLang,
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
export type StatisticsResponse = {
|
|
968
|
+
chars: number,
|
|
969
|
+
words: number,
|
|
970
|
+
sentences: number,
|
|
971
|
+
reading_time_sec: number,
|
|
972
|
+
reading_time_min: number,
|
|
973
|
+
/** Flesch-Kincaid grade level; -3.4 when the text cannot be scored. */
|
|
974
|
+
readability: number,
|
|
975
|
+
/** Formula name -> score. The formulas present depend on `lang`; empty for 'auto'.
|
|
976
|
+
* `text_standard` is a string (e.g. "8th and 9th grade"). */
|
|
977
|
+
readability_scores: Record<string, number | string>,
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
export type SimilarTermsResponse = {
|
|
981
|
+
/** Up to 5 [similarity, term] pairs (similarity 0-1), most similar first. */
|
|
982
|
+
neighbors: Array<[number, string]>,
|
|
983
|
+
/** WordNet lemma names; multi-word ones use underscores (e.g. "domestic_dog"). */
|
|
984
|
+
synonyms: string[],
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
export type ProfanityResponse = {
|
|
988
|
+
/** The text split on whitespace (punctuation stays attached). */
|
|
989
|
+
toks: string[],
|
|
990
|
+
/** Aligned with `toks`: 1 for profanity, 0 otherwise. */
|
|
991
|
+
labels: Array<0 | 1>,
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
export type DictionaryEntry = {
|
|
995
|
+
id: string,
|
|
996
|
+
entry: string,
|
|
997
|
+
case_sensitive: boolean,
|
|
998
|
+
/** RFC 1123 timestamp, e.g. "Wed, 07 Oct 2020 21:15:47 GMT". */
|
|
999
|
+
created_at: string,
|
|
1000
|
+
updated_at: string,
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
export type AddDictionaryEntryOptions = {
|
|
1004
|
+
/** Defaults to true. */
|
|
1005
|
+
case_sensitive?: boolean,
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
export type CustomMapping = {
|
|
1009
|
+
id: string,
|
|
1010
|
+
/** The text to match; `^` / `$` anchor to a sentence's start / end, `#` matches a number. */
|
|
1011
|
+
entry: string,
|
|
1012
|
+
/** The replacement suggested; a `#` substitutes the matched number back in. */
|
|
1013
|
+
mapping: string,
|
|
1014
|
+
/** Shown with the suggestion; empty string or null (older rules) when none was set. */
|
|
1015
|
+
description: string | null,
|
|
1016
|
+
case_sensitive: boolean,
|
|
1017
|
+
/** RFC 1123 timestamp, e.g. "Wed, 07 Oct 2020 21:15:47 GMT". */
|
|
1018
|
+
created_at: string,
|
|
1019
|
+
updated_at: string,
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
export type CustomMappingsResponse = {
|
|
1023
|
+
/** Sorted by entry. */
|
|
1024
|
+
custom_mappings: CustomMapping[],
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
export type AddCustomMappingOptions = {
|
|
1028
|
+
/** Shown to the end user with the suggestion; a mapping with a description cannot be ignored. */
|
|
1029
|
+
description?: string,
|
|
1030
|
+
/** Defaults to true. */
|
|
1031
|
+
case_sensitive?: boolean,
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
export type CustomFilter = {
|
|
1035
|
+
id: string,
|
|
1036
|
+
/** The original text of the suppressed edits; empty string is a wildcard. */
|
|
1037
|
+
input: string,
|
|
1038
|
+
/** The replacement text of the suppressed edits; empty string is a wildcard. */
|
|
1039
|
+
output: string,
|
|
1040
|
+
case_sensitive: boolean,
|
|
1041
|
+
/** RFC 1123 timestamp, e.g. "Wed, 07 Oct 2020 21:15:47 GMT". */
|
|
1042
|
+
created_at: string,
|
|
1043
|
+
updated_at: string,
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
export type CustomFiltersResponse = {
|
|
1047
|
+
/** Sorted by input. */
|
|
1048
|
+
custom_filters: CustomFilter[],
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
export type AddCustomFilterOptions = {
|
|
1052
|
+
/** Defaults to true. */
|
|
1053
|
+
case_sensitive?: boolean,
|
|
1054
|
+
}
|
|
1055
|
+
|
|
425
1056
|
export type UserDetails = {
|
|
426
1057
|
userId?: string,
|
|
427
1058
|
anonUser?: boolean,
|
|
@@ -430,49 +1061,91 @@ export type UserDetails = {
|
|
|
430
1061
|
export declare class Client {
|
|
431
1062
|
constructor(apiKey: string, options?: ConstructorOptions);
|
|
432
1063
|
|
|
433
|
-
edits(text: string, sessionId?: string, options?: EditOptions, userDetails?: UserDetails): Promise<AxiosResponse
|
|
1064
|
+
edits(text: string, sessionId?: string, options?: EditOptions, userDetails?: UserDetails): Promise<AxiosResponse<WithUsage<EditsResponse>>>;
|
|
434
1065
|
acceptEdit(editUUID: string, sessionId?: string, userId?: string): Promise<AxiosResponse>;
|
|
435
1066
|
rejectEdit(editUUID: string, sessionId?: string, userId?: string): Promise<AxiosResponse>;
|
|
436
1067
|
|
|
437
|
-
spellcheck(text: string, sessionId?: string, options?: SpellcheckOptions, userDetails?: UserDetails): Promise<AxiosResponse
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
1068
|
+
spellcheck(text: string, sessionId?: string, options?: SpellcheckOptions, userDetails?: UserDetails): Promise<AxiosResponse<WithUsage<SpellcheckResponse>>>;
|
|
1069
|
+
|
|
1070
|
+
/** `data` is `[]` when no completion is available (the prediction failed or was too
|
|
1071
|
+
* short). Check `Array.isArray(data)` before reading fields. */
|
|
1072
|
+
complete(query: string, sessionId?: string): Promise<AxiosResponse<WithUsage<CompleteResponse> | never[]>>;
|
|
1073
|
+
/** Pass the `hash`, `query` and `output` that complete() returned. A changed `query` or
|
|
1074
|
+
* `completion` gets a 400 ("Arguments do not match hash."). */
|
|
1075
|
+
acceptComplete(completeUUID: string, query: string, completion: string, sessionId?: string): Promise<AxiosResponse<WithUsage<AcceptCompleteResponse>>>;
|
|
1076
|
+
/** `data` is `[]` when the API cannot split the text into sentences. Check
|
|
1077
|
+
* `Array.isArray(data)` before reading fields. */
|
|
1078
|
+
tone(text: string): Promise<AxiosResponse<WithUsage<ToneResponse> | never[]>>;
|
|
1079
|
+
rephrase(text: string, options?: RephraseOptions): Promise<AxiosResponse<WithUsage<RephraseResponse>>>;
|
|
1080
|
+
/** A text with no sentences (e.g. markup or punctuation only) gets a 204 with an empty
|
|
1081
|
+
* body, so `data` is `''` then; a text the API cannot split into sentences gets a 200
|
|
1082
|
+
* with `[]`. Check `Array.isArray(data) || !data` before reading fields. */
|
|
1083
|
+
sentiment(text: string): Promise<AxiosResponse<WithUsage<SentimentResponse> | '' | never[]>>;
|
|
1084
|
+
statistics(text: string, options?: StatisticsOptions): Promise<AxiosResponse<WithUsage<StatisticsResponse>>>;
|
|
1085
|
+
similarTerms(query: string): Promise<AxiosResponse<WithUsage<SimilarTermsResponse>>>;
|
|
1086
|
+
profanity(text: string): Promise<AxiosResponse<WithUsage<ProfanityResponse>>>;
|
|
1087
|
+
dictionaryEntries(): Promise<AxiosResponse<DictionaryEntry[]>>;
|
|
1088
|
+
addDictionaryEntry(entry: string, options?: AddDictionaryEntryOptions): Promise<AxiosResponse<WithUsage<DictionaryEntry>>>;
|
|
1089
|
+
/** Answers 204 with an empty body. */
|
|
1090
|
+
deleteDictionaryEntry(entryId: string): Promise<AxiosResponse<''>>;
|
|
1091
|
+
customMappings(): Promise<AxiosResponse<WithUsage<CustomMappingsResponse>>>;
|
|
1092
|
+
addCustomMapping(entry: string, mapping: string, options?: AddCustomMappingOptions): Promise<AxiosResponse<WithUsage<CustomMapping>>>;
|
|
1093
|
+
/** Answers 204 with an empty body. */
|
|
1094
|
+
deleteCustomMapping(mappingId: string): Promise<AxiosResponse<''>>;
|
|
1095
|
+
customFilters(): Promise<AxiosResponse<WithUsage<CustomFiltersResponse>>>;
|
|
1096
|
+
addCustomFilter(input: string, output: string, options?: AddCustomFilterOptions): Promise<AxiosResponse<WithUsage<CustomFilter>>>;
|
|
1097
|
+
/** Answers 204 with an empty body. */
|
|
1098
|
+
deleteCustomFilter(filterId: string): Promise<AxiosResponse<''>>;
|
|
1099
|
+
extract(text: string, fields: ExtractField[], options?: ExtractOptions): Promise<AxiosResponse<WithUsage<ExtractResponse>>>;
|
|
1100
|
+
extract(texts: string[], fields: ExtractField[], options?: ExtractOptions): Promise<AxiosResponse<WithUsage<ExtractBatchResponse>>>;
|
|
1101
|
+
extract(text: string | string[], fields: ExtractField[], options?: ExtractOptions): Promise<AxiosResponse<WithUsage<ExtractResponse | ExtractBatchResponse>>>;
|
|
1102
|
+
fileExtract(file: UploadFile, fields: ExtractField[], options?: FileExtractOptions): Promise<AxiosResponse<WithUsage<FileExtractResponse>>>;
|
|
1103
|
+
translate(text: string, targetLang: string, options?: TranslateOptions): Promise<AxiosResponse<WithUsage<TranslateResponse>>>;
|
|
1104
|
+
translate(texts: string[], targetLang: string, options?: TranslateOptions): Promise<AxiosResponse<WithUsage<TranslateBatchResponse>>>;
|
|
1105
|
+
translate(text: string | string[], targetLang: string, options?: TranslateOptions): Promise<AxiosResponse<WithUsage<TranslateResponse | TranslateBatchResponse>>>;
|
|
1106
|
+
summarize(text: string, options?: SummarizeOptions): Promise<AxiosResponse<WithUsage<SummarizeResponse>>>;
|
|
1107
|
+
summarize(texts: string[], options?: SummarizeOptions): Promise<AxiosResponse<WithUsage<SummarizeBatchResponse>>>;
|
|
1108
|
+
summarize(text: string | string[], options?: SummarizeOptions): Promise<AxiosResponse<WithUsage<SummarizeResponse | SummarizeBatchResponse>>>;
|
|
1109
|
+
fileSummarize(file: UploadFile, options?: FileSummarizeOptions): Promise<AxiosResponse<WithUsage<FileSummarizeResponse>>>;
|
|
1110
|
+
|
|
1111
|
+
aidetect(text: string, options?: AIDetectOptions): Promise<AxiosResponse<WithUsage<AIDetectResponse & AIDetectReportFields>>>;
|
|
1112
|
+
aidetect(texts: string[], options?: AIDetectBatchOptions): Promise<AxiosResponse<WithUsage<AIDetectBatchResponse>>>;
|
|
1113
|
+
aidetect(text: string | string[], options?: AIDetectBatchOptions): Promise<AxiosResponse<WithUsage<AIDetectResponse | AIDetectBatchResponse>>>;
|
|
1114
|
+
fileAidetect(file: UploadFile, options?: FileAIDetectOptions): Promise<AxiosResponse<WithUsage<FileAIDetectResponse>>>;
|
|
1115
|
+
urlAidetect(url: string, options?: AIDetectOptions): Promise<AxiosResponse<WithUsage<URLAIDetectResponse>>>;
|
|
1116
|
+
styleguide(text: string, rules: StyleguideRule[] | string): Promise<AxiosResponse<WithUsage<StyleguideResponse>>>;
|
|
1117
|
+
styleguide(texts: string[], rules: StyleguideRule[] | string): Promise<AxiosResponse<WithUsage<StyleguideBatchResponse>>>;
|
|
1118
|
+
styleguide(text: string | string[], rules: StyleguideRule[] | string): Promise<AxiosResponse<WithUsage<StyleguideResponse | StyleguideBatchResponse>>>;
|
|
1119
|
+
styleguideRulesets(): Promise<AxiosResponse<WithUsage<StyleguideRulesetsResponse>>>;
|
|
1120
|
+
saveStyleguideRuleset(name: string, rules: StyleguideRule[]): Promise<AxiosResponse<WithUsage<SaveStyleguideRulesetResponse>>>;
|
|
1121
|
+
deleteStyleguideRuleset(name: string): Promise<AxiosResponse<WithUsage<DeleteStyleguideRulesetResponse>>>;
|
|
1122
|
+
simplify(text: string, options?: SimplifyOptions): Promise<AxiosResponse<WithUsage<SimplifyResponse>>>;
|
|
1123
|
+
simplify(texts: string[], options?: SimplifyOptions): Promise<AxiosResponse<WithUsage<SimplifyBatchResponse>>>;
|
|
1124
|
+
simplify(text: string | string[], options?: SimplifyOptions): Promise<AxiosResponse<WithUsage<SimplifyResponse | SimplifyBatchResponse>>>;
|
|
1125
|
+
langdetect(text: string, options?: LangdetectOptions): Promise<AxiosResponse<WithUsage<LangdetectResponse>>>;
|
|
1126
|
+
langdetect(texts: string[], options?: LangdetectOptions): Promise<AxiosResponse<WithUsage<LangdetectBatchResponse>>>;
|
|
1127
|
+
langdetect(text: string | string[], options?: LangdetectOptions): Promise<AxiosResponse<WithUsage<LangdetectResponse | LangdetectBatchResponse>>>;
|
|
1128
|
+
quality(text: string, options?: QualityOptions): Promise<AxiosResponse<WithUsage<QualityResponse>>>;
|
|
1129
|
+
quality(texts: string[], options?: QualityOptions): Promise<AxiosResponse<WithUsage<QualityBatchResponse>>>;
|
|
1130
|
+
quality(text: string | string[], options?: QualityOptions): Promise<AxiosResponse<WithUsage<QualityResponse | QualityBatchResponse>>>;
|
|
1131
|
+
pii(text: string, options?: PIIOptions): Promise<AxiosResponse<WithUsage<PIIResponse>>>;
|
|
1132
|
+
ner(text: string, options?: NEROptions): Promise<AxiosResponse<WithUsage<NERResponse>>>;
|
|
1133
|
+
ner(texts: string[], options?: NEROptions): Promise<AxiosResponse<WithUsage<NERBatchResponse>>>;
|
|
1134
|
+
ner(text: string | string[], options?: NEROptions): Promise<AxiosResponse<WithUsage<NERResponse | NERBatchResponse>>>;
|
|
1135
|
+
inclusive(text: string, options?: InclusiveOptions): Promise<AxiosResponse<WithUsage<InclusiveResponse>>>;
|
|
1136
|
+
inclusive(texts: string[], options?: InclusiveOptions): Promise<AxiosResponse<WithUsage<InclusiveBatchResponse>>>;
|
|
1137
|
+
inclusive(text: string | string[], options?: InclusiveOptions): Promise<AxiosResponse<WithUsage<InclusiveResponse | InclusiveBatchResponse>>>;
|
|
1138
|
+
safety(text: string, options?: SafetyOptions): Promise<AxiosResponse<WithUsage<SafetyResponse>>>;
|
|
1139
|
+
safety(texts: string[], options?: SafetyOptions): Promise<AxiosResponse<WithUsage<SafetyBatchResponse>>>;
|
|
1140
|
+
safety(text: string | string[], options?: SafetyOptions): Promise<AxiosResponse<WithUsage<SafetyResponse | SafetyBatchResponse>>>;
|
|
1141
|
+
classify(text: string, labels: ClassifyLabel[], options?: ClassifyOptions): Promise<AxiosResponse<WithUsage<ClassifyResponse>>>;
|
|
1142
|
+
classify(texts: string[], labels: ClassifyLabel[], options?: ClassifyOptions): Promise<AxiosResponse<WithUsage<ClassifyBatchResponse>>>;
|
|
1143
|
+
classify(text: string | string[], labels: ClassifyLabel[], options?: ClassifyOptions): Promise<AxiosResponse<WithUsage<ClassifyResponse | ClassifyBatchResponse>>>;
|
|
1144
|
+
seo(text: string, options?: SeoOptions): Promise<AxiosResponse<WithUsage<SeoResponse>>>;
|
|
477
1145
|
accountStatus(): Promise<AxiosResponse<AccountStatusResponse>>;
|
|
1146
|
+
apiUsage(options?: ReportingWindowOptions): Promise<AxiosResponse<WithUsage<ApiUsageResponse>>>;
|
|
1147
|
+
apiEndpointUsage(options?: ApiEndpointUsageOptions): Promise<AxiosResponse<WithUsage<ApiEndpointUsageResponse>>>;
|
|
1148
|
+
/** Not WithUsage<>: the response's own `usage` is an integer and return_usage is not sent. */
|
|
1149
|
+
apiQuotaUsage(options?: ReportingWindowOptions): Promise<AxiosResponse<ApiQuotaUsageResponse>>;
|
|
1150
|
+
apiUserActivity(options?: ReportingWindowOptions): Promise<AxiosResponse<WithUsage<ApiUserActivityResponse>>>;
|
|
478
1151
|
}
|