@ai-sdk/assemblyai 3.0.0-beta.2 → 3.0.0-beta.21
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 +154 -4
- package/README.md +2 -0
- package/dist/index.js +95 -112
- package/dist/index.js.map +1 -1
- package/package.json +7 -9
- package/dist/index.d.mts +0 -123
- package/dist/index.mjs +0 -439
- package/dist/index.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,155 @@
|
|
|
1
1
|
# @ai-sdk/assemblyai
|
|
2
2
|
|
|
3
|
+
## 3.0.0-beta.21
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- ef992f8: Remove CommonJS exports from all packages. All packages are now ESM-only (`"type": "module"`). Consumers using `require()` must switch to ESM `import` syntax.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [ef992f8]
|
|
12
|
+
- @ai-sdk/provider@4.0.0-beta.11
|
|
13
|
+
- @ai-sdk/provider-utils@5.0.0-beta.19
|
|
14
|
+
|
|
15
|
+
## 3.0.0-beta.20
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [90e2d8a]
|
|
20
|
+
- @ai-sdk/provider-utils@5.0.0-beta.18
|
|
21
|
+
|
|
22
|
+
## 3.0.0-beta.19
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- Updated dependencies [3ae1786]
|
|
27
|
+
- @ai-sdk/provider-utils@5.0.0-beta.17
|
|
28
|
+
|
|
29
|
+
## 3.0.0-beta.18
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- Updated dependencies [176466a]
|
|
34
|
+
- @ai-sdk/provider@4.0.0-beta.10
|
|
35
|
+
- @ai-sdk/provider-utils@5.0.0-beta.16
|
|
36
|
+
|
|
37
|
+
## 3.0.0-beta.17
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- Updated dependencies [e311194]
|
|
42
|
+
- @ai-sdk/provider@4.0.0-beta.9
|
|
43
|
+
- @ai-sdk/provider-utils@5.0.0-beta.15
|
|
44
|
+
|
|
45
|
+
## 3.0.0-beta.16
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- Updated dependencies [34bd95d]
|
|
50
|
+
- Updated dependencies [008271d]
|
|
51
|
+
- @ai-sdk/provider@4.0.0-beta.8
|
|
52
|
+
- @ai-sdk/provider-utils@5.0.0-beta.14
|
|
53
|
+
|
|
54
|
+
## 3.0.0-beta.15
|
|
55
|
+
|
|
56
|
+
### Patch Changes
|
|
57
|
+
|
|
58
|
+
- Updated dependencies [b0c2869]
|
|
59
|
+
- Updated dependencies [7e26e81]
|
|
60
|
+
- @ai-sdk/provider-utils@5.0.0-beta.13
|
|
61
|
+
|
|
62
|
+
## 3.0.0-beta.14
|
|
63
|
+
|
|
64
|
+
### Patch Changes
|
|
65
|
+
|
|
66
|
+
- Updated dependencies [46d1149]
|
|
67
|
+
- @ai-sdk/provider-utils@5.0.0-beta.12
|
|
68
|
+
|
|
69
|
+
## 3.0.0-beta.13
|
|
70
|
+
|
|
71
|
+
### Patch Changes
|
|
72
|
+
|
|
73
|
+
- Updated dependencies [6fd51c0]
|
|
74
|
+
- @ai-sdk/provider-utils@5.0.0-beta.11
|
|
75
|
+
- @ai-sdk/provider@4.0.0-beta.7
|
|
76
|
+
|
|
77
|
+
## 3.0.0-beta.12
|
|
78
|
+
|
|
79
|
+
### Patch Changes
|
|
80
|
+
|
|
81
|
+
- Updated dependencies [c29a26f]
|
|
82
|
+
- @ai-sdk/provider-utils@5.0.0-beta.10
|
|
83
|
+
- @ai-sdk/provider@4.0.0-beta.6
|
|
84
|
+
|
|
85
|
+
## 3.0.0-beta.11
|
|
86
|
+
|
|
87
|
+
### Patch Changes
|
|
88
|
+
|
|
89
|
+
- 38fc777: Add AI Gateway hint to provider READMEs
|
|
90
|
+
|
|
91
|
+
## 3.0.0-beta.10
|
|
92
|
+
|
|
93
|
+
### Patch Changes
|
|
94
|
+
|
|
95
|
+
- Updated dependencies [2e17091]
|
|
96
|
+
- @ai-sdk/provider-utils@5.0.0-beta.9
|
|
97
|
+
|
|
98
|
+
## 3.0.0-beta.9
|
|
99
|
+
|
|
100
|
+
### Patch Changes
|
|
101
|
+
|
|
102
|
+
- Updated dependencies [986c6fd]
|
|
103
|
+
- Updated dependencies [493295c]
|
|
104
|
+
- @ai-sdk/provider-utils@5.0.0-beta.8
|
|
105
|
+
|
|
106
|
+
## 3.0.0-beta.8
|
|
107
|
+
|
|
108
|
+
### Patch Changes
|
|
109
|
+
|
|
110
|
+
- Updated dependencies [1f509d4]
|
|
111
|
+
- @ai-sdk/provider-utils@5.0.0-beta.7
|
|
112
|
+
- @ai-sdk/provider@4.0.0-beta.5
|
|
113
|
+
|
|
114
|
+
## 3.0.0-beta.7
|
|
115
|
+
|
|
116
|
+
### Patch Changes
|
|
117
|
+
|
|
118
|
+
- Updated dependencies [3887c70]
|
|
119
|
+
- @ai-sdk/provider-utils@5.0.0-beta.6
|
|
120
|
+
- @ai-sdk/provider@4.0.0-beta.4
|
|
121
|
+
|
|
122
|
+
## 3.0.0-beta.6
|
|
123
|
+
|
|
124
|
+
### Patch Changes
|
|
125
|
+
|
|
126
|
+
- Updated dependencies [776b617]
|
|
127
|
+
- @ai-sdk/provider-utils@5.0.0-beta.5
|
|
128
|
+
- @ai-sdk/provider@4.0.0-beta.3
|
|
129
|
+
|
|
130
|
+
## 3.0.0-beta.5
|
|
131
|
+
|
|
132
|
+
### Patch Changes
|
|
133
|
+
|
|
134
|
+
- Updated dependencies [61753c3]
|
|
135
|
+
- @ai-sdk/provider-utils@5.0.0-beta.4
|
|
136
|
+
|
|
137
|
+
## 3.0.0-beta.4
|
|
138
|
+
|
|
139
|
+
### Patch Changes
|
|
140
|
+
|
|
141
|
+
- Updated dependencies [f7d4f01]
|
|
142
|
+
- @ai-sdk/provider-utils@5.0.0-beta.3
|
|
143
|
+
- @ai-sdk/provider@4.0.0-beta.2
|
|
144
|
+
|
|
145
|
+
## 3.0.0-beta.3
|
|
146
|
+
|
|
147
|
+
### Patch Changes
|
|
148
|
+
|
|
149
|
+
- Updated dependencies [5c2a5a2]
|
|
150
|
+
- @ai-sdk/provider@4.0.0-beta.1
|
|
151
|
+
- @ai-sdk/provider-utils@5.0.0-beta.2
|
|
152
|
+
|
|
3
153
|
## 3.0.0-beta.2
|
|
4
154
|
|
|
5
155
|
### Patch Changes
|
|
@@ -220,13 +370,13 @@
|
|
|
220
370
|
Before
|
|
221
371
|
|
|
222
372
|
```ts
|
|
223
|
-
model.textEmbeddingModel(
|
|
373
|
+
model.textEmbeddingModel("my-model-id");
|
|
224
374
|
```
|
|
225
375
|
|
|
226
376
|
After
|
|
227
377
|
|
|
228
378
|
```ts
|
|
229
|
-
model.embeddingModel(
|
|
379
|
+
model.embeddingModel("my-model-id");
|
|
230
380
|
```
|
|
231
381
|
|
|
232
382
|
- 95f65c2: chore: use import \* from zod/v4
|
|
@@ -427,13 +577,13 @@
|
|
|
427
577
|
Before
|
|
428
578
|
|
|
429
579
|
```ts
|
|
430
|
-
model.textEmbeddingModel(
|
|
580
|
+
model.textEmbeddingModel("my-model-id");
|
|
431
581
|
```
|
|
432
582
|
|
|
433
583
|
After
|
|
434
584
|
|
|
435
585
|
```ts
|
|
436
|
-
model.embeddingModel(
|
|
586
|
+
model.embeddingModel("my-model-id");
|
|
437
587
|
```
|
|
438
588
|
|
|
439
589
|
- Updated dependencies [8d9e8ad]
|
package/README.md
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
The **[AssemblyAI provider](https://ai-sdk.dev/providers/ai-sdk-providers/assemblyai)** for the [AI SDK](https://ai-sdk.dev/docs)
|
|
4
4
|
contains transcription model support for the AssemblyAI transcription API.
|
|
5
5
|
|
|
6
|
+
> **Deploying to Vercel?** With Vercel's AI Gateway you can access AssemblyAI (and hundreds of models from other providers) — no additional packages, API keys, or extra cost. [Get started with AI Gateway](https://vercel.com/ai-gateway).
|
|
7
|
+
|
|
6
8
|
## Setup
|
|
7
9
|
|
|
8
10
|
The AssemblyAI provider is available in the `@ai-sdk/assemblyai` module. You can install it with
|
package/dist/index.js
CHANGED
|
@@ -1,197 +1,181 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/index.ts
|
|
21
|
-
var index_exports = {};
|
|
22
|
-
__export(index_exports, {
|
|
23
|
-
VERSION: () => VERSION,
|
|
24
|
-
assemblyai: () => assemblyai,
|
|
25
|
-
createAssemblyAI: () => createAssemblyAI
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(index_exports);
|
|
28
|
-
|
|
29
1
|
// src/assemblyai-provider.ts
|
|
30
|
-
|
|
31
|
-
|
|
2
|
+
import {
|
|
3
|
+
NoSuchModelError
|
|
4
|
+
} from "@ai-sdk/provider";
|
|
5
|
+
import {
|
|
6
|
+
loadApiKey,
|
|
7
|
+
withUserAgentSuffix
|
|
8
|
+
} from "@ai-sdk/provider-utils";
|
|
32
9
|
|
|
33
10
|
// src/assemblyai-transcription-model.ts
|
|
34
|
-
|
|
35
|
-
|
|
11
|
+
import {
|
|
12
|
+
combineHeaders,
|
|
13
|
+
createJsonResponseHandler,
|
|
14
|
+
extractResponseHeaders,
|
|
15
|
+
parseProviderOptions,
|
|
16
|
+
postJsonToApi,
|
|
17
|
+
postToApi
|
|
18
|
+
} from "@ai-sdk/provider-utils";
|
|
19
|
+
import { z as z2 } from "zod/v4";
|
|
36
20
|
|
|
37
21
|
// src/assemblyai-error.ts
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
var assemblyaiErrorDataSchema =
|
|
41
|
-
error:
|
|
42
|
-
message:
|
|
43
|
-
code:
|
|
22
|
+
import { z } from "zod/v4";
|
|
23
|
+
import { createJsonErrorResponseHandler } from "@ai-sdk/provider-utils";
|
|
24
|
+
var assemblyaiErrorDataSchema = z.object({
|
|
25
|
+
error: z.object({
|
|
26
|
+
message: z.string(),
|
|
27
|
+
code: z.number()
|
|
44
28
|
})
|
|
45
29
|
});
|
|
46
|
-
var assemblyaiFailedResponseHandler =
|
|
30
|
+
var assemblyaiFailedResponseHandler = createJsonErrorResponseHandler({
|
|
47
31
|
errorSchema: assemblyaiErrorDataSchema,
|
|
48
32
|
errorToMessage: (data) => data.error.message
|
|
49
33
|
});
|
|
50
34
|
|
|
51
35
|
// src/assemblyai-transcription-model.ts
|
|
52
|
-
var assemblyaiTranscriptionModelOptionsSchema =
|
|
36
|
+
var assemblyaiTranscriptionModelOptionsSchema = z2.object({
|
|
53
37
|
/**
|
|
54
38
|
* End time of the audio in milliseconds.
|
|
55
39
|
*/
|
|
56
|
-
audioEndAt:
|
|
40
|
+
audioEndAt: z2.number().int().nullish(),
|
|
57
41
|
/**
|
|
58
42
|
* Start time of the audio in milliseconds.
|
|
59
43
|
*/
|
|
60
|
-
audioStartFrom:
|
|
44
|
+
audioStartFrom: z2.number().int().nullish(),
|
|
61
45
|
/**
|
|
62
46
|
* Whether to automatically generate chapters for the transcription.
|
|
63
47
|
*/
|
|
64
|
-
autoChapters:
|
|
48
|
+
autoChapters: z2.boolean().nullish(),
|
|
65
49
|
/**
|
|
66
50
|
* Whether to automatically generate highlights for the transcription.
|
|
67
51
|
*/
|
|
68
|
-
autoHighlights:
|
|
52
|
+
autoHighlights: z2.boolean().nullish(),
|
|
69
53
|
/**
|
|
70
54
|
* Boost parameter for the transcription.
|
|
71
55
|
* Allowed values: 'low', 'default', 'high'.
|
|
72
56
|
*/
|
|
73
|
-
boostParam:
|
|
57
|
+
boostParam: z2.string().nullish(),
|
|
74
58
|
/**
|
|
75
59
|
* Whether to enable content safety filtering.
|
|
76
60
|
*/
|
|
77
|
-
contentSafety:
|
|
61
|
+
contentSafety: z2.boolean().nullish(),
|
|
78
62
|
/**
|
|
79
63
|
* Confidence threshold for content safety filtering (25-100).
|
|
80
64
|
*/
|
|
81
|
-
contentSafetyConfidence:
|
|
65
|
+
contentSafetyConfidence: z2.number().int().min(25).max(100).nullish(),
|
|
82
66
|
/**
|
|
83
67
|
* Custom spelling rules for the transcription.
|
|
84
68
|
*/
|
|
85
|
-
customSpelling:
|
|
86
|
-
|
|
87
|
-
from:
|
|
88
|
-
to:
|
|
69
|
+
customSpelling: z2.array(
|
|
70
|
+
z2.object({
|
|
71
|
+
from: z2.array(z2.string()),
|
|
72
|
+
to: z2.string()
|
|
89
73
|
})
|
|
90
74
|
).nullish(),
|
|
91
75
|
/**
|
|
92
76
|
* Whether to include filler words (um, uh, etc.) in the transcription.
|
|
93
77
|
*/
|
|
94
|
-
disfluencies:
|
|
78
|
+
disfluencies: z2.boolean().nullish(),
|
|
95
79
|
/**
|
|
96
80
|
* Whether to enable entity detection.
|
|
97
81
|
*/
|
|
98
|
-
entityDetection:
|
|
82
|
+
entityDetection: z2.boolean().nullish(),
|
|
99
83
|
/**
|
|
100
84
|
* Whether to filter profanity from the transcription.
|
|
101
85
|
*/
|
|
102
|
-
filterProfanity:
|
|
86
|
+
filterProfanity: z2.boolean().nullish(),
|
|
103
87
|
/**
|
|
104
88
|
* Whether to format text with punctuation and capitalization.
|
|
105
89
|
*/
|
|
106
|
-
formatText:
|
|
90
|
+
formatText: z2.boolean().nullish(),
|
|
107
91
|
/**
|
|
108
92
|
* Whether to enable IAB categories detection.
|
|
109
93
|
*/
|
|
110
|
-
iabCategories:
|
|
94
|
+
iabCategories: z2.boolean().nullish(),
|
|
111
95
|
/**
|
|
112
96
|
* Language code for the transcription.
|
|
113
97
|
*/
|
|
114
|
-
languageCode:
|
|
98
|
+
languageCode: z2.union([z2.literal("en"), z2.string()]).nullish(),
|
|
115
99
|
/**
|
|
116
100
|
* Confidence threshold for language detection.
|
|
117
101
|
*/
|
|
118
|
-
languageConfidenceThreshold:
|
|
102
|
+
languageConfidenceThreshold: z2.number().nullish(),
|
|
119
103
|
/**
|
|
120
104
|
* Whether to enable language detection.
|
|
121
105
|
*/
|
|
122
|
-
languageDetection:
|
|
106
|
+
languageDetection: z2.boolean().nullish(),
|
|
123
107
|
/**
|
|
124
108
|
* Whether to process audio as multichannel.
|
|
125
109
|
*/
|
|
126
|
-
multichannel:
|
|
110
|
+
multichannel: z2.boolean().nullish(),
|
|
127
111
|
/**
|
|
128
112
|
* Whether to add punctuation to the transcription.
|
|
129
113
|
*/
|
|
130
|
-
punctuate:
|
|
114
|
+
punctuate: z2.boolean().nullish(),
|
|
131
115
|
/**
|
|
132
116
|
* Whether to redact personally identifiable information (PII).
|
|
133
117
|
*/
|
|
134
|
-
redactPii:
|
|
118
|
+
redactPii: z2.boolean().nullish(),
|
|
135
119
|
/**
|
|
136
120
|
* Whether to redact PII in the audio file.
|
|
137
121
|
*/
|
|
138
|
-
redactPiiAudio:
|
|
122
|
+
redactPiiAudio: z2.boolean().nullish(),
|
|
139
123
|
/**
|
|
140
124
|
* Audio format for PII redaction.
|
|
141
125
|
*/
|
|
142
|
-
redactPiiAudioQuality:
|
|
126
|
+
redactPiiAudioQuality: z2.string().nullish(),
|
|
143
127
|
/**
|
|
144
128
|
* List of PII types to redact.
|
|
145
129
|
*/
|
|
146
|
-
redactPiiPolicies:
|
|
130
|
+
redactPiiPolicies: z2.array(z2.string()).nullish(),
|
|
147
131
|
/**
|
|
148
132
|
* Substitution method for redacted PII.
|
|
149
133
|
*/
|
|
150
|
-
redactPiiSub:
|
|
134
|
+
redactPiiSub: z2.string().nullish(),
|
|
151
135
|
/**
|
|
152
136
|
* Whether to enable sentiment analysis.
|
|
153
137
|
*/
|
|
154
|
-
sentimentAnalysis:
|
|
138
|
+
sentimentAnalysis: z2.boolean().nullish(),
|
|
155
139
|
/**
|
|
156
140
|
* Whether to identify different speakers in the audio.
|
|
157
141
|
*/
|
|
158
|
-
speakerLabels:
|
|
142
|
+
speakerLabels: z2.boolean().nullish(),
|
|
159
143
|
/**
|
|
160
144
|
* Number of speakers expected in the audio.
|
|
161
145
|
*/
|
|
162
|
-
speakersExpected:
|
|
146
|
+
speakersExpected: z2.number().int().nullish(),
|
|
163
147
|
/**
|
|
164
148
|
* Threshold for speech detection (0-1).
|
|
165
149
|
*/
|
|
166
|
-
speechThreshold:
|
|
150
|
+
speechThreshold: z2.number().min(0).max(1).nullish(),
|
|
167
151
|
/**
|
|
168
152
|
* Whether to generate a summary of the transcription.
|
|
169
153
|
*/
|
|
170
|
-
summarization:
|
|
154
|
+
summarization: z2.boolean().nullish(),
|
|
171
155
|
/**
|
|
172
156
|
* Model to use for summarization.
|
|
173
157
|
*/
|
|
174
|
-
summaryModel:
|
|
158
|
+
summaryModel: z2.string().nullish(),
|
|
175
159
|
/**
|
|
176
160
|
* Type of summary to generate.
|
|
177
161
|
*/
|
|
178
|
-
summaryType:
|
|
162
|
+
summaryType: z2.string().nullish(),
|
|
179
163
|
/**
|
|
180
164
|
* Name of the authentication header for webhook requests.
|
|
181
165
|
*/
|
|
182
|
-
webhookAuthHeaderName:
|
|
166
|
+
webhookAuthHeaderName: z2.string().nullish(),
|
|
183
167
|
/**
|
|
184
168
|
* Value of the authentication header for webhook requests.
|
|
185
169
|
*/
|
|
186
|
-
webhookAuthHeaderValue:
|
|
170
|
+
webhookAuthHeaderValue: z2.string().nullish(),
|
|
187
171
|
/**
|
|
188
172
|
* URL to send webhook notifications to.
|
|
189
173
|
*/
|
|
190
|
-
webhookUrl:
|
|
174
|
+
webhookUrl: z2.string().nullish(),
|
|
191
175
|
/**
|
|
192
176
|
* List of words to boost recognition for.
|
|
193
177
|
*/
|
|
194
|
-
wordBoost:
|
|
178
|
+
wordBoost: z2.array(z2.string()).nullish()
|
|
195
179
|
});
|
|
196
180
|
var AssemblyAITranscriptionModel = class {
|
|
197
181
|
constructor(modelId, config) {
|
|
@@ -208,7 +192,7 @@ var AssemblyAITranscriptionModel = class {
|
|
|
208
192
|
}) {
|
|
209
193
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H;
|
|
210
194
|
const warnings = [];
|
|
211
|
-
const assemblyaiOptions = await
|
|
195
|
+
const assemblyaiOptions = await parseProviderOptions({
|
|
212
196
|
provider: "assemblyai",
|
|
213
197
|
providerOptions,
|
|
214
198
|
schema: assemblyaiTranscriptionModelOptionsSchema
|
|
@@ -276,7 +260,7 @@ var AssemblyAITranscriptionModel = class {
|
|
|
276
260
|
}),
|
|
277
261
|
{
|
|
278
262
|
method: "GET",
|
|
279
|
-
headers:
|
|
263
|
+
headers: combineHeaders(
|
|
280
264
|
this.config.headers(),
|
|
281
265
|
headers
|
|
282
266
|
),
|
|
@@ -299,7 +283,7 @@ var AssemblyAITranscriptionModel = class {
|
|
|
299
283
|
if (transcript.status === "completed") {
|
|
300
284
|
return {
|
|
301
285
|
transcript,
|
|
302
|
-
responseHeaders:
|
|
286
|
+
responseHeaders: extractResponseHeaders(response)
|
|
303
287
|
};
|
|
304
288
|
}
|
|
305
289
|
if (transcript.status === "error") {
|
|
@@ -313,39 +297,39 @@ var AssemblyAITranscriptionModel = class {
|
|
|
313
297
|
async doGenerate(options) {
|
|
314
298
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
315
299
|
const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
|
|
316
|
-
const { value: uploadResponse } = await
|
|
300
|
+
const { value: uploadResponse } = await postToApi({
|
|
317
301
|
url: this.config.url({
|
|
318
302
|
path: "/v2/upload",
|
|
319
303
|
modelId: ""
|
|
320
304
|
}),
|
|
321
305
|
headers: {
|
|
322
306
|
"Content-Type": "application/octet-stream",
|
|
323
|
-
...
|
|
307
|
+
...combineHeaders(this.config.headers(), options.headers)
|
|
324
308
|
},
|
|
325
309
|
body: {
|
|
326
310
|
content: options.audio,
|
|
327
311
|
values: options.audio
|
|
328
312
|
},
|
|
329
313
|
failedResponseHandler: assemblyaiFailedResponseHandler,
|
|
330
|
-
successfulResponseHandler:
|
|
314
|
+
successfulResponseHandler: createJsonResponseHandler(
|
|
331
315
|
assemblyaiUploadResponseSchema
|
|
332
316
|
),
|
|
333
317
|
abortSignal: options.abortSignal,
|
|
334
318
|
fetch: this.config.fetch
|
|
335
319
|
});
|
|
336
320
|
const { body, warnings } = await this.getArgs(options);
|
|
337
|
-
const { value: submitResponse } = await
|
|
321
|
+
const { value: submitResponse } = await postJsonToApi({
|
|
338
322
|
url: this.config.url({
|
|
339
323
|
path: "/v2/transcript",
|
|
340
324
|
modelId: this.modelId
|
|
341
325
|
}),
|
|
342
|
-
headers:
|
|
326
|
+
headers: combineHeaders(this.config.headers(), options.headers),
|
|
343
327
|
body: {
|
|
344
328
|
...body,
|
|
345
329
|
audio_url: uploadResponse.upload_url
|
|
346
330
|
},
|
|
347
331
|
failedResponseHandler: assemblyaiFailedResponseHandler,
|
|
348
|
-
successfulResponseHandler:
|
|
332
|
+
successfulResponseHandler: createJsonResponseHandler(
|
|
349
333
|
assemblyaiSubmitResponseSchema
|
|
350
334
|
),
|
|
351
335
|
abortSignal: options.abortSignal,
|
|
@@ -377,37 +361,37 @@ var AssemblyAITranscriptionModel = class {
|
|
|
377
361
|
};
|
|
378
362
|
}
|
|
379
363
|
};
|
|
380
|
-
var assemblyaiUploadResponseSchema =
|
|
381
|
-
upload_url:
|
|
364
|
+
var assemblyaiUploadResponseSchema = z2.object({
|
|
365
|
+
upload_url: z2.string()
|
|
382
366
|
});
|
|
383
|
-
var assemblyaiSubmitResponseSchema =
|
|
384
|
-
id:
|
|
385
|
-
status:
|
|
367
|
+
var assemblyaiSubmitResponseSchema = z2.object({
|
|
368
|
+
id: z2.string(),
|
|
369
|
+
status: z2.enum(["queued", "processing", "completed", "error"])
|
|
386
370
|
});
|
|
387
|
-
var assemblyaiTranscriptionResponseSchema =
|
|
388
|
-
id:
|
|
389
|
-
status:
|
|
390
|
-
text:
|
|
391
|
-
language_code:
|
|
392
|
-
words:
|
|
393
|
-
|
|
394
|
-
start:
|
|
395
|
-
end:
|
|
396
|
-
text:
|
|
371
|
+
var assemblyaiTranscriptionResponseSchema = z2.object({
|
|
372
|
+
id: z2.string(),
|
|
373
|
+
status: z2.enum(["queued", "processing", "completed", "error"]),
|
|
374
|
+
text: z2.string().nullish(),
|
|
375
|
+
language_code: z2.string().nullish(),
|
|
376
|
+
words: z2.array(
|
|
377
|
+
z2.object({
|
|
378
|
+
start: z2.number(),
|
|
379
|
+
end: z2.number(),
|
|
380
|
+
text: z2.string()
|
|
397
381
|
})
|
|
398
382
|
).nullish(),
|
|
399
|
-
audio_duration:
|
|
400
|
-
error:
|
|
383
|
+
audio_duration: z2.number().nullish(),
|
|
384
|
+
error: z2.string().nullish()
|
|
401
385
|
});
|
|
402
386
|
|
|
403
387
|
// src/version.ts
|
|
404
|
-
var VERSION = true ? "3.0.0-beta.
|
|
388
|
+
var VERSION = true ? "3.0.0-beta.21" : "0.0.0-test";
|
|
405
389
|
|
|
406
390
|
// src/assemblyai-provider.ts
|
|
407
391
|
function createAssemblyAI(options = {}) {
|
|
408
|
-
const getHeaders = () =>
|
|
392
|
+
const getHeaders = () => withUserAgentSuffix(
|
|
409
393
|
{
|
|
410
|
-
authorization:
|
|
394
|
+
authorization: loadApiKey({
|
|
411
395
|
apiKey: options.apiKey,
|
|
412
396
|
environmentVariableName: "ASSEMBLYAI_API_KEY",
|
|
413
397
|
description: "AssemblyAI"
|
|
@@ -431,26 +415,25 @@ function createAssemblyAI(options = {}) {
|
|
|
431
415
|
provider.transcription = createTranscriptionModel;
|
|
432
416
|
provider.transcriptionModel = createTranscriptionModel;
|
|
433
417
|
provider.languageModel = () => {
|
|
434
|
-
throw new
|
|
418
|
+
throw new NoSuchModelError({
|
|
435
419
|
modelId: "unknown",
|
|
436
420
|
modelType: "languageModel",
|
|
437
421
|
message: "AssemblyAI does not provide language models"
|
|
438
422
|
});
|
|
439
423
|
};
|
|
440
424
|
provider.embeddingModel = (modelId) => {
|
|
441
|
-
throw new
|
|
425
|
+
throw new NoSuchModelError({ modelId, modelType: "embeddingModel" });
|
|
442
426
|
};
|
|
443
427
|
provider.textEmbeddingModel = provider.embeddingModel;
|
|
444
428
|
provider.imageModel = (modelId) => {
|
|
445
|
-
throw new
|
|
429
|
+
throw new NoSuchModelError({ modelId, modelType: "imageModel" });
|
|
446
430
|
};
|
|
447
431
|
return provider;
|
|
448
432
|
}
|
|
449
433
|
var assemblyai = createAssemblyAI();
|
|
450
|
-
|
|
451
|
-
0 && (module.exports = {
|
|
434
|
+
export {
|
|
452
435
|
VERSION,
|
|
453
436
|
assemblyai,
|
|
454
437
|
createAssemblyAI
|
|
455
|
-
}
|
|
438
|
+
};
|
|
456
439
|
//# sourceMappingURL=index.js.map
|