@saplingai/sapling-js 1.0.10 → 1.0.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saplingai/sapling-js",
3
- "version": "1.0.10",
3
+ "version": "1.0.13",
4
4
  "description": "JavaScript library for using the Sapling.ai API.",
5
5
  "type": "module",
6
6
  "dependencies": {
@@ -1,5 +1,25 @@
1
1
  import { AxiosResponse } from "axios";
2
2
 
3
+ type AdvancedEditOptions = {
4
+ advanced_edits?: boolean,
5
+ adverbs?: boolean,
6
+ simplifications?: boolean,
7
+ hard_to_read?: boolean,
8
+ qualifiers?: boolean,
9
+ voice?: boolean,
10
+ dei?: boolean,
11
+ gender?: boolean,
12
+ gender_pronoun?: boolean,
13
+ gender_noun?: boolean,
14
+ gender_id?: boolean,
15
+ sensitivity?: boolean,
16
+ disability?: boolean,
17
+ age?: boolean,
18
+ race?: boolean,
19
+ social_class?: boolean,
20
+ violence?: boolean,
21
+ }
22
+
3
23
  type ConstructorOptions = {
4
24
  timeout?: number,
5
25
  hostname?: string,
@@ -11,6 +31,11 @@ type EditOptions = {
11
31
  autoApply?: boolean,
12
32
  lang?: string,
13
33
  medical?: boolean,
34
+ advancedEdits?: AdvancedEditOptions,
35
+ }
36
+
37
+ type AIDetectOptions = {
38
+ sent_scores?: boolean,
14
39
  }
15
40
 
16
41
  type SpellcheckOptions = {
@@ -34,4 +59,6 @@ declare class Client {
34
59
  complete(query: string, sessionId: string): Promise<AxiosResponse>;
35
60
  acceptComplete(completeUUID: string, query: string, completion: string, sessionId: string): Promise<AxiosResponse>;
36
61
  tone(text: string): Promise<AxiosResponse>;
62
+
63
+ aidetect(text: string, options?: AIDetectOptions): Promise<AxiosResponse>;
37
64
  }
package/sapling/client.js CHANGED
@@ -52,6 +52,10 @@ export class Client {
52
52
  data.medical = options.medical;
53
53
  }
54
54
 
55
+ if (options.advancedEdits != null) {
56
+ data.advanced_edits = options.advancedEdits;
57
+ }
58
+
55
59
  return this.axiosPromise(url, 'post', data);
56
60
  }
57
61
 
@@ -152,4 +156,18 @@ export class Client {
152
156
  return this.axiosPromise(url, 'post', data);
153
157
  }
154
158
 
159
+ aidetect(text, options = {}) {
160
+ const url = `${this.urlEndpoint}aidetect`;
161
+
162
+ let data = {
163
+ text,
164
+ key: this.apiKey,
165
+ }
166
+
167
+ if (options.sent_scores != null) {
168
+ data.sent_scores = options.sent_scores;
169
+ }
170
+
171
+ return this.axiosPromise(url, 'post', data);
172
+ }
155
173
  }