{"id":20268584,"url":"https://github.com/agoraio/agora-realtime-ai-api","last_synced_at":"2025-04-11T03:40:44.090Z","repository":{"id":260012635,"uuid":"863901025","full_name":"AgoraIO/agora-realtime-ai-api","owner":"AgoraIO","description":null,"archived":false,"fork":false,"pushed_at":"2024-12-26T02:51:31.000Z","size":67,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-04-06T21:05:58.621Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AgoraIO.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-27T06:05:22.000Z","updated_at":"2024-12-26T02:51:34.000Z","dependencies_parsed_at":"2024-10-29T03:46:19.126Z","dependency_job_id":"088fc6fa-4080-43b2-ad18-569d3e063b48","html_url":"https://github.com/AgoraIO/agora-realtime-ai-api","commit_stats":null,"previous_names":["agoraio/agora-realtime-ai-api"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgoraIO%2Fagora-realtime-ai-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgoraIO%2Fagora-realtime-ai-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgoraIO%2Fagora-realtime-ai-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgoraIO%2Fagora-realtime-ai-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AgoraIO","download_url":"https://codeload.github.com/AgoraIO/agora-realtime-ai-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248339262,"owners_count":21087213,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T12:18:57.446Z","updated_at":"2025-04-11T03:40:44.058Z","avatar_url":"https://github.com/AgoraIO.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## API Reference for `agora-realtime-ai-api` Python Package\n\n### `RtcOptions` Class\n\nThe `RtcOptions` class represents the configuration options for an RTC (Real-Time Communication) session.\n\n#### Constructor:\n```python\nRtcOptions(\n    *,\n    channel_name: str = None,\n    uid: int = 0,\n    sample_rate: int = 24000,\n    channels: int = 1,\n    enable_pcm_dump: bool = False\n)\n```\n- **channel_name**: Name of the channel.\n- **uid**: Unique identifier for the user.\n- **sample_rate**: Sample rate for audio (default is 24,000 Hz).\n- **channels**: Number of audio channels (default is 1).\n- **enable_pcm_dump**: Flag to enable PCM audio dump (default is `False`).\n\n### `AudioStream` Class\n\nThe `AudioStream` class represents an iterable stream of PCM audio frames.\n\n#### Constructor:\n```python\nAudioStream()\n```\n\n#### Methods:\n- `__aiter__() -\u003e AsyncIterator[PcmAudioFrame]`: Async iterator to traverse through audio frames.\n- `__anext__() -\u003e PcmAudioFrame`: Returns the next audio frame in the queue.\n\n---\n\n\n### `Channel` Class\n\nThe `Channel` class handles the RTC channel and associated operations such as connection, audio subscriptions, and data stream messages.\n\n#### Constructor:\n```python\nChannel(rtc: \"RtcEngine\", options: RtcOptions)\n```\n\n#### Methods:\n- `connect() -\u003e None`: Connects to the channel asynchronously.\n- `disconnect() -\u003e None`: Disconnects from the channel asynchronously.\n- `get_audio_frames(uid: int) -\u003e AudioStream`: Returns the audio stream for a specific user.\n- `push_audio_frame(frame: bytes) -\u003e None`: Sends a PCM audio frame to the channel.\n- `clear_sender_audio_buffer() -\u003e None`: Clears the audio buffer used for sending.\n- `subscribe_audio(uid: int) -\u003e None`: Subscribes to a user's audio stream.\n- `unsubscribe_audio(uid: int) -\u003e None`: Unsubscribes from a user's audio stream.\n- `send_stream_message(data: str, msg_id: str) -\u003e None`: Sends a data stream message to the channel.\n\n---\n\n### `ChatMessage` Class\n\nRepresents a chat message to be sent over the RTC channel.\n\n#### Constructor:\n```python\nChatMessage(message: str, msg_id: str)\n```\n\n---\n\n### `Chat` Class\n\nHandles the queue of chat messages and sends them over the RTC channel.\n\n#### Constructor:\n```python\nChat(channel: Channel)\n```\n\n#### Methods:\n- `send_message(item: ChatMessage) -\u003e None`: Sends a chat message.\n\n---\n\n### `RtcEngine` Class\n\nThe `RtcEngine` class initializes the Agora service and provides methods for managing RTC channels.\n\n#### Constructor:\n```python\nRtcEngine(appid: str, appcert: str)\n```\n\n#### Methods:\n- `create_channel(options: RtcOptions) -\u003e Channel`: Creates an RTC channel with the given options.\n- `destroy() -\u003e None`: Destroys the RTC engine instance.\n\n---","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagoraio%2Fagora-realtime-ai-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagoraio%2Fagora-realtime-ai-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagoraio%2Fagora-realtime-ai-api/lists"}