You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0fe0332
Browse filesBrowse the repository at this point in the historyBrowse files
Add RephraseTextOptions with writingStyle, tone and extraBodyParameters,
accepted as the third argument of rephraseText(). Passing the writing
style and tone positionally is deprecated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: README.md
+10-4Lines changed: 10 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1129,7 +1129,12 @@ To rephrase text, call `rephraseText()`. The first argument is a string containi
1129
1129
1130
1130
The second argument is the target language code. Language codes are **case-insensitive** strings, for example, `'de'`, `'fr'`, `'en'`. The target language code can also be `null` to enable auto-detection of the target language.
1131
1131
1132
-
The last two arguments, `writingStyle` and `tone`, are optional and specify the writing style and tone of the rephrased text. Possible values are defined in the `WritingStyle` and `WritingTone` enums.
1132
+
The third argument is optional and is a `RephraseTextOptions` object with the following properties:
1133
+
- `writingStyle`: the writing style of the rephrased text. Possible values are defined in the `WritingStyle` enum.
1134
+
- `tone`: the tone of the rephrased text. Possible values are defined in the `WritingTone` enum. The API accepts either `writingStyle` or `tone` in a request, not both.
1135
+
- `extraBodyParameters`: extra parameters to add to the request body. They can override parameters set by the library.
1136
+
1137
+
Passing the writing style and tone as the third and fourth arguments, for example `rephraseText(text, 'en', WritingStyle.ACADEMIC)`, is deprecated and will be removed in the next major version.
1133
1138
1134
1139
`rephraseText()` returns a Promise that fulfills with an `Improvement` object or an array of `Improvement` objects corresponding to your input text(s). The `Improvement` object has the following properties:
1135
1140
- `text`: the rephrased text,
@@ -1138,15 +1143,16 @@ The last two arguments, `writingStyle` and `tone`, are optional and specify the
1138
1143
1139
1144
```javascript
1140
1145
// Rephrasing a text in academic style:
1141
-
const rephrasedResult = await deepLClient.rephraseText('This is an example text.', 'en', WritingStyle.ACADEMIC);
1146
+
const rephrasedResult = await deepLClient.rephraseText('This is an example text.', 'en', {
1147
+
writingStyle:WritingStyle.ACADEMIC,
1148
+
});
1142
1149
console.log(rephrasedResult.text); // The rephrased text in academic style
0 commit comments