From d8ba732e17ee4e8cf8db0a4fcb0a5c063e9a05f3 Mon Sep 17 00:00:00 2001 From: Xingyu Xiang Date: Wed, 1 Jan 2025 14:50:08 -0800 Subject: [PATCH 1/2] fix dependency and imports --- notebook/agentchat_realtime_websocket.ipynb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/notebook/agentchat_realtime_websocket.ipynb b/notebook/agentchat_realtime_websocket.ipynb index d97320401c..99521750fb 100644 --- a/notebook/agentchat_realtime_websocket.ipynb +++ b/notebook/agentchat_realtime_websocket.ipynb @@ -31,14 +31,14 @@ "\n", "To use the realtime agent we will connect it to a local websocket trough the browser.\n", "\n", - "We have prepared a `WebsocketAudioAdapter` to enable you to connect your realtime agent to a websocket service.\n", + "We have prepared a `WebSocketAudioAdapter` to enable you to connect your realtime agent to a websocket service.\n", "\n", "To be able to run this notebook, you will need to install ag2, fastapi and uvicorn.\n", "````{=mdx}\n", ":::info Requirements\n", "Install `ag2`:\n", "```bash\n", - "pip install \"ag2\", \"fastapi>=0.115.0,<1\", \"uvicorn>=0.30.6,<1\"\n", + "pip install \"ag2\", \"fastapi>=0.115.0,<1\", \"uvicorn>=0.30.6,<1\" \"flaml[automl]\"\n", "```\n", "For more information, please refer to the [installation guide](/docs/installation/Installation).\n", ":::\n", @@ -51,7 +51,7 @@ "metadata": {}, "outputs": [], "source": [ - "!pip install \"ag2\" \"fastapi>=0.115.0,<1\" \"uvicorn>=0.30.6,<1\"" + "!pip install \"ag2\" \"fastapi>=0.115.0,<1\" \"uvicorn>=0.30.6,<1\" \"flaml[automl]\"" ] }, { @@ -81,7 +81,7 @@ "from fastapi.templating import Jinja2Templates\n", "\n", "import autogen\n", - "from autogen.agentchat.realtime_agent import RealtimeAgent, WebsocketAudioAdapter" + "from autogen.agentchat.realtime_agent import RealtimeAgent, WebSocketAudioAdapter" ] }, { @@ -237,7 +237,7 @@ "1. **Set Up the WebSocket Endpoint**: Define the `/media-stream` WebSocket route to handle audio streaming.\n", "2. **Accept WebSocket Connections**: Accept incoming WebSocket connections from clients.\n", "3. **Initialize Logger**: Retrieve a logger instance for logging purposes.\n", - "4. **Configure Audio Adapter**: Instantiate a `WebsocketAudioAdapter`, connecting the WebSocket to handle audio streaming with logging.\n", + "4. **Configure Audio Adapter**: Instantiate a `WebSocketAudioAdapter`, connecting the WebSocket to handle audio streaming with logging.\n", "5. **Set Up Realtime Agent**: Create a `RealtimeAgent` with the following:\n", " - **Name**: `Weather Bot`.\n", " - **System Message**: Introduces the AI assistant and its capabilities.\n", @@ -261,7 +261,7 @@ "\n", " logger = getLogger(\"uvicorn.error\")\n", "\n", - " audio_adapter = WebsocketAudioAdapter(websocket, logger=logger)\n", + " audio_adapter = WebSocketAudioAdapter(websocket, logger=logger)\n", " realtime_agent = RealtimeAgent(\n", " name=\"Weather Bot\",\n", " system_message=\"Hello there! I am an AI voice assistant powered by Autogen and the OpenAI Realtime API. You can ask me about weather, jokes, or anything you can imagine. Start by saying 'How can I help you'?\",\n", From c354b6a5c4344fa25fd5c2b57ab725e90d39fd39 Mon Sep 17 00:00:00 2001 From: Davor Runje Date: Thu, 2 Jan 2025 13:00:14 +0100 Subject: [PATCH 2/2] removed flaml[automl] from pip install --- notebook/agentchat_realtime_websocket.ipynb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/notebook/agentchat_realtime_websocket.ipynb b/notebook/agentchat_realtime_websocket.ipynb index 99521750fb..df67991714 100644 --- a/notebook/agentchat_realtime_websocket.ipynb +++ b/notebook/agentchat_realtime_websocket.ipynb @@ -51,7 +51,7 @@ "metadata": {}, "outputs": [], "source": [ - "!pip install \"ag2\" \"fastapi>=0.115.0,<1\" \"uvicorn>=0.30.6,<1\" \"flaml[automl]\"" + "!pip install \"ag2\" \"fastapi>=0.115.0,<1\" \"uvicorn>=0.30.6,<1\"" ] }, { @@ -65,7 +65,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -116,7 +116,7 @@ " \"No LLM found for the given model, please add the following lines to the OAI_CONFIG_LIST file:\"\n", " \"\"\"\n", " {\n", - " \"model\": \"gpt-4o-realtime-preview\",\n", + " \"model\": \"gpt-4o-mini-realtime-preview\",\n", " \"api_key\": \"sk-***********************...*\",\n", " \"tags\": [\"gpt-4o-mini-realtime\", \"realtime\"]\n", " }\"\"\"\n",