@speechall/sdk 1.0.0 → 2.0.4

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