@ai-sdk/assemblyai 0.0.0-70e0935a-20260114150030 → 0.0.0-98261322-20260122142521
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 +31 -4
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/docs/100-assemblyai.mdx +282 -0
- package/package.json +10 -5
- package/src/assemblyai-api-types.ts +362 -0
- package/src/assemblyai-config.ts +9 -0
- package/src/assemblyai-error.test.ts +34 -0
- package/src/assemblyai-error.ts +16 -0
- package/src/assemblyai-provider.ts +112 -0
- package/src/assemblyai-transcription-model.test.ts +368 -0
- package/src/assemblyai-transcription-model.ts +430 -0
- package/src/assemblyai-transcription-settings.ts +1 -0
- package/src/index.ts +6 -0
- package/src/transcript-test.mp3 +0 -0
- package/src/version.ts +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,39 @@
|
|
|
1
1
|
# @ai-sdk/assemblyai
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-98261322-20260122142521
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
- 080559b: chore: add docs to package dist
|
|
8
|
+
|
|
9
|
+
## 2.0.9
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 8dc54db: chore: add src folders to package bundle
|
|
14
|
+
|
|
15
|
+
## 2.0.8
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [5c090e7]
|
|
20
|
+
- @ai-sdk/provider@3.0.4
|
|
21
|
+
- @ai-sdk/provider-utils@4.0.8
|
|
22
|
+
|
|
23
|
+
## 2.0.7
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Updated dependencies [46f46e4]
|
|
28
|
+
- @ai-sdk/provider-utils@4.0.7
|
|
29
|
+
|
|
30
|
+
## 2.0.6
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- Updated dependencies [1b11dcb]
|
|
35
|
+
- @ai-sdk/provider-utils@4.0.6
|
|
36
|
+
- @ai-sdk/provider@3.0.3
|
|
10
37
|
|
|
11
38
|
## 2.0.5
|
|
12
39
|
|
package/dist/index.js
CHANGED
|
@@ -401,7 +401,7 @@ var assemblyaiTranscriptionResponseSchema = import_v42.z.object({
|
|
|
401
401
|
});
|
|
402
402
|
|
|
403
403
|
// src/version.ts
|
|
404
|
-
var VERSION = true ? "0.0.0-
|
|
404
|
+
var VERSION = true ? "0.0.0-98261322-20260122142521" : "0.0.0-test";
|
|
405
405
|
|
|
406
406
|
// src/assemblyai-provider.ts
|
|
407
407
|
function createAssemblyAI(options = {}) {
|
package/dist/index.mjs
CHANGED
|
@@ -385,7 +385,7 @@ var assemblyaiTranscriptionResponseSchema = z2.object({
|
|
|
385
385
|
});
|
|
386
386
|
|
|
387
387
|
// src/version.ts
|
|
388
|
-
var VERSION = true ? "0.0.0-
|
|
388
|
+
var VERSION = true ? "0.0.0-98261322-20260122142521" : "0.0.0-test";
|
|
389
389
|
|
|
390
390
|
// src/assemblyai-provider.ts
|
|
391
391
|
function createAssemblyAI(options = {}) {
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: AssemblyAI
|
|
3
|
+
description: Learn how to use the AssemblyAI provider for the AI SDK.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# AssemblyAI Provider
|
|
7
|
+
|
|
8
|
+
The [AssemblyAI](https://assemblyai.com/) provider contains language model support for the AssemblyAI transcription API.
|
|
9
|
+
|
|
10
|
+
## Setup
|
|
11
|
+
|
|
12
|
+
The AssemblyAI provider is available in the `@ai-sdk/assemblyai` module. You can install it with
|
|
13
|
+
|
|
14
|
+
<Tabs items={['pnpm', 'npm', 'yarn', 'bun']}>
|
|
15
|
+
<Tab>
|
|
16
|
+
<Snippet text="pnpm add @ai-sdk/assemblyai" dark />
|
|
17
|
+
</Tab>
|
|
18
|
+
<Tab>
|
|
19
|
+
<Snippet text="npm install @ai-sdk/assemblyai" dark />
|
|
20
|
+
</Tab>
|
|
21
|
+
<Tab>
|
|
22
|
+
<Snippet text="yarn add @ai-sdk/assemblyai" dark />
|
|
23
|
+
</Tab>
|
|
24
|
+
|
|
25
|
+
<Tab>
|
|
26
|
+
<Snippet text="bun add @ai-sdk/assemblyai" dark />
|
|
27
|
+
</Tab>
|
|
28
|
+
</Tabs>
|
|
29
|
+
|
|
30
|
+
## Provider Instance
|
|
31
|
+
|
|
32
|
+
You can import the default provider instance `assemblyai` from `@ai-sdk/assemblyai`:
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import { assemblyai } from '@ai-sdk/assemblyai';
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
If you need a customized setup, you can import `createAssemblyAI` from `@ai-sdk/assemblyai` and create a provider instance with your settings:
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import { createAssemblyAI } from '@ai-sdk/assemblyai';
|
|
42
|
+
|
|
43
|
+
const assemblyai = createAssemblyAI({
|
|
44
|
+
// custom settings, e.g.
|
|
45
|
+
fetch: customFetch,
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
You can use the following optional settings to customize the AssemblyAI provider instance:
|
|
50
|
+
|
|
51
|
+
- **apiKey** _string_
|
|
52
|
+
|
|
53
|
+
API key that is being sent using the `Authorization` header.
|
|
54
|
+
It defaults to the `ASSEMBLYAI_API_KEY` environment variable.
|
|
55
|
+
|
|
56
|
+
- **headers** _Record<string,string>_
|
|
57
|
+
|
|
58
|
+
Custom headers to include in the requests.
|
|
59
|
+
|
|
60
|
+
- **fetch** _(input: RequestInfo, init?: RequestInit) => Promise<Response>_
|
|
61
|
+
|
|
62
|
+
Custom [fetch](https://developer.mozilla.org/en-US/docs/Web/API/fetch) implementation.
|
|
63
|
+
Defaults to the global `fetch` function.
|
|
64
|
+
You can use it as a middleware to intercept requests,
|
|
65
|
+
or to provide a custom fetch implementation for e.g. testing.
|
|
66
|
+
|
|
67
|
+
## Transcription Models
|
|
68
|
+
|
|
69
|
+
You can create models that call the [AssemblyAI transcription API](https://www.assemblyai.com/docs/getting-started/transcribe-an-audio-file/typescript)
|
|
70
|
+
using the `.transcription()` factory method.
|
|
71
|
+
|
|
72
|
+
The first argument is the model id e.g. `best`.
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
const model = assemblyai.transcription('best');
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
You can also pass additional provider-specific options using the `providerOptions` argument. For example, supplying the `contentSafety` option will enable content safety filtering.
|
|
79
|
+
|
|
80
|
+
```ts highlight="6"
|
|
81
|
+
import { experimental_transcribe as transcribe } from 'ai';
|
|
82
|
+
import { assemblyai } from '@ai-sdk/assemblyai';
|
|
83
|
+
import { readFile } from 'fs/promises';
|
|
84
|
+
|
|
85
|
+
const result = await transcribe({
|
|
86
|
+
model: assemblyai.transcription('best'),
|
|
87
|
+
audio: await readFile('audio.mp3'),
|
|
88
|
+
providerOptions: { assemblyai: { contentSafety: true } },
|
|
89
|
+
});
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
The following provider options are available:
|
|
93
|
+
|
|
94
|
+
- **audioEndAt** _number_
|
|
95
|
+
|
|
96
|
+
End time of the audio in milliseconds.
|
|
97
|
+
Optional.
|
|
98
|
+
|
|
99
|
+
- **audioStartFrom** _number_
|
|
100
|
+
|
|
101
|
+
Start time of the audio in milliseconds.
|
|
102
|
+
Optional.
|
|
103
|
+
|
|
104
|
+
- **autoChapters** _boolean_
|
|
105
|
+
|
|
106
|
+
Whether to automatically generate chapters for the transcription.
|
|
107
|
+
Optional.
|
|
108
|
+
|
|
109
|
+
- **autoHighlights** _boolean_
|
|
110
|
+
|
|
111
|
+
Whether to automatically generate highlights for the transcription.
|
|
112
|
+
Optional.
|
|
113
|
+
|
|
114
|
+
- **boostParam** _enum_
|
|
115
|
+
|
|
116
|
+
Boost parameter for the transcription.
|
|
117
|
+
Allowed values: `'low'`, `'default'`, `'high'`.
|
|
118
|
+
Optional.
|
|
119
|
+
|
|
120
|
+
- **contentSafety** _boolean_
|
|
121
|
+
|
|
122
|
+
Whether to enable content safety filtering.
|
|
123
|
+
Optional.
|
|
124
|
+
|
|
125
|
+
- **contentSafetyConfidence** _number_
|
|
126
|
+
|
|
127
|
+
Confidence threshold for content safety filtering (25-100).
|
|
128
|
+
Optional.
|
|
129
|
+
|
|
130
|
+
- **customSpelling** _array of objects_
|
|
131
|
+
|
|
132
|
+
Custom spelling rules for the transcription.
|
|
133
|
+
Each object has `from` (array of strings) and `to` (string) properties.
|
|
134
|
+
Optional.
|
|
135
|
+
|
|
136
|
+
- **disfluencies** _boolean_
|
|
137
|
+
|
|
138
|
+
Whether to include disfluencies (um, uh, etc.) in the transcription.
|
|
139
|
+
Optional.
|
|
140
|
+
|
|
141
|
+
- **entityDetection** _boolean_
|
|
142
|
+
|
|
143
|
+
Whether to detect entities in the transcription.
|
|
144
|
+
Optional.
|
|
145
|
+
|
|
146
|
+
- **filterProfanity** _boolean_
|
|
147
|
+
|
|
148
|
+
Whether to filter profanity in the transcription.
|
|
149
|
+
Optional.
|
|
150
|
+
|
|
151
|
+
- **formatText** _boolean_
|
|
152
|
+
|
|
153
|
+
Whether to format the text in the transcription.
|
|
154
|
+
Optional.
|
|
155
|
+
|
|
156
|
+
- **iabCategories** _boolean_
|
|
157
|
+
|
|
158
|
+
Whether to include IAB categories in the transcription.
|
|
159
|
+
Optional.
|
|
160
|
+
|
|
161
|
+
- **languageCode** _string_
|
|
162
|
+
|
|
163
|
+
Language code for the audio.
|
|
164
|
+
Supports numerous ISO-639-1 and ISO-639-3 language codes.
|
|
165
|
+
Optional.
|
|
166
|
+
|
|
167
|
+
- **languageConfidenceThreshold** _number_
|
|
168
|
+
|
|
169
|
+
Confidence threshold for language detection.
|
|
170
|
+
Optional.
|
|
171
|
+
|
|
172
|
+
- **languageDetection** _boolean_
|
|
173
|
+
|
|
174
|
+
Whether to enable language detection.
|
|
175
|
+
Optional.
|
|
176
|
+
|
|
177
|
+
- **multichannel** _boolean_
|
|
178
|
+
|
|
179
|
+
Whether to process multiple audio channels separately.
|
|
180
|
+
Optional.
|
|
181
|
+
|
|
182
|
+
- **punctuate** _boolean_
|
|
183
|
+
|
|
184
|
+
Whether to add punctuation to the transcription.
|
|
185
|
+
Optional.
|
|
186
|
+
|
|
187
|
+
- **redactPii** _boolean_
|
|
188
|
+
|
|
189
|
+
Whether to redact personally identifiable information.
|
|
190
|
+
Optional.
|
|
191
|
+
|
|
192
|
+
- **redactPiiAudio** _boolean_
|
|
193
|
+
|
|
194
|
+
Whether to redact PII in the audio file.
|
|
195
|
+
Optional.
|
|
196
|
+
|
|
197
|
+
- **redactPiiAudioQuality** _enum_
|
|
198
|
+
|
|
199
|
+
Quality of the redacted audio file.
|
|
200
|
+
Allowed values: `'mp3'`, `'wav'`.
|
|
201
|
+
Optional.
|
|
202
|
+
|
|
203
|
+
- **redactPiiPolicies** _array of enums_
|
|
204
|
+
|
|
205
|
+
Policies for PII redaction, specifying which types of information to redact.
|
|
206
|
+
Supports numerous types like `'person_name'`, `'phone_number'`, etc.
|
|
207
|
+
Optional.
|
|
208
|
+
|
|
209
|
+
- **redactPiiSub** _enum_
|
|
210
|
+
|
|
211
|
+
Substitution method for redacted PII.
|
|
212
|
+
Allowed values: `'entity_name'`, `'hash'`.
|
|
213
|
+
Optional.
|
|
214
|
+
|
|
215
|
+
- **sentimentAnalysis** _boolean_
|
|
216
|
+
|
|
217
|
+
Whether to perform sentiment analysis on the transcription.
|
|
218
|
+
Optional.
|
|
219
|
+
|
|
220
|
+
- **speakerLabels** _boolean_
|
|
221
|
+
|
|
222
|
+
Whether to label different speakers in the transcription.
|
|
223
|
+
Optional.
|
|
224
|
+
|
|
225
|
+
- **speakersExpected** _number_
|
|
226
|
+
|
|
227
|
+
Expected number of speakers in the audio.
|
|
228
|
+
Optional.
|
|
229
|
+
|
|
230
|
+
- **speechThreshold** _number_
|
|
231
|
+
|
|
232
|
+
Threshold for speech detection (0-1).
|
|
233
|
+
Optional.
|
|
234
|
+
|
|
235
|
+
- **summarization** _boolean_
|
|
236
|
+
|
|
237
|
+
Whether to generate a summary of the transcription.
|
|
238
|
+
Optional.
|
|
239
|
+
|
|
240
|
+
- **summaryModel** _enum_
|
|
241
|
+
|
|
242
|
+
Model to use for summarization.
|
|
243
|
+
Allowed values: `'informative'`, `'conversational'`, `'catchy'`.
|
|
244
|
+
Optional.
|
|
245
|
+
|
|
246
|
+
- **summaryType** _enum_
|
|
247
|
+
|
|
248
|
+
Type of summary to generate.
|
|
249
|
+
Allowed values: `'bullets'`, `'bullets_verbose'`, `'gist'`, `'headline'`, `'paragraph'`.
|
|
250
|
+
Optional.
|
|
251
|
+
|
|
252
|
+
- **topics** _array of strings_
|
|
253
|
+
|
|
254
|
+
List of topics to detect in the transcription.
|
|
255
|
+
Optional.
|
|
256
|
+
|
|
257
|
+
- **webhookAuthHeaderName** _string_
|
|
258
|
+
|
|
259
|
+
Name of the authentication header for webhook requests.
|
|
260
|
+
Optional.
|
|
261
|
+
|
|
262
|
+
- **webhookAuthHeaderValue** _string_
|
|
263
|
+
|
|
264
|
+
Value of the authentication header for webhook requests.
|
|
265
|
+
Optional.
|
|
266
|
+
|
|
267
|
+
- **webhookUrl** _string_
|
|
268
|
+
|
|
269
|
+
URL to send webhook notifications to.
|
|
270
|
+
Optional.
|
|
271
|
+
|
|
272
|
+
- **wordBoost** _array of strings_
|
|
273
|
+
|
|
274
|
+
List of words to boost in the transcription.
|
|
275
|
+
Optional.
|
|
276
|
+
|
|
277
|
+
### Model Capabilities
|
|
278
|
+
|
|
279
|
+
| Model | Transcription | Duration | Segments | Language |
|
|
280
|
+
| ------ | ------------------- | ------------------- | ------------------- | ------------------- |
|
|
281
|
+
| `best` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
|
|
282
|
+
| `nano` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/assemblyai",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-98261322-20260122142521",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -8,9 +8,14 @@
|
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"files": [
|
|
10
10
|
"dist/**/*",
|
|
11
|
+
"docs/**/*",
|
|
12
|
+
"src",
|
|
11
13
|
"CHANGELOG.md",
|
|
12
14
|
"README.md"
|
|
13
15
|
],
|
|
16
|
+
"directories": {
|
|
17
|
+
"doc": "./docs"
|
|
18
|
+
},
|
|
14
19
|
"exports": {
|
|
15
20
|
"./package.json": "./package.json",
|
|
16
21
|
".": {
|
|
@@ -20,15 +25,15 @@
|
|
|
20
25
|
}
|
|
21
26
|
},
|
|
22
27
|
"dependencies": {
|
|
23
|
-
"@ai-sdk/provider": "
|
|
24
|
-
"@ai-sdk/provider-utils": "
|
|
28
|
+
"@ai-sdk/provider": "3.0.4",
|
|
29
|
+
"@ai-sdk/provider-utils": "4.0.8"
|
|
25
30
|
},
|
|
26
31
|
"devDependencies": {
|
|
27
32
|
"@types/node": "20.17.24",
|
|
28
33
|
"tsup": "^8",
|
|
29
34
|
"typescript": "5.6.3",
|
|
30
35
|
"zod": "3.25.76",
|
|
31
|
-
"@ai-sdk/test-server": "1.0.
|
|
36
|
+
"@ai-sdk/test-server": "1.0.2",
|
|
32
37
|
"@vercel/ai-tsconfig": "0.0.0"
|
|
33
38
|
},
|
|
34
39
|
"peerDependencies": {
|
|
@@ -54,7 +59,7 @@
|
|
|
54
59
|
"scripts": {
|
|
55
60
|
"build": "pnpm clean && tsup --tsconfig tsconfig.build.json",
|
|
56
61
|
"build:watch": "pnpm clean && tsup --watch --tsconfig tsconfig.build.json",
|
|
57
|
-
"clean": "del-cli dist *.tsbuildinfo",
|
|
62
|
+
"clean": "del-cli dist docs *.tsbuildinfo",
|
|
58
63
|
"lint": "eslint \"./**/*.ts*\"",
|
|
59
64
|
"type-check": "tsc --build",
|
|
60
65
|
"prettier-check": "prettier --check \"./**/*.ts*\"",
|