-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathasyncapi.yml
660 lines (651 loc) · 21.9 KB
/
asyncapi.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
asyncapi: 2.6.0
defaultContentType: application/json
id: http://assemblyai.com/asyncapi
info:
title: AssemblyAI Streaming Speech-to-Text API
description: AssemblyAI Streaming Speech-to-Text API
license:
name: MIT License
version: 1.1.2
contact:
name: API Support
email: [email protected]
url: https://www.assemblyai.com/docs/
servers:
API:
url: wss://api.assemblyai.com
protocol: wss
description: AssemblyAI API
security:
- ApiKey: []
- Token: []
tags:
# This tag is used as the Fern package name for the channel and messages, even tho the tag is not linked to anything.
# x-fern-group-sdk-name also doesn't work on channels and messages.
# Hence, it has to be "realtime" and can't be "streaming" until these gaps in Fern are fixed.
- name: realtime
description: Streaming Speech-to-Text
externalDocs:
url: https://www.assemblyai.com/docs/speech-to-text/streaming
channels:
/v2/realtime/ws:
bindings:
ws:
headers:
type: object
properties:
Authorization:
description: Authenticate using your AssemblyAI API key
type: string
query:
type: object
required: [sample_rate]
properties:
sample_rate:
description: The sample rate of the streamed audio
type: integer
examples:
- 16000
word_boost:
description: |
Add up to 2500 characters of custom vocabulary.
The parameter value must be a JSON encoded array of strings. The JSON must be URL encoded like other query string parameters.
type: string
examples:
- '["foo","bar"]'
encoding:
description: The encoding of the audio data
$ref: "#/components/schemas/AudioEncoding"
token:
description: |
Authenticate using a [generated temporary token](https://www.assemblyai.com/docs/speech-to-text/streaming#authenticate-with-a-temporary-token)
type: string
format: password
examples:
- eyJhbGciOiJIUzI1...
disable_partial_transcripts:
summary: Disable partial transcripts
description: Set to true to not receive partial transcripts. Defaults to false.
type: boolean
default: false
enable_extra_session_information:
summary: Enable extra session information
description: Set to true to receive the SessionInformation message before the session ends. Defaults to false.
type: boolean
default: false
publish:
description: Send messages to the WebSocket
operationId: sendMessage
message:
oneOf:
- $ref: "#/components/messages/SendAudio"
- $ref: "#/components/messages/TerminateSession"
- $ref: "#/components/messages/ForceEndUtterance"
- $ref: "#/components/messages/ConfigureEndUtteranceSilenceThreshold"
subscribe:
description: Receive messages from the WebSocket
operationId: receiveMessage
message:
oneOf:
- $ref: "#/components/messages/SessionBegins"
- $ref: "#/components/messages/PartialTranscript"
- $ref: "#/components/messages/FinalTranscript"
- $ref: "#/components/messages/SessionInformation"
- $ref: "#/components/messages/SessionTerminated"
- $ref: "#/components/messages/RealtimeError"
x-fern-examples:
- query-parameters:
sample_rate: 16000
word_boost: '["foo","bar"]'
encoding: pcm_s16le
token: eyJhbGciOiJIUzI1...
disable_partial_transcripts: true
enable_extra_session_information: true
messages:
- messageId: SendAudio
type: publish
value: UklGRtjIAABXQVZFZ
- messageId: PartialTranscript
type: subscribe
value:
audio_start: 0
audio_end: 1500
confidence: 0.987190506414702
text: there is a house in new orleans
words:
- start: 0
end: 300
confidence: 1.0
text: there
created: "2023-05-24T08:09:10.161850"
- messageId: FinalTranscript
type: subscribe
value:
audio_start: 0
audio_end: 1500
confidence: 0.987190506414702
text: there is a house in new orleans
words:
- start: 0
end: 300
confidence: 1.0
text: there
created: "2023-05-24T08:09:10.161850"
punctuated: true
text_formatted: true
- messageId: TerminateSession
type: publish
value:
terminate_session: true
- messageId: SessionTerminated
type: subscribe
value:
message_type: "SessionTerminated"
components:
messages:
SendAudio:
messageId: sendAudio
summary: Send audio
payload:
$ref: "#/components/schemas/AudioData"
ForceEndUtterance:
messageId: forceEndUtterance
summary: Manually end an utterance
payload:
$ref: "#/components/schemas/ForceEndUtterance"
ConfigureEndUtteranceSilenceThreshold:
messageId: configureEndUtteranceSilenceThreshold
summary: Configure the threshold for how long to wait before ending an utterance. Default is 700ms.
payload:
$ref: "#/components/schemas/ConfigureEndUtteranceSilenceThreshold"
TerminateSession:
messageId: terminateSession
summary: Terminate session
payload:
$ref: "#/components/schemas/TerminateSession"
SessionBegins:
messageId: SessionBegins
summary: Session start
payload:
$ref: "#/components/schemas/SessionBegins"
SessionInformation:
messageId: SessionInformation
summary: Information about the session
description: |
Information about the session that is concluding.
This message is sent at the end of the session, before the SessionTerminated message.
payload:
$ref: "#/components/schemas/SessionInformation"
SessionTerminated:
messageId: SessionTerminated
summary: Session terminated
payload:
$ref: "#/components/schemas/SessionTerminated"
RealtimeError:
messageId: RealtimeError
summary: Error message
payload:
$ref: "#/components/schemas/RealtimeError"
PartialTranscript:
messageId: partialTranscript
summary: As you send audio data to the API, the API immediately starts responding with Partial Transcript results.
payload:
$ref: "#/components/schemas/PartialTranscript"
FinalTranscript:
messageId: finalTranscript
summary: Transcript text at the end of an utterance with punctuation and casing.
description: After you've received your partial results, our model continues to analyze incoming audio and, when it detects the end of an "utterance" (usually a pause in speech), it'll finalize the results sent to you so far with higher accuracy, as well as add punctuation and casing to the transcription text.
payload:
$ref: "#/components/schemas/FinalTranscript"
schemas:
RealtimeBaseMessage:
type: object
x-fern-sdk-group-name: realtime
required:
- message_type
properties:
message_type:
description: Describes the type of the message
$ref: "#/components/schemas/MessageType"
RealtimeMessage:
x-fern-sdk-group-name: realtime
oneOf:
- $ref: "#/components/schemas/SessionBegins"
- $ref: "#/components/schemas/PartialTranscript"
- $ref: "#/components/schemas/FinalTranscript"
- $ref: "#/components/schemas/SessionInformation"
- $ref: "#/components/schemas/SessionTerminated"
- $ref: "#/components/schemas/RealtimeError"
RealtimeError:
summary: Error message
type: object
x-fern-sdk-group-name: realtime
additionalProperties: false
required: [error]
properties:
error:
type: string
examples:
- { "error": "Client sent audio too fast" }
MessageType:
type: string
x-fern-sdk-group-name: realtime
enum:
[
SessionBegins,
PartialTranscript,
FinalTranscript,
SessionInformation,
SessionTerminated,
]
RealtimeTranscriptType:
type: string
x-fern-sdk-group-name: realtime
enum: [PartialTranscript, FinalTranscript]
RealtimeTranscript:
x-fern-sdk-group-name: realtime
oneOf:
- $ref: "#/components/schemas/PartialTranscript"
- $ref: "#/components/schemas/FinalTranscript"
discriminator: "message_type"
SessionBegins:
summary: Session start
x-fern-sdk-group-name: realtime
allOf:
- $ref: "#/components/schemas/RealtimeBaseMessage"
- type: object
required:
- message_type
- session_id
- expires_at
properties:
message_type:
description: Describes the type of the message
type: string
const: SessionBegins
session_id:
description: Unique identifier for the established session
type: string
format: uuid
expires_at:
description: Timestamp when this session will expire
type: string
pattern: '^(?:(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2}:\d{2}(?:\.\d+)?))$'
x-fern-type: datetime
x-ts-type: Date
additionalProperties: false
examples:
- {
session_id: "f14499a6-c399-4c30-b1eb-0a33af64b1d9",
expires_at: "2023-11-04T16:51:38.316048",
message_type: "SessionBegins",
}
SessionInformation:
summary: Information about the session
description: |
Information about the session that is concluding.
This message is sent at the end of the session, before the SessionTerminated message.
x-fern-sdk-group-name: realtime
allOf:
- $ref: "#/components/schemas/RealtimeBaseMessage"
- type: object
required:
- message_type
- audio_duration_seconds
properties:
message_type:
description: Describes the type of the message
type: string
const: SessionInformation
audio_duration_seconds:
description: The total duration of the audio in seconds
type: number
format: float
additionalProperties: false
examples:
- {
message_type: "SessionInformation",
audio_duration_seconds: 232.192,
}
SessionTerminated:
summary: Session terminated
x-fern-sdk-group-name: realtime
allOf:
- $ref: "#/components/schemas/RealtimeBaseMessage"
- type: object
required:
- message_type
properties:
message_type:
description: Describes the type of the message
type: string
const: SessionTerminated
additionalProperties: false
examples:
- { message_type: "SessionTerminated" }
RealtimeBaseTranscript:
type: object
x-fern-sdk-group-name: realtime
required:
- audio_start
- audio_end
- confidence
- text
- words
- created
properties:
audio_start:
description: Start time of audio sample relative to session start, in milliseconds
type: integer
audio_end:
description: End time of audio sample relative to session start, in milliseconds
type: integer
confidence:
description: The confidence score of the entire transcription, between 0 and 1
type: number
minimum: 0
maximum: 1
format: double
text:
description: The partial transcript for your audio
type: string
words:
description: |
An array of objects, with the information for each word in the transcription text.
Includes the start and end time of the word in milliseconds, the confidence score of the word, and the text, which is the word itself.
type: array
items:
$ref: "#/components/schemas/Word"
created:
description: The timestamp for the partial transcript
type: string
pattern: '^(?:(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2}:\d{2}(?:\.\d+)?))$'
x-fern-type: datetime
x-ts-type: Date
additionalProperties: false
PartialTranscript:
summary: As you send audio data to the API, the API immediately starts responding with Partial Transcript results.
x-fern-sdk-group-name: realtime
allOf:
- $ref: "#/components/schemas/RealtimeBaseTranscript"
- type: object
required:
- message_type
properties:
message_type:
description: Describes the type of message
type: string
const: PartialTranscript
additionalProperties: false
examples:
- {
message_type: "PartialTranscript",
created: "2023-11-03T17:14:13.854523",
audio_start: 5310,
audio_end: 7540,
confidence: 0.59751355353605,
text: "how can i show",
words:
[
{
start: 7140,
end: 7175,
confidence: 0.466229424909777,
text: "how",
},
{
start: 7220,
end: 7255,
confidence: 0.432059008767216,
text: "can",
},
{
start: 7300,
end: 7335,
confidence: 0.994432034661841,
text: "i",
},
{
start: 7380,
end: 7415,
confidence: 0.497333745805364,
text: "show",
},
],
}
FinalTranscript:
summary: Transcript text at the end of an utterance with punctuation and casing.
x-fern-sdk-group-name: realtime
allOf:
- $ref: "#/components/schemas/RealtimeBaseTranscript"
- type: object
required:
- message_type
- punctuated
- text_formatted
properties:
message_type:
description: Describes the type of message
type: string
const: FinalTranscript
punctuated:
description: Whether the text is punctuated and cased
type: boolean
text_formatted:
description: Whether the text is formatted, for example Dollar -> $
type: boolean
additionalProperties: false
examples:
- {
message_type: "FinalTranscript",
created: "2023-11-03T17:14:35.00332",
audio_start: 5310,
audio_end: 25580,
confidence: 0.853363490052184,
text: "How can I show these two slides? So that demonstrates that the guide Cap, which for most of the last 3 million years has been the size of the lower 48 States, has shrunk by 40%. But this understates the seriousness of this particular problem because it doesn't show the sickness of the ice, the Oregon of the beating heart of the global climate system. It expands in winter and contracts against summer. The next slide I show you will be a rapid fast forward of what happened over the last 25 years. The permanentized is marked in red, and as you see, it expands to the dark wood. That's an annual.",
words:
[
{
start: 7140,
end: 7175,
confidence: 0.466229424909777,
text: "How",
},
{
start: 7220,
end: 7255,
confidence: 0.432059008767216,
text: "can",
},
{ start: 7300, end: 7335, confidence: 0.99, text: "I" },
{
start: 7380,
end: 7415,
confidence: 0.497333745805364,
text: "show",
},
{
start: 7660,
end: 7695,
confidence: 0.999622368415665,
text: "these",
},
{ start: 7700, end: 7735, confidence: 1, text: "two" },
{
start: 7780,
end: 7895,
confidence: 0.950111441145432,
text: "slides?",
},
{
start: 8060,
end: 8095,
confidence: 0.865500654768006,
text: "So",
},
{
start: 8100,
end: 8135,
confidence: 0.736370866587664,
text: "that",
},
{
start: 8220,
end: 8535,
confidence: 0.704626940209106,
text: "demonstrates",
},
{
start: 8580,
end: 8615,
confidence: 0.993622467290789,
text: "that",
},
],
punctuated: true,
text_formatted: true,
}
Word:
type: object
x-fern-sdk-group-name: realtime
required:
- start
- end
- confidence
- text
properties:
start:
description: Start time of the word in milliseconds
type: integer
end:
description: End time of the word in milliseconds
type: integer
confidence:
description: Confidence score of the word
type: number
minimum: 0
maximum: 1
format: double
text:
description: The word itself
type: string
additionalProperties: false
examples:
[
{
start: 7140,
end: 7175,
confidence: 0.466229424909777,
text: "how",
},
{
start: 7220,
end: 7255,
confidence: 0.432059008767216,
text: "can",
},
{ start: 7300, end: 7335, confidence: 0.994432034661841, text: "i" },
{
start: 7380,
end: 7415,
confidence: 0.497333745805364,
text: "show",
},
{
start: 7140,
end: 7175,
confidence: 0.466229424909777,
text: "How",
},
{
start: 7220,
end: 7255,
confidence: 0.432059008767216,
text: "can",
},
{ start: 7300, end: 7335, confidence: 0.99, text: "I" },
]
AudioData:
type: string
description: Binary audio data
format: binary
x-fern-sdk-group-name: realtime
x-ts-type: ArrayBufferLike
ForceEndUtterance:
description: Manually end an utterance
x-fern-sdk-group-name: realtime
type: object
required:
- force_end_utterance
properties:
force_end_utterance:
description: A boolean value to communicate that you wish to force the end of the utterance
type: boolean
additionalProperties: false
examples:
- { "force_end_utterance": true }
ConfigureEndUtteranceSilenceThreshold:
description: Configure the threshold for how long to wait before ending an utterance. Default is 700ms.
x-fern-sdk-group-name: realtime
type: object
required:
- end_utterance_silence_threshold
properties:
end_utterance_silence_threshold:
description: The duration threshold in milliseconds
type: integer
minimum: 0
maximum: 20000
additionalProperties: false
examples:
- { "end_utterance_silence_threshold": 300 }
TerminateSession:
summary: Terminate session
x-fern-sdk-group-name: realtime
type: object
required:
- terminate_session
properties:
terminate_session:
description: Set to true to end your streaming session forever
type: boolean
additionalProperties: false
examples:
- { "terminate_session": true }
AudioEncoding:
type: string
x-fern-sdk-group-name: realtime
description: The encoding of the audio data
default: pcm_s16le
enum:
- pcm_s16le
- pcm_mulaw
x-fern-enum:
pcm_s16le:
description: PCM signed 16-bit little-endian
casing:
camel: pcmS16le
snake: pcm_s16le
pascal: PcmS16le
screamingSnake: PCM_S16LE
pcm_mulaw:
description: PCM Mu-law
casing:
camel: pcmMulaw
snake: pcm_mulaw
pascal: PcmMulaw
screamingSnake: PCM_MULAW
examples:
- "pcm_s16le"
- "pcm_mulaw"
securitySchemes:
ApiKey:
description: Authenticate using your AssemblyAI API key
type: httpApiKey
in: header
name: Authorization
Token:
description: "Authenticate using a [generated temporary token](https://www.assemblyai.com/docs/speech-to-text/streaming#authenticate-with-a-temporary-token)"
type: httpApiKey
in: query
name: token