Spaces:
Runtime error
Runtime error
Add context to each prompt
Browse files
app.py
CHANGED
@@ -7,16 +7,16 @@ def greet(name):
|
|
7 |
|
8 |
openai.api_key = os.environ["openai.api_key"] # new line
|
9 |
|
10 |
-
messages = [
|
11 |
-
{'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 \
|
12 |
-
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 \
|
13 |
-
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 \
|
14 |
-
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 \
|
15 |
-
is less difficult.'}]
|
16 |
|
17 |
def chatbot(input):
|
18 |
if input:
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
20 |
chat = openai.ChatCompletion.create(
|
21 |
model="gpt-3.5-turbo", messages=messages
|
22 |
)
|
|
|
7 |
|
8 |
openai.api_key = os.environ["openai.api_key"] # new line
|
9 |
|
10 |
+
messages = []
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
def chatbot(input):
|
13 |
if input:
|
14 |
+
context = "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 \
|
15 |
+
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 \
|
16 |
+
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 \
|
17 |
+
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 \
|
18 |
+
is less difficult. "
|
19 |
+
messages.append({"role": "user", "content": context + input})
|
20 |
chat = openai.ChatCompletion.create(
|
21 |
model="gpt-3.5-turbo", messages=messages
|
22 |
)
|