From c5f68d66567abaeefaa489c132e54f78c3101552 Mon Sep 17 00:00:00 2001 From: michael Date: Tue, 21 Oct 2025 08:37:42 +0000 Subject: [PATCH] feat: Update query processing guidelines for fund ID retrieval and clarify terminology --- app/services/querying.py | 19 +++++++++++++++---- investors.db | Bin 27054080 -> 27054080 bytes 2 files changed, 15 insertions(+), 4 deletions(-) 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 59ed697527cff793d423e3fa59d167e40eba2b28..c3d9648ad30c565d9786ca2624d03dad6ccaeb88 100644 GIT binary patch delta 1867 zcmW;MReY8O6o7HRjqwc_yo}KsFgizf!-&z{HM+ZduO!iYr?#GxpP zp*TvQBub$);*o$dD2sAPM0r#|MN~p%R6$i#Lv_?ZP1HgX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