Skip to content

Commit

Permalink
Merge pull request #333 from ag2ai/0101_realtime_agent
Browse files Browse the repository at this point in the history
[RealtimeAgent Notebook] Fix dependencies and imports
  • Loading branch information
davorrunje authored Jan 2, 2025
2 parents 7778696 + c354b6a commit 461db25
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions notebook/agentchat_realtime_websocket.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -65,7 +65,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -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"
]
},
{
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down

0 comments on commit 461db25

Please sign in to comment.