Metadata-Version: 2.4
Name: rboto-transcribe-streaming
Version: 0.1.0
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Framework :: AsyncIO
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Programming Language :: Rust
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Dist: rboto==0.1.0
License-File: LICENSE
Summary: rboto: async-only, typed Python client for Amazon Transcribe Streaming, powered by Rust. Alpha preview.
Keywords: rboto,aws,transcribe-streaming,asyncio,typing,rust
Home-Page: https://github.com/ferrumio/rboto
Author-email: Leandro Cavalcante Damascena <leandro.damascena@gmail.com>
License-Expression: Apache-2.0
Requires-Python: >=3.12
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Changelog, https://github.com/ferrumio/rboto/releases
Project-URL: Documentation, https://ferrumio.github.io/rboto/clients/
Project-URL: Homepage, https://ferrumio.github.io/rboto/
Project-URL: Issues, https://github.com/ferrumio/rboto/issues
Project-URL: Repository, https://github.com/ferrumio/rboto

<!-- Generated by rboto-codegen. Edit the descriptor, template, or example source. -->
# rboto-transcribe-streaming

rboto is an independent project maintained by [Ferrumio](https://github.com/ferrumio).
It is not affiliated with, sponsored by, or endorsed by Amazon Web Services (AWS).

**Preview (Alpha).** rboto is under active development. APIs may change between releases.

rboto provides an **async-only, typed Python client for Amazon Transcribe Streaming**,
powered by Rust. This package contains `TranscribeStreamingClient` and
**5 operations**.

## Installation

Requires Python 3.12 or newer and a native wheel for your Python version and platform.

```bash
python -m pip install "rboto[transcribe-streaming]"
```

You can also install `rboto-transcribe-streaming` directly; it installs the matching
`rboto` package. Only the selected service is installed.

These are the package names to use when a release is available on your package index.
If your index has no release yet, follow the
[source installation instructions](https://ferrumio.github.io/rboto/getting-started/).

## Usage

Configure credentials through your environment, shared profile, or workload role.
The example uses `us-east-1`; select a region where your service and resources are available.
Resource names, identifiers, input files, and model IDs in the example are placeholders
to replace with your own.

```python
import asyncio
import wave
from collections.abc import AsyncIterator

from rboto import TranscribeStreamingClient
from rboto_transcribe_streaming.types import AudioStream


async def audio_events() -> AsyncIterator[AudioStream]:
    audio = await asyncio.to_thread(wave.open, "speech.wav", "rb")
    try:
        if (audio.getnchannels(), audio.getsampwidth(), audio.getframerate()) != (1, 2, 16000):
            raise ValueError("Use mono, 16-bit PCM audio sampled at 16 kHz")
        while chunk := await asyncio.to_thread(audio.readframes, 1600):
            yield {"audio_event": {"audio_chunk": chunk}}
            await asyncio.sleep(0.1)
    finally:
        await asyncio.to_thread(audio.close)


async def main() -> None:
    client = TranscribeStreamingClient(region="us-east-1")
    response = await client.start_stream_transcription(
        language_code="en-US",
        media_sample_rate_hertz=16000,
        media_encoding="pcm",
        audio_stream=audio_events(),
    )
    async for event in response["transcript_result_stream"]:
        print(event)


if __name__ == "__main__":
    asyncio.run(main())
```

In an application with an event loop, call `await main()` instead of `asyncio.run(main())`.
Reuse the client across calls. Constructing a client does not send a request.

## API conventions

- Import the client with `from rboto import TranscribeStreamingClient`.
- Every operation is asynchronous: use `await client.method(...)`.
- Operation arguments are keyword-only and use the Python names listed below.
- Structured inputs use typed dictionaries and tagged unions from `rboto_transcribe_streaming.types`.
- Regular responses expose typed attributes; `response.to_dict()` converts them to a dictionary.
- Event-stream responses may be typed dictionaries containing async iterators. Follow the
  declared return type; consume event streams with `async for`.
- Byte streams are consumed asynchronously. `await stream.read()` buffers the complete body;
  iterate the stream when processing a large response.
- Direct operation calls return one page.

- Catch modeled exceptions from `rboto_transcribe_streaming.exceptions`. Their `error_code`,
  `message`, and `operation_name` identify service failures.

Clients also accept `profile`, `endpoint_url`, or shared `Session` settings.
See [configuration](https://ferrumio.github.io/rboto/guides/configuration/),
[errors](https://ferrumio.github.io/rboto/guides/errors/), and
[streaming](https://ferrumio.github.io/rboto/guides/streaming/).

## Operations

This is the complete operation catalog for this generated package. “Required arguments”
lists arguments without defaults in the Python signature. Service-side conditions may
require additional arguments. Each method links to its complete signature, including
optional arguments. Nested input definitions are in `rboto_transcribe_streaming.types`;
native response definitions are in the package's `_native.pyi`.

| Method | Required arguments | Return type |
|---|---|---|
| [`get_medical_scribe_stream`](#get_medical_scribe_stream) | <code>session_id: str</code> | <code>GetMedicalScribeStreamOutput</code> |
| [`start_call_analytics_stream_transcription`](#start_call_analytics_stream_transcription) | <code>media_sample_rate_hertz: int</code>, <code>media_encoding: MediaEncoding</code>, <code>audio_stream: AsyncIterator[AudioStream]</code> | <code>StartCallAnalyticsStreamTranscriptionOutput</code> |
| [`start_medical_scribe_stream`](#start_medical_scribe_stream) | <code>language_code: MedicalScribeLanguageCode</code>, <code>media_sample_rate_hertz: int</code>, <code>media_encoding: MedicalScribeMediaEncoding</code>, <code>input_stream: AsyncIterator[MedicalScribeInputStream]</code> | <code>StartMedicalScribeStreamOutput</code> |
| [`start_medical_stream_transcription`](#start_medical_stream_transcription) | <code>language_code: LanguageCode</code>, <code>media_sample_rate_hertz: int</code>, <code>media_encoding: MediaEncoding</code>, <code>specialty: Specialty</code>, <code>type: Type</code>, <code>audio_stream: AsyncIterator[AudioStream]</code> | <code>StartMedicalStreamTranscriptionOutput</code> |
| [`start_stream_transcription`](#start_stream_transcription) | <code>media_sample_rate_hertz: int</code>, <code>media_encoding: MediaEncoding</code>, <code>audio_stream: AsyncIterator[AudioStream]</code> | <code>StartStreamTranscriptionOutput</code> |

## Complete signatures

### get_medical_scribe_stream

```python
async def get_medical_scribe_stream(
    *,
    session_id: str,
) -> GetMedicalScribeStreamOutput: ...
```


### start_call_analytics_stream_transcription

```python
async def start_call_analytics_stream_transcription(
    *,
    media_sample_rate_hertz: int,
    media_encoding: MediaEncoding,
    audio_stream: AsyncIterator[AudioStream],
    language_code: CallAnalyticsLanguageCode | None = None,
    vocabulary_name: str | None = None,
    session_id: str | None = None,
    vocabulary_filter_name: str | None = None,
    vocabulary_filter_method: VocabularyFilterMethod | None = None,
    language_model_name: str | None = None,
    identify_language: bool | None = None,
    language_options: str | None = None,
    preferred_language: CallAnalyticsLanguageCode | None = None,
    vocabulary_names: str | None = None,
    vocabulary_filter_names: str | None = None,
    enable_partial_results_stabilization: bool | None = None,
    partial_results_stability: PartialResultsStability | None = None,
    content_identification_type: ContentIdentificationType | None = None,
    content_redaction_type: ContentRedactionType | None = None,
    pii_entity_types: str | None = None,
) -> StartCallAnalyticsStreamTranscriptionOutput: ...
```


### start_medical_scribe_stream

```python
async def start_medical_scribe_stream(
    *,
    language_code: MedicalScribeLanguageCode,
    media_sample_rate_hertz: int,
    media_encoding: MedicalScribeMediaEncoding,
    input_stream: AsyncIterator[MedicalScribeInputStream],
    session_id: str | None = None,
) -> StartMedicalScribeStreamOutput: ...
```


### start_medical_stream_transcription

```python
async def start_medical_stream_transcription(
    *,
    language_code: LanguageCode,
    media_sample_rate_hertz: int,
    media_encoding: MediaEncoding,
    specialty: Specialty,
    type: Type,
    audio_stream: AsyncIterator[AudioStream],
    vocabulary_name: str | None = None,
    show_speaker_label: bool | None = None,
    session_id: str | None = None,
    enable_channel_identification: bool | None = None,
    number_of_channels: int | None = None,
    content_identification_type: MedicalContentIdentificationType | None = None,
) -> StartMedicalStreamTranscriptionOutput: ...
```


### start_stream_transcription

```python
async def start_stream_transcription(
    *,
    media_sample_rate_hertz: int,
    media_encoding: MediaEncoding,
    audio_stream: AsyncIterator[AudioStream],
    language_code: LanguageCode | None = None,
    vocabulary_name: str | None = None,
    session_id: str | None = None,
    vocabulary_filter_name: str | None = None,
    vocabulary_filter_method: VocabularyFilterMethod | None = None,
    show_speaker_label: bool | None = None,
    enable_channel_identification: bool | None = None,
    number_of_channels: int | None = None,
    enable_partial_results_stabilization: bool | None = None,
    partial_results_stability: PartialResultsStability | None = None,
    content_identification_type: ContentIdentificationType | None = None,
    content_redaction_type: ContentRedactionType | None = None,
    pii_entity_types: str | None = None,
    language_model_name: str | None = None,
    identify_language: bool | None = None,
    language_options: str | None = None,
    preferred_language: LanguageCode | None = None,
    identify_multiple_languages: bool | None = None,
    vocabulary_names: str | None = None,
    vocabulary_filter_names: str | None = None,
    session_resume_window: int | None = None,
    transcript_format: TranscriptFormat | None = None,
) -> StartStreamTranscriptionOutput: ...
```


## Links

- [Service guide](https://ferrumio.github.io/rboto/clients/)
- [Repository](https://github.com/ferrumio/rboto)
- [Issues](https://github.com/ferrumio/rboto/issues)
- [Releases](https://github.com/ferrumio/rboto/releases)

Licensed under Apache-2.0.

