aquibmoin commited on
Commit
39d59b3
1 Parent(s): 0f87001

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -12,7 +12,7 @@ bi_model = AutoModel.from_pretrained(bi_encoder_model_name)
12
 
13
  # Set up OpenAI client
14
  api_key = os.getenv('OPENAI_API_KEY')
15
- openai.api_key = api_key
16
 
17
  # Define a system message to introduce Exos
18
  system_message = "You are Exos, a helpful assistant specializing in Exoplanet research. Provide detailed and accurate responses related to Exoplanet research."
@@ -36,7 +36,7 @@ def generate_response(user_input, relevant_context="", max_tokens=150, temperatu
36
  else:
37
  combined_input = f"Question: {user_input}\nAnswer:"
38
 
39
- response = openai.ChatCompletion.create(
40
  model="gpt-4",
41
  messages=[
42
  {"role": "system", "content": system_message},
 
12
 
13
  # Set up OpenAI client
14
  api_key = os.getenv('OPENAI_API_KEY')
15
+ client = OpenAI(api_key=api_key)
16
 
17
  # Define a system message to introduce Exos
18
  system_message = "You are Exos, a helpful assistant specializing in Exoplanet research. Provide detailed and accurate responses related to Exoplanet research."
 
36
  else:
37
  combined_input = f"Question: {user_input}\nAnswer:"
38
 
39
+ response = client.chat.completions.create(
40
  model="gpt-4",
41
  messages=[
42
  {"role": "system", "content": system_message},