fruitpicker01 commited on
Commit
9b5decc
·
verified ·
1 Parent(s): a68c099

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -75,7 +75,7 @@ def generate_standard_prompt(description, advantages, *selected_values):
75
  return prompt
76
 
77
  # Функции для генерации сообщений
78
- def generate_message_gpt4o(prompt, gpt4o_temperature=1):
79
  try:
80
  headers = {
81
  "Content-Type": "application/json",
@@ -89,7 +89,7 @@ def generate_message_gpt4o(prompt, gpt4o_temperature=1):
89
  }
90
  response = requests.post("https://api.openai.com/v1/chat/completions", json=data, headers=headers)
91
  response_data = response.json()
92
- return clean_message(response_data["choices"][0]["message"]["content"].strip()) + f" {temperature}"
93
  except Exception as e:
94
  return f"Ошибка при обращении к ChatGPT-4o-Latest: {e}"
95
 
@@ -103,7 +103,7 @@ def clean_message(message):
103
  return message
104
 
105
  # Обновленные функции генерации сообщений с учетом обрезки незаконченных предложений
106
- def generate_message_gigachat_pro(prompt, gigachat_pro_temperature=0.87):
107
  try:
108
  messages = [SystemMessage(content=prompt)]
109
  chat_pro = GigaChat(credentials=gc_key, model='GigaChat-Pro', max_tokens=68, temperature=gigachat_pro_temperature, verify_ssl_certs=False)
@@ -113,7 +113,7 @@ def generate_message_gigachat_pro(prompt, gigachat_pro_temperature=0.87):
113
  except Exception as e:
114
  return f"Ошибка при обращении к GigaChat-Pro: {e}"
115
 
116
- def generate_message_gigachat_lite(prompt, gigachat_lite_temperature=0.87):
117
  try:
118
  time.sleep(2)
119
  messages = [SystemMessage(content=prompt)]
@@ -124,7 +124,7 @@ def generate_message_gigachat_lite(prompt, gigachat_lite_temperature=0.87):
124
  except Exception as e:
125
  return f"Ошибка при обращении к GigaChat-Lite: {e}"
126
 
127
- def generate_message_gigachat_plus(prompt, gigachat_plus_temperature=0.87):
128
  try:
129
  time.sleep(2)
130
  messages = [SystemMessage(content=prompt)]
 
75
  return prompt
76
 
77
  # Функции для генерации сообщений
78
+ def generate_message_gpt4o(prompt, gpt4o_temperature):
79
  try:
80
  headers = {
81
  "Content-Type": "application/json",
 
89
  }
90
  response = requests.post("https://api.openai.com/v1/chat/completions", json=data, headers=headers)
91
  response_data = response.json()
92
+ return clean_message(response_data["choices"][0]["message"]["content"].strip())
93
  except Exception as e:
94
  return f"Ошибка при обращении к ChatGPT-4o-Latest: {e}"
95
 
 
103
  return message
104
 
105
  # Обновленные функции генерации сообщений с учетом обрезки незаконченных предложений
106
+ def generate_message_gigachat_pro(prompt, gigachat_pro_temperature):
107
  try:
108
  messages = [SystemMessage(content=prompt)]
109
  chat_pro = GigaChat(credentials=gc_key, model='GigaChat-Pro', max_tokens=68, temperature=gigachat_pro_temperature, verify_ssl_certs=False)
 
113
  except Exception as e:
114
  return f"Ошибка при обращении к GigaChat-Pro: {e}"
115
 
116
+ def generate_message_gigachat_lite(prompt, gigachat_lite_temperature):
117
  try:
118
  time.sleep(2)
119
  messages = [SystemMessage(content=prompt)]
 
124
  except Exception as e:
125
  return f"Ошибка при обращении к GigaChat-Lite: {e}"
126
 
127
+ def generate_message_gigachat_plus(prompt, gigachat_plus_temperature):
128
  try:
129
  time.sleep(2)
130
  messages = [SystemMessage(content=prompt)]