@@ -25,7 +25,7 @@ import Lmnt from 'lmnt-node';
25
25
const client = new Lmnt ();
26
26
27
27
async function main () {
28
- const response = await client .speech .synthesize ({ text: ' hello world.' , voice: ' ava' });
28
+ const response = await client .speech .generate ({ text: ' hello world.' , voice: ' ava' });
29
29
30
30
console .log (response .audio );
31
31
}
@@ -44,8 +44,8 @@ import Lmnt from 'lmnt-node';
44
44
const client = new Lmnt ();
45
45
46
46
async function main() {
47
- const params: Lmnt .SpeechSynthesizeParams = { text: ' hello world.' , voice: ' ava' };
48
- const response: Lmnt .SpeechSynthesizeResponse = await client .speech .synthesize (params );
47
+ const params: Lmnt .SpeechGenerateParams = { text: ' hello world.' , voice: ' ava' };
48
+ const response: Lmnt .SpeechGenerateResponse = await client .speech .generate (params );
49
49
}
50
50
51
51
main ();
@@ -62,17 +62,15 @@ a subclass of `APIError` will be thrown:
62
62
<!-- prettier-ignore -->
63
63
``` ts
64
64
async function main() {
65
- const response = await client .speech
66
- .synthesize ({ text: ' hello world.' , voice: ' ava' })
67
- .catch (async (err ) => {
68
- if (err instanceof Lmnt .APIError ) {
69
- console .log (err .status ); // 400
70
- console .log (err .name ); // BadRequestError
71
- console .log (err .headers ); // {server: 'nginx', ...}
72
- } else {
73
- throw err ;
74
- }
75
- });
65
+ const response = await client .speech .generate ({ text: ' hello world.' , voice: ' ava' }).catch (async (err ) => {
66
+ if (err instanceof Lmnt .APIError ) {
67
+ console .log (err .status ); // 400
68
+ console .log (err .name ); // BadRequestError
69
+ console .log (err .headers ); // {server: 'nginx', ...}
70
+ } else {
71
+ throw err ;
72
+ }
73
+ });
76
74
}
77
75
78
76
main ();
@@ -107,7 +105,7 @@ const client = new Lmnt({
107
105
});
108
106
109
107
// Or, configure per-request:
110
- await client .speech .synthesize ({ text: ' hello world.' , voice: ' ava' }, {
108
+ await client .speech .generate ({ text: ' hello world.' , voice: ' ava' }, {
111
109
maxRetries: 5 ,
112
110
});
113
111
```
@@ -124,7 +122,7 @@ const client = new Lmnt({
124
122
});
125
123
126
124
// Override per-request:
127
- await client .speech .synthesize ({ text: ' hello world.' , voice: ' ava' }, {
125
+ await client .speech .generate ({ text: ' hello world.' , voice: ' ava' }, {
128
126
timeout: 5 * 1000 ,
129
127
});
130
128
```
@@ -145,12 +143,12 @@ You can also use the `.withResponse()` method to get the raw `Response` along wi
145
143
``` ts
146
144
const client = new Lmnt ();
147
145
148
- const response = await client .speech .synthesize ({ text: ' hello world.' , voice: ' ava' }).asResponse ();
146
+ const response = await client .speech .generate ({ text: ' hello world.' , voice: ' ava' }).asResponse ();
149
147
console .log (response .headers .get (' X-My-Header' ));
150
148
console .log (response .statusText ); // access the underlying Response object
151
149
152
150
const { data : response, response : raw } = await client .speech
153
- .synthesize ({ text: ' hello world.' , voice: ' ava' })
151
+ .generate ({ text: ' hello world.' , voice: ' ava' })
154
152
.withResponse ();
155
153
console .log (raw .headers .get (' X-My-Header' ));
156
154
console .log (response .audio );
@@ -257,7 +255,7 @@ const client = new Lmnt({
257
255
});
258
256
259
257
// Override per-request:
260
- await client .speech .synthesize (
258
+ await client .speech .generate (
261
259
{ text: ' hello world.' , voice: ' ava' },
262
260
{
263
261
httpAgent: new http .Agent ({ keepAlive: false }),
0 commit comments