Преглед изворни кода

model change to gpt-4o-mini

kevin пре 1 година
родитељ
комит
aeeb53d612
1 измењених фајлова са 7 додато и 7 уклоњено
  1. 7 7
      main.py

+ 7 - 7
main.py

@@ -23,7 +23,7 @@ app.openai_client = OpenAI(api_key=app.openai_key)
 
 app.chat_messages = [
     {"role": "system",
-     "content": "Please respond professionally and in a friendly manner, using the same language as the original request."}
+     "content": "Please respond professionally and in a friendly manner, using the same language as the original request. Use emoji responsibly."}
 ]
 app.translate_messages = [
     {"role": "system",
@@ -57,7 +57,7 @@ def test():
     return jsonify({"status": "0"})
 
 def roulette() -> str:
-    roulette_arr = [(80, "gpt-3.5-turbo"), (20, "gpt-4o")]
+    roulette_arr = [(80, "gpt-4o-mini"), (20, "gpt-4o")]
     rand_num = random.randrange(0, 99)
     model_name = ""
     n = 0
@@ -82,7 +82,7 @@ def recommend(headlines, category):
                                     """
         }
         chat_messages.append(json_payload)
-        json_response = app.openai_client.chat.completions.create(model="gpt-3.5-turbo",
+        json_response = app.openai_client.chat.completions.create(model="gpt-4o-mini",
                                                                   messages=chat_messages,
                                                                   response_format={"type": "json_object"}
                                                                   )
@@ -143,7 +143,7 @@ def gpt():
     assistant_id = ""
     assistant = None
     chat_messages = []
-    chat_model = "gpt-3.5-turbo"
+    chat_model = "gpt-4o-mini"
     use_video = False
     suggest = False
     summarize = False
@@ -213,7 +213,7 @@ def gpt():
                 "role": "user",
                 "content": islamic_message
             })
-            islamic_response = app.openai_client.chat.completions.create(model="gpt-3.5-turbo",  # GPT-3.5 Turbo engine
+            islamic_response = app.openai_client.chat.completions.create(model="gpt-4o-mini",
                                                                          messages=islam_messages,
                                                                          max_tokens=2, temperature=0.5)
             if 'Ya' in islamic_response.choices[0].message.content:
@@ -259,7 +259,7 @@ def gpt():
     result = {}
     try:
         n = num_choices
-        if "gpt-3.5-turbo" in chat_model:
+        if "gpt-3.5-turbo" or "gpt-4o-mini" in chat_model:
             chat_model = roulette()
         app.logger.info(f"Model used: {chat_model}")
         if assistant_id and not suggest:
@@ -434,7 +434,7 @@ def train_with_id(job_id):
 
 @app.route('/assistant/create', methods=['POST'])
 def assistant_create():
-    model_name = "gpt-3.5-turbo"
+    model_name = "gpt-4o-mini"
     assistant_name = "Assistant"
     assistant_ins = "Please respond professionally and in a friendly manner, using the same language as the original request."
     if request.is_json: