Update app.py
Browse files
app.py
CHANGED
@@ -8,7 +8,7 @@ OPENAI_API_KEY = os.getenv('OPENAI_API_KEY')
|
|
8 |
if not OPENAI_API_KEY:
|
9 |
raise ValueError("API key not found. Please set the OPENAI_API_KEY environment variable.")
|
10 |
|
11 |
-
|
12 |
|
13 |
global_system_prompt = None
|
14 |
global_model = 'gpt-4'
|
@@ -57,7 +57,7 @@ def convert_history_to_openai_format(history):
|
|
57 |
|
58 |
def bot(history):
|
59 |
global global_model
|
60 |
-
response =
|
61 |
model=global_model,
|
62 |
messages=convert_history_to_openai_format(history)
|
63 |
)
|
|
|
8 |
if not OPENAI_API_KEY:
|
9 |
raise ValueError("API key not found. Please set the OPENAI_API_KEY environment variable.")
|
10 |
|
11 |
+
client = OpenAI(api_key=OPENAI_API_KEY)
|
12 |
|
13 |
global_system_prompt = None
|
14 |
global_model = 'gpt-4'
|
|
|
57 |
|
58 |
def bot(history):
|
59 |
global global_model
|
60 |
+
response = client.chat.completions.create(
|
61 |
model=global_model,
|
62 |
messages=convert_history_to_openai_format(history)
|
63 |
)
|