diff --git a/app/services/querying.py b/app/services/querying.py index de9bd97..252fce9 100644 --- a/app/services/querying.py +++ b/app/services/querying.py @@ -38,10 +38,21 @@ class QueryProcessor: # Update system message to specifically request only fund IDs system_message_updated = ( prompt_template.format(dialect="SQLite", top_k=5) - + "\n\nIMPORTANT: You must ONLY return the fund IDs (id field from the funds table) that match the user's criteria. " - + "Do NOT return any other information, explanations, or data. " - + "Your response should be ONLY a comma-separated list of numbers representing the fund IDs. " - + "Example format: 1, 5, 12, 23" + + "\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" + + "\n- The 'investors' table is for parent company information only" + + "\n- Relationship: investors (1) -> (many) funds" + + "\n\n=== YOUR TASK ===" + + "\nReturn ONLY fund IDs (funds.id) that match the user's criteria." + + "\nFormat: comma-separated numbers only (e.g., 1, 5, 12, 23)" + + "\nNo explanations, no other data." + + "\n\n=== QUERY GUIDELINES ===" + + "\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" ) self.agent = create_react_agent( model=self.llm, diff --git a/investors.db b/investors.db index 59ed697..c3d9648 100644 Binary files a/investors.db and b/investors.db differ