Spaces:
Running
Running
arvind6599
commited on
Commit
·
e22d08b
1
Parent(s):
0d68333
minor
Browse files
app.py
CHANGED
@@ -162,21 +162,21 @@ def submit_prompt(email, name, system_prompt_1, system_prompt_2, system_prompt_3
|
|
162 |
],
|
163 |
temperature=TEMPERATURE
|
164 |
)
|
165 |
-
|
166 |
except Exception as e:
|
167 |
-
|
168 |
|
169 |
# Check if the answer contains the user message tags.
|
170 |
-
if start_tag in
|
171 |
# Extract the content between the tags.
|
172 |
-
start_index =
|
173 |
-
end_index =
|
174 |
# Extract the answer between the tags and stop the execution for this question as the query is deemed irrelevant.
|
175 |
-
answer =
|
176 |
notRelevant = True
|
177 |
else:
|
178 |
# If no tags, treat the entire answer as the response.
|
179 |
-
output1 =
|
180 |
output2 = ""
|
181 |
|
182 |
for doc in docs:
|
|
|
162 |
],
|
163 |
temperature=TEMPERATURE
|
164 |
)
|
165 |
+
output1 = response.choices[0].message.content.strip()
|
166 |
except Exception as e:
|
167 |
+
output1 = f"Error during OpenAI API call: {str(e)}"
|
168 |
|
169 |
# Check if the answer contains the user message tags.
|
170 |
+
if start_tag in output1 and end_tag in output1:
|
171 |
# Extract the content between the tags.
|
172 |
+
start_index = output1.index(start_tag) + len(start_tag)
|
173 |
+
end_index = output1.index(end_tag)
|
174 |
# Extract the answer between the tags and stop the execution for this question as the query is deemed irrelevant.
|
175 |
+
answer = output1[start_index:end_index].strip()
|
176 |
notRelevant = True
|
177 |
else:
|
178 |
# If no tags, treat the entire answer as the response.
|
179 |
+
output1 = output1.strip()
|
180 |
output2 = ""
|
181 |
|
182 |
for doc in docs:
|