spitch 1.25.0 → 1.26.1
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 +48 -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 +9 -4
- package/client.js.map +1 -1
- package/client.mjs +10 -5
- package/client.mjs.map +1 -1
- package/internal/parse.d.mts.map +1 -1
- package/internal/parse.d.ts.map +1 -1
- package/internal/parse.js +5 -0
- package/internal/parse.js.map +1 -1
- package/internal/parse.mjs +5 -0
- package/internal/parse.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 +21 -13
- package/src/internal/parse.ts +6 -0
- 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/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;
|
|
@@ -523,9 +536,10 @@ export class Spitch {
|
|
|
523
536
|
controller: AbortController,
|
|
524
537
|
): Promise<Response> {
|
|
525
538
|
const { signal, method, ...options } = init || {};
|
|
526
|
-
|
|
539
|
+
const abort = controller.abort.bind(controller);
|
|
540
|
+
if (signal) signal.addEventListener('abort', abort, { once: true });
|
|
527
541
|
|
|
528
|
-
const timeout = setTimeout(
|
|
542
|
+
const timeout = setTimeout(abort, ms);
|
|
529
543
|
|
|
530
544
|
const isReadableBody =
|
|
531
545
|
((globalThis as any).ReadableStream && options.body instanceof (globalThis as any).ReadableStream) ||
|
|
@@ -680,6 +694,7 @@ export class Spitch {
|
|
|
680
694
|
'X-Stainless-Retry-Count': String(retryCount),
|
|
681
695
|
...(options.timeout ? { 'X-Stainless-Timeout': String(Math.trunc(options.timeout / 1000)) } : {}),
|
|
682
696
|
...getPlatformHeaders(),
|
|
697
|
+
'X-Data-Retention': this.dataRetention?.toString() ?? null,
|
|
683
698
|
},
|
|
684
699
|
await this.authHeaders(options),
|
|
685
700
|
this._options.defaultHeaders,
|
|
@@ -754,7 +769,6 @@ export class Spitch {
|
|
|
754
769
|
speech: API.Speech = new API.Speech(this);
|
|
755
770
|
text: API.Text = new API.Text(this);
|
|
756
771
|
files: API.Files = new API.Files(this);
|
|
757
|
-
jobs: API.Jobs = new API.Jobs(this);
|
|
758
772
|
}
|
|
759
773
|
|
|
760
774
|
Spitch.Speech = Speech;
|
|
@@ -768,6 +782,7 @@ export declare namespace Spitch {
|
|
|
768
782
|
|
|
769
783
|
export {
|
|
770
784
|
Speech as Speech,
|
|
785
|
+
type Segment as Segment,
|
|
771
786
|
type Transcription as Transcription,
|
|
772
787
|
type SpeechGenerateParams as SpeechGenerateParams,
|
|
773
788
|
type SpeechTranscribeParams as SpeechTranscribeParams,
|
|
@@ -792,11 +807,4 @@ export declare namespace Spitch {
|
|
|
792
807
|
type FileDownloadParams as FileDownloadParams,
|
|
793
808
|
type FileUploadParams as FileUploadParams,
|
|
794
809
|
};
|
|
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
810
|
}
|
package/src/internal/parse.ts
CHANGED
|
@@ -29,6 +29,12 @@ export async function defaultParseResponse<T>(client: Spitch, props: APIResponse
|
|
|
29
29
|
const mediaType = contentType?.split(';')[0]?.trim();
|
|
30
30
|
const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json');
|
|
31
31
|
if (isJSON) {
|
|
32
|
+
const contentLength = response.headers.get('content-length');
|
|
33
|
+
if (contentLength === '0') {
|
|
34
|
+
// if there is no content we can't do anything
|
|
35
|
+
return undefined as T;
|
|
36
|
+
}
|
|
37
|
+
|
|
32
38
|
const json = await response.json();
|
|
33
39
|
return json as T;
|
|
34
40
|
}
|
package/src/resources/files.ts
CHANGED
|
@@ -10,16 +10,7 @@ import { path } from '../internal/utils/path';
|
|
|
10
10
|
|
|
11
11
|
export class Files extends APIResource {
|
|
12
12
|
/**
|
|
13
|
-
* Get
|
|
14
|
-
*
|
|
15
|
-
* Args: identity: Authentication identity containing org_id and user_id limit:
|
|
16
|
-
* Maximum number of files to return (max 100) status: Optional filter by file
|
|
17
|
-
* status (processing, ready, etc.) cursor: Optional pagination cursor for getting
|
|
18
|
-
* next page db: Database session
|
|
19
|
-
*
|
|
20
|
-
* Returns: ListFilesResponse: Paginated list of files with metadata
|
|
21
|
-
*
|
|
22
|
-
* Raises: HTTPException: 400 if cursor is invalid
|
|
13
|
+
* Get Files
|
|
23
14
|
*/
|
|
24
15
|
list(
|
|
25
16
|
query: FileListParams | null | undefined = {},
|
|
@@ -29,77 +20,39 @@ export class Files extends APIResource {
|
|
|
29
20
|
}
|
|
30
21
|
|
|
31
22
|
/**
|
|
32
|
-
* Delete
|
|
33
|
-
*
|
|
34
|
-
* Args: file_id: UUID of the file to delete identity: Authentication identity
|
|
35
|
-
* containing org_id db: Database session s3: S3 session for deleting objects
|
|
36
|
-
*
|
|
37
|
-
* Returns: dict: Success confirmation
|
|
38
|
-
*
|
|
39
|
-
* Raises: HTTPException: 404 if file not found or doesn't belong to org
|
|
23
|
+
* Delete File
|
|
40
24
|
*/
|
|
41
|
-
delete(fileID: string, options?: RequestOptions): APIPromise<
|
|
25
|
+
delete(fileID: string, options?: RequestOptions): APIPromise<FileDeleteResponse> {
|
|
42
26
|
return this._client.delete(path`/v1/files/${fileID}`, options);
|
|
43
27
|
}
|
|
44
28
|
|
|
45
29
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* Args: file_id: UUID of the file to download identity: Authentication identity
|
|
49
|
-
* containing org_id ttl: Time-to-live for the download URL in seconds (60-3600)
|
|
50
|
-
* db: Database session s3: S3 session for generating pre-signed URLs
|
|
51
|
-
*
|
|
52
|
-
* Returns: FileDownloadResponse: Contains file_id, download URL, and expiration
|
|
53
|
-
* time
|
|
54
|
-
*
|
|
55
|
-
* Raises: HTTPException: 404 if file not found, doesn't belong to org, or not
|
|
56
|
-
* ready
|
|
30
|
+
* Download File
|
|
57
31
|
*/
|
|
58
32
|
download(
|
|
59
33
|
fileID: string,
|
|
60
34
|
query: FileDownloadParams | null | undefined = {},
|
|
61
35
|
options?: RequestOptions,
|
|
62
|
-
): APIPromise<
|
|
36
|
+
): APIPromise<unknown> {
|
|
63
37
|
return this._client.get(path`/v1/files/${fileID}/url`, { query, ...options });
|
|
64
38
|
}
|
|
65
39
|
|
|
66
40
|
/**
|
|
67
|
-
* Get
|
|
68
|
-
*
|
|
69
|
-
* Args: file_id: UUID of the file to retrieve identity: Authentication identity
|
|
70
|
-
* containing org_id db: Database session
|
|
71
|
-
*
|
|
72
|
-
* Returns: FileMetaResponse: File metadata including upload information
|
|
73
|
-
*
|
|
74
|
-
* Raises: HTTPException: 404 if file not found or doesn't belong to org
|
|
75
|
-
* HTTPException: 500 if uploader information is corrupted
|
|
41
|
+
* Get File
|
|
76
42
|
*/
|
|
77
43
|
get(fileID: string, options?: RequestOptions): APIPromise<File> {
|
|
78
44
|
return this._client.get(path`/v1/files/${fileID}`, options);
|
|
79
45
|
}
|
|
80
46
|
|
|
81
47
|
/**
|
|
82
|
-
* Upload a file to
|
|
83
|
-
*
|
|
84
|
-
* Args: file: The file to upload from the request identity: Authentication
|
|
85
|
-
* identity containing org_id and user_id db: Database session
|
|
86
|
-
*
|
|
87
|
-
* Returns: FileMetaResponse: Metadata for the uploaded file
|
|
88
|
-
*
|
|
89
|
-
* Raises: HTTPException: 500 if upload fails
|
|
48
|
+
* Upload a file to your storage.
|
|
90
49
|
*/
|
|
91
50
|
upload(body: FileUploadParams, options?: RequestOptions): APIPromise<File> {
|
|
92
51
|
return this._client.post('/v1/files', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
93
52
|
}
|
|
94
53
|
|
|
95
54
|
/**
|
|
96
|
-
* Get
|
|
97
|
-
*
|
|
98
|
-
* Args: identity: Authentication identity containing org_id db: Database session
|
|
99
|
-
*
|
|
100
|
-
* Returns: FileUsage: Usage statistics including total/used bytes and file count
|
|
101
|
-
*
|
|
102
|
-
* Raises: HTTPException: 500 if unable to calculate usage
|
|
55
|
+
* Get Usage
|
|
103
56
|
*/
|
|
104
57
|
usage(options?: RequestOptions): APIPromise<FileUsage> {
|
|
105
58
|
return this._client.get('/v1/files:usage', options);
|
|
@@ -109,15 +62,9 @@ export class Files extends APIResource {
|
|
|
109
62
|
export type FilesFilesCursor = FilesCursor<File>;
|
|
110
63
|
|
|
111
64
|
/**
|
|
112
|
-
*
|
|
113
|
-
* status: status of the file, `processing` or `ready` original_name: original name
|
|
114
|
-
* of the file. If the file was uploaded via API
|
|
65
|
+
* Metadata info for this file.
|
|
115
66
|
*/
|
|
116
67
|
export interface File {
|
|
117
|
-
category: string | null;
|
|
118
|
-
|
|
119
|
-
content_type: string | null;
|
|
120
|
-
|
|
121
68
|
created_at: string;
|
|
122
69
|
|
|
123
70
|
file_id: string;
|
|
@@ -126,35 +73,40 @@ export interface File {
|
|
|
126
73
|
|
|
127
74
|
size_bytes: number | null;
|
|
128
75
|
|
|
129
|
-
status:
|
|
76
|
+
status: string;
|
|
130
77
|
|
|
131
78
|
uploaded_by?: string | null;
|
|
132
79
|
}
|
|
133
80
|
|
|
134
|
-
/**
|
|
135
|
-
* Storage usage information for an organization.
|
|
136
|
-
*
|
|
137
|
-
* Attributes: total: Human-readable total storage limit used: Human-readable used
|
|
138
|
-
* storage amount total_bytes: Total storage limit in bytes used_bytes: Used
|
|
139
|
-
* storage amount in bytes num_files: Number of files stored
|
|
140
|
-
*/
|
|
141
81
|
export interface FileUsage {
|
|
142
|
-
|
|
82
|
+
/**
|
|
83
|
+
* number of files available.
|
|
84
|
+
*/
|
|
85
|
+
num_files?: number;
|
|
143
86
|
|
|
144
|
-
|
|
87
|
+
/**
|
|
88
|
+
* total storage available in human-readable format
|
|
89
|
+
*/
|
|
90
|
+
total?: string;
|
|
145
91
|
|
|
146
|
-
|
|
92
|
+
/**
|
|
93
|
+
* storage used in bytes
|
|
94
|
+
*/
|
|
95
|
+
total_bytes?: number;
|
|
147
96
|
|
|
148
|
-
|
|
97
|
+
/**
|
|
98
|
+
* storage used in human-readable format
|
|
99
|
+
*/
|
|
100
|
+
used?: string;
|
|
149
101
|
|
|
150
|
-
|
|
102
|
+
/**
|
|
103
|
+
* total storage available in bytes
|
|
104
|
+
*/
|
|
105
|
+
used_bytes?: number;
|
|
151
106
|
}
|
|
152
107
|
|
|
153
108
|
/**
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
* Attributes: items: List of file metadata responses next_cursor: Optional cursor
|
|
157
|
-
* for pagination to get next page of results
|
|
109
|
+
* an array of file information.
|
|
158
110
|
*/
|
|
159
111
|
export interface Files {
|
|
160
112
|
items: Array<File>;
|
|
@@ -162,25 +114,13 @@ export interface Files {
|
|
|
162
114
|
next_cursor?: string | null;
|
|
163
115
|
}
|
|
164
116
|
|
|
165
|
-
export
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Response model for file download URLs.
|
|
169
|
-
*
|
|
170
|
-
* Attributes: file_id: Unique identifier for the file url: Pre-signed download URL
|
|
171
|
-
* expires_at: When the download URL expires
|
|
172
|
-
*/
|
|
173
|
-
export interface FileDownloadResponse {
|
|
174
|
-
expires_at: string;
|
|
175
|
-
|
|
176
|
-
file_id: string;
|
|
177
|
-
|
|
178
|
-
url: string;
|
|
117
|
+
export interface FileDeleteResponse {
|
|
118
|
+
status?: boolean;
|
|
179
119
|
}
|
|
180
120
|
|
|
181
|
-
export
|
|
182
|
-
|
|
183
|
-
}
|
|
121
|
+
export type FileDownloadResponse = unknown;
|
|
122
|
+
|
|
123
|
+
export interface FileListParams extends FilesCursorParams {}
|
|
184
124
|
|
|
185
125
|
export interface FileDownloadParams {
|
|
186
126
|
ttl?: number;
|
package/src/resources/index.ts
CHANGED
|
@@ -11,8 +11,13 @@ export {
|
|
|
11
11
|
type FileUploadParams,
|
|
12
12
|
type FilesFilesCursor,
|
|
13
13
|
} from './files';
|
|
14
|
-
export {
|
|
15
|
-
|
|
14
|
+
export {
|
|
15
|
+
Speech,
|
|
16
|
+
type Segment,
|
|
17
|
+
type Transcription,
|
|
18
|
+
type SpeechGenerateParams,
|
|
19
|
+
type SpeechTranscribeParams,
|
|
20
|
+
} from './speech';
|
|
16
21
|
export {
|
|
17
22
|
Text,
|
|
18
23
|
type Diacritics,
|
package/src/resources/speech.ts
CHANGED
|
@@ -12,19 +12,21 @@ import { multipartFormRequestOptions } from '../internal/uploads';
|
|
|
12
12
|
*/
|
|
13
13
|
export class Speech extends APIResource {
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Convert text to speech. Select a voice and use that to generate audio in any
|
|
16
|
+
* format. Audio is retured in chunks.
|
|
16
17
|
*/
|
|
17
18
|
generate(body: SpeechGenerateParams, options?: RequestOptions): APIPromise<Response> {
|
|
18
19
|
return this._client.post('/v1/speech', {
|
|
19
20
|
body,
|
|
20
21
|
...options,
|
|
21
|
-
headers: buildHeaders([{ Accept: 'audio
|
|
22
|
+
headers: buildHeaders([{ Accept: 'audio/wav' }, options?.headers]),
|
|
22
23
|
__binaryResponse: true,
|
|
23
24
|
});
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
/**
|
|
27
|
-
*
|
|
28
|
+
* Convert speech to text. Upload audio file containing speech and get back text
|
|
29
|
+
* that represents the content of the audio file.
|
|
28
30
|
*/
|
|
29
31
|
transcribe(body: SpeechTranscribeParams, options?: RequestOptions): APIPromise<Transcription> {
|
|
30
32
|
return this._client.post(
|
|
@@ -34,26 +36,53 @@ export class Speech extends APIResource {
|
|
|
34
36
|
}
|
|
35
37
|
}
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
/**
|
|
40
|
+
* a segment (sentence or word-level) of the transcript. It contains a start and
|
|
41
|
+
* end time.
|
|
42
|
+
*/
|
|
43
|
+
export interface Segment {
|
|
44
|
+
/**
|
|
45
|
+
* the exact time when this segment ended.
|
|
46
|
+
*/
|
|
47
|
+
end: number;
|
|
39
48
|
|
|
40
|
-
|
|
49
|
+
/**
|
|
50
|
+
* the exact time when this segment started.
|
|
51
|
+
*/
|
|
52
|
+
start: number;
|
|
41
53
|
|
|
42
|
-
|
|
54
|
+
/**
|
|
55
|
+
* the text that belongs in this timeframe.
|
|
56
|
+
*/
|
|
57
|
+
text: string;
|
|
43
58
|
}
|
|
44
59
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Response from speech-to-text.
|
|
62
|
+
*/
|
|
63
|
+
export interface Transcription {
|
|
64
|
+
/**
|
|
65
|
+
* for audit purposes.
|
|
66
|
+
*/
|
|
67
|
+
request_id: string;
|
|
48
68
|
|
|
49
|
-
|
|
69
|
+
text: string;
|
|
50
70
|
|
|
51
|
-
|
|
52
|
-
|
|
71
|
+
/**
|
|
72
|
+
* sentence-level or word-level groupings of your transcript. Each sentence (or
|
|
73
|
+
* word) will fall within a time range.
|
|
74
|
+
*/
|
|
75
|
+
segments?: Array<Segment> | null;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* @deprecated sentence-level or word-level groupings of your transcript. Each
|
|
79
|
+
* sentence (or word) will fall within a time range.
|
|
80
|
+
*/
|
|
81
|
+
timestamps?: Array<Segment> | null;
|
|
53
82
|
}
|
|
54
83
|
|
|
55
84
|
export interface SpeechGenerateParams {
|
|
56
|
-
language: 'yo' | 'en' | 'ha' | 'ig' | 'am';
|
|
85
|
+
language: 'yo' | 'en' | 'ha' | 'ig' | 'am' | 'pcm';
|
|
57
86
|
|
|
58
87
|
text: string;
|
|
59
88
|
|
|
@@ -81,27 +110,34 @@ export interface SpeechGenerateParams {
|
|
|
81
110
|
| 'tena'
|
|
82
111
|
| 'tesfaye';
|
|
83
112
|
|
|
84
|
-
|
|
113
|
+
/**
|
|
114
|
+
* the audio format for the returned audio bytes.
|
|
115
|
+
*/
|
|
116
|
+
format?: 'mp3' | 'wav' | 'ogg_opus' | 'webm_opus' | 'mulaw' | 'alaw' | 'flac' | 'pcm_s16le';
|
|
85
117
|
|
|
86
|
-
model?:
|
|
118
|
+
model?: string | null;
|
|
87
119
|
}
|
|
88
120
|
|
|
89
121
|
export interface SpeechTranscribeParams {
|
|
90
|
-
language: 'yo' | 'en' | 'ha' | 'ig' | 'am';
|
|
122
|
+
language: 'yo' | 'en' | 'ha' | 'ig' | 'am' | 'pcm';
|
|
91
123
|
|
|
92
|
-
content?: Uploadable | null;
|
|
124
|
+
content?: Uploadable | string | null;
|
|
93
125
|
|
|
94
|
-
model?: 'mansa_v1' | 'legacy' |
|
|
126
|
+
model?: 'mansa_v1' | 'legacy' | null;
|
|
95
127
|
|
|
96
128
|
special_words?: string | null;
|
|
97
129
|
|
|
98
130
|
timestamp?: 'sentence' | 'word' | 'none' | null;
|
|
99
131
|
|
|
132
|
+
/**
|
|
133
|
+
* @deprecated
|
|
134
|
+
*/
|
|
100
135
|
url?: string | null;
|
|
101
136
|
}
|
|
102
137
|
|
|
103
138
|
export declare namespace Speech {
|
|
104
139
|
export {
|
|
140
|
+
type Segment as Segment,
|
|
105
141
|
type Transcription as Transcription,
|
|
106
142
|
type SpeechGenerateParams as SpeechGenerateParams,
|
|
107
143
|
type SpeechTranscribeParams as SpeechTranscribeParams,
|
package/src/resources/text.ts
CHANGED
|
@@ -6,67 +6,45 @@ import { RequestOptions } from '../internal/request-options';
|
|
|
6
6
|
|
|
7
7
|
export class Text extends APIResource {
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Add appopriate tone marks to text.
|
|
10
10
|
*/
|
|
11
11
|
toneMark(body: TextToneMarkParams, options?: RequestOptions): APIPromise<Diacritics> {
|
|
12
12
|
return this._client.post('/v1/diacritics', { body, ...options });
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* Translate
|
|
16
|
+
* Translate text from one language to another. Select the source and target
|
|
17
|
+
* languages, and get text in new language.
|
|
17
18
|
*/
|
|
18
19
|
translate(body: TextTranslateParams, options?: RequestOptions): APIPromise<Translation> {
|
|
19
20
|
return this._client.post('/v1/translate', { body, ...options });
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
/**
|
|
24
|
-
* Response model for text diacritization requests.
|
|
25
|
-
*
|
|
26
|
-
* Attributes:
|
|
27
|
-
* request_id: Unique identifier for the diacritization request
|
|
28
|
-
* text: Text with added diacritical marks for proper pronunciation
|
|
29
|
-
* language: Language code for the diacritized text
|
|
30
|
-
*/
|
|
31
24
|
export interface Diacritics {
|
|
32
25
|
request_id: string;
|
|
33
26
|
|
|
34
27
|
text: string;
|
|
35
28
|
}
|
|
36
29
|
|
|
37
|
-
/**
|
|
38
|
-
* Translation result model.
|
|
39
|
-
*
|
|
40
|
-
* Attributes: request_id (UUID): Unique ID for this request. text: translated
|
|
41
|
-
* text. due_date: used when model is `human`. the date you can expect the
|
|
42
|
-
* translation to be delivered
|
|
43
|
-
*/
|
|
44
30
|
export interface Translation {
|
|
45
31
|
request_id: string;
|
|
46
32
|
|
|
47
33
|
text: string;
|
|
48
|
-
|
|
49
|
-
due_date?: string | null;
|
|
50
34
|
}
|
|
51
35
|
|
|
52
36
|
export interface TextToneMarkParams {
|
|
53
|
-
language: 'yo' | 'en' | 'ha' | 'ig' | 'am';
|
|
37
|
+
language: 'yo' | 'en' | 'ha' | 'ig' | 'am' | 'pcm';
|
|
54
38
|
|
|
55
39
|
text: string;
|
|
56
40
|
}
|
|
57
41
|
|
|
58
42
|
export interface TextTranslateParams {
|
|
59
|
-
source: 'yo' | 'en' | 'ha' | 'ig' | 'am';
|
|
60
|
-
|
|
61
|
-
target: 'yo' | 'en' | 'ha' | 'ig' | 'am';
|
|
62
|
-
|
|
63
|
-
file_id?: string | null;
|
|
43
|
+
source: 'yo' | 'en' | 'ha' | 'ig' | 'am' | 'pcm';
|
|
64
44
|
|
|
65
|
-
|
|
45
|
+
target: 'yo' | 'en' | 'ha' | 'ig' | 'am' | 'pcm';
|
|
66
46
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
text?: string | null;
|
|
47
|
+
text: string;
|
|
70
48
|
}
|
|
71
49
|
|
|
72
50
|
export declare namespace Text {
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '1.
|
|
1
|
+
export const VERSION = '1.26.1'; // x-release-please-version
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "1.
|
|
1
|
+
export declare const VERSION = "1.26.1";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "1.
|
|
1
|
+
export declare const VERSION = "1.26.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '1.
|
|
1
|
+
export const VERSION = '1.26.1'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|
package/resources/jobs.d.mts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { APIResource } from "../core/resource.mjs";
|
|
2
|
-
import { APIPromise } from "../core/api-promise.mjs";
|
|
3
|
-
import { FilesCursor, type FilesCursorParams, PagePromise } from "../core/pagination.mjs";
|
|
4
|
-
import { RequestOptions } from "../internal/request-options.mjs";
|
|
5
|
-
export declare class Jobs extends APIResource {
|
|
6
|
-
/**
|
|
7
|
-
* Get Jobs
|
|
8
|
-
*/
|
|
9
|
-
list(query?: JobListParams | null | undefined, options?: RequestOptions): PagePromise<JobsFilesCursor, Job>;
|
|
10
|
-
/**
|
|
11
|
-
* Get Job
|
|
12
|
-
*/
|
|
13
|
-
get(jobID: string, options?: RequestOptions): APIPromise<Job>;
|
|
14
|
-
}
|
|
15
|
-
export type JobsFilesCursor = FilesCursor<Job>;
|
|
16
|
-
/**
|
|
17
|
-
* Metadata model for job metadata.
|
|
18
|
-
*/
|
|
19
|
-
export interface Job {
|
|
20
|
-
created_by: string;
|
|
21
|
-
due_date: string;
|
|
22
|
-
job_id: string;
|
|
23
|
-
org_id: string;
|
|
24
|
-
status: string;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Response model for listing jobs.
|
|
28
|
-
*
|
|
29
|
-
* Attributes: items: list of job metadata responses next_cursor: Optional cursor
|
|
30
|
-
* for pagination to get next page of results
|
|
31
|
-
*/
|
|
32
|
-
export interface Jobs {
|
|
33
|
-
items: Array<Job>;
|
|
34
|
-
next_cursor?: string | null;
|
|
35
|
-
}
|
|
36
|
-
export interface JobListParams extends FilesCursorParams {
|
|
37
|
-
status?: 'queued' | 'in_progress' | 'finished' | null;
|
|
38
|
-
}
|
|
39
|
-
export declare namespace Jobs {
|
|
40
|
-
export { type Job as Job, type Jobs as Jobs, type JobsFilesCursor as JobsFilesCursor, type JobListParams as JobListParams, };
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=jobs.d.mts.map
|
package/resources/jobs.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jobs.d.mts","sourceRoot":"","sources":["../src/resources/jobs.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,WAAW,EAAE,KAAK,iBAAiB,EAAE,WAAW,EAAE;OACpD,EAAE,cAAc,EAAE;AAGzB,qBAAa,IAAK,SAAQ,WAAW;IACnC;;OAEG;IACH,IAAI,CACF,KAAK,GAAE,aAAa,GAAG,IAAI,GAAG,SAAc,EAC5C,OAAO,CAAC,EAAE,cAAc,GACvB,WAAW,CAAC,eAAe,EAAE,GAAG,CAAC;IAIpC;;OAEG;IACH,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,GAAG,CAAC;CAG9D;AAED,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,GAAG;IAClB,UAAU,EAAE,MAAM,CAAC;IAEnB,QAAQ,EAAE,MAAM,CAAC;IAEjB,MAAM,EAAE,MAAM,CAAC;IAEf,MAAM,EAAE,MAAM,CAAC;IAEf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,MAAM,WAAW,IAAI;IACnB,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAElB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,MAAM,WAAW,aAAc,SAAQ,iBAAiB;IACtD,MAAM,CAAC,EAAE,QAAQ,GAAG,aAAa,GAAG,UAAU,GAAG,IAAI,CAAC;CACvD;AAED,MAAM,CAAC,OAAO,WAAW,IAAI,CAAC;IAC5B,OAAO,EACL,KAAK,GAAG,IAAI,GAAG,EACf,KAAK,IAAI,IAAI,IAAI,EACjB,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,aAAa,IAAI,aAAa,GACpC,CAAC;CACH"}
|
package/resources/jobs.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { APIResource } from "../core/resource.js";
|
|
2
|
-
import { APIPromise } from "../core/api-promise.js";
|
|
3
|
-
import { FilesCursor, type FilesCursorParams, PagePromise } from "../core/pagination.js";
|
|
4
|
-
import { RequestOptions } from "../internal/request-options.js";
|
|
5
|
-
export declare class Jobs extends APIResource {
|
|
6
|
-
/**
|
|
7
|
-
* Get Jobs
|
|
8
|
-
*/
|
|
9
|
-
list(query?: JobListParams | null | undefined, options?: RequestOptions): PagePromise<JobsFilesCursor, Job>;
|
|
10
|
-
/**
|
|
11
|
-
* Get Job
|
|
12
|
-
*/
|
|
13
|
-
get(jobID: string, options?: RequestOptions): APIPromise<Job>;
|
|
14
|
-
}
|
|
15
|
-
export type JobsFilesCursor = FilesCursor<Job>;
|
|
16
|
-
/**
|
|
17
|
-
* Metadata model for job metadata.
|
|
18
|
-
*/
|
|
19
|
-
export interface Job {
|
|
20
|
-
created_by: string;
|
|
21
|
-
due_date: string;
|
|
22
|
-
job_id: string;
|
|
23
|
-
org_id: string;
|
|
24
|
-
status: string;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Response model for listing jobs.
|
|
28
|
-
*
|
|
29
|
-
* Attributes: items: list of job metadata responses next_cursor: Optional cursor
|
|
30
|
-
* for pagination to get next page of results
|
|
31
|
-
*/
|
|
32
|
-
export interface Jobs {
|
|
33
|
-
items: Array<Job>;
|
|
34
|
-
next_cursor?: string | null;
|
|
35
|
-
}
|
|
36
|
-
export interface JobListParams extends FilesCursorParams {
|
|
37
|
-
status?: 'queued' | 'in_progress' | 'finished' | null;
|
|
38
|
-
}
|
|
39
|
-
export declare namespace Jobs {
|
|
40
|
-
export { type Job as Job, type Jobs as Jobs, type JobsFilesCursor as JobsFilesCursor, type JobListParams as JobListParams, };
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=jobs.d.ts.map
|