Skip to content

Commit b7f207e

Browse files
committed
VAT-983: update docs
1 parent 8d5e27c commit b7f207e

File tree

1 file changed

+122
-2
lines changed

1 file changed

+122
-2
lines changed

README.md

Lines changed: 122 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,116 @@ function onData(data) {
210210

211211
The `data` object that is received has the following structure:
212212

213+
#### General structure
214+
215+
```json
216+
{
217+
"type": "<str>",
218+
"headers": {
219+
"key1": "value1",
220+
"key2": "value2"
221+
}
222+
}
213223
```
214224

225+
#### Timestamped transcription packet
226+
227+
```json
228+
{
229+
"type": "TIMESTAMPED_TRANSCRIPTION",
230+
"headers": {},
231+
"transcript": "hello world",
232+
"words": [
233+
{
234+
"word": "hello",
235+
"start_time": 1350.39,
236+
"end_time": 4600.5,
237+
"speaker": "Speaker 1",
238+
"confidence": 0.96,
239+
"entity": null,
240+
"entity_group_id": null
241+
},
242+
{
243+
"word": "world",
244+
"start_time": 6200.3,
245+
"end_time": 8020.0,
246+
"speaker": "Speaker 1",
247+
"confidence": 0.98,
248+
"entity": null,
249+
"entity_group_id": null
250+
}
251+
]
252+
}
215253
```
216254

217-
#### Notes
255+
#### Timestamped transcription packet
256+
257+
```json
258+
{
259+
"type": "PROCESSED_TIMESTAMPED_TRANSCRIPTION",
260+
"headers": {},
261+
"transcript": "Hello, world!",
262+
"words": [
263+
{
264+
"word": "hello",
265+
"start_time": 1350.39,
266+
"end_time": 4600.5,
267+
"speaker": "Speaker 1",
268+
"confidence": 0.96,
269+
"entity": null,
270+
"entity_group_id": null
271+
},
272+
{
273+
"word": "world",
274+
"start_time": 6200.3,
275+
"end_time": 8020.0,
276+
"speaker": "Speaker 1",
277+
"confidence": 0.98,
278+
"entity": null,
279+
"entity_group_id": null
280+
}
281+
],
282+
"processed_words": [
283+
{
284+
"word": "Hello,",
285+
"start_time": 1350.39,
286+
"end_time": 4600.5,
287+
"speaker": "Speaker 1",
288+
"confidence": 0.96,
289+
"entity": null,
290+
"entity_group_id": null
291+
},
292+
{
293+
"word": "world!",
294+
"start_time": 6200.3,
295+
"end_time": 8020.0,
296+
"speaker": "Speaker 1",
297+
"confidence": 0.98,
298+
"entity": null,
299+
"entity_group_id": null
300+
}
301+
]
302+
}
303+
```
304+
305+
#### Headers
306+
307+
| Name | Type | Description |
308+
| --------------------- | ------- | ---------------------------------------------------------------------------------------------------------- |
309+
| PacketNumber | int | Incremental packet number |
310+
| Sid | string | Session id |
311+
| FrameStartTime | double | Frame start time in milliseconds |
312+
| FrameEndTime | double | Frame end time in milliseconds |
313+
| FinalFrame | boolean | Flag for marking that a segment of speech has ended and it won't be updated |
314+
| SilenceDetected | boolean | Flag to indicate silence was detected on the audio frame |
315+
| ProcessingTimeSeconds | double | Time of inferencing |
316+
| SplitPacket | boolean | Flag that indicates the response packet was split and this is one of the pieces |
317+
| FinalSplitPacket | boolean | Flag that indicates this is the final piece of the split response |
318+
| SplitId | string | Full packet id in format `<packet_number>.<split_id>.<sub-split-id>.<sub-sub-split-id>` |
319+
| RequestBytes | int | Additional bytes requested to produce a frame. This is just an estimation, any number of bytes can be sent |
320+
| SpokenCommand | string | Command detected in frame |
321+
322+
#### NOTE
218323

219324
So, the `data` can be final frame - i.e. the backend has fully finalized the transcript for those words and the time intervals (start and end time).
220325
Or can be partial frame - i.e. the backend has not fully finalized the transcript for those words and the time intervals, and it will most likely change until it is overlapped by a final frame.
@@ -285,8 +390,23 @@ const onConfig = (data) => {
285390

286391
Where `data` object has the following structure:
287392

288-
```
393+
#### Config applied packet
289394

395+
```json
396+
{
397+
"type": "CONFIG_APPLIED",
398+
"headers": {},
399+
"config_packet": {
400+
"type": "CONFIG",
401+
"headers": {},
402+
"spokenCommandsList": [
403+
{
404+
"command": "NEW_PARAGRAPH",
405+
"regex": ["new line"]
406+
}
407+
]
408+
}
409+
}
290410
```
291411

292412
### `onCommandData`

0 commit comments

Comments
 (0)