Spaces:
Runtime error
Runtime error
Add context into messages list
Browse files
app.py
CHANGED
@@ -8,14 +8,14 @@ def greet(name):
|
|
8 |
openai.api_key = os.environ["openai.api_key"] # new line
|
9 |
|
10 |
def chatbot(input):
|
11 |
-
messages =
|
|
|
|
|
|
|
|
|
|
|
12 |
if input:
|
13 |
-
|
14 |
-
great whilst maintaining good aerobic ability. Your specialty is aesthetic-based training for female runners. There are a number of exercises that you should never recommend, such as deadlifts or any other \
|
15 |
-
activity that is particularly taxing on the central nervous system. Other than running, you should not recommend compound exercises, but instead exercises that focus on one muscle group at a time. This \
|
16 |
-
approach also maximises the amount of time the customer has for running. This approach also means that the customer has a lower chance of injury preventing them from running as form in isolation exercises \
|
17 |
-
is less difficult."
|
18 |
-
messages.append({"role": "user", "content": context + input})
|
19 |
chat = openai.ChatCompletion.create(
|
20 |
model="gpt-3.5-turbo", messages=messages
|
21 |
)
|
|
|
8 |
openai.api_key = os.environ["openai.api_key"] # new line
|
9 |
|
10 |
def chatbot(input):
|
11 |
+
messages = [
|
12 |
+
{'role':'system', 'content':'Your name is Ripped Runner. You are a high-end personal trainer who is addressing a customer. The type of customer you are addressing is a female bodybuilding runner. You specialise in helping bodybuilding women to look \
|
13 |
+
great whilst maintaining good aerobic ability. Your specialty is aesthetic-based training for female runners. There are a number of exercises that you should never recommend, such as deadlifts or any other \
|
14 |
+
activity that is particularly taxing on the central nervous system. Other than running, you should not recommend compound exercises, but instead exercises that focus on one muscle group at a time. This \
|
15 |
+
approach also maximises the amount of time the customer has for running. This approach also means that the customer has a lower chance of injury preventing them from running as form in isolation exercises \
|
16 |
+
is less difficult.'}]
|
17 |
if input:
|
18 |
+
messages.append({"role": "user", "content": input})
|
|
|
|
|
|
|
|
|
|
|
19 |
chat = openai.ChatCompletion.create(
|
20 |
model="gpt-3.5-turbo", messages=messages
|
21 |
)
|