Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -130,25 +130,25 @@ def launch_bot():
|
|
130 |
|
131 |
agree = st.checkbox('Escalate this response to Premium')
|
132 |
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
# Change this to include OpenAI_API key
|
138 |
# Function to get the assistant's response
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
|
153 |
|
154 |
if __name__ == "__main__":
|
|
|
130 |
|
131 |
agree = st.checkbox('Escalate this response to Premium')
|
132 |
|
133 |
+
if agree:
|
134 |
+
Print('OpenAI, Oh Great!')
|
135 |
+
with st.chat_message("assistant"):
|
136 |
+
with st.spinner("Thinking..."):
|
137 |
# Change this to include OpenAI_API key
|
138 |
# Function to get the assistant's response
|
139 |
+
completion = openai.ChatCompletion.create(
|
140 |
+
model="gpt-3.5-turbo",
|
141 |
+
messages=[
|
142 |
+
{"role": "system", "content": "You are a helpful Natural Farming assistant with extensive experience in accessible science and technical writing, and the heart of a teacher."},
|
143 |
+
{"role": "user", "content": prompt3}
|
144 |
+
]
|
145 |
+
)
|
146 |
+
|
147 |
+
response = completion.choices[0].message
|
148 |
+
st.write(response)
|
149 |
+
|
150 |
+
message = {"role": "assistant", "content": response}
|
151 |
+
st.session_state.messages.append(message)
|
152 |
|
153 |
|
154 |
if __name__ == "__main__":
|