frkhan commited on
Commit
f4efd15
·
1 Parent(s): 57996a3

-- Introduced Guardrail against searching harmful content.

Browse files
app.py CHANGED
@@ -181,6 +181,15 @@ with gr.Blocks() as gradio_ui:
181
 
182
 
183
  with gr.Column():
 
 
 
 
 
 
 
 
 
184
  gr.HTML("""
185
  <div style="padding: 12px; border: 1px solid #d32f2f; background-color: #ffebee; border-radius: 8px; margin-bottom: 15px;">
186
  <p style="margin: 0; color: #c62828; font-weight: 500;">
 
181
 
182
 
183
  with gr.Column():
184
+ gr.HTML("""
185
+ <div style="padding: 12px; border: 1px solid #e65100; background-color: #fff3e0; border-radius: 8px; margin-bottom: 15px;">
186
+ <p style="margin: 0; color: #d84315; font-weight: 500;">
187
+ 🚫 <code style="background-color: #ffcc80; color: #d84315; padding: 2px 5px; border-radius: 4px; font-weight: 600;">Content Warning:</code>
188
+ This tool is for educational purposes only. Do not use it to access or scrape adult, NSFW, illegal, or otherwise harmful websites.
189
+ The system is designed to detect and block such content. Misuse may result in being blocked from the service.
190
+ </p>
191
+ </div>
192
+ """)
193
  gr.HTML("""
194
  <div style="padding: 12px; border: 1px solid #d32f2f; background-color: #ffebee; border-radius: 8px; margin-bottom: 15px;">
195
  <p style="margin: 0; color: #c62828; font-weight: 500;">
docker-compose.dev.yml CHANGED
@@ -1,7 +1,5 @@
1
- version: '3.8'
2
-
3
  services:
4
- semantic-search-app:
5
  build:
6
  context: .
7
  dockerfile: Dockerfile.dev # Use the development Dockerfile for local development
 
 
 
1
  services:
2
+ llm-web-scrapper:
3
  build:
4
  context: .
5
  dockerfile: Dockerfile.dev # Use the development Dockerfile for local development
docker-compose.yml CHANGED
@@ -1,7 +1,5 @@
1
- version: '3.8'
2
-
3
  services:
4
- semantic-search-app:
5
  build:
6
  context: .
7
  dockerfile: Dockerfile
 
 
 
1
  services:
2
+ llm-web-scrapper:
3
  build:
4
  context: .
5
  dockerfile: Dockerfile
llm_inference_service.py CHANGED
@@ -56,7 +56,10 @@ def extract_page_info_by_llm(user_query: str, scraped_markdown_content: str, mod
56
 
57
  prompt = f"""
58
  You are an expert assistant who can extract useful information from the content provided to you. Most of the time,
59
- the content will be product pages from e-commerce websites. Users will ask you to extract product information such as product name, price, rating, etc.
 
 
 
60
 
61
  Please provide your identity (model name and provider if applicable) at the beginning of your answer.
62
 
 
56
 
57
  prompt = f"""
58
  You are an expert assistant who can extract useful information from the content provided to you. Most of the time,
59
+ the content will be from e-commerce websites, and users will ask you to extract product information like product name, price, rating, etc.
60
+
61
+ **Safety Guardrails:**
62
+ You have a strict policy against processing harmful content. If the user's query or the provided context involves any of the following topics, you must strictly refuse to answer: adult content, NSFW, sexual topics (including nude or semi-nude magazines/websites), gambling, dark web, child assault, sex trafficking, or any other illegal activities. Instead, you must respond with only this exact message: "Warning: The requested content is inappropriate and violates the safety guidelines. This tool cannot be used for such purposes." Do not provide any other information.
63
 
64
  Please provide your identity (model name and provider if applicable) at the beginning of your answer.
65