@speechall/sdk 1.0.0 → 2.1.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.
Files changed (151) hide show
  1. package/.beads/README.md +81 -0
  2. package/.beads/config.yaml +62 -0
  3. package/.beads/issues.jsonl +47 -0
  4. package/.beads/metadata.json +4 -0
  5. package/.env.example +5 -0
  6. package/.fernignore +45 -0
  7. package/.gitattributes +3 -0
  8. package/.github/copilot-instructions.md +78 -0
  9. package/.github/workflows/auto-release-simple.yml.deprecated +106 -0
  10. package/.github/workflows/auto-release.yml +67 -0
  11. package/.github/workflows/ci.yml +41 -0
  12. package/.github/workflows/release.yml +57 -0
  13. package/AGENTS.md +94 -0
  14. package/CHANGELOG.md +65 -0
  15. package/CLAUDE.md +129 -0
  16. package/README.md +294 -155
  17. package/examples/CLAUDE.md +136 -0
  18. package/examples/advanced-options.ts +213 -0
  19. package/examples/basic-transcription.ts +66 -0
  20. package/examples/error-handling.ts +251 -0
  21. package/examples/list-models.ts +112 -0
  22. package/examples/remote-transcription.ts +60 -0
  23. package/fern/fern.config.json +4 -0
  24. package/fern/generators.yml +43 -0
  25. package/jest.config.js +11 -0
  26. package/package.json +26 -46
  27. package/regenerate.sh +45 -0
  28. package/scripts/fix-generated-code.sh +25 -0
  29. package/src/BaseClient.ts +82 -0
  30. package/src/Client.ts +30 -0
  31. package/src/api/errors/BadRequestError.ts +22 -0
  32. package/src/api/errors/GatewayTimeoutError.ts +22 -0
  33. package/src/api/errors/InternalServerError.ts +22 -0
  34. package/src/api/errors/NotFoundError.ts +22 -0
  35. package/src/api/errors/PaymentRequiredError.ts +22 -0
  36. package/src/api/errors/ServiceUnavailableError.ts +22 -0
  37. package/src/api/errors/TooManyRequestsError.ts +22 -0
  38. package/src/api/errors/UnauthorizedError.ts +22 -0
  39. package/src/api/errors/index.ts +8 -0
  40. package/src/api/index.ts +3 -0
  41. package/src/api/resources/index.ts +5 -0
  42. package/src/api/resources/replacementRules/client/Client.ts +148 -0
  43. package/src/api/resources/replacementRules/client/index.ts +1 -0
  44. package/src/api/resources/replacementRules/client/requests/CreateReplacementRulesetRequest.ts +25 -0
  45. package/src/api/resources/replacementRules/client/requests/index.ts +1 -0
  46. package/src/api/resources/replacementRules/index.ts +2 -0
  47. package/src/api/resources/replacementRules/types/CreateReplacementRulesetResponse.ts +6 -0
  48. package/src/api/resources/replacementRules/types/index.ts +1 -0
  49. package/src/api/resources/speechToText/client/Client.ts +275 -0
  50. package/src/api/resources/speechToText/client/index.ts +1 -0
  51. package/src/api/resources/speechToText/client/requests/RemoteTranscriptionConfiguration.ts +20 -0
  52. package/src/api/resources/speechToText/client/requests/TranscribeRequest.ts +26 -0
  53. package/src/api/resources/speechToText/client/requests/index.ts +2 -0
  54. package/src/api/resources/speechToText/index.ts +1 -0
  55. package/src/api/types/BaseTranscriptionConfiguration.ts +29 -0
  56. package/src/api/types/ErrorResponse.ts +11 -0
  57. package/src/api/types/ExactRule.ts +13 -0
  58. package/src/api/types/RegexGroupRule.ts +28 -0
  59. package/src/api/types/RegexRule.ts +28 -0
  60. package/src/api/types/ReplacementRule.ts +25 -0
  61. package/src/api/types/SpeechToTextModel.ts +90 -0
  62. package/src/api/types/TranscriptLanguageCode.ts +114 -0
  63. package/src/api/types/TranscriptOutputFormat.ts +18 -0
  64. package/src/api/types/TranscriptionDetailed.ts +19 -0
  65. package/src/api/types/TranscriptionModelIdentifier.ts +70 -0
  66. package/src/api/types/TranscriptionOnlyText.ts +11 -0
  67. package/src/api/types/TranscriptionProvider.ts +23 -0
  68. package/src/api/types/TranscriptionResponse.ts +8 -0
  69. package/src/api/types/TranscriptionSegment.ts +17 -0
  70. package/src/api/types/TranscriptionWord.ts +17 -0
  71. package/src/api/types/index.ts +16 -0
  72. package/src/auth/BearerAuthProvider.ts +37 -0
  73. package/src/auth/index.ts +1 -0
  74. package/src/core/auth/AuthProvider.ts +6 -0
  75. package/src/core/auth/AuthRequest.ts +9 -0
  76. package/src/core/auth/BasicAuth.ts +32 -0
  77. package/src/core/auth/BearerToken.ts +20 -0
  78. package/src/core/auth/NoOpAuthProvider.ts +8 -0
  79. package/src/core/auth/index.ts +5 -0
  80. package/src/core/base64.ts +27 -0
  81. package/src/core/exports.ts +2 -0
  82. package/src/core/fetcher/APIResponse.ts +23 -0
  83. package/src/core/fetcher/BinaryResponse.ts +34 -0
  84. package/src/core/fetcher/EndpointMetadata.ts +13 -0
  85. package/src/core/fetcher/EndpointSupplier.ts +14 -0
  86. package/src/core/fetcher/Fetcher.ts +391 -0
  87. package/src/core/fetcher/Headers.ts +93 -0
  88. package/src/core/fetcher/HttpResponsePromise.ts +116 -0
  89. package/src/core/fetcher/RawResponse.ts +61 -0
  90. package/src/core/fetcher/Supplier.ts +11 -0
  91. package/src/core/fetcher/createRequestUrl.ts +6 -0
  92. package/src/core/fetcher/getErrorResponseBody.ts +33 -0
  93. package/src/core/fetcher/getFetchFn.ts +3 -0
  94. package/src/core/fetcher/getHeader.ts +8 -0
  95. package/src/core/fetcher/getRequestBody.ts +20 -0
  96. package/src/core/fetcher/getResponseBody.ts +58 -0
  97. package/src/core/fetcher/index.ts +11 -0
  98. package/src/core/fetcher/makeRequest.ts +42 -0
  99. package/src/core/fetcher/requestWithRetries.ts +64 -0
  100. package/src/core/fetcher/signals.ts +26 -0
  101. package/src/core/file/exports.ts +1 -0
  102. package/src/core/file/file.ts +217 -0
  103. package/src/core/file/index.ts +2 -0
  104. package/src/core/file/types.ts +81 -0
  105. package/src/core/headers.ts +35 -0
  106. package/src/core/index.ts +7 -0
  107. package/src/core/json.ts +27 -0
  108. package/src/core/logging/exports.ts +19 -0
  109. package/src/core/logging/index.ts +1 -0
  110. package/src/core/logging/logger.ts +203 -0
  111. package/src/core/runtime/index.ts +1 -0
  112. package/src/core/runtime/runtime.ts +134 -0
  113. package/src/core/url/encodePathParam.ts +18 -0
  114. package/src/core/url/index.ts +3 -0
  115. package/src/core/url/join.ts +79 -0
  116. package/src/core/url/qs.ts +74 -0
  117. package/src/environments.ts +7 -0
  118. package/src/errors/SpeechallError.ts +58 -0
  119. package/src/errors/SpeechallTimeoutError.ts +13 -0
  120. package/src/errors/handleNonStatusCodeError.ts +37 -0
  121. package/src/errors/index.ts +2 -0
  122. package/src/exports.ts +1 -0
  123. package/src/index.ts +6 -0
  124. package/test-import.ts +17 -0
  125. package/tests/integration/api.test.ts +93 -0
  126. package/tests/unit/client.test.ts +91 -0
  127. package/tsconfig.json +20 -0
  128. package/dist/api.d.ts +0 -501
  129. package/dist/api.d.ts.map +0 -1
  130. package/dist/api.js +0 -610
  131. package/dist/base.d.ts +0 -32
  132. package/dist/base.d.ts.map +0 -1
  133. package/dist/base.js +0 -35
  134. package/dist/common.d.ts +0 -14
  135. package/dist/common.d.ts.map +0 -1
  136. package/dist/common.js +0 -91
  137. package/dist/configuration.d.ts +0 -23
  138. package/dist/configuration.d.ts.map +0 -1
  139. package/dist/configuration.js +0 -25
  140. package/dist/esm/api.js +0 -592
  141. package/dist/esm/base.js +0 -27
  142. package/dist/esm/common.js +0 -79
  143. package/dist/esm/configuration.js +0 -21
  144. package/dist/esm/example.js +0 -131
  145. package/dist/esm/index.js +0 -2
  146. package/dist/example.d.ts +0 -3
  147. package/dist/example.d.ts.map +0 -1
  148. package/dist/example.js +0 -133
  149. package/dist/index.d.ts +0 -3
  150. package/dist/index.d.ts.map +0 -1
  151. package/dist/index.js +0 -18
package/dist/esm/api.js DELETED
@@ -1,592 +0,0 @@
1
- import globalAxios from 'axios';
2
- import { DUMMY_BASE_URL, assertParamExists, setBearerAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common.js';
3
- import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, operationServerMap } from './base.js';
4
- export const BaseTranscriptionConfigurationTimestampGranularityEnum = {
5
- Word: 'word',
6
- Segment: 'segment'
7
- };
8
- export const ExactRuleKindEnum = {
9
- Exact: 'exact'
10
- };
11
- export const OpenAIAudioResponseFormat = {
12
- Json: 'json',
13
- Text: 'text',
14
- Srt: 'srt',
15
- VerboseJson: 'verbose_json',
16
- Vtt: 'vtt'
17
- };
18
- export const RegexGroupRuleKindEnum = {
19
- RegexGroup: 'regex_group'
20
- };
21
- export const RegexGroupRuleFlagsEnum = {
22
- I: 'i',
23
- M: 'm',
24
- S: 's',
25
- X: 'x',
26
- U: 'u'
27
- };
28
- export const RegexRuleKindEnum = {
29
- Regex: 'regex'
30
- };
31
- export const RegexRuleFlagsEnum = {
32
- I: 'i',
33
- M: 'm',
34
- S: 's',
35
- X: 'x',
36
- U: 'u'
37
- };
38
- export const RemoteTranscriptionConfigurationTimestampGranularityEnum = {
39
- Word: 'word',
40
- Segment: 'segment'
41
- };
42
- export const SpeechToTextModelModelTypeEnum = {
43
- General: 'general',
44
- PhoneCall: 'phone_call',
45
- Video: 'video',
46
- CommandAndSearch: 'command_and_search',
47
- Medical: 'medical',
48
- Legal: 'legal',
49
- Voicemail: 'voicemail',
50
- Meeting: 'meeting'
51
- };
52
- export const SpeechToTextModelAccuracyTierEnum = {
53
- Basic: 'basic',
54
- Standard: 'standard',
55
- Enhanced: 'enhanced',
56
- Premium: 'premium'
57
- };
58
- export const TranscriptLanguageCode = {
59
- Auto: 'auto',
60
- En: 'en',
61
- EnAu: 'en_au',
62
- EnUk: 'en_uk',
63
- EnUs: 'en_us',
64
- Af: 'af',
65
- Am: 'am',
66
- Ar: 'ar',
67
- As: 'as',
68
- Az: 'az',
69
- Ba: 'ba',
70
- Be: 'be',
71
- Bg: 'bg',
72
- Bn: 'bn',
73
- Bo: 'bo',
74
- Br: 'br',
75
- Bs: 'bs',
76
- Ca: 'ca',
77
- Cs: 'cs',
78
- Cy: 'cy',
79
- Da: 'da',
80
- De: 'de',
81
- El: 'el',
82
- Es: 'es',
83
- Et: 'et',
84
- Eu: 'eu',
85
- Fa: 'fa',
86
- Fi: 'fi',
87
- Fo: 'fo',
88
- Fr: 'fr',
89
- Gl: 'gl',
90
- Gu: 'gu',
91
- Ha: 'ha',
92
- Haw: 'haw',
93
- He: 'he',
94
- Hi: 'hi',
95
- Hr: 'hr',
96
- Ht: 'ht',
97
- Hu: 'hu',
98
- Hy: 'hy',
99
- Id: 'id',
100
- Is: 'is',
101
- It: 'it',
102
- Ja: 'ja',
103
- Jw: 'jw',
104
- Ka: 'ka',
105
- Kk: 'kk',
106
- Km: 'km',
107
- Kn: 'kn',
108
- Ko: 'ko',
109
- La: 'la',
110
- Lb: 'lb',
111
- Ln: 'ln',
112
- Lo: 'lo',
113
- Lt: 'lt',
114
- Lv: 'lv',
115
- Mg: 'mg',
116
- Mi: 'mi',
117
- Mk: 'mk',
118
- Ml: 'ml',
119
- Mn: 'mn',
120
- Mr: 'mr',
121
- Ms: 'ms',
122
- Mt: 'mt',
123
- My: 'my',
124
- Ne: 'ne',
125
- Nl: 'nl',
126
- Nn: 'nn',
127
- False: 'false',
128
- Oc: 'oc',
129
- Pa: 'pa',
130
- Pl: 'pl',
131
- Ps: 'ps',
132
- Pt: 'pt',
133
- Ro: 'ro',
134
- Ru: 'ru',
135
- Sa: 'sa',
136
- Sd: 'sd',
137
- Si: 'si',
138
- Sk: 'sk',
139
- Sl: 'sl',
140
- Sn: 'sn',
141
- So: 'so',
142
- Sq: 'sq',
143
- Sr: 'sr',
144
- Su: 'su',
145
- Sv: 'sv',
146
- Sw: 'sw',
147
- Ta: 'ta',
148
- Te: 'te',
149
- Tg: 'tg',
150
- Th: 'th',
151
- Tk: 'tk',
152
- Tl: 'tl',
153
- Tr: 'tr',
154
- Tt: 'tt',
155
- Uk: 'uk',
156
- Ur: 'ur',
157
- Uz: 'uz',
158
- Vi: 'vi',
159
- Yi: 'yi',
160
- Yo: 'yo',
161
- Zh: 'zh'
162
- };
163
- export const TranscriptOutputFormat = {
164
- Text: 'text',
165
- JsonText: 'json_text',
166
- Json: 'json',
167
- Srt: 'srt',
168
- Vtt: 'vtt'
169
- };
170
- export const TranscriptionModelIdentifier = {
171
- AmazonTranscribe: 'amazon.transcribe',
172
- AssemblyaiBest: 'assemblyai.best',
173
- AssemblyaiNano: 'assemblyai.nano',
174
- AssemblyaiSlam1: 'assemblyai.slam-1',
175
- AssemblyaiUniversal: 'assemblyai.universal',
176
- AzureStandard: 'azure.standard',
177
- CloudflareWhisper: 'cloudflare.whisper',
178
- CloudflareWhisperLargeV3Turbo: 'cloudflare.whisper-large-v3-turbo',
179
- CloudflareWhisperTinyEn: 'cloudflare.whisper-tiny-en',
180
- DeepgramBase: 'deepgram.base',
181
- DeepgramBaseConversationalai: 'deepgram.base-conversationalai',
182
- DeepgramBaseFinance: 'deepgram.base-finance',
183
- DeepgramBaseGeneral: 'deepgram.base-general',
184
- DeepgramBaseMeeting: 'deepgram.base-meeting',
185
- DeepgramBasePhonecall: 'deepgram.base-phonecall',
186
- DeepgramBaseVideo: 'deepgram.base-video',
187
- DeepgramBaseVoicemail: 'deepgram.base-voicemail',
188
- DeepgramEnhanced: 'deepgram.enhanced',
189
- DeepgramEnhancedFinance: 'deepgram.enhanced-finance',
190
- DeepgramEnhancedGeneral: 'deepgram.enhanced-general',
191
- DeepgramEnhancedMeeting: 'deepgram.enhanced-meeting',
192
- DeepgramEnhancedPhonecall: 'deepgram.enhanced-phonecall',
193
- DeepgramNova: 'deepgram.nova',
194
- DeepgramNovaGeneral: 'deepgram.nova-general',
195
- DeepgramNovaPhonecall: 'deepgram.nova-phonecall',
196
- DeepgramNova2: 'deepgram.nova-2',
197
- DeepgramNova2Atc: 'deepgram.nova-2-atc',
198
- DeepgramNova2Automotive: 'deepgram.nova-2-automotive',
199
- DeepgramNova2Conversationalai: 'deepgram.nova-2-conversationalai',
200
- DeepgramNova2Drivethru: 'deepgram.nova-2-drivethru',
201
- DeepgramNova2Finance: 'deepgram.nova-2-finance',
202
- DeepgramNova2General: 'deepgram.nova-2-general',
203
- DeepgramNova2Medical: 'deepgram.nova-2-medical',
204
- DeepgramNova2Meeting: 'deepgram.nova-2-meeting',
205
- DeepgramNova2Phonecall: 'deepgram.nova-2-phonecall',
206
- DeepgramNova2Video: 'deepgram.nova-2-video',
207
- DeepgramNova2Voicemail: 'deepgram.nova-2-voicemail',
208
- DeepgramNova3: 'deepgram.nova-3',
209
- DeepgramNova3General: 'deepgram.nova-3-general',
210
- DeepgramNova3Medical: 'deepgram.nova-3-medical',
211
- DeepgramWhisper: 'deepgram.whisper',
212
- DeepgramWhisperBase: 'deepgram.whisper-base',
213
- DeepgramWhisperLarge: 'deepgram.whisper-large',
214
- DeepgramWhisperMedium: 'deepgram.whisper-medium',
215
- DeepgramWhisperSmall: 'deepgram.whisper-small',
216
- DeepgramWhisperTiny: 'deepgram.whisper-tiny',
217
- FalaiElevenlabsSpeechToText: 'falai.elevenlabs-speech-to-text',
218
- FalaiSpeechToText: 'falai.speech-to-text',
219
- FalaiWhisper: 'falai.whisper',
220
- FalaiWizper: 'falai.wizper',
221
- FireworksaiWhisperV3: 'fireworksai.whisper-v3',
222
- FireworksaiWhisperV3Turbo: 'fireworksai.whisper-v3-turbo',
223
- GladiaStandard: 'gladia.standard',
224
- GoogleEnhanced: 'google.enhanced',
225
- GoogleStandard: 'google.standard',
226
- GeminiGemini25FlashPreview0520: 'gemini.gemini-2.5-flash-preview-05-20',
227
- GeminiGemini25ProPreview0605: 'gemini.gemini-2.5-pro-preview-06-05',
228
- GeminiGemini20Flash: 'gemini.gemini-2.0-flash',
229
- GeminiGemini20FlashLite: 'gemini.gemini-2.0-flash-lite',
230
- GroqDistilWhisperLargeV3En: 'groq.distil-whisper-large-v3-en',
231
- GroqWhisperLargeV3: 'groq.whisper-large-v3',
232
- GroqWhisperLargeV3Turbo: 'groq.whisper-large-v3-turbo',
233
- IbmStandard: 'ibm.standard',
234
- OpenaiWhisper1: 'openai.whisper-1',
235
- OpenaiGpt4oTranscribe: 'openai.gpt-4o-transcribe',
236
- OpenaiGpt4oMiniTranscribe: 'openai.gpt-4o-mini-transcribe',
237
- RevaiMachine: 'revai.machine',
238
- RevaiFusion: 'revai.fusion',
239
- SpeechmaticsEnhanced: 'speechmatics.enhanced',
240
- SpeechmaticsStandard: 'speechmatics.standard'
241
- };
242
- export const TranscriptionProvider = {
243
- Amazon: 'amazon',
244
- Assemblyai: 'assemblyai',
245
- Azure: 'azure',
246
- Cloudflare: 'cloudflare',
247
- Deepgram: 'deepgram',
248
- Falai: 'falai',
249
- Fireworksai: 'fireworksai',
250
- Gemini: 'gemini',
251
- Gladia: 'gladia',
252
- Google: 'google',
253
- Groq: 'groq',
254
- Ibm: 'ibm',
255
- Openai: 'openai',
256
- Revai: 'revai',
257
- Speechmatics: 'speechmatics'
258
- };
259
- export const OpenAICompatibleSpeechToTextApiAxiosParamCreator = function (configuration) {
260
- return {
261
- openaiCompatibleCreateTranscription: async (file, model, language, prompt, responseFormat, temperature, timestampGranularities, options = {}) => {
262
- assertParamExists('openaiCompatibleCreateTranscription', 'file', file);
263
- assertParamExists('openaiCompatibleCreateTranscription', 'model', model);
264
- const localVarPath = `/openai-compatible/audio/transcriptions`;
265
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
266
- let baseOptions;
267
- if (configuration) {
268
- baseOptions = configuration.baseOptions;
269
- }
270
- const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
271
- const localVarHeaderParameter = {};
272
- const localVarQueryParameter = {};
273
- const localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)();
274
- await setBearerAuthToObject(localVarHeaderParameter, configuration);
275
- if (file !== undefined) {
276
- localVarFormParams.append('file', file);
277
- }
278
- if (model !== undefined) {
279
- localVarFormParams.append('model', model);
280
- }
281
- if (language !== undefined) {
282
- localVarFormParams.append('language', language);
283
- }
284
- if (prompt !== undefined) {
285
- localVarFormParams.append('prompt', prompt);
286
- }
287
- if (responseFormat !== undefined) {
288
- localVarFormParams.append('response_format', responseFormat);
289
- }
290
- if (temperature !== undefined) {
291
- localVarFormParams.append('temperature', temperature);
292
- }
293
- if (timestampGranularities) {
294
- localVarFormParams.append('timestamp_granularities[]', timestampGranularities.join(COLLECTION_FORMATS.csv));
295
- }
296
- localVarHeaderParameter['Content-Type'] = 'multipart/form-data';
297
- setSearchParams(localVarUrlObj, localVarQueryParameter);
298
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
299
- localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
300
- localVarRequestOptions.data = localVarFormParams;
301
- return {
302
- url: toPathString(localVarUrlObj),
303
- options: localVarRequestOptions,
304
- };
305
- },
306
- openaiCompatibleCreateTranslation: async (file, model, prompt, responseFormat, temperature, options = {}) => {
307
- assertParamExists('openaiCompatibleCreateTranslation', 'file', file);
308
- assertParamExists('openaiCompatibleCreateTranslation', 'model', model);
309
- const localVarPath = `/openai-compatible/audio/translations`;
310
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
311
- let baseOptions;
312
- if (configuration) {
313
- baseOptions = configuration.baseOptions;
314
- }
315
- const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
316
- const localVarHeaderParameter = {};
317
- const localVarQueryParameter = {};
318
- const localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)();
319
- await setBearerAuthToObject(localVarHeaderParameter, configuration);
320
- if (file !== undefined) {
321
- localVarFormParams.append('file', file);
322
- }
323
- if (model !== undefined) {
324
- localVarFormParams.append('model', new Blob([JSON.stringify(model)], { type: "application/json", }));
325
- }
326
- if (prompt !== undefined) {
327
- localVarFormParams.append('prompt', prompt);
328
- }
329
- if (responseFormat !== undefined) {
330
- localVarFormParams.append('response_format', responseFormat);
331
- }
332
- if (temperature !== undefined) {
333
- localVarFormParams.append('temperature', temperature);
334
- }
335
- localVarHeaderParameter['Content-Type'] = 'multipart/form-data';
336
- setSearchParams(localVarUrlObj, localVarQueryParameter);
337
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
338
- localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
339
- localVarRequestOptions.data = localVarFormParams;
340
- return {
341
- url: toPathString(localVarUrlObj),
342
- options: localVarRequestOptions,
343
- };
344
- },
345
- };
346
- };
347
- export const OpenAICompatibleSpeechToTextApiFp = function (configuration) {
348
- const localVarAxiosParamCreator = OpenAICompatibleSpeechToTextApiAxiosParamCreator(configuration);
349
- return {
350
- async openaiCompatibleCreateTranscription(file, model, language, prompt, responseFormat, temperature, timestampGranularities, options) {
351
- const localVarAxiosArgs = await localVarAxiosParamCreator.openaiCompatibleCreateTranscription(file, model, language, prompt, responseFormat, temperature, timestampGranularities, options);
352
- const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
353
- const localVarOperationServerBasePath = operationServerMap['OpenAICompatibleSpeechToTextApi.openaiCompatibleCreateTranscription']?.[localVarOperationServerIndex]?.url;
354
- return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
355
- },
356
- async openaiCompatibleCreateTranslation(file, model, prompt, responseFormat, temperature, options) {
357
- const localVarAxiosArgs = await localVarAxiosParamCreator.openaiCompatibleCreateTranslation(file, model, prompt, responseFormat, temperature, options);
358
- const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
359
- const localVarOperationServerBasePath = operationServerMap['OpenAICompatibleSpeechToTextApi.openaiCompatibleCreateTranslation']?.[localVarOperationServerIndex]?.url;
360
- return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
361
- },
362
- };
363
- };
364
- export const OpenAICompatibleSpeechToTextApiFactory = function (configuration, basePath, axios) {
365
- const localVarFp = OpenAICompatibleSpeechToTextApiFp(configuration);
366
- return {
367
- openaiCompatibleCreateTranscription(file, model, language, prompt, responseFormat, temperature, timestampGranularities, options) {
368
- return localVarFp.openaiCompatibleCreateTranscription(file, model, language, prompt, responseFormat, temperature, timestampGranularities, options).then((request) => request(axios, basePath));
369
- },
370
- openaiCompatibleCreateTranslation(file, model, prompt, responseFormat, temperature, options) {
371
- return localVarFp.openaiCompatibleCreateTranslation(file, model, prompt, responseFormat, temperature, options).then((request) => request(axios, basePath));
372
- },
373
- };
374
- };
375
- export class OpenAICompatibleSpeechToTextApi extends BaseAPI {
376
- openaiCompatibleCreateTranscription(file, model, language, prompt, responseFormat, temperature, timestampGranularities, options) {
377
- return OpenAICompatibleSpeechToTextApiFp(this.configuration).openaiCompatibleCreateTranscription(file, model, language, prompt, responseFormat, temperature, timestampGranularities, options).then((request) => request(this.axios, this.basePath));
378
- }
379
- openaiCompatibleCreateTranslation(file, model, prompt, responseFormat, temperature, options) {
380
- return OpenAICompatibleSpeechToTextApiFp(this.configuration).openaiCompatibleCreateTranslation(file, model, prompt, responseFormat, temperature, options).then((request) => request(this.axios, this.basePath));
381
- }
382
- }
383
- export const OpenaiCompatibleCreateTranscriptionTimestampGranularitiesEnum = {
384
- Word: 'word',
385
- Segment: 'segment'
386
- };
387
- export const ReplacementRulesApiAxiosParamCreator = function (configuration) {
388
- return {
389
- createReplacementRuleset: async (createReplacementRulesetRequest, options = {}) => {
390
- assertParamExists('createReplacementRuleset', 'createReplacementRulesetRequest', createReplacementRulesetRequest);
391
- const localVarPath = `/replacement-rulesets`;
392
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
393
- let baseOptions;
394
- if (configuration) {
395
- baseOptions = configuration.baseOptions;
396
- }
397
- const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
398
- const localVarHeaderParameter = {};
399
- const localVarQueryParameter = {};
400
- await setBearerAuthToObject(localVarHeaderParameter, configuration);
401
- localVarHeaderParameter['Content-Type'] = 'application/json';
402
- setSearchParams(localVarUrlObj, localVarQueryParameter);
403
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
404
- localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
405
- localVarRequestOptions.data = serializeDataIfNeeded(createReplacementRulesetRequest, localVarRequestOptions, configuration);
406
- return {
407
- url: toPathString(localVarUrlObj),
408
- options: localVarRequestOptions,
409
- };
410
- },
411
- };
412
- };
413
- export const ReplacementRulesApiFp = function (configuration) {
414
- const localVarAxiosParamCreator = ReplacementRulesApiAxiosParamCreator(configuration);
415
- return {
416
- async createReplacementRuleset(createReplacementRulesetRequest, options) {
417
- const localVarAxiosArgs = await localVarAxiosParamCreator.createReplacementRuleset(createReplacementRulesetRequest, options);
418
- const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
419
- const localVarOperationServerBasePath = operationServerMap['ReplacementRulesApi.createReplacementRuleset']?.[localVarOperationServerIndex]?.url;
420
- return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
421
- },
422
- };
423
- };
424
- export const ReplacementRulesApiFactory = function (configuration, basePath, axios) {
425
- const localVarFp = ReplacementRulesApiFp(configuration);
426
- return {
427
- createReplacementRuleset(createReplacementRulesetRequest, options) {
428
- return localVarFp.createReplacementRuleset(createReplacementRulesetRequest, options).then((request) => request(axios, basePath));
429
- },
430
- };
431
- };
432
- export class ReplacementRulesApi extends BaseAPI {
433
- createReplacementRuleset(createReplacementRulesetRequest, options) {
434
- return ReplacementRulesApiFp(this.configuration).createReplacementRuleset(createReplacementRulesetRequest, options).then((request) => request(this.axios, this.basePath));
435
- }
436
- }
437
- export const SpeechToTextApiAxiosParamCreator = function (configuration) {
438
- return {
439
- listSpeechToTextModels: async (options = {}) => {
440
- const localVarPath = `/speech-to-text-models`;
441
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
442
- let baseOptions;
443
- if (configuration) {
444
- baseOptions = configuration.baseOptions;
445
- }
446
- const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
447
- const localVarHeaderParameter = {};
448
- const localVarQueryParameter = {};
449
- await setBearerAuthToObject(localVarHeaderParameter, configuration);
450
- setSearchParams(localVarUrlObj, localVarQueryParameter);
451
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
452
- localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
453
- return {
454
- url: toPathString(localVarUrlObj),
455
- options: localVarRequestOptions,
456
- };
457
- },
458
- transcribe: async (model, body, language, outputFormat, rulesetId, punctuation, timestampGranularity, diarization, initialPrompt, temperature, smartFormat, speakersExpected, customVocabulary, options = {}) => {
459
- assertParamExists('transcribe', 'model', model);
460
- assertParamExists('transcribe', 'body', body);
461
- const localVarPath = `/transcribe`;
462
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
463
- let baseOptions;
464
- if (configuration) {
465
- baseOptions = configuration.baseOptions;
466
- }
467
- const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
468
- const localVarHeaderParameter = {};
469
- const localVarQueryParameter = {};
470
- await setBearerAuthToObject(localVarHeaderParameter, configuration);
471
- if (model !== undefined) {
472
- localVarQueryParameter['model'] = model;
473
- }
474
- if (language !== undefined) {
475
- localVarQueryParameter['language'] = language;
476
- }
477
- if (outputFormat !== undefined) {
478
- localVarQueryParameter['output_format'] = outputFormat;
479
- }
480
- if (rulesetId !== undefined) {
481
- localVarQueryParameter['ruleset_id'] = rulesetId;
482
- }
483
- if (punctuation !== undefined) {
484
- localVarQueryParameter['punctuation'] = punctuation;
485
- }
486
- if (timestampGranularity !== undefined) {
487
- localVarQueryParameter['timestamp_granularity'] = timestampGranularity;
488
- }
489
- if (diarization !== undefined) {
490
- localVarQueryParameter['diarization'] = diarization;
491
- }
492
- if (initialPrompt !== undefined) {
493
- localVarQueryParameter['initial_prompt'] = initialPrompt;
494
- }
495
- if (temperature !== undefined) {
496
- localVarQueryParameter['temperature'] = temperature;
497
- }
498
- if (smartFormat !== undefined) {
499
- localVarQueryParameter['smart_format'] = smartFormat;
500
- }
501
- if (speakersExpected !== undefined) {
502
- localVarQueryParameter['speakers_expected'] = speakersExpected;
503
- }
504
- if (customVocabulary) {
505
- localVarQueryParameter['custom_vocabulary'] = customVocabulary;
506
- }
507
- localVarHeaderParameter['Content-Type'] = 'audio/*';
508
- setSearchParams(localVarUrlObj, localVarQueryParameter);
509
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
510
- localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
511
- localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration);
512
- return {
513
- url: toPathString(localVarUrlObj),
514
- options: localVarRequestOptions,
515
- };
516
- },
517
- transcribeRemote: async (remoteTranscriptionConfiguration, options = {}) => {
518
- assertParamExists('transcribeRemote', 'remoteTranscriptionConfiguration', remoteTranscriptionConfiguration);
519
- const localVarPath = `/transcribe-remote`;
520
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
521
- let baseOptions;
522
- if (configuration) {
523
- baseOptions = configuration.baseOptions;
524
- }
525
- const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
526
- const localVarHeaderParameter = {};
527
- const localVarQueryParameter = {};
528
- await setBearerAuthToObject(localVarHeaderParameter, configuration);
529
- localVarHeaderParameter['Content-Type'] = 'application/json';
530
- setSearchParams(localVarUrlObj, localVarQueryParameter);
531
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
532
- localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
533
- localVarRequestOptions.data = serializeDataIfNeeded(remoteTranscriptionConfiguration, localVarRequestOptions, configuration);
534
- return {
535
- url: toPathString(localVarUrlObj),
536
- options: localVarRequestOptions,
537
- };
538
- },
539
- };
540
- };
541
- export const SpeechToTextApiFp = function (configuration) {
542
- const localVarAxiosParamCreator = SpeechToTextApiAxiosParamCreator(configuration);
543
- return {
544
- async listSpeechToTextModels(options) {
545
- const localVarAxiosArgs = await localVarAxiosParamCreator.listSpeechToTextModels(options);
546
- const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
547
- const localVarOperationServerBasePath = operationServerMap['SpeechToTextApi.listSpeechToTextModels']?.[localVarOperationServerIndex]?.url;
548
- return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
549
- },
550
- async transcribe(model, body, language, outputFormat, rulesetId, punctuation, timestampGranularity, diarization, initialPrompt, temperature, smartFormat, speakersExpected, customVocabulary, options) {
551
- const localVarAxiosArgs = await localVarAxiosParamCreator.transcribe(model, body, language, outputFormat, rulesetId, punctuation, timestampGranularity, diarization, initialPrompt, temperature, smartFormat, speakersExpected, customVocabulary, options);
552
- const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
553
- const localVarOperationServerBasePath = operationServerMap['SpeechToTextApi.transcribe']?.[localVarOperationServerIndex]?.url;
554
- return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
555
- },
556
- async transcribeRemote(remoteTranscriptionConfiguration, options) {
557
- const localVarAxiosArgs = await localVarAxiosParamCreator.transcribeRemote(remoteTranscriptionConfiguration, options);
558
- const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
559
- const localVarOperationServerBasePath = operationServerMap['SpeechToTextApi.transcribeRemote']?.[localVarOperationServerIndex]?.url;
560
- return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
561
- },
562
- };
563
- };
564
- export const SpeechToTextApiFactory = function (configuration, basePath, axios) {
565
- const localVarFp = SpeechToTextApiFp(configuration);
566
- return {
567
- listSpeechToTextModels(options) {
568
- return localVarFp.listSpeechToTextModels(options).then((request) => request(axios, basePath));
569
- },
570
- transcribe(model, body, language, outputFormat, rulesetId, punctuation, timestampGranularity, diarization, initialPrompt, temperature, smartFormat, speakersExpected, customVocabulary, options) {
571
- return localVarFp.transcribe(model, body, language, outputFormat, rulesetId, punctuation, timestampGranularity, diarization, initialPrompt, temperature, smartFormat, speakersExpected, customVocabulary, options).then((request) => request(axios, basePath));
572
- },
573
- transcribeRemote(remoteTranscriptionConfiguration, options) {
574
- return localVarFp.transcribeRemote(remoteTranscriptionConfiguration, options).then((request) => request(axios, basePath));
575
- },
576
- };
577
- };
578
- export class SpeechToTextApi extends BaseAPI {
579
- listSpeechToTextModels(options) {
580
- return SpeechToTextApiFp(this.configuration).listSpeechToTextModels(options).then((request) => request(this.axios, this.basePath));
581
- }
582
- transcribe(model, body, language, outputFormat, rulesetId, punctuation, timestampGranularity, diarization, initialPrompt, temperature, smartFormat, speakersExpected, customVocabulary, options) {
583
- return SpeechToTextApiFp(this.configuration).transcribe(model, body, language, outputFormat, rulesetId, punctuation, timestampGranularity, diarization, initialPrompt, temperature, smartFormat, speakersExpected, customVocabulary, options).then((request) => request(this.axios, this.basePath));
584
- }
585
- transcribeRemote(remoteTranscriptionConfiguration, options) {
586
- return SpeechToTextApiFp(this.configuration).transcribeRemote(remoteTranscriptionConfiguration, options).then((request) => request(this.axios, this.basePath));
587
- }
588
- }
589
- export const TranscribeTimestampGranularityEnum = {
590
- Word: 'word',
591
- Segment: 'segment'
592
- };
package/dist/esm/base.js DELETED
@@ -1,27 +0,0 @@
1
- import globalAxios from 'axios';
2
- export const BASE_PATH = "https://api.speechall.com/v1".replace(/\/+$/, "");
3
- export const COLLECTION_FORMATS = {
4
- csv: ",",
5
- ssv: " ",
6
- tsv: "\t",
7
- pipes: "|",
8
- };
9
- export class BaseAPI {
10
- constructor(configuration, basePath = BASE_PATH, axios = globalAxios) {
11
- this.basePath = basePath;
12
- this.axios = axios;
13
- if (configuration) {
14
- this.configuration = configuration;
15
- this.basePath = configuration.basePath ?? basePath;
16
- }
17
- }
18
- }
19
- ;
20
- export class RequiredError extends Error {
21
- constructor(field, msg) {
22
- super(msg);
23
- this.field = field;
24
- this.name = "RequiredError";
25
- }
26
- }
27
- export const operationServerMap = {};