Browse Source

Enabling Alloy

Enabling Alloy
pull/295/head
arunabeshc 1 month ago
parent
commit
57f46138ea
  1. 42
      week2/community-contributions/AI Booking Chatbot.ipynb

42
week2/community-contributions/AI Booking Chatbot.ipynb

@ -316,7 +316,7 @@
"def talker(message):\n", "def talker(message):\n",
" response = openai.audio.speech.create(\n", " response = openai.audio.speech.create(\n",
" model=\"tts-1\",\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", " input=message\n",
" )\n", " )\n",
" audio_stream = BytesIO(response.content)\n", " audio_stream = BytesIO(response.content)\n",
@ -413,7 +413,7 @@
" history += [{\"role\":\"assistant\", \"content\":reply}]\n", " history += [{\"role\":\"assistant\", \"content\":reply}]\n",
"\n", "\n",
" # Comment out or delete the next line if you'd rather skip Audio for now..\n", " # Comment out or delete the next line if you'd rather skip Audio for now..\n",
" # talker(reply)\n", " talker(reply)\n",
" \n", " \n",
" # return history, image\n", " # return history, image\n",
" return history" " return history"
@ -644,13 +644,49 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "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": [ "source": [
"print(ticket_availability)" "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": { "metadata": {

Loading…
Cancel
Save