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