From 57f46138ea8fd2045c6490813e920aea1b7a238a Mon Sep 17 00:00:00 2001
From: arunabeshc <39411643+arunabeshc@users.noreply.github.com>
Date: Mon, 7 Apr 2025 12:18:45 +0530
Subject: [PATCH] Enabling Alloy

Enabling Alloy
---
 .../AI Booking Chatbot.ipynb                  | 42 +++++++++++++++++--
 1 file changed, 39 insertions(+), 3 deletions(-)

diff --git a/week2/community-contributions/AI Booking Chatbot.ipynb b/week2/community-contributions/AI Booking Chatbot.ipynb
index 44406f2..827e832 100644
--- a/week2/community-contributions/AI Booking Chatbot.ipynb	
+++ b/week2/community-contributions/AI Booking Chatbot.ipynb	
@@ -316,7 +316,7 @@
     "def talker(message):\n",
     "    response = openai.audio.speech.create(\n",
     "        model=\"tts-1\",\n",
-    "        voice=\"onyx\",  # Also, try replacing onyx with alloy\n",
+    "        voice=\"alloy\",  # Also, try replacing with onyx\n",
     "        input=message\n",
     "    )\n",
     "    audio_stream = BytesIO(response.content)\n",
@@ -413,7 +413,7 @@
     "    history += [{\"role\":\"assistant\", \"content\":reply}]\n",
     "\n",
     "    # Comment out or delete the next line if you'd rather skip Audio for now..\n",
-    "    # talker(reply)\n",
+    "    talker(reply)\n",
     "    \n",
     "    # return history, image\n",
     "    return history"
@@ -644,13 +644,49 @@
      "name": "stdout",
      "output_type": "stream",
      "text": [
-      "{'london': '20', 'paris': '90', 'tokyo': '100', 'berlin': '2'}\n"
+      "{'london': '20', 'paris': '90', 'tokyo': '100', 'berlin': '2'}\n",
+      "ChatCompletionMessage(content=None, refusal=None, role='assistant', annotations=[], audio=None, function_call=None, tool_calls=[ChatCompletionMessageToolCall(id='call_ELqH6MFPXMfklfid2QhDQr8Z', function=Function(arguments='{\"destination_city\":\"London\"}', name='get_ticket_price'), type='function')])\n",
+      "Tool get_ticket_price called for London\n",
+      "ChatCompletionMessage(content=None, refusal=None, role='assistant', annotations=[], audio=None, function_call=None, tool_calls=[ChatCompletionMessageToolCall(id='call_dDP6CpaDUOkT8yzQbYQMjF5Q', function=Function(arguments='{\"destination_city\":\"Berlin\"}', name='get_ticket_price'), type='function')])\n",
+      "Tool get_ticket_price called for Berlin\n",
+      "ChatCompletionMessage(content=None, refusal=None, role='assistant', annotations=[], audio=None, function_call=None, tool_calls=[ChatCompletionMessageToolCall(id='call_F4l14muEmGWk1ZUqdLvH5xUc', function=Function(arguments='{\"destination_city\":\"Berlin\",\"price\":\"$499\",\"availability\":\"Available\"}', name='book_ticket'), type='function')])\n",
+      "Tool get_ticket_price called for Berlin\n",
+      "Tool get_ticket_availability called for Berlin\n",
+      "Tool book_function called for Berlin\n",
+      "ChatCompletionMessage(content=None, refusal=None, role='assistant', annotations=[], audio=None, function_call=None, tool_calls=[ChatCompletionMessageToolCall(id='call_j6hezbCfwk2EiGQArBfxFEwp', function=Function(arguments='{\"destination_city\":\"Berlin\",\"price\":\"$499\",\"availability\":\"Available\"}', name='book_ticket'), type='function')])\n",
+      "Tool get_ticket_price called for Berlin\n",
+      "Tool get_ticket_availability called for Berlin\n",
+      "Tool book_function called for Berlin\n"
      ]
     }
    ],
    "source": [
     "print(ticket_availability)"
    ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "id": "3d6638a5-ec46-4e98-912b-9408664bb200",
+   "metadata": {},
+   "outputs": [],
+   "source": []
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "id": "f8fd989c-6da8-4668-8992-62b1eefdba03",
+   "metadata": {},
+   "outputs": [],
+   "source": []
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "id": "181f3d17-322c-4f0d-b835-dd1b90ba6784",
+   "metadata": {},
+   "outputs": [],
+   "source": []
   }
  ],
  "metadata": {