Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,12 +4,13 @@ import os
|
|
| 4 |
|
| 5 |
# Retrieve the API key from the environment variable
|
| 6 |
api_key = os.environ.get('SECRET_TOKEN')
|
|
|
|
| 7 |
|
| 8 |
# Store conversation history
|
| 9 |
conversation_history = []
|
| 10 |
|
| 11 |
# Initialize the OpenAI client with your API key
|
| 12 |
-
client = openai.
|
| 13 |
api_key=api_key,
|
| 14 |
model="gpt-3.5-turbo-16k",
|
| 15 |
messages=conversation_history,
|
|
@@ -39,7 +40,7 @@ def chatbot(prompt):
|
|
| 39 |
ai_role = "Freya"
|
| 40 |
|
| 41 |
# Generate AI response with updated role and conversation history
|
| 42 |
-
response = chat_completion = client.chat.
|
| 43 |
model="gpt-3.5-turbo-16k",
|
| 44 |
messages=conversation_history,
|
| 45 |
max_tokens=350,
|
|
|
|
| 4 |
|
| 5 |
# Retrieve the API key from the environment variable
|
| 6 |
api_key = os.environ.get('SECRET_TOKEN')
|
| 7 |
+
openai.api_key = api_key
|
| 8 |
|
| 9 |
# Store conversation history
|
| 10 |
conversation_history = []
|
| 11 |
|
| 12 |
# Initialize the OpenAI client with your API key
|
| 13 |
+
client = openai.chat.completion.create(
|
| 14 |
api_key=api_key,
|
| 15 |
model="gpt-3.5-turbo-16k",
|
| 16 |
messages=conversation_history,
|
|
|
|
| 40 |
ai_role = "Freya"
|
| 41 |
|
| 42 |
# Generate AI response with updated role and conversation history
|
| 43 |
+
response = chat_completion = client.chat.completion.create(
|
| 44 |
model="gpt-3.5-turbo-16k",
|
| 45 |
messages=conversation_history,
|
| 46 |
max_tokens=350,
|