import pandas as pd def format_df_to_string(df: pd.DataFrame, title: str) -> str: """Formats a pandas DataFrame into a markdown-like string for the prompt.""" if df is None or df.empty: return "" header = f"### {title}\n" rows = [] for _, row in df.iterrows(): if 'Done' in df.columns and 'Task' in df.columns: status = "[x]" if row['Done'] else "[ ]" rows.append(f"- {status} {row['Task']}") elif 'Term' in df.columns and 'Description' in df.columns: rows.append(f"- **{row['Term']}**: {row['Description']}") return header + "\n".join(rows) + "\n\n"