From b631ce340d065ac49afe0a07b525ca88f2c0b844 Mon Sep 17 00:00:00 2001 From: Looki2000 Date: Mon, 4 Dec 2023 14:33:47 +0100 Subject: [PATCH] fixed VERY CRITICAL system instructions formating error --- frontend/chatgpt_wrap.py | 21 +++++++++++---------- frontend/system_instructions.txt | 9 +++++---- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/frontend/chatgpt_wrap.py b/frontend/chatgpt_wrap.py index 8814392..7b07af6 100644 --- a/frontend/chatgpt_wrap.py +++ b/frontend/chatgpt_wrap.py @@ -1,13 +1,6 @@ import random from dupa import dupa import openai -# -# -#data = [{ -# "role": "system", -# "content": "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\nDATA:\nphone: 103 870 844\ndelivery location: ul. Zielona 98/3, Kurwiszynów\npaymentMethod: gotówka\n2x Pizza Prościutto\n3x Pizza Pesto\n3x Lemoniada\n3x Sos Łagodny\n\nREMEMBER 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:\nWRONG:\nChciałbym zamówić jedną Margherittę, dwie Colę, pięć Fant i jedną Sprite.\nRIGHT:\nChciałbym zamówić jedną Margarittę, dwie Kole, pięć Fant i jednego Sprajta.\n\nIf the call ends, say at the end of your final response \"CALLEND\"", -#}] -#while True: class ChatGPTWrap: @@ -51,10 +44,13 @@ class ChatGPTWrap: self.system_inst = self.system_inst_template.format( phone_number = self.phone_number, order_items = self.order_items, - delivery_address = self.delivery_address, + delivery_location = self.delivery_address, payment_method = self.payment_method ) + print("System:") + print(self.system_inst) + #### true openai chat gpt system instructions initialization stuff below #### ##### (everything that needs to be done each assistant session like some chat gpt conversation cleanup) #### @@ -74,8 +70,13 @@ class ChatGPTWrap: ) chat = self.client.chat.completions.create( - model="gpt-3.5-turbo", messages=self.chat_history, - stop=["CALLEND"] + model="ft:gpt-3.5-turbo-1106:personal::8QBgBttE", + messages=self.chat_history, + temperature=0.57, + max_tokens=256, + top_p=1, + frequency_penalty=0, + presence_penalty=0 ) reply = chat.choices[0].message.content diff --git a/frontend/system_instructions.txt b/frontend/system_instructions.txt index 93e01e4..1a688e7 100644 --- a/frontend/system_instructions.txt +++ b/frontend/system_instructions.txt @@ -1,10 +1,11 @@ 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 DATA: -phone: {{phone_number}} -delivery location: {{delivery_location}} -paymentMethod: {{payment_method}} -{{order_items}} +phone: {phone_number} +delivery location: {delivery_location} +paymentMethod: {payment_method} +OrderItems: +{order_items} 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: WRONG: