Abid Ali Awan commited on
Commit
e31c1a9
·
1 Parent(s): 0d6d0e1

Enhance README with detailed project description, features, tools used, and supported regulatory sources. Update RegRadarAgent to include memory context in report generation and modify UIHandler to display top past queries. This improves user experience by providing relevant historical insights during regulatory report generation.

Browse files
Files changed (3) hide show
  1. README.md +27 -1
  2. agents/reg_radar.py +12 -3
  3. agents/ui_handler.py +8 -3
README.md CHANGED
@@ -11,4 +11,30 @@ license: apache-2.0
11
  short_description: RegRadar watches the worlds regulators so you dont have to.
12
  ---
13
 
14
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  short_description: RegRadar watches the worlds regulators so you dont have to.
12
  ---
13
 
14
+ # RegRadar
15
+
16
+ RegRadar is an AI-powered regulatory compliance assistant that monitors global regulations so you don't have to. It helps compliance professionals, legal teams, and businesses stay up-to-date with the latest regulatory changes across industries and regions.
17
+
18
+ ## 🚀 Features
19
+ - **Automatic Query Type Detection**: Understands if your message is a regulatory compliance query or a general question, and selects the right tools.
20
+ - **Information Extraction**: Extracts key details (industry, region, keywords) from your queries for precise analysis.
21
+ - **Regulatory Web Crawler**: Crawls official regulatory websites (e.g., SEC, FDA, FTC, ESMA, BIS) for recent updates and compliance changes (last 30 days).
22
+ - **Regulatory Search Engine**: Searches across multiple sources for industry-specific compliance information and aggregates results.
23
+ - **Memory System**: Remembers past queries and responses, personalizing results for each session/user.
24
+ - **AI Analysis Engine**: Summarizes findings and generates actionable compliance recommendations and executive summaries.
25
+
26
+ ## 🛠️ Tools Used
27
+ - **Gradio**: For the interactive web UI.
28
+ - **OpenAI/KeywordsAI LLM**: For natural language understanding, information extraction, summarization, and LLM tracking.
29
+ - **Tavily**: For regulatory web crawling and search.
30
+ - **Mem0**: For session-based memory and personalization.
31
+
32
+ ## 🌍 Supported Regulatory Sources
33
+ - US: SEC, FDA, FTC, Federal Register, CFTC, FDIC, FINRA, Federal Reserve Board
34
+ - EU: ESMA, EBA, EIOPA, European Parliament, ECB
35
+ - Asia: Japan FSA, Reserve Bank of India
36
+ - Global: BIS, IMF, World Bank, OECD
37
+
38
+ ## 📺 Video Demo
39
+ [//]: # (TODO: Embed or link to the video demo here)
40
+
agents/reg_radar.py CHANGED
@@ -86,8 +86,17 @@ class RegRadarAgent:
86
  "memory_results": memory_results,
87
  }
88
 
89
- def generate_report(self, params, crawl_results):
90
- """Generate a comprehensive regulatory report"""
 
 
 
 
 
 
 
 
 
91
  if not crawl_results["results"]:
92
  summary_prompt = (
93
  f"No regulatory updates found for {params['industry']} in {params['region']} "
@@ -104,7 +113,7 @@ class RegRadarAgent:
104
 
105
  summary_prompt = f"""
106
  Create a comprehensive regulatory compliance report for {params["industry"]} industry in {params["region"]} region.
107
-
108
  Analyze these regulatory updates:
109
  {json.dumps(by_source, indent=2)}
110
 
 
86
  "memory_results": memory_results,
87
  }
88
 
89
+ def generate_report(self, params, crawl_results, memory_results=None):
90
+ """Generate a comprehensive regulatory report, including memory context if available"""
91
+ memory_context = ""
92
+ if memory_results:
93
+ # Format memory results for inclusion in the prompt (limit to 3 for brevity)
94
+ memory_context = "\n\n# 💾 Related Past Queries and Insights\n"
95
+ for i, mem in enumerate(memory_results[:3], 1):
96
+ memory_text = mem.get("memory", "N/A")
97
+ memory_context += f"\n**{i}. Memory:** {memory_text[:300]}...\n"
98
+ memory_context += "\nIncorporate any relevant insights from these past queries into your analysis.\n"
99
+
100
  if not crawl_results["results"]:
101
  summary_prompt = (
102
  f"No regulatory updates found for {params['industry']} in {params['region']} "
 
113
 
114
  summary_prompt = f"""
115
  Create a comprehensive regulatory compliance report for {params["industry"]} industry in {params["region"]} region.
116
+ {memory_context}
117
  Analyze these regulatory updates:
118
  {json.dumps(by_source, indent=2)}
119
 
agents/ui_handler.py CHANGED
@@ -134,12 +134,17 @@ class UIHandler:
134
 
135
  # Display memory results if available
136
  if memory_results:
 
 
 
 
 
137
  memory_msg = f"""
138
  <details>
139
  <summary><strong>💾 Related Past Queries</strong> - Click to expand</summary>
140
 
141
- Found {len(memory_results)} similar past queries in memory.
142
-
143
  </details>
144
  """
145
  history.append(ChatMessage(role="assistant", content=memory_msg))
@@ -159,7 +164,7 @@ Found {len(memory_results)} similar past queries in memory.
159
  streaming_content = ""
160
  history.append(ChatMessage(role="assistant", content=""))
161
 
162
- for chunk in self.agent.generate_report(params, crawl_results):
163
  streaming_content += chunk
164
  history[-1] = ChatMessage(role="assistant", content=streaming_content)
165
  yield history, "", gr.update(interactive=False)
 
134
 
135
  # Display memory results if available
136
  if memory_results:
137
+ top_memories = memory_results[:3]
138
+ memory_details = ""
139
+ for i, mem in enumerate(top_memories, 1):
140
+ memory_text = mem.get("memory", "N/A")
141
+ memory_details += f"\n**{i}. Memory:** {memory_text[:300]}...\n"
142
  memory_msg = f"""
143
  <details>
144
  <summary><strong>💾 Related Past Queries</strong> - Click to expand</summary>
145
 
146
+ Found {len(memory_results)} similar past queries in memory. Top 3 shown below:
147
+ {memory_details}
148
  </details>
149
  """
150
  history.append(ChatMessage(role="assistant", content=memory_msg))
 
164
  streaming_content = ""
165
  history.append(ChatMessage(role="assistant", content=""))
166
 
167
+ for chunk in self.agent.generate_report(params, crawl_results, memory_results):
168
  streaming_content += chunk
169
  history[-1] = ChatMessage(role="assistant", content=streaming_content)
170
  yield history, "", gr.update(interactive=False)