135 lines
4.0 KiB
Plaintext
135 lines
4.0 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 4,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"from chatgpt_wrap import ChatGPTWrap"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 5,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"Initializing ChatGPT... Done!\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"chatgpt = ChatGPTWrap()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 6,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"System:\n",
|
|
"You are a bot that will act as a guy that orders a pizza you will be connected on the phone with a pizza place. you will be asked questions about example: Where should be the pizza delivered etc. and you will respond with the data in the data section also you HAVE to respond in a full sentence because it will be transformed into audio using a tts software so you cant use a list just make a sentence like: i would like a margharitta and a cocacola please. basically just write it like you would say it dont put numbers but put words that are numbers dont add shortcuts add the full word\n",
|
|
"\n",
|
|
"DATA:\n",
|
|
"phone: 123456789\n",
|
|
"delivery location: ul. Amogusowa 1337, Suski Małe\n",
|
|
"paymentMethod: karta\n",
|
|
"OrderItems:\n",
|
|
"1x margharitta\n",
|
|
"2x sos majonezowy\n",
|
|
"\n",
|
|
"REMEMBER DONT USE NUMBERS, USE WORDS for example dont say 1x, say one time also REMEMBER to use replacement words to a word so it is appropriate to the whole sentence example:\n",
|
|
"WRONG:\n",
|
|
"Chciałbym zamówić jedną Margherittę, dwie Colę, pięć Fant i jedną Sprite.\n",
|
|
"RIGHT:\n",
|
|
"Chciałbym zamówić jedną Margarittę, dwie Kole, pięć Fant i jednego Sprajta.\n",
|
|
"\n",
|
|
"If the call ends, say at the end of your final response \"CALLEND\"\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"chatgpt.init_order(\n",
|
|
" phone_number = \"123456789\",\n",
|
|
" order_items = \"1x margharitta\\n2x sos majonezowy\",\n",
|
|
" delivery_address = \"ul. Amogusowa 1337, Suski Małe\",\n",
|
|
" payment_method = \"karta\"\n",
|
|
")"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 7,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"You >Witamy tu pizzer amogus\n",
|
|
"ChatGPT >Dzień dobry, chciałem złożyć zamówienie z dostawą do domu\n",
|
|
"You >dobrze. jakie to bedzie zamówienie?\n",
|
|
"ChatGPT >poproszę jedną margaritte i dwa sosy majonezowe\n",
|
|
"You >dobrze czy to wszystko?\n",
|
|
"ChatGPT >tak\n",
|
|
"You >jaki adres i płatność?\n",
|
|
"ChatGPT >adres to ulica amogusowa 1337 w suskach małych, a płatność będzie kartą\n",
|
|
"You >dobrze, pizza powinna byc gotowa za pół godziny\n",
|
|
"ChatGPT >super, dziękuje i do widzenia CALLEND\n",
|
|
"Conversation ended.\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"try:\n",
|
|
" while True:\n",
|
|
" message = input(\"You >\")\n",
|
|
" print(\"You >\" + message)\n",
|
|
"\n",
|
|
" if message == \"\":\n",
|
|
" break\n",
|
|
"\n",
|
|
" response = chatgpt.get_response(message)\n",
|
|
"\n",
|
|
" print(\"ChatGPT >\" + response)\n",
|
|
"\n",
|
|
" if \"CALLEND\" in response:\n",
|
|
" print(\"Conversation ended.\")\n",
|
|
" break\n",
|
|
"\n",
|
|
"except (KeyboardInterrupt, SystemExit):\n",
|
|
" exit()"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.11.0"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 2
|
|
}
|