diff --git a/open-ai-integration/overview/product-overview.mdx b/open-ai-integration/overview/product-overview.mdx
index 6115ab28c..29bd593d8 100644
--- a/open-ai-integration/overview/product-overview.mdx
+++ b/open-ai-integration/overview/product-overview.mdx
@@ -7,7 +7,7 @@ description: >
---
Integrating Agora’s real-time audio communication with OpenAI’s Large Language Models (LLMs) unlocks the potential for powerful, interactive voice-based applications. By combining Agora’s robust real-time audio streaming capabilities with the conversational intelligence of OpenAI’s LLMs, you can create seamless voice-enabled experiences, such as voice-powered AI assistants or interactive dialogue systems. This integration enables dynamic, responsive audio interactions, enhancing user engagement across a broad range of use cases—from customer support bots to collaborative voice-driven applications.
Most importantly, by combining the strengths of Agora and OpenAI, this integration enables the most natural form of language interaction, lowering the barrier for users to harness the power of AI and making advanced technologies more accessible than ever before.
+
diff --git a/shared/open-ai-integration/quickstart.mdx b/shared/open-ai-integration/quickstart.mdx
index 3ee35c773..f2e4d9b4c 100644
--- a/shared/open-ai-integration/quickstart.mdx
+++ b/shared/open-ai-integration/quickstart.mdx
@@ -24,41 +24,42 @@ Follow these steps to set up your Python integration project:
1. Create a new folder for the project.
- ```bash
- mkdir realtime-agent
- cd realtime-agent/
+ ```bash
+ mkdir realtime-agent
+ cd realtime-agent/
- ```
+ ```
1. Create the following structure for your project:
- ```
- /realtime-agent
- ├── __init__.py
- ├── .env
- ├── agent.py
- ├── agora
- │ ├── __init__.py
- │ ├── requirements.txt
- │ └── rtc.py
- └── realtimeapi
- ├── __init__.py
- ├── client.py
- ├── messages.py
- └── util.py
- ```
-
-
- This project uses the OpenAI [`realtimeapi-examples`](https://openai.com/api/) package.Download the project and unzip it into your `realtime-agent` folder.
-
-
- The following descriptions provide an overview of the key files in the project:
-
- - `agent.py`: The primary script responsible for executing the `RealtimeKitAgent`. It integrates Agora's functionality from the `agora/rtc.py` module and OpenAI's capabilities from the `realtimeapi` package.
- - `agora/rtc.py`: Contains an implementation of the server-side Agora Python Voice SDK.
- - `realtimeapi/`: Contains the classes and methods that interact with OpenAI’s Realtime API.
-
- The [Complete code](#complete-integration-code) for `agent.py` and `rtc.py` is provided at the bottom of this page.
+ ```
+ /realtime-agent
+ ├── __init__.py
+ ├── .env
+ ├── agent.py
+ ├── agora
+ │ ├── __init__.py
+ │ ├── requirements.txt
+ │ └── rtc.py
+ └── realtimeapi
+ ├── __init__.py
+ ├── client.py
+ ├── messages.py
+ └── util.py
+ ```
+
+
+ This project uses the OpenAI [`realtimeapi-examples`](https://openai.com/api/) package.Download the project and unzip it into your
+ `realtime-agent` folder.
+
+
+ The following descriptions provide an overview of the key files in the project:
+
+ - `agent.py`: The primary script responsible for executing the `RealtimeKitAgent`. It integrates Agora's functionality from the `agora/rtc.py` module and OpenAI's capabilities from the `realtimeapi` package.
+ - `agora/rtc.py`: Contains an implementation of the server-side Agora Python Voice SDK.
+ - `realtimeapi/`: Contains the classes and methods that interact with OpenAI’s Realtime API.
+
+ The [Complete code](#complete-integration-code) for `agent.py` and `rtc.py` is provided at the bottom of this page.
1. Open your `.env` file and add the following keys:
@@ -68,9 +69,6 @@ Follow these steps to set up your Python integration project:
# OpenAI API key for authentication
OPENAI_API_KEY=your_openai_api_key_here
-
- # API base URI for the Realtime API
- REALTIME_API_BASE_URI=wss://api.openai.com
```
1. Install the dependencies:
@@ -88,7 +86,8 @@ The `RealtimeKitAgent` class integrates Agora's audio communication capabilities
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.
-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.
+ 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.
```python
@@ -695,7 +694,7 @@ async def shutdown(loop, signal=None):
print(f"Received exit signal {signal.name}...")
tasks = [t for t in asyncio.all_tasks() if t is not asyncio.current_task()]
-
+
print(f"Cancelling {len(tasks)} outstanding tasks")
for task in tasks:
task.cancel()
@@ -703,11 +702,11 @@ async def shutdown(loop, signal=None):
await asyncio.gather(*tasks, return_exceptions=True)
loop.stop()
-if __name__ == "__main__": # Load environment variables and run the agent
+if **name** == "**main**": # Load environment variables and run the agent
load_dotenv()
asyncio.run(
RealtimeKitAgent.entry_point(
- engine=RtcEngine(appid="aab8b8f5a8cd4469a63042fcfafe7063"),
+ engine=RtcEngine(appid=os.getenv("AGORA_APP_ID")),
inference_config=InferenceConfig(
system_message="""\\
You are a helpful assistant. If asked about the weather, make sure to use the provided tool to get that information. \\