feat: Update query processing guidelines for fund ID retrieval and clarify terminology

This commit is contained in:
2025-10-21 08:37:42 +00:00
parent 390ecee9ed
commit c5f68d6656
2 changed files with 15 additions and 4 deletions
+15 -4
View File
@@ -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,
BIN
View File
Binary file not shown.