spitch 1.25.0 → 1.26.0
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/CHANGELOG.md +34 -0
- package/LICENSE +1 -1
- package/README.md +43 -9
- package/client.d.mts +7 -7
- package/client.d.mts.map +1 -1
- package/client.d.ts +7 -7
- package/client.d.ts.map +1 -1
- package/client.js +6 -2
- package/client.js.map +1 -1
- package/client.mjs +7 -3
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/files.d.mts +34 -89
- package/resources/files.d.mts.map +1 -1
- package/resources/files.d.ts +34 -89
- package/resources/files.d.ts.map +1 -1
- package/resources/files.js +6 -53
- package/resources/files.js.map +1 -1
- package/resources/files.mjs +6 -53
- package/resources/files.mjs.map +1 -1
- package/resources/index.d.mts +1 -2
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -2
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +1 -3
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -2
- package/resources/index.mjs.map +1 -1
- package/resources/speech.d.mts +51 -17
- package/resources/speech.d.mts.map +1 -1
- package/resources/speech.d.ts +51 -17
- package/resources/speech.d.ts.map +1 -1
- package/resources/speech.js +5 -3
- package/resources/speech.js.map +1 -1
- package/resources/speech.mjs +5 -3
- package/resources/speech.mjs.map +1 -1
- package/resources/text.d.mts +7 -25
- package/resources/text.d.mts.map +1 -1
- package/resources/text.d.ts +7 -25
- package/resources/text.d.ts.map +1 -1
- package/resources/text.js +3 -2
- package/resources/text.js.map +1 -1
- package/resources/text.mjs +3 -2
- package/resources/text.mjs.map +1 -1
- package/src/client.ts +18 -11
- package/src/resources/files.ts +36 -96
- package/src/resources/index.ts +7 -2
- package/src/resources/speech.ts +55 -19
- package/src/resources/text.ts +7 -29
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
- package/resources/jobs.d.mts +0 -42
- package/resources/jobs.d.mts.map +0 -1
- package/resources/jobs.d.ts +0 -42
- package/resources/jobs.d.ts.map +0 -1
- package/resources/jobs.js +0 -23
- package/resources/jobs.js.map +0 -1
- package/resources/jobs.mjs +0 -19
- package/resources/jobs.mjs.map +0 -1
- package/src/resources/jobs.ts +0 -68
package/resources/index.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { Files, type File, type FileUsage, type FileDeleteResponse, type FileDownloadResponse, type FileListParams, type FileDownloadParams, type FileUploadParams, type FilesFilesCursor, } from "./files.mjs";
|
|
2
|
-
export {
|
|
3
|
-
export { Speech, type Transcription, type SpeechGenerateParams, type SpeechTranscribeParams } from "./speech.mjs";
|
|
2
|
+
export { Speech, type Segment, type Transcription, type SpeechGenerateParams, type SpeechTranscribeParams, } from "./speech.mjs";
|
|
4
3
|
export { Text, type Diacritics, type Translation, type TextToneMarkParams, type TextTranslateParams, } from "./text.mjs";
|
|
5
4
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"OAEO,EACL,KAAK,EACL,KAAK,IAAI,EACT,KAAK,SAAS,EACd,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,GACtB;OACM,
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"OAEO,EACL,KAAK,EACL,KAAK,IAAI,EACT,KAAK,SAAS,EACd,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,GACtB;OACM,EACL,MAAM,EACN,KAAK,OAAO,EACZ,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,GAC5B;OACM,EACL,IAAI,EACJ,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,GACzB"}
|
package/resources/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { Files, type File, type FileUsage, type FileDeleteResponse, type FileDownloadResponse, type FileListParams, type FileDownloadParams, type FileUploadParams, type FilesFilesCursor, } from "./files.js";
|
|
2
|
-
export {
|
|
3
|
-
export { Speech, type Transcription, type SpeechGenerateParams, type SpeechTranscribeParams } from "./speech.js";
|
|
2
|
+
export { Speech, type Segment, type Transcription, type SpeechGenerateParams, type SpeechTranscribeParams, } from "./speech.js";
|
|
4
3
|
export { Text, type Diacritics, type Translation, type TextToneMarkParams, type TextTranslateParams, } from "./text.js";
|
|
5
4
|
//# sourceMappingURL=index.d.ts.map
|
package/resources/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"OAEO,EACL,KAAK,EACL,KAAK,IAAI,EACT,KAAK,SAAS,EACd,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,GACtB;OACM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"OAEO,EACL,KAAK,EACL,KAAK,IAAI,EACT,KAAK,SAAS,EACd,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,GACtB;OACM,EACL,MAAM,EACN,KAAK,OAAO,EACZ,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,GAC5B;OACM,EACL,IAAI,EACJ,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,GACzB"}
|
package/resources/index.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.Text = exports.Speech = exports.
|
|
4
|
+
exports.Text = exports.Speech = exports.Files = void 0;
|
|
5
5
|
var files_1 = require("./files.js");
|
|
6
6
|
Object.defineProperty(exports, "Files", { enumerable: true, get: function () { return files_1.Files; } });
|
|
7
|
-
var jobs_1 = require("./jobs.js");
|
|
8
|
-
Object.defineProperty(exports, "Jobs", { enumerable: true, get: function () { return jobs_1.Jobs; } });
|
|
9
7
|
var speech_1 = require("./speech.js");
|
|
10
8
|
Object.defineProperty(exports, "Speech", { enumerable: true, get: function () { return speech_1.Speech; } });
|
|
11
9
|
var text_1 = require("./text.js");
|
package/resources/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,oCAUiB;AATf,8FAAA,KAAK,OAAA;AAUP,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,oCAUiB;AATf,8FAAA,KAAK,OAAA;AAUP,sCAMkB;AALhB,gGAAA,MAAM,OAAA;AAMR,kCAMgB;AALd,4FAAA,IAAI,OAAA"}
|
package/resources/index.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
export { Files, } from "./files.mjs";
|
|
3
|
-
export {
|
|
4
|
-
export { Speech } from "./speech.mjs";
|
|
3
|
+
export { Speech, } from "./speech.mjs";
|
|
5
4
|
export { Text, } from "./text.mjs";
|
|
6
5
|
//# sourceMappingURL=index.mjs.map
|
package/resources/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EACL,KAAK,GASN;OACM,
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EACL,KAAK,GASN;OACM,EACL,MAAM,GAKP;OACM,EACL,IAAI,GAKL"}
|
package/resources/speech.d.mts
CHANGED
|
@@ -7,42 +7,76 @@ import { RequestOptions } from "../internal/request-options.mjs";
|
|
|
7
7
|
*/
|
|
8
8
|
export declare class Speech extends APIResource {
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Convert text to speech. Select a voice and use that to generate audio in any
|
|
11
|
+
* format. Audio is retured in chunks.
|
|
11
12
|
*/
|
|
12
13
|
generate(body: SpeechGenerateParams, options?: RequestOptions): APIPromise<Response>;
|
|
13
14
|
/**
|
|
14
|
-
*
|
|
15
|
+
* Convert speech to text. Upload audio file containing speech and get back text
|
|
16
|
+
* that represents the content of the audio file.
|
|
15
17
|
*/
|
|
16
18
|
transcribe(body: SpeechTranscribeParams, options?: RequestOptions): APIPromise<Transcription>;
|
|
17
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* a segment (sentence or word-level) of the transcript. It contains a start and
|
|
22
|
+
* end time.
|
|
23
|
+
*/
|
|
24
|
+
export interface Segment {
|
|
25
|
+
/**
|
|
26
|
+
* the exact time when this segment ended.
|
|
27
|
+
*/
|
|
28
|
+
end: number;
|
|
29
|
+
/**
|
|
30
|
+
* the exact time when this segment started.
|
|
31
|
+
*/
|
|
32
|
+
start: number;
|
|
33
|
+
/**
|
|
34
|
+
* the text that belongs in this timeframe.
|
|
35
|
+
*/
|
|
36
|
+
text: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Response from speech-to-text.
|
|
40
|
+
*/
|
|
18
41
|
export interface Transcription {
|
|
42
|
+
/**
|
|
43
|
+
* for audit purposes.
|
|
44
|
+
*/
|
|
19
45
|
request_id: string;
|
|
20
46
|
text: string;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
47
|
+
/**
|
|
48
|
+
* sentence-level or word-level groupings of your transcript. Each sentence (or
|
|
49
|
+
* word) will fall within a time range.
|
|
50
|
+
*/
|
|
51
|
+
segments?: Array<Segment> | null;
|
|
52
|
+
/**
|
|
53
|
+
* @deprecated sentence-level or word-level groupings of your transcript. Each
|
|
54
|
+
* sentence (or word) will fall within a time range.
|
|
55
|
+
*/
|
|
56
|
+
timestamps?: Array<Segment> | null;
|
|
29
57
|
}
|
|
30
58
|
export interface SpeechGenerateParams {
|
|
31
|
-
language: 'yo' | 'en' | 'ha' | 'ig' | 'am';
|
|
59
|
+
language: 'yo' | 'en' | 'ha' | 'ig' | 'am' | 'pcm';
|
|
32
60
|
text: string;
|
|
33
61
|
voice: 'sade' | 'segun' | 'femi' | 'funmi' | 'amina' | 'aliyu' | 'hasan' | 'zainab' | 'john' | 'jude' | 'lina' | 'lucy' | 'henry' | 'kani' | 'ngozi' | 'amara' | 'obinna' | 'ebuka' | 'hana' | 'selam' | 'tena' | 'tesfaye';
|
|
34
|
-
|
|
35
|
-
|
|
62
|
+
/**
|
|
63
|
+
* the audio format for the returned audio bytes.
|
|
64
|
+
*/
|
|
65
|
+
format?: 'mp3' | 'wav' | 'ogg_opus' | 'webm_opus' | 'mulaw' | 'alaw' | 'flac' | 'pcm_s16le';
|
|
66
|
+
model?: string | null;
|
|
36
67
|
}
|
|
37
68
|
export interface SpeechTranscribeParams {
|
|
38
|
-
language: 'yo' | 'en' | 'ha' | 'ig' | 'am';
|
|
39
|
-
content?: Uploadable | null;
|
|
40
|
-
model?: 'mansa_v1' | 'legacy' |
|
|
69
|
+
language: 'yo' | 'en' | 'ha' | 'ig' | 'am' | 'pcm';
|
|
70
|
+
content?: Uploadable | string | null;
|
|
71
|
+
model?: 'mansa_v1' | 'legacy' | null;
|
|
41
72
|
special_words?: string | null;
|
|
42
73
|
timestamp?: 'sentence' | 'word' | 'none' | null;
|
|
74
|
+
/**
|
|
75
|
+
* @deprecated
|
|
76
|
+
*/
|
|
43
77
|
url?: string | null;
|
|
44
78
|
}
|
|
45
79
|
export declare namespace Speech {
|
|
46
|
-
export { type Transcription as Transcription, type SpeechGenerateParams as SpeechGenerateParams, type SpeechTranscribeParams as SpeechTranscribeParams, };
|
|
80
|
+
export { type Segment as Segment, type Transcription as Transcription, type SpeechGenerateParams as SpeechGenerateParams, type SpeechTranscribeParams as SpeechTranscribeParams, };
|
|
47
81
|
}
|
|
48
82
|
//# sourceMappingURL=speech.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"speech.d.mts","sourceRoot":"","sources":["../src/resources/speech.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,KAAK,UAAU,EAAE;OAEnB,EAAE,cAAc,EAAE;AAGzB;;GAEG;AACH,qBAAa,MAAO,SAAQ,WAAW;IACrC
|
|
1
|
+
{"version":3,"file":"speech.d.mts","sourceRoot":"","sources":["../src/resources/speech.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,KAAK,UAAU,EAAE;OAEnB,EAAE,cAAc,EAAE;AAGzB;;GAEG;AACH,qBAAa,MAAO,SAAQ,WAAW;IACrC;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,QAAQ,CAAC;IASpF;;;OAGG;IACH,UAAU,CAAC,IAAI,EAAE,sBAAsB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,aAAa,CAAC;CAM9F;AAED;;;GAGG;AACH,MAAM,WAAW,OAAO;IACtB;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;IAEjC;;;OAGG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;CACpC;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;IAEnD,IAAI,EAAE,MAAM,CAAC;IAEb,KAAK,EACD,MAAM,GACN,OAAO,GACP,MAAM,GACN,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,QAAQ,GACR,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,OAAO,GACP,MAAM,GACN,OAAO,GACP,OAAO,GACP,QAAQ,GACR,OAAO,GACP,MAAM,GACN,OAAO,GACP,MAAM,GACN,SAAS,CAAC;IAEd;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,UAAU,GAAG,WAAW,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,WAAW,CAAC;IAE5F,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;IAEnD,OAAO,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAAC;IAErC,KAAK,CAAC,EAAE,UAAU,GAAG,QAAQ,GAAG,IAAI,CAAC;IAErC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE9B,SAAS,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAEhD;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IAC9B,OAAO,EACL,KAAK,OAAO,IAAI,OAAO,EACvB,KAAK,aAAa,IAAI,aAAa,EACnC,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,sBAAsB,IAAI,sBAAsB,GACtD,CAAC;CACH"}
|
package/resources/speech.d.ts
CHANGED
|
@@ -7,42 +7,76 @@ import { RequestOptions } from "../internal/request-options.js";
|
|
|
7
7
|
*/
|
|
8
8
|
export declare class Speech extends APIResource {
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Convert text to speech. Select a voice and use that to generate audio in any
|
|
11
|
+
* format. Audio is retured in chunks.
|
|
11
12
|
*/
|
|
12
13
|
generate(body: SpeechGenerateParams, options?: RequestOptions): APIPromise<Response>;
|
|
13
14
|
/**
|
|
14
|
-
*
|
|
15
|
+
* Convert speech to text. Upload audio file containing speech and get back text
|
|
16
|
+
* that represents the content of the audio file.
|
|
15
17
|
*/
|
|
16
18
|
transcribe(body: SpeechTranscribeParams, options?: RequestOptions): APIPromise<Transcription>;
|
|
17
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* a segment (sentence or word-level) of the transcript. It contains a start and
|
|
22
|
+
* end time.
|
|
23
|
+
*/
|
|
24
|
+
export interface Segment {
|
|
25
|
+
/**
|
|
26
|
+
* the exact time when this segment ended.
|
|
27
|
+
*/
|
|
28
|
+
end: number;
|
|
29
|
+
/**
|
|
30
|
+
* the exact time when this segment started.
|
|
31
|
+
*/
|
|
32
|
+
start: number;
|
|
33
|
+
/**
|
|
34
|
+
* the text that belongs in this timeframe.
|
|
35
|
+
*/
|
|
36
|
+
text: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Response from speech-to-text.
|
|
40
|
+
*/
|
|
18
41
|
export interface Transcription {
|
|
42
|
+
/**
|
|
43
|
+
* for audit purposes.
|
|
44
|
+
*/
|
|
19
45
|
request_id: string;
|
|
20
46
|
text: string;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
47
|
+
/**
|
|
48
|
+
* sentence-level or word-level groupings of your transcript. Each sentence (or
|
|
49
|
+
* word) will fall within a time range.
|
|
50
|
+
*/
|
|
51
|
+
segments?: Array<Segment> | null;
|
|
52
|
+
/**
|
|
53
|
+
* @deprecated sentence-level or word-level groupings of your transcript. Each
|
|
54
|
+
* sentence (or word) will fall within a time range.
|
|
55
|
+
*/
|
|
56
|
+
timestamps?: Array<Segment> | null;
|
|
29
57
|
}
|
|
30
58
|
export interface SpeechGenerateParams {
|
|
31
|
-
language: 'yo' | 'en' | 'ha' | 'ig' | 'am';
|
|
59
|
+
language: 'yo' | 'en' | 'ha' | 'ig' | 'am' | 'pcm';
|
|
32
60
|
text: string;
|
|
33
61
|
voice: 'sade' | 'segun' | 'femi' | 'funmi' | 'amina' | 'aliyu' | 'hasan' | 'zainab' | 'john' | 'jude' | 'lina' | 'lucy' | 'henry' | 'kani' | 'ngozi' | 'amara' | 'obinna' | 'ebuka' | 'hana' | 'selam' | 'tena' | 'tesfaye';
|
|
34
|
-
|
|
35
|
-
|
|
62
|
+
/**
|
|
63
|
+
* the audio format for the returned audio bytes.
|
|
64
|
+
*/
|
|
65
|
+
format?: 'mp3' | 'wav' | 'ogg_opus' | 'webm_opus' | 'mulaw' | 'alaw' | 'flac' | 'pcm_s16le';
|
|
66
|
+
model?: string | null;
|
|
36
67
|
}
|
|
37
68
|
export interface SpeechTranscribeParams {
|
|
38
|
-
language: 'yo' | 'en' | 'ha' | 'ig' | 'am';
|
|
39
|
-
content?: Uploadable | null;
|
|
40
|
-
model?: 'mansa_v1' | 'legacy' |
|
|
69
|
+
language: 'yo' | 'en' | 'ha' | 'ig' | 'am' | 'pcm';
|
|
70
|
+
content?: Uploadable | string | null;
|
|
71
|
+
model?: 'mansa_v1' | 'legacy' | null;
|
|
41
72
|
special_words?: string | null;
|
|
42
73
|
timestamp?: 'sentence' | 'word' | 'none' | null;
|
|
74
|
+
/**
|
|
75
|
+
* @deprecated
|
|
76
|
+
*/
|
|
43
77
|
url?: string | null;
|
|
44
78
|
}
|
|
45
79
|
export declare namespace Speech {
|
|
46
|
-
export { type Transcription as Transcription, type SpeechGenerateParams as SpeechGenerateParams, type SpeechTranscribeParams as SpeechTranscribeParams, };
|
|
80
|
+
export { type Segment as Segment, type Transcription as Transcription, type SpeechGenerateParams as SpeechGenerateParams, type SpeechTranscribeParams as SpeechTranscribeParams, };
|
|
47
81
|
}
|
|
48
82
|
//# sourceMappingURL=speech.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"speech.d.ts","sourceRoot":"","sources":["../src/resources/speech.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,KAAK,UAAU,EAAE;OAEnB,EAAE,cAAc,EAAE;AAGzB;;GAEG;AACH,qBAAa,MAAO,SAAQ,WAAW;IACrC
|
|
1
|
+
{"version":3,"file":"speech.d.ts","sourceRoot":"","sources":["../src/resources/speech.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,KAAK,UAAU,EAAE;OAEnB,EAAE,cAAc,EAAE;AAGzB;;GAEG;AACH,qBAAa,MAAO,SAAQ,WAAW;IACrC;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,QAAQ,CAAC;IASpF;;;OAGG;IACH,UAAU,CAAC,IAAI,EAAE,sBAAsB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,aAAa,CAAC;CAM9F;AAED;;;GAGG;AACH,MAAM,WAAW,OAAO;IACtB;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;IAEjC;;;OAGG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;CACpC;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;IAEnD,IAAI,EAAE,MAAM,CAAC;IAEb,KAAK,EACD,MAAM,GACN,OAAO,GACP,MAAM,GACN,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,QAAQ,GACR,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,OAAO,GACP,MAAM,GACN,OAAO,GACP,OAAO,GACP,QAAQ,GACR,OAAO,GACP,MAAM,GACN,OAAO,GACP,MAAM,GACN,SAAS,CAAC;IAEd;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,UAAU,GAAG,WAAW,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,WAAW,CAAC;IAE5F,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;IAEnD,OAAO,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAAC;IAErC,KAAK,CAAC,EAAE,UAAU,GAAG,QAAQ,GAAG,IAAI,CAAC;IAErC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE9B,SAAS,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAEhD;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IAC9B,OAAO,EACL,KAAK,OAAO,IAAI,OAAO,EACvB,KAAK,aAAa,IAAI,aAAa,EACnC,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,sBAAsB,IAAI,sBAAsB,GACtD,CAAC;CACH"}
|
package/resources/speech.js
CHANGED
|
@@ -10,18 +10,20 @@ const uploads_1 = require("../internal/uploads.js");
|
|
|
10
10
|
*/
|
|
11
11
|
class Speech extends resource_1.APIResource {
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Convert text to speech. Select a voice and use that to generate audio in any
|
|
14
|
+
* format. Audio is retured in chunks.
|
|
14
15
|
*/
|
|
15
16
|
generate(body, options) {
|
|
16
17
|
return this._client.post('/v1/speech', {
|
|
17
18
|
body,
|
|
18
19
|
...options,
|
|
19
|
-
headers: (0, headers_1.buildHeaders)([{ Accept: 'audio
|
|
20
|
+
headers: (0, headers_1.buildHeaders)([{ Accept: 'audio/wav' }, options?.headers]),
|
|
20
21
|
__binaryResponse: true,
|
|
21
22
|
});
|
|
22
23
|
}
|
|
23
24
|
/**
|
|
24
|
-
*
|
|
25
|
+
* Convert speech to text. Upload audio file containing speech and get back text
|
|
26
|
+
* that represents the content of the audio file.
|
|
25
27
|
*/
|
|
26
28
|
transcribe(body, options) {
|
|
27
29
|
return this._client.post('/v1/transcriptions', (0, uploads_1.multipartFormRequestOptions)({ body, ...options }, this._client));
|
package/resources/speech.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"speech.js","sourceRoot":"","sources":["../src/resources/speech.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAG/C,oDAAmD;AAEnD,oDAAkE;AAElE;;GAEG;AACH,MAAa,MAAO,SAAQ,sBAAW;IACrC
|
|
1
|
+
{"version":3,"file":"speech.js","sourceRoot":"","sources":["../src/resources/speech.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAG/C,oDAAmD;AAEnD,oDAAkE;AAElE;;GAEG;AACH,MAAa,MAAO,SAAQ,sBAAW;IACrC;;;OAGG;IACH,QAAQ,CAAC,IAA0B,EAAE,OAAwB;QAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE;YACrC,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAClE,gBAAgB,EAAE,IAAI;SACvB,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,UAAU,CAAC,IAA4B,EAAE,OAAwB;QAC/D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CACtB,oBAAoB,EACpB,IAAA,qCAA2B,EAAC,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,CAChE,CAAC;IACJ,CAAC;CACF;AAxBD,wBAwBC"}
|
package/resources/speech.mjs
CHANGED
|
@@ -7,18 +7,20 @@ import { multipartFormRequestOptions } from "../internal/uploads.mjs";
|
|
|
7
7
|
*/
|
|
8
8
|
export class Speech extends APIResource {
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Convert text to speech. Select a voice and use that to generate audio in any
|
|
11
|
+
* format. Audio is retured in chunks.
|
|
11
12
|
*/
|
|
12
13
|
generate(body, options) {
|
|
13
14
|
return this._client.post('/v1/speech', {
|
|
14
15
|
body,
|
|
15
16
|
...options,
|
|
16
|
-
headers: buildHeaders([{ Accept: 'audio
|
|
17
|
+
headers: buildHeaders([{ Accept: 'audio/wav' }, options?.headers]),
|
|
17
18
|
__binaryResponse: true,
|
|
18
19
|
});
|
|
19
20
|
}
|
|
20
21
|
/**
|
|
21
|
-
*
|
|
22
|
+
* Convert speech to text. Upload audio file containing speech and get back text
|
|
23
|
+
* that represents the content of the audio file.
|
|
22
24
|
*/
|
|
23
25
|
transcribe(body, options) {
|
|
24
26
|
return this._client.post('/v1/transcriptions', multipartFormRequestOptions({ body, ...options }, this._client));
|
package/resources/speech.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"speech.mjs","sourceRoot":"","sources":["../src/resources/speech.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,YAAY,EAAE;OAEhB,EAAE,2BAA2B,EAAE;AAEtC;;GAEG;AACH,MAAM,OAAO,MAAO,SAAQ,WAAW;IACrC
|
|
1
|
+
{"version":3,"file":"speech.mjs","sourceRoot":"","sources":["../src/resources/speech.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,YAAY,EAAE;OAEhB,EAAE,2BAA2B,EAAE;AAEtC;;GAEG;AACH,MAAM,OAAO,MAAO,SAAQ,WAAW;IACrC;;;OAGG;IACH,QAAQ,CAAC,IAA0B,EAAE,OAAwB;QAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE;YACrC,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAClE,gBAAgB,EAAE,IAAI;SACvB,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,UAAU,CAAC,IAA4B,EAAE,OAAwB;QAC/D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CACtB,oBAAoB,EACpB,2BAA2B,CAAC,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,CAChE,CAAC;IACJ,CAAC;CACF"}
|
package/resources/text.d.mts
CHANGED
|
@@ -3,49 +3,31 @@ import { APIPromise } from "../core/api-promise.mjs";
|
|
|
3
3
|
import { RequestOptions } from "../internal/request-options.mjs";
|
|
4
4
|
export declare class Text extends APIResource {
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Add appopriate tone marks to text.
|
|
7
7
|
*/
|
|
8
8
|
toneMark(body: TextToneMarkParams, options?: RequestOptions): APIPromise<Diacritics>;
|
|
9
9
|
/**
|
|
10
|
-
* Translate
|
|
10
|
+
* Translate text from one language to another. Select the source and target
|
|
11
|
+
* languages, and get text in new language.
|
|
11
12
|
*/
|
|
12
13
|
translate(body: TextTranslateParams, options?: RequestOptions): APIPromise<Translation>;
|
|
13
14
|
}
|
|
14
|
-
/**
|
|
15
|
-
* Response model for text diacritization requests.
|
|
16
|
-
*
|
|
17
|
-
* Attributes:
|
|
18
|
-
* request_id: Unique identifier for the diacritization request
|
|
19
|
-
* text: Text with added diacritical marks for proper pronunciation
|
|
20
|
-
* language: Language code for the diacritized text
|
|
21
|
-
*/
|
|
22
15
|
export interface Diacritics {
|
|
23
16
|
request_id: string;
|
|
24
17
|
text: string;
|
|
25
18
|
}
|
|
26
|
-
/**
|
|
27
|
-
* Translation result model.
|
|
28
|
-
*
|
|
29
|
-
* Attributes: request_id (UUID): Unique ID for this request. text: translated
|
|
30
|
-
* text. due_date: used when model is `human`. the date you can expect the
|
|
31
|
-
* translation to be delivered
|
|
32
|
-
*/
|
|
33
19
|
export interface Translation {
|
|
34
20
|
request_id: string;
|
|
35
21
|
text: string;
|
|
36
|
-
due_date?: string | null;
|
|
37
22
|
}
|
|
38
23
|
export interface TextToneMarkParams {
|
|
39
|
-
language: 'yo' | 'en' | 'ha' | 'ig' | 'am';
|
|
24
|
+
language: 'yo' | 'en' | 'ha' | 'ig' | 'am' | 'pcm';
|
|
40
25
|
text: string;
|
|
41
26
|
}
|
|
42
27
|
export interface TextTranslateParams {
|
|
43
|
-
source: 'yo' | 'en' | 'ha' | 'ig' | 'am';
|
|
44
|
-
target: 'yo' | 'en' | 'ha' | 'ig' | 'am';
|
|
45
|
-
|
|
46
|
-
instructions?: string | null;
|
|
47
|
-
model?: 'human' | 'auto';
|
|
48
|
-
text?: string | null;
|
|
28
|
+
source: 'yo' | 'en' | 'ha' | 'ig' | 'am' | 'pcm';
|
|
29
|
+
target: 'yo' | 'en' | 'ha' | 'ig' | 'am' | 'pcm';
|
|
30
|
+
text: string;
|
|
49
31
|
}
|
|
50
32
|
export declare namespace Text {
|
|
51
33
|
export { type Diacritics as Diacritics, type Translation as Translation, type TextToneMarkParams as TextToneMarkParams, type TextTranslateParams as TextTranslateParams, };
|
package/resources/text.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.mts","sourceRoot":"","sources":["../src/resources/text.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,IAAK,SAAQ,WAAW;IACnC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,UAAU,CAAC;IAIpF
|
|
1
|
+
{"version":3,"file":"text.d.mts","sourceRoot":"","sources":["../src/resources/text.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,IAAK,SAAQ,WAAW;IACnC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,UAAU,CAAC;IAIpF;;;OAGG;IACH,SAAS,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,WAAW,CAAC;CAGxF;AAED,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,MAAM,CAAC;IAEnB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IAEnB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;IAEnD,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;IAEjD,MAAM,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;IAEjD,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,CAAC,OAAO,WAAW,IAAI,CAAC;IAC5B,OAAO,EACL,KAAK,UAAU,IAAI,UAAU,EAC7B,KAAK,WAAW,IAAI,WAAW,EAC/B,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,mBAAmB,IAAI,mBAAmB,GAChD,CAAC;CACH"}
|
package/resources/text.d.ts
CHANGED
|
@@ -3,49 +3,31 @@ import { APIPromise } from "../core/api-promise.js";
|
|
|
3
3
|
import { RequestOptions } from "../internal/request-options.js";
|
|
4
4
|
export declare class Text extends APIResource {
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Add appopriate tone marks to text.
|
|
7
7
|
*/
|
|
8
8
|
toneMark(body: TextToneMarkParams, options?: RequestOptions): APIPromise<Diacritics>;
|
|
9
9
|
/**
|
|
10
|
-
* Translate
|
|
10
|
+
* Translate text from one language to another. Select the source and target
|
|
11
|
+
* languages, and get text in new language.
|
|
11
12
|
*/
|
|
12
13
|
translate(body: TextTranslateParams, options?: RequestOptions): APIPromise<Translation>;
|
|
13
14
|
}
|
|
14
|
-
/**
|
|
15
|
-
* Response model for text diacritization requests.
|
|
16
|
-
*
|
|
17
|
-
* Attributes:
|
|
18
|
-
* request_id: Unique identifier for the diacritization request
|
|
19
|
-
* text: Text with added diacritical marks for proper pronunciation
|
|
20
|
-
* language: Language code for the diacritized text
|
|
21
|
-
*/
|
|
22
15
|
export interface Diacritics {
|
|
23
16
|
request_id: string;
|
|
24
17
|
text: string;
|
|
25
18
|
}
|
|
26
|
-
/**
|
|
27
|
-
* Translation result model.
|
|
28
|
-
*
|
|
29
|
-
* Attributes: request_id (UUID): Unique ID for this request. text: translated
|
|
30
|
-
* text. due_date: used when model is `human`. the date you can expect the
|
|
31
|
-
* translation to be delivered
|
|
32
|
-
*/
|
|
33
19
|
export interface Translation {
|
|
34
20
|
request_id: string;
|
|
35
21
|
text: string;
|
|
36
|
-
due_date?: string | null;
|
|
37
22
|
}
|
|
38
23
|
export interface TextToneMarkParams {
|
|
39
|
-
language: 'yo' | 'en' | 'ha' | 'ig' | 'am';
|
|
24
|
+
language: 'yo' | 'en' | 'ha' | 'ig' | 'am' | 'pcm';
|
|
40
25
|
text: string;
|
|
41
26
|
}
|
|
42
27
|
export interface TextTranslateParams {
|
|
43
|
-
source: 'yo' | 'en' | 'ha' | 'ig' | 'am';
|
|
44
|
-
target: 'yo' | 'en' | 'ha' | 'ig' | 'am';
|
|
45
|
-
|
|
46
|
-
instructions?: string | null;
|
|
47
|
-
model?: 'human' | 'auto';
|
|
48
|
-
text?: string | null;
|
|
28
|
+
source: 'yo' | 'en' | 'ha' | 'ig' | 'am' | 'pcm';
|
|
29
|
+
target: 'yo' | 'en' | 'ha' | 'ig' | 'am' | 'pcm';
|
|
30
|
+
text: string;
|
|
49
31
|
}
|
|
50
32
|
export declare namespace Text {
|
|
51
33
|
export { type Diacritics as Diacritics, type Translation as Translation, type TextToneMarkParams as TextToneMarkParams, type TextTranslateParams as TextTranslateParams, };
|
package/resources/text.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../src/resources/text.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,IAAK,SAAQ,WAAW;IACnC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,UAAU,CAAC;IAIpF
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../src/resources/text.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,IAAK,SAAQ,WAAW;IACnC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,UAAU,CAAC;IAIpF;;;OAGG;IACH,SAAS,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,WAAW,CAAC;CAGxF;AAED,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,MAAM,CAAC;IAEnB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IAEnB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;IAEnD,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;IAEjD,MAAM,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;IAEjD,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,CAAC,OAAO,WAAW,IAAI,CAAC;IAC5B,OAAO,EACL,KAAK,UAAU,IAAI,UAAU,EAC7B,KAAK,WAAW,IAAI,WAAW,EAC/B,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,mBAAmB,IAAI,mBAAmB,GAChD,CAAC;CACH"}
|
package/resources/text.js
CHANGED
|
@@ -5,13 +5,14 @@ exports.Text = void 0;
|
|
|
5
5
|
const resource_1 = require("../core/resource.js");
|
|
6
6
|
class Text extends resource_1.APIResource {
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Add appopriate tone marks to text.
|
|
9
9
|
*/
|
|
10
10
|
toneMark(body, options) {
|
|
11
11
|
return this._client.post('/v1/diacritics', { body, ...options });
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
* Translate
|
|
14
|
+
* Translate text from one language to another. Select the source and target
|
|
15
|
+
* languages, and get text in new language.
|
|
15
16
|
*/
|
|
16
17
|
translate(body, options) {
|
|
17
18
|
return this._client.post('/v1/translate', { body, ...options });
|
package/resources/text.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.js","sourceRoot":"","sources":["../src/resources/text.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAI/C,MAAa,IAAK,SAAQ,sBAAW;IACnC;;OAEG;IACH,QAAQ,CAAC,IAAwB,EAAE,OAAwB;QACzD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACnE,CAAC;IAED
|
|
1
|
+
{"version":3,"file":"text.js","sourceRoot":"","sources":["../src/resources/text.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAI/C,MAAa,IAAK,SAAQ,sBAAW;IACnC;;OAEG;IACH,QAAQ,CAAC,IAAwB,EAAE,OAAwB;QACzD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACnE,CAAC;IAED;;;OAGG;IACH,SAAS,CAAC,IAAyB,EAAE,OAAwB;QAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAClE,CAAC;CACF;AAfD,oBAeC"}
|
package/resources/text.mjs
CHANGED
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
import { APIResource } from "../core/resource.mjs";
|
|
3
3
|
export class Text extends APIResource {
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Add appopriate tone marks to text.
|
|
6
6
|
*/
|
|
7
7
|
toneMark(body, options) {
|
|
8
8
|
return this._client.post('/v1/diacritics', { body, ...options });
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
* Translate
|
|
11
|
+
* Translate text from one language to another. Select the source and target
|
|
12
|
+
* languages, and get text in new language.
|
|
12
13
|
*/
|
|
13
14
|
translate(body, options) {
|
|
14
15
|
return this._client.post('/v1/translate', { body, ...options });
|
package/resources/text.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.mjs","sourceRoot":"","sources":["../src/resources/text.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAItB,MAAM,OAAO,IAAK,SAAQ,WAAW;IACnC;;OAEG;IACH,QAAQ,CAAC,IAAwB,EAAE,OAAwB;QACzD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACnE,CAAC;IAED
|
|
1
|
+
{"version":3,"file":"text.mjs","sourceRoot":"","sources":["../src/resources/text.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAItB,MAAM,OAAO,IAAK,SAAQ,WAAW;IACnC;;OAEG;IACH,QAAQ,CAAC,IAAwB,EAAE,OAAwB;QACzD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACnE,CAAC;IAED;;;OAGG;IACH,SAAS,CAAC,IAAyB,EAAE,OAAwB;QAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAClE,CAAC;CACF"}
|
package/src/client.ts
CHANGED
|
@@ -29,8 +29,13 @@ import {
|
|
|
29
29
|
Files,
|
|
30
30
|
FilesFilesCursor,
|
|
31
31
|
} from './resources/files';
|
|
32
|
-
import {
|
|
33
|
-
|
|
32
|
+
import {
|
|
33
|
+
Segment,
|
|
34
|
+
Speech,
|
|
35
|
+
SpeechGenerateParams,
|
|
36
|
+
SpeechTranscribeParams,
|
|
37
|
+
Transcription,
|
|
38
|
+
} from './resources/speech';
|
|
34
39
|
import { Diacritics, Text, TextToneMarkParams, TextTranslateParams, Translation } from './resources/text';
|
|
35
40
|
import { type Fetch } from './internal/builtin-types';
|
|
36
41
|
import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
|
|
@@ -51,6 +56,8 @@ export interface ClientOptions {
|
|
|
51
56
|
*/
|
|
52
57
|
apiKey?: string | undefined;
|
|
53
58
|
|
|
59
|
+
dataRetention?: boolean | null | undefined;
|
|
60
|
+
|
|
54
61
|
/**
|
|
55
62
|
* Override the default base URL for the API, e.g., "https://api.example.com/v2/"
|
|
56
63
|
*
|
|
@@ -125,11 +132,12 @@ export interface ClientOptions {
|
|
|
125
132
|
*/
|
|
126
133
|
export class Spitch {
|
|
127
134
|
apiKey: string;
|
|
135
|
+
dataRetention: boolean | null;
|
|
128
136
|
|
|
129
137
|
baseURL: string;
|
|
130
138
|
maxRetries: number;
|
|
131
139
|
timeout: number;
|
|
132
|
-
logger: Logger
|
|
140
|
+
logger: Logger;
|
|
133
141
|
logLevel: LogLevel | undefined;
|
|
134
142
|
fetchOptions: MergedRequestInit | undefined;
|
|
135
143
|
|
|
@@ -142,6 +150,7 @@ export class Spitch {
|
|
|
142
150
|
* API Client for interfacing with the Spitch API.
|
|
143
151
|
*
|
|
144
152
|
* @param {string | undefined} [opts.apiKey=process.env['SPITCH_API_KEY'] ?? undefined]
|
|
153
|
+
* @param {boolean | null | undefined} [opts.dataRetention=true]
|
|
145
154
|
* @param {string} [opts.baseURL=process.env['SPITCH_BASE_URL'] ?? https://api.spi-tch.com] - Override the default base URL for the API.
|
|
146
155
|
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
147
156
|
* @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
|
|
@@ -153,6 +162,7 @@ export class Spitch {
|
|
|
153
162
|
constructor({
|
|
154
163
|
baseURL = readEnv('SPITCH_BASE_URL'),
|
|
155
164
|
apiKey = readEnv('SPITCH_API_KEY'),
|
|
165
|
+
dataRetention = true,
|
|
156
166
|
...opts
|
|
157
167
|
}: ClientOptions = {}) {
|
|
158
168
|
if (apiKey === undefined) {
|
|
@@ -163,6 +173,7 @@ export class Spitch {
|
|
|
163
173
|
|
|
164
174
|
const options: ClientOptions = {
|
|
165
175
|
apiKey,
|
|
176
|
+
dataRetention,
|
|
166
177
|
...opts,
|
|
167
178
|
baseURL: baseURL || `https://api.spi-tch.com`,
|
|
168
179
|
};
|
|
@@ -185,6 +196,7 @@ export class Spitch {
|
|
|
185
196
|
this._options = options;
|
|
186
197
|
|
|
187
198
|
this.apiKey = apiKey;
|
|
199
|
+
this.dataRetention = dataRetention;
|
|
188
200
|
}
|
|
189
201
|
|
|
190
202
|
/**
|
|
@@ -201,6 +213,7 @@ export class Spitch {
|
|
|
201
213
|
fetch: this.fetch,
|
|
202
214
|
fetchOptions: this.fetchOptions,
|
|
203
215
|
apiKey: this.apiKey,
|
|
216
|
+
dataRetention: this.dataRetention,
|
|
204
217
|
...options,
|
|
205
218
|
});
|
|
206
219
|
return client;
|
|
@@ -680,6 +693,7 @@ export class Spitch {
|
|
|
680
693
|
'X-Stainless-Retry-Count': String(retryCount),
|
|
681
694
|
...(options.timeout ? { 'X-Stainless-Timeout': String(Math.trunc(options.timeout / 1000)) } : {}),
|
|
682
695
|
...getPlatformHeaders(),
|
|
696
|
+
'X-Data-Retention': this.dataRetention?.toString() ?? null,
|
|
683
697
|
},
|
|
684
698
|
await this.authHeaders(options),
|
|
685
699
|
this._options.defaultHeaders,
|
|
@@ -754,7 +768,6 @@ export class Spitch {
|
|
|
754
768
|
speech: API.Speech = new API.Speech(this);
|
|
755
769
|
text: API.Text = new API.Text(this);
|
|
756
770
|
files: API.Files = new API.Files(this);
|
|
757
|
-
jobs: API.Jobs = new API.Jobs(this);
|
|
758
771
|
}
|
|
759
772
|
|
|
760
773
|
Spitch.Speech = Speech;
|
|
@@ -768,6 +781,7 @@ export declare namespace Spitch {
|
|
|
768
781
|
|
|
769
782
|
export {
|
|
770
783
|
Speech as Speech,
|
|
784
|
+
type Segment as Segment,
|
|
771
785
|
type Transcription as Transcription,
|
|
772
786
|
type SpeechGenerateParams as SpeechGenerateParams,
|
|
773
787
|
type SpeechTranscribeParams as SpeechTranscribeParams,
|
|
@@ -792,11 +806,4 @@ export declare namespace Spitch {
|
|
|
792
806
|
type FileDownloadParams as FileDownloadParams,
|
|
793
807
|
type FileUploadParams as FileUploadParams,
|
|
794
808
|
};
|
|
795
|
-
|
|
796
|
-
export {
|
|
797
|
-
type Jobs as Jobs,
|
|
798
|
-
type Job as Job,
|
|
799
|
-
type JobsFilesCursor as JobsFilesCursor,
|
|
800
|
-
type JobListParams as JobListParams,
|
|
801
|
-
};
|
|
802
809
|
}
|