feat: Add industry column to ProjectTable and update related schemas and query filters

This commit is contained in:
2025-10-23 12:52:52 +00:00
parent 483c2cc114
commit 1ac755b2d7
6 changed files with 89 additions and 3 deletions
+14 -3
View File
@@ -37,7 +37,7 @@ class QueryProcessor:
self.toolkit = SQLDatabaseToolkit(db=db, llm=self.llm)
# Update system message to specifically request only fund IDs
system_message_updated = (
prompt_template.format(dialect="SQLite", top_k=5)
prompt_template.format(dialect="SQLite", top_k=100)
+ "\n\n=== IMPORTANT TERMINOLOGY ==="
+ "\n- When users say 'investors' or 'find me investors', they mean FUNDS"
+ "\n- Always query the 'funds' table for investment opportunities"
@@ -51,8 +51,19 @@ class QueryProcessor:
+ "\n1. For geographic searches: use funds.geographic_focus"
+ "\n2. For sector searches: JOIN with fund_sectors table"
+ "\n3. For stage searches: JOIN with fund_investment_stages table"
+ "\n4. If no results: respond with 'NO_RESULTS'"
+ "\n5. Never repeat the same failed query"
+ "\n4. Return ALL matching fund IDs, not just the first few"
+ "\n5. If no results: respond with 'NO_RESULTS'"
+ "\n6. Never repeat the same failed query"
+ "\n\n=== GEOGRAPHIC SEARCH RULES (VERY IMPORTANT) ==="
+ "\n- ALWAYS use LIKE '%keyword%' for geographic searches, NEVER use exact equality (=)"
+ "\n- When user says 'Europe', match ANY location containing 'Europe' (e.g., 'Northern Europe', 'Western Europe', 'Europe', 'Central Europe')"
+ "\n- When user says 'America', match locations like 'North America', 'South America', 'Latin America', 'United States'"
+ "\n- When user says 'Asia', match 'Asia', 'Southeast Asia', 'East Asia', etc."
+ "\n- Examples:"
+ "\n * User: 'Europe' → SQL: WHERE geographic_focus LIKE '%Europe%'"
+ "\n * User: 'America' → SQL: WHERE geographic_focus LIKE '%America%'"
+ "\n * User: 'UK' → SQL: WHERE geographic_focus LIKE '%UK%' OR geographic_focus LIKE '%United Kingdom%'"
+ "\n- Be INCLUSIVE: capture all relevant regional variations"
)
self.agent = create_react_agent(
model=self.llm,