fruitpicker01 commited on
Commit
0a0069b
·
verified ·
1 Parent(s): dfe4918

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -85,12 +85,13 @@ def generate_message_gpt4o(prompt, temperature):
85
  data = {
86
  "model": "chatgpt-4o-latest",
87
  "messages": [{"role": "system", "content": prompt}],
88
- "max_tokens": 101,
89
- "temperature": temperature # Передача температуры
90
  }
91
  response = requests.post("https://api.openai.com/v1/chat/completions", json=data, headers=headers)
92
  response_data = response.json()
93
- return clean_message(response_data["choices"][0]["message"]["content"].strip())
 
94
  except Exception as e:
95
  return f"Ошибка при обращении к ChatGPT-4o-Latest: {e}"
96
 
 
85
  data = {
86
  "model": "chatgpt-4o-latest",
87
  "messages": [{"role": "system", "content": prompt}],
88
+ "max_tokens": 101, # Значение max_tokens можно зафиксировать, если не нужно передавать его
89
+ "temperature": temperature # Используем переданное значение температуры
90
  }
91
  response = requests.post("https://api.openai.com/v1/chat/completions", json=data, headers=headers)
92
  response_data = response.json()
93
+ message = response_data["choices"][0]["message"]["content"].strip()
94
+ return clean_message(message)
95
  except Exception as e:
96
  return f"Ошибка при обращении к ChatGPT-4o-Latest: {e}"
97