Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -39,7 +39,8 @@ def chatbot_response_with_guardrails(message):
|
|
39 |
)
|
40 |
|
41 |
# Extract the response from TogetherAI's guardrail model
|
42 |
-
guardrail_check = response.choices[0].text.strip
|
|
|
43 |
|
44 |
# Step 3: Check for inappropriate content in the guardrail model's output
|
45 |
if 'toxic' in guardrail_check.lower() or any(
|
@@ -53,7 +54,7 @@ def chatbot_response_with_guardrails(message):
|
|
53 |
|
54 |
# If the response is safe, return the raw response
|
55 |
else:
|
56 |
-
return
|
57 |
|
58 |
except Exception as e:
|
59 |
return f"Error: {e}"
|
|
|
39 |
)
|
40 |
|
41 |
# Extract the response from TogetherAI's guardrail model
|
42 |
+
guardrail_check = response.choices[0].text.strip
|
43 |
+
print(guardrail_check)
|
44 |
|
45 |
# Step 3: Check for inappropriate content in the guardrail model's output
|
46 |
if 'toxic' in guardrail_check.lower() or any(
|
|
|
54 |
|
55 |
# If the response is safe, return the raw response
|
56 |
else:
|
57 |
+
return response
|
58 |
|
59 |
except Exception as e:
|
60 |
return f"Error: {e}"
|