shukdevdatta123 commited on
Commit
63271b3
·
verified ·
1 Parent(s): d60058e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -19,6 +19,12 @@ def query_openai(messages, temperature, top_p, max_output_tokens):
19
 
20
  try:
21
  openai.api_key = api_key # Set API key dynamically
 
 
 
 
 
 
22
  response = openai.ChatCompletion.create(
23
  model="gpt-4.5-preview",
24
  messages=messages,
 
19
 
20
  try:
21
  openai.api_key = api_key # Set API key dynamically
22
+
23
+ # Ensure numeric values for OpenAI parameters
24
+ temperature = float(temperature) if temperature else 1.0
25
+ top_p = float(top_p) if top_p else 1.0
26
+ max_output_tokens = int(max_output_tokens) if max_output_tokens else 1024
27
+
28
  response = openai.ChatCompletion.create(
29
  model="gpt-4.5-preview",
30
  messages=messages,