Aniruddha7 commited on
Commit
5bdbccd
·
1 Parent(s): c3eb2cc

refactor: convert last hardcoded SQL hint to _build_sql() for full consistency

Browse files
Files changed (1) hide show
  1. Agent/agentic_workflow.py +5 -6
Agent/agentic_workflow.py CHANGED
@@ -3127,12 +3127,11 @@ def query_craft(question: str) -> str:
3127
  _specific_dept_name = _rd # Use exact DB casing
3128
  break
3129
  if _specific_dept_name:
3130
- _specific_hint = (
3131
- f"SELECT COUNT(DISTINCT de.emp_no) AS employee_count\n"
3132
- f"FROM dept_emp de\n"
3133
- f"JOIN department d ON de.dept_no = d.dept_no\n"
3134
- f"WHERE d.dept_name = '{_specific_dept_name}'\n"
3135
- f"AND de.to_date IS NULL;"
3136
  )
3137
  print(f"[MICRO-HINT] Injecting specific-department employee count hint for: {_specific_dept_name}")
3138
  question = f"{question}\n\n# HINT: The following SQL may help, but do not copy blindly.\n{_specific_hint}"
 
3127
  _specific_dept_name = _rd # Use exact DB casing
3128
  break
3129
  if _specific_dept_name:
3130
+ _specific_hint = _build_sql(
3131
+ select_cols=["COUNT(DISTINCT de.emp_no) AS employee_count"],
3132
+ base_table="dept_emp de",
3133
+ joins=["JOIN department d ON de.dept_no = d.dept_no"],
3134
+ where=[f"d.dept_name = '{_specific_dept_name}'", "de.to_date IS NULL"]
 
3135
  )
3136
  print(f"[MICRO-HINT] Injecting specific-department employee count hint for: {_specific_dept_name}")
3137
  question = f"{question}\n\n# HINT: The following SQL may help, but do not copy blindly.\n{_specific_hint}"