Skip to main content

API Reference for agora-realtime-ai-api Python Package

RtcOptions Class

The RtcOptions class represents the configuration options for an RTC (Real-Time Communication) session.

Constructor:

RtcOptions(
    *,
    channel_name: str = None,
    uid: int = 0,
    sample_rate: int = 24000,
    channels: int = 1,
    enable_pcm_dump: bool = False
)
  • channel_name: Name of the channel.
  • uid: Unique identifier for the user.
  • sample_rate: Sample rate for audio (default is 24,000 Hz).
  • channels: Number of audio channels (default is 1).
  • enable_pcm_dump: Flag to enable PCM audio dump (default is False).

AudioStream Class

The AudioStream class represents an iterable stream of PCM audio frames.

Constructor:

AudioStream()

Methods:

  • __aiter__() -> AsyncIterator[PcmAudioFrame]: Async iterator to traverse through audio frames.
  • __anext__() -> PcmAudioFrame: Returns the next audio frame in the queue.

Channel Class

The Channel class handles the RTC channel and associated operations such as connection, audio subscriptions, and data stream messages.

Constructor:

Channel(rtc: "RtcEngine", options: RtcOptions)

Methods:

  • connect() -> None: Connects to the channel asynchronously.
  • disconnect() -> None: Disconnects from the channel asynchronously.
  • get_audio_frames(uid: int) -> AudioStream: Returns the audio stream for a specific user.
  • push_audio_frame(frame: bytes) -> None: Sends a PCM audio frame to the channel.
  • clear_sender_audio_buffer() -> None: Clears the audio buffer used for sending.
  • subscribe_audio(uid: int) -> None: Subscribes to a user's audio stream.
  • unsubscribe_audio(uid: int) -> None: Unsubscribes from a user's audio stream.
  • send_stream_message(data: str, msg_id: str) -> None: Sends a data stream message to the channel.

ChatMessage Class

Represents a chat message to be sent over the RTC channel.

Constructor:

ChatMessage(message: str, msg_id: str)

Chat Class

Handles the queue of chat messages and sends them over the RTC channel.

Constructor:

Chat(channel: Channel)

Methods:

  • send_message(item: ChatMessage) -> None: Sends a chat message.

RtcEngine Class

The RtcEngine class initializes the Agora service and provides methods for managing RTC channels.

Constructor:

RtcEngine(appid: str, appcert: str)

Methods:

  • create_channel(options: RtcOptions) -> Channel: Creates an RTC channel with the given options.
  • destroy() -> None: Destroys the RTC engine instance.

Metadata

Release files for agora-realtime-ai-api-v1 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agora-realtime-ai-api-v1 0.0.3
File Size Uploaded
agora_realtime_ai_api_v1-0.0.3.tar.gz 14.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agora-realtime-ai-api-v1 0.0.3
File Interpreter ABI Platform
agora_realtime_ai_api_v1-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 29.9 kB

Release files / agora_realtime_ai_api_v1-0.0.3.tar.gz

Download URL agora_realtime_ai_api_v1-0.0.3.tar.gz
Size 14.3 kB
Tags Source
SHA-256 checksum
How to use checksums
566451cded0005c7983e787b15ea6efa2a9a6297239d1006cbe293939f6576d4
BLAKE2b-256 checksum
How to use checksums
2a12b4b15403e69e735de9dc88858f0ecbfbf75863b9292f7648171b119761bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / agora_realtime_ai_api_v1-0.0.3-py3-none-any.whl

Download URL agora_realtime_ai_api_v1-0.0.3-py3-none-any.whl
Size 15.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0247215025bee0e31ac4bd9578bf90d0c03f3038c4359fa6964a2b62453362c4
BLAKE2b-256 checksum
How to use checksums
2329eee0e63f365d5a7eb8f0d2f11546a9d99478687196118cbaf47206070c2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page