Skip to content

Commit

Permalink
Merge branch 'python-sdk-open-ai-integration' into u260924
Browse files Browse the repository at this point in the history
  • Loading branch information
digitallysavvy authored Sep 27, 2024
2 parents ab3ceef + 911718e commit 36d9a2f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions shared/open-ai-integration/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,12 @@ The `RealtimeKitAgent` class integrates Agora's audio communication capabilities

### Connect to Agora and OpenAI

The `setup_and_run_agent` method sets up the `RealtimeKitAgent` by connecting to an Agora channel using the provided `RtcEngine` and initializing a session with the OpenAI Realtime API client. Here's the updated implementation with inline comments:
The `setup_and_run_agent` method sets up the `RealtimeKitAgent` by connecting to an Agora channel using the provided `RtcEngine` and initializing a session with the OpenAI Realtime API client. It sends configuration messages to set up the session and define conversation parameters, such as the system message and output audio format, before starting the agent's operations. The method uses asynchronous execution to handle both listening for the session start and sending conversation configuration updates concurrently. It ensures that the connection is properly managed and cleaned up after use, even in cases of exceptions, early exits, or shutdowns.

<Admonition type="info" title="Note">
UIDs in the Python SDK are set using a string value. Agora recommends using only numerical values for UID strings to ensure compatibility
with all Agora products and extensions.
</Admonition>

```python
@classmethod
Expand Down Expand Up @@ -341,7 +346,7 @@ async def _process_model_messages(self) -> None:

### Main entry point

The main entry point of the application sets up the Agora RTC engine, configures the options, and launches the RealtimeKitAgent. Here's the updated implementation with inline comments:
The main entry point of the application sets up the Agora RTC engine, configures the options, and launches the RealtimeKitAgent.

```python
if __name__ == "__main__":
Expand Down

0 comments on commit 36d9a2f

Please sign in to comment.