@saplingai/sapling-js 1.0.33-beta.1 → 1.0.34

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.un~ ADDED
Binary file
Binary file
package/README.md CHANGED
@@ -1,64 +1,51 @@
1
- # sapling-js
1
+ # Sapling JS
2
2
 
3
3
  Node.js client for the [Sapling.ai API](https://sapling.ai/api).
4
4
 
5
5
  Try out a [grammar check demo](https://sapling.ai/grammar-check).
6
6
  Compare against grammar checking tools and APIs like Grammarly (Grammerly), LanguageTool, ProWritingAid and Ginger.
7
7
 
8
- Functionality
9
- --------
8
+ ## Functionality
10
9
 
11
10
  Sapling is an AI messaging assistant.
12
11
  The API currently offers spelling and grammar checking endpoints.
13
12
 
14
13
  Benefits include:
15
- - **60% more grammar corrections**: compared to [other systems](https://sapling.ai/comparison/api) at similar accuracy using state-of-the-art machine learning systems for natural language processing.
14
+ - **60% more grammar corrections**: Compared to [other systems](https://sapling.ai/comparison/api) at similar accuracy using state-of-the-art generative AI models.
16
15
  - **Low Latency**: Achieve the same real-time performance that users of Sapling's own interface experience.
17
16
  - **Over 20 error types**: Error categories such as preposition, noun form, and verb tense, including both high-level and fine-grained error information.
18
- - **Custom Models**: Get corrections and edits tuned to the domain of your text—for example academic writing vs. subtitles.
17
+ - **Custom Models**: Get corrections optimized for your content type, from academic writing, to medical notes, to user-generated reviews.
19
18
  - **Enterprise Security**: Contact us for our no data retention policies, [self-hosted/on-premises](https://sapling.ai/onprem) deployment options, and other [cybersecurity policies and procedures](https://sapling.ai/security).
20
19
  - **Rich Text Editor Support**: TinyMCE, CKEditor, QuillJS, Trix, ProseMirror, WordPress, Draft.js, Froala, Lexical and others. Sapling's [HTML SDK](https://sapling.ai/docs/sdk/HTML/quickstart) can also be directly imported into HTML pages as JavaScript.
21
20
 
22
-
23
21
  ### Node.js
24
- sapling-js can be run in a Node.js server or script environment.
25
22
 
26
- See [this folder](https://github.com/saplingai/sapling-samples/tree/master/javascript/script) for an example of grammar checking without UI.
23
+ Sapling can be run in a Node.js server or script environment.
27
24
 
25
+ See [this folder](https://github.com/saplingai/sapling-samples/tree/master/javascript/script) for an example of grammar checking without UI.
28
26
 
29
27
  ### React
30
- sapling-js can be imported directly into a React project.
31
28
 
32
- See [this React App](https://github.com/saplingai/sapling-samples/tree/master/javascript/react-app) for a React demo app.
29
+ Sapling can be imported directly into a React project.
33
30
 
31
+ See [this React App](https://github.com/saplingai/sapling-samples/tree/master/javascript/react-app) for a React demo app.
34
32
 
35
33
  ### Angular
36
- sapling-js provides Angular support.
37
-
38
- See [this Angular App](https://github.com/saplingai/sapling-samples/tree/master/javascript/angular-app) for an Angular demo app.
39
-
40
-
41
- ### Typescript
42
- sapling-js provides Typescript declarations and can be imported directly into a Typescript project.
43
34
 
44
- See [this Typescript App](https://github.com/saplingai/sapling-samples/tree/master/javascript/angular-app) for a Typescript demo app.
35
+ For Angular support, refer to [this Angular App](https://github.com/saplingai/sapling-samples/tree/master/javascript/angular-app) for an Angular demo app.
45
36
 
46
- --------
37
+ ### TypeScript
47
38
 
39
+ For TypeScript declarations and how Sapling can be imported directly into a TypeScript project, see [this TypeScript App](https://github.com/saplingai/sapling-samples/tree/master/javascript/angular-app) for a demo app.
48
40
 
49
- Installation
50
- --------
41
+ ## Installation
51
42
 
52
- `npm install @saplingai/sapling-js`
43
+ - `npm install @saplingai/sapling-js`
44
+ - Create a key by following [these instructions](https://sapling.ai/docs/api/api-access).
53
45
 
54
- - Register for an account at [Sapling.ai](https://sapling.ai/user/register).
55
- - After registering and signing in, generate a development API key in your [dashboard](https://sapling.ai/user_settings).
46
+ ## Backend Quickstart
56
47
 
57
-
58
- Quickstart - Backend
59
- -----------
60
-
61
- ```javscript
48
+ ```javascript
62
49
  import { Client } from "@saplingai/sapling-js/client";
63
50
 
64
51
  const apiKey = '<YOUR_API_KEY>';
@@ -68,36 +55,37 @@ client
68
55
  .then(function (response) {
69
56
  console.log(response.data);
70
57
  })
71
-
72
- // {
73
- // edits: [
74
- // {
75
- // end: 8,
76
- // error_type: 'R:DET:ART',
77
- // general_error_type: 'Grammar',
78
- // id: '740071c9-8ea3-583d-a86b-7ef80e5fc91e',
79
- // replacement: 'an',
80
- // sentence: 'I have a apple',
81
- // sentence_start: 0,
82
- // start: 7
83
- // }
84
- // ]
85
- // }
86
58
  ```
87
59
 
60
+ You should see something like the following output:
61
+
62
+ ```javascript
63
+ {
64
+ edits: [
65
+ {
66
+ end: 8,
67
+ error_type: "R:DET:ART",
68
+ general_error_type: "Grammar",
69
+ id: "740071c9-8ea3-583d-a86b-7ef80e5fc91e",
70
+ replacement: "an",
71
+ sentence: "I have a apple",
72
+ sentence_start: 0,
73
+ start: 7
74
+ }
75
+ ]
76
+ }
77
+ ```
88
78
 
89
- Quickstart - Frontend
90
- -----------
79
+ ## Frontend Quickstart
91
80
 
92
81
  The SDK provides a way to automatically apply edit suggestions to any HTML contenteditable and textarea elements.
93
82
 
94
83
  Do **not** serve a page like this publicly, as it exposes the API key. See documentation [Deploying to Production](https://sapling.ai/docs/sdk/JavaScript/frontend_documentation#deploying-to-production) for an example of setting up the API key with a separate backend environment.
95
84
 
96
- ```javscript
85
+ ```javascript
97
86
  import { useEffect } from 'react';
98
87
  import { Sapling } from "@saplingai/sapling-js/observer";
99
88
 
100
-
101
89
  function App() {
102
90
  useEffect(() => {
103
91
  Sapling.init({
@@ -120,11 +108,8 @@ function App() {
120
108
  }
121
109
  ```
122
110
 
111
+ ## Further Documentation
123
112
 
124
- Documentation
125
- -------------
126
-
127
- - Complete Sapling HTTP API and SDK [documentation](https://sapling.ai/docs).
128
- - Get a production key by following [these instructions](https://sapling.ai/docs/api/api-access).
129
- - JavaScript, HTML, and Python [starter code](https://github.com/saplingai/sapling-samples).
130
- - More information on [request options and response structure](https://sapling.ai/docs/api/edits-overview).
113
+ - Full Sapling HTTP API and SDK [documentation](https://sapling.ai/docs).
114
+ - Create a key by following [these instructions](https://sapling.ai/docs/api/api-access).
115
+ - JavaScript, HTML, and Python [starter code](https://github.com/saplingai/sapling-samples).
package/index.d.ts CHANGED
@@ -1 +1 @@
1
- export * from '../sapling/client';
1
+ export * from './sapling/client';
package/index.ts CHANGED
@@ -1 +1 @@
1
- export * from '../sapling/client';
1
+ export * from './sapling/client';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saplingai/sapling-js",
3
- "version": "1.0.33-beta.1",
3
+ "version": "1.0.34",
4
4
  "description": "JavaScript library for using the Sapling.ai API.",
5
5
  "type": "module",
6
6
  "dependencies": {