@remotion/openai-whisper 4.0.364 → 4.0.366

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/openai-whisper"
4
4
  },
5
5
  "name": "@remotion/openai-whisper",
6
- "version": "4.0.364",
6
+ "version": "4.0.366",
7
7
  "description": "Work with the output of the OpenAI Whisper API",
8
8
  "main": "dist/index.js",
9
9
  "sideEffects": false,
@@ -16,18 +16,15 @@
16
16
  "test": "bun test src",
17
17
  "make": "tsc -d"
18
18
  },
19
- "files": [
20
- "dist"
21
- ],
22
19
  "author": "Jonny Burger <jonny@remotion.dev>",
23
20
  "license": "MIT",
24
21
  "dependencies": {
25
- "@remotion/captions": "4.0.364"
22
+ "@remotion/captions": "4.0.366"
26
23
  },
27
24
  "peerDependencies": {},
28
25
  "devDependencies": {
29
26
  "openai": "4.67.1",
30
- "@remotion/eslint-config-internal": "4.0.364",
27
+ "@remotion/eslint-config-internal": "4.0.366",
31
28
  "eslint": "9.19.0"
32
29
  },
33
30
  "keywords": [
@@ -1 +0,0 @@
1
- export {};
@@ -1,278 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const bun_test_1 = require("bun:test");
4
- const openai_whisper_api_to_captions_1 = require("../openai-whisper-api-to-captions");
5
- (0, bun_test_1.test)('foreign API (https://github.com/remotion-dev/remotion/issues/5031)', () => {
6
- const res = {
7
- text: "Hello world. It's great to finally be here, surrounded by the endless possibilities that this universe has to offer, and I'm excited to see what the future holds for all of us.",
8
- task: 'transcribe',
9
- language: '',
10
- duration: 10.625,
11
- words: [
12
- { word: ' Hello', start: 0, end: 0.46000000834465027 },
13
- { word: ' world.', start: 0.46000000834465027, end: 0.9800000190734863 },
14
- { word: " It's", start: 0.9800000190734863, end: 1.5800000429153442 },
15
- { word: ' great', start: 1.5800000429153442, end: 1.7999999523162842 },
16
- { word: ' to', start: 1.7999999523162842, end: 1.9600000381469727 },
17
- { word: ' finally', start: 1.9600000381469727, end: 2.319999933242798 },
18
- { word: ' be', start: 2.319999933242798, end: 2.5799999237060547 },
19
- { word: ' here,', start: 2.5799999237060547, end: 3 },
20
- { word: ' surrounded', start: 3, end: 3.5999999046325684 },
21
- { word: ' by', start: 3.5999999046325684, end: 4.019999980926514 },
22
- { word: ' the', start: 4.019999980926514, end: 4.179999828338623 },
23
- { word: ' endless', start: 4.179999828338623, end: 4.519999980926514 },
24
- {
25
- word: ' possibilities',
26
- start: 4.519999980926514,
27
- end: 5.119999885559082,
28
- },
29
- { word: ' that', start: 5.119999885559082, end: 5.639999866485596 },
30
- { word: ' this', start: 5.639999866485596, end: 5.820000171661377 },
31
- { word: ' universe', start: 5.820000171661377, end: 6.179999828338623 },
32
- { word: ' has', start: 6.179999828338623, end: 6.519999980926514 },
33
- { word: ' to', start: 6.519999980926514, end: 6.659999847412109 },
34
- { word: ' offer,', start: 6.659999847412109, end: 7.179999828338623 },
35
- { word: ' and', start: 7.179999828338623, end: 7.679999828338623 },
36
- { word: " I'm", start: 7.679999828338623, end: 7.820000171661377 },
37
- { word: ' excited', start: 7.820000171661377, end: 8.180000305175781 },
38
- { word: ' to', start: 8.180000305175781, end: 8.420000076293945 },
39
- { word: ' see', start: 8.420000076293945, end: 8.600000381469727 },
40
- { word: ' what', start: 8.600000381469727, end: 8.739999771118164 },
41
- { word: ' the', start: 8.739999771118164, end: 8.859999656677246 },
42
- { word: ' future', start: 8.859999656677246, end: 9.180000305175781 },
43
- { word: ' holds', start: 9.180000305175781, end: 9.520000457763672 },
44
- { word: ' for', start: 9.520000457763672, end: 9.779999732971191 },
45
- { word: ' all', start: 9.779999732971191, end: 9.979999542236328 },
46
- { word: ' of', start: 9.979999542236328, end: 10.079999923706055 },
47
- { word: ' us.', start: 10.079999923706055, end: 10.34000015258789 },
48
- ],
49
- };
50
- (0, bun_test_1.expect)((0, openai_whisper_api_to_captions_1.openAiWhisperApiToCaptions)({ transcription: res })).toEqual({
51
- captions: [
52
- {
53
- confidence: null,
54
- endMs: 460.00000834465027,
55
- startMs: 0,
56
- text: 'Hello',
57
- timestampMs: 230.00000417232513,
58
- },
59
- {
60
- confidence: null,
61
- endMs: 980.0000190734863,
62
- startMs: 460.00000834465027,
63
- text: ' world.',
64
- timestampMs: 720.0000137090683,
65
- },
66
- {
67
- confidence: null,
68
- endMs: 1580.0000429153442,
69
- startMs: 980.0000190734863,
70
- text: " It's",
71
- timestampMs: 1280.0000309944153,
72
- },
73
- {
74
- confidence: null,
75
- endMs: 1799.9999523162842,
76
- startMs: 1580.0000429153442,
77
- text: ' great',
78
- timestampMs: 1689.9999976158142,
79
- },
80
- {
81
- confidence: null,
82
- endMs: 1960.0000381469727,
83
- startMs: 1799.9999523162842,
84
- text: ' to',
85
- timestampMs: 1879.9999952316284,
86
- },
87
- {
88
- confidence: null,
89
- endMs: 2319.999933242798,
90
- startMs: 1960.0000381469727,
91
- text: ' finally',
92
- timestampMs: 2139.9999856948853,
93
- },
94
- {
95
- confidence: null,
96
- endMs: 2579.9999237060547,
97
- startMs: 2319.999933242798,
98
- text: ' be',
99
- timestampMs: 2449.9999284744263,
100
- },
101
- {
102
- confidence: null,
103
- endMs: 3000,
104
- startMs: 2579.9999237060547,
105
- text: ' here,',
106
- timestampMs: 2789.9999618530273,
107
- },
108
- {
109
- confidence: null,
110
- endMs: 3599.9999046325684,
111
- startMs: 3000,
112
- text: ' surrounded',
113
- timestampMs: 3299.999952316284,
114
- },
115
- {
116
- confidence: null,
117
- endMs: 4019.9999809265137,
118
- startMs: 3599.9999046325684,
119
- text: ' by',
120
- timestampMs: 3809.999942779541,
121
- },
122
- {
123
- confidence: null,
124
- endMs: 4179.999828338623,
125
- startMs: 4019.9999809265137,
126
- text: ' the',
127
- timestampMs: 4099.999904632568,
128
- },
129
- {
130
- confidence: null,
131
- endMs: 4519.999980926514,
132
- startMs: 4179.999828338623,
133
- text: ' endless',
134
- timestampMs: 4349.999904632568,
135
- },
136
- {
137
- confidence: null,
138
- endMs: 5119.999885559082,
139
- startMs: 4519.999980926514,
140
- text: ' possibilities',
141
- timestampMs: 4819.999933242798,
142
- },
143
- {
144
- confidence: null,
145
- endMs: 5639.999866485596,
146
- startMs: 5119.999885559082,
147
- text: ' that',
148
- timestampMs: 5379.999876022339,
149
- },
150
- {
151
- confidence: null,
152
- endMs: 5820.000171661377,
153
- startMs: 5639.999866485596,
154
- text: ' this',
155
- timestampMs: 5730.000019073486,
156
- },
157
- {
158
- confidence: null,
159
- endMs: 6179.999828338623,
160
- startMs: 5820.000171661377,
161
- text: ' universe',
162
- timestampMs: 6000,
163
- },
164
- {
165
- confidence: null,
166
- endMs: 6519.999980926514,
167
- startMs: 6179.999828338623,
168
- text: ' has',
169
- timestampMs: 6349.999904632568,
170
- },
171
- {
172
- confidence: null,
173
- endMs: 6659.999847412109,
174
- startMs: 6519.999980926514,
175
- text: ' to',
176
- timestampMs: 6589.9999141693115,
177
- },
178
- {
179
- confidence: null,
180
- endMs: 7179.999828338623,
181
- startMs: 6659.999847412109,
182
- text: ' offer,',
183
- timestampMs: 6919.999837875366,
184
- },
185
- {
186
- confidence: null,
187
- endMs: 7679.999828338623,
188
- startMs: 7179.999828338623,
189
- text: ' and',
190
- timestampMs: 7429.999828338623,
191
- },
192
- {
193
- confidence: null,
194
- endMs: 7820.000171661377,
195
- startMs: 7679.999828338623,
196
- text: " I'm",
197
- timestampMs: 7750,
198
- },
199
- {
200
- confidence: null,
201
- endMs: 8180.000305175781,
202
- startMs: 7820.000171661377,
203
- text: ' excited',
204
- timestampMs: 8000.000238418579,
205
- },
206
- {
207
- confidence: null,
208
- endMs: 8420.000076293945,
209
- startMs: 8180.000305175781,
210
- text: ' to',
211
- timestampMs: 8300.000190734863,
212
- },
213
- {
214
- confidence: null,
215
- endMs: 8600.000381469727,
216
- startMs: 8420.000076293945,
217
- text: ' see',
218
- timestampMs: 8510.000228881836,
219
- },
220
- {
221
- confidence: null,
222
- endMs: 8739.999771118164,
223
- startMs: 8600.000381469727,
224
- text: ' what',
225
- timestampMs: 8670.000076293945,
226
- },
227
- {
228
- confidence: null,
229
- endMs: 8859.999656677246,
230
- startMs: 8739.999771118164,
231
- text: ' the',
232
- timestampMs: 8799.999713897705,
233
- },
234
- {
235
- confidence: null,
236
- endMs: 9180.000305175781,
237
- startMs: 8859.999656677246,
238
- text: ' future',
239
- timestampMs: 9019.999980926514,
240
- },
241
- {
242
- confidence: null,
243
- endMs: 9520.000457763672,
244
- startMs: 9180.000305175781,
245
- text: ' holds',
246
- timestampMs: 9350.000381469727,
247
- },
248
- {
249
- confidence: null,
250
- endMs: 9779.999732971191,
251
- startMs: 9520.000457763672,
252
- text: ' for',
253
- timestampMs: 9650.000095367432,
254
- },
255
- {
256
- confidence: null,
257
- endMs: 9979.999542236328,
258
- startMs: 9779.999732971191,
259
- text: ' all',
260
- timestampMs: 9879.99963760376,
261
- },
262
- {
263
- confidence: null,
264
- endMs: 10079.999923706055,
265
- startMs: 9979.999542236328,
266
- text: ' of',
267
- timestampMs: 10029.999732971191,
268
- },
269
- {
270
- confidence: null,
271
- endMs: 10340.00015258789,
272
- startMs: 10079.999923706055,
273
- text: ' us.',
274
- timestampMs: 10210.000038146973,
275
- },
276
- ],
277
- });
278
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,100 +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
- const bun_test_1 = require("bun:test");
7
- const fs_1 = __importDefault(require("fs"));
8
- const openai_1 = __importDefault(require("openai"));
9
- const path_1 = __importDefault(require("path"));
10
- const openai_whisper_api_to_captions_1 = require("../openai-whisper-api-to-captions");
11
- const output_1 = require("./output");
12
- (0, bun_test_1.test)('Should convert to captions from mock', () => {
13
- const results = (0, openai_whisper_api_to_captions_1.openAiWhisperApiToCaptions)({ transcription: output_1.testOutput });
14
- (0, bun_test_1.expect)(results.captions.slice(0, 10)).toEqual([
15
- {
16
- confidence: null,
17
- endMs: 7039.999961853027,
18
- startMs: 6519.999980926514,
19
- text: "What's",
20
- timestampMs: 6779.9999713897705,
21
- },
22
- {
23
- confidence: null,
24
- endMs: 7559.999942779541,
25
- startMs: 7039.999961853027,
26
- text: ' up,',
27
- timestampMs: 7299.999952316284,
28
- },
29
- {
30
- confidence: null,
31
- endMs: 7880.000114440918,
32
- startMs: 7619.999885559082,
33
- text: ' everybody?',
34
- timestampMs: 7750,
35
- },
36
- {
37
- confidence: null,
38
- endMs: 8300.000190734863,
39
- startMs: 8239.999771118164,
40
- text: ' This',
41
- timestampMs: 8269.999980926514,
42
- },
43
- {
44
- confidence: null,
45
- endMs: 8699.999809265137,
46
- startMs: 8300.000190734863,
47
- text: ' is',
48
- timestampMs: 8500,
49
- },
50
- {
51
- confidence: null,
52
- endMs: 8899.999618530273,
53
- startMs: 8699.999809265137,
54
- text: ' Cortland',
55
- timestampMs: 8799.999713897705,
56
- },
57
- {
58
- confidence: null,
59
- endMs: 9159.99984741211,
60
- startMs: 8899.999618530273,
61
- text: ' from',
62
- timestampMs: 9029.999732971191,
63
- },
64
- {
65
- confidence: null,
66
- endMs: 9560.0004196167,
67
- startMs: 9159.99984741211,
68
- text: ' IndieHackers.',
69
- timestampMs: 9360.000133514404,
70
- },
71
- {
72
- confidence: null,
73
- endMs: 10000,
74
- startMs: 9560.0004196167,
75
- text: 'com',
76
- timestampMs: 9780.00020980835,
77
- },
78
- {
79
- confidence: null,
80
- endMs: 10359.999656677246,
81
- startMs: 10000,
82
- text: ' and',
83
- timestampMs: 10179.999828338623,
84
- },
85
- ]);
86
- });
87
- if (!process.env.CI) {
88
- (0, bun_test_1.test)('Should convert to captions', async () => {
89
- const openai = new openai_1.default();
90
- const transcription = await openai.audio.transcriptions.create({
91
- file: fs_1.default.createReadStream(path_1.default.join(__dirname, '..', '..', '..', 'template-audiogram', 'public', 'audio.wav')),
92
- model: 'whisper-1',
93
- response_format: 'verbose_json',
94
- prompt: 'Hello, welcome to my lecture.',
95
- timestamp_granularities: ['word'],
96
- });
97
- const { captions } = (0, openai_whisper_api_to_captions_1.openAiWhisperApiToCaptions)({ transcription });
98
- (0, bun_test_1.expect)(captions.length).toBeGreaterThan(60);
99
- }, { timeout: 60000 });
100
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,66 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const bun_test_1 = require("bun:test");
4
- const openai_whisper_api_to_captions_1 = require("../openai-whisper-api-to-captions");
5
- (0, bun_test_1.test)('issue 5069 case 1', () => {
6
- const res = {
7
- text: 'Like-minded.',
8
- task: 'transcribe',
9
- language: '',
10
- duration: 1.325,
11
- words: [
12
- { word: ' Like', start: 0, end: 0.5600000023841858 },
13
- { word: '-minded.', start: 0.5600000023841858, end: 1.0800000429153442 },
14
- ],
15
- };
16
- const results = (0, openai_whisper_api_to_captions_1.openAiWhisperApiToCaptions)({ transcription: res });
17
- (0, bun_test_1.expect)(results).toEqual({
18
- captions: [
19
- {
20
- confidence: null,
21
- endMs: 560.0000023841858,
22
- startMs: 0,
23
- text: 'Like-',
24
- timestampMs: 280.0000011920929,
25
- },
26
- {
27
- confidence: null,
28
- endMs: 1080.0000429153442,
29
- startMs: 560.0000023841858,
30
- text: 'minded.',
31
- timestampMs: 820.000022649765,
32
- },
33
- ],
34
- });
35
- });
36
- (0, bun_test_1.test)('issue 5069 case 2', () => {
37
- const res = {
38
- text: '50,000.',
39
- task: 'transcribe',
40
- language: '',
41
- duration: 1.45,
42
- words: [
43
- { word: ' 50', start: 0, end: 0.5600000023841858 },
44
- { word: ',000.', start: 0.5600000023841858, end: 1.1399999856948853 },
45
- ],
46
- };
47
- const results = (0, openai_whisper_api_to_captions_1.openAiWhisperApiToCaptions)({ transcription: res });
48
- (0, bun_test_1.expect)(results).toEqual({
49
- captions: [
50
- {
51
- confidence: null,
52
- endMs: 560.0000023841858,
53
- startMs: 0,
54
- text: '50,',
55
- timestampMs: 280.0000011920929,
56
- },
57
- {
58
- confidence: null,
59
- endMs: 1139.9999856948853,
60
- startMs: 560.0000023841858,
61
- text: '000.',
62
- timestampMs: 849.9999940395355,
63
- },
64
- ],
65
- });
66
- });
@@ -1,11 +0,0 @@
1
- export declare const testOutput: {
2
- task: "transcribe";
3
- language: string;
4
- duration: number;
5
- text: string;
6
- words: {
7
- word: string;
8
- start: number;
9
- end: number;
10
- }[];
11
- };