Skip to content

Transcribe SDK: Wait for all chunks being sent before sending complete signal #46

@Alexandre27

Description

@Alexandre27

Hi, I'm doing tests based on this example simple_file.py and i noticed there's a small delay to ensure that all chunks are sent

    # Small delay to ensure empty frame is sent before close
    await asyncio.sleep(0.4)

Is there any way to wait for completion apart from sleep? Something like what is done for the output stream await stream.await_output()?
Because if i remove or decrease the apply_realtime_delay sleep i get this error aws_sdk_transcribe_streaming.models.BadRequestException: A complete signal was sent without the preceding empty frame., even though that the empty byte is only sent after all chunks are on queue.

I tried waiting for the input stream to be empty (by tracking the internal queue) and calling the flush before sending the empty byte , but to no avail.
I'm experimenting with trascribe and using the old sdk, where i have a utility script that sends chunks that works fine, but once i update the sdk i run into this error.

I feel like using timeout in a prod app might lead to some strange outcomes, so i wonder if this is something that will be implemented (or already is on smitty) or if using this SDK depends on throttling control that needs to be implemented on server.
Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions