NEOGRAPH_API asio::awaitable< CompactedHistory > compact_history(std::vector< ChatMessage > messages, Provider &provider, std::string model, int max_tokens=12000, int recent_keep=6)
Summarize old turns when the history exceeds a token budget.
NEOGRAPH_API int estimate_tokens(const std::vector< ChatMessage > &messages)
Rough token estimate for a message list.
NEOGRAPH_API void sanitize_tool_calls(std::vector< ChatMessage > &messages)
Repair OpenAI-invalid tool pairings in place.
Result of compact_history.
std::string summary
LLM summary of the compacted span ("" if none).
bool compacted
true iff a summary was produced.
std::vector< ChatMessage > recent
Leading system (if any) + summary-as-system + last N.