Spaces:
Sleeping
Sleeping
Update data_planner.py
Browse files- data_planner.py +7 -0
data_planner.py
CHANGED
|
@@ -29,6 +29,13 @@ def determine_data_requirements(
|
|
| 29 |
f"Current participantId: '{participant_id or ''}'\n"
|
| 30 |
"Use this schema for all reasoning. It includes field names, types, and aliases:\n"
|
| 31 |
f"{json.dumps(schema)}\n\n"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
"Strictly return only a valid JSON object with keys: collections, filters, instruction. No explanation."
|
| 33 |
),
|
| 34 |
}
|
|
|
|
| 29 |
f"Current participantId: '{participant_id or ''}'\n"
|
| 30 |
"Use this schema for all reasoning. It includes field names, types, and aliases:\n"
|
| 31 |
f"{json.dumps(schema)}\n\n"
|
| 32 |
+
"PLANNING RULES:\n"
|
| 33 |
+
"- Choose collections ONLY if they contain the fields needed to answer.\n"
|
| 34 |
+
"- If the user asks about headcount/revenue history, choose 'participants' (fields: headcountHistory, revenueHistory).\n"
|
| 35 |
+
"- Apply companyCode ONLY on collections that have companyCode in the schema (do NOT add companyCode to 'participants').\n"
|
| 36 |
+
"- If an alias is used in the question, map it to the canonical field using $aliases.\n"
|
| 37 |
+
"- Return 'collections' as a list of objects [{'name': <collection>, 'fields': [<field1>, ...]}].\n"
|
| 38 |
+
"- 'filters' must only include fields that exist in the chosen collections.\n"
|
| 39 |
"Strictly return only a valid JSON object with keys: collections, filters, instruction. No explanation."
|
| 40 |
),
|
| 41 |
}
|