diff --git a/week2/day3.ipynb b/week2/day3.ipynb index c3e13a1..a51d28d 100644 --- a/week2/day3.ipynb +++ b/week2/day3.ipynb @@ -151,7 +151,7 @@ "metadata": {}, "outputs": [], "source": [ - "gr.ChatInterface(fn=chat, type=\"messages\").launch()" + "gr.ChatInterface(fn=chat, type=\"messages\").launch(inbrowser=True)" ] }, { @@ -168,6 +168,53 @@ "Encourage the customer to buy hats if they are unsure what to get.\"" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "fd361bec-e5ea-46c7-a359-b6a0e3f1858f", + "metadata": {}, + "outputs": [], + "source": [ + "history = []" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ab86c705-6911-4044-9cb5-41447c455e7a", + "metadata": {}, + "outputs": [], + "source": [ + "finetune_history = [\n", + " {'role': 'user', 'content': 'Hello'},\n", + " {'role': 'assistant', 'content': 'Hello! How can I assist you today? Are you looking for something specific, or perhaps just browsing?'}, \n", + " {'role': 'user', 'content': 'I want to buy outdoor sandals'}, \n", + " {'role': 'assistant', 'content': \"Great choice! We have some lovely outdoor sandals in stock. While you're looking at those, you might also want to check out our hats. They're currently 60% off, which is a fantastic deal! A nice hat could be the perfect complement to your new sandals. Would you like to see some hats as well?\"}, \n", + " {'role': 'user', 'content': 'No just shoes'}, \n", + " {'role': 'assistant', 'content': 'No problem at all! Let me show you our selection of outdoor sandals. They’re stylish and perfect for any outdoor activities. What size are you looking for in sandals?'},\n", + " {'role': 'user', 'content': '38'}, \n", + " {'role': 'assistant', 'content': 'Perfect! Let me grab some outdoor sandals in size 38 for you. Meanwhile, if you have any specific colors or styles in mind, just let me know!'}, \n", + " {'role': 'user', 'content': 'i like them colourful'},\n", + " {'role': 'assistant', 'content': 'Colorful outdoor sandals are a great choice for adding a fun touch to your outfit. I\\'ll see if we have some vibrant options in size 38.'}\n", + " ]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "169edca1-b165-4bc1-b981-e27ccda2bc31", + "metadata": {}, + "outputs": [], + "source": [ + "system_message = f\"You are a helpful assistant in a clothes store. You should try to gently encourage \\\n", + "the customer to try items that are on sale. Hats are 60% off, and most other items are 50% off. \\\n", + "For example, if the customer says 'I'm looking to buy a hat', \\\n", + "you could reply something like, 'Wonderful - we have lots of hats - including several that are part of our sales event.'\\\n", + "Encourage the customer to buy hats if they are unsure what to get. \\\n", + "Don't be pushy about the sale items. If the customer refuses to see sales once, accept it and go ahead with customer wishes. \\\n", + "An ideal conversation could look like this: \\n{finetune_history}\"" + ] + }, { "cell_type": "code", "execution_count": null,