mirror of
https://github.com/Xe138/AI-Trader.git
synced 2026-04-01 17:17:24 -04:00
debug: add logging to verify conversation history capture
Added debug output to confirm: - How many messages are in conversation_history - How many assistant vs tool messages - Preview of first assistant message content - What the summarizer receives This will verify that the full detailed reasoning (like portfolio analysis, trade execution details) is being captured and passed to the summarizer. Output will show: [DEBUG] Generating summary from N messages [DEBUG] Assistant messages: X, Tool messages: Y [DEBUG] First assistant message preview: ... [DEBUG ReasoningSummarizer] Formatting N messages [DEBUG ReasoningSummarizer] Breakdown: X assistant, Y tool
This commit is contained in:
@@ -670,6 +670,15 @@ Summary:"""
|
||||
session_duration = time.time() - session_start
|
||||
|
||||
# 7. Generate reasoning summary
|
||||
# Debug: Log conversation history size
|
||||
print(f"\n[DEBUG] Generating summary from {len(self.conversation_history)} messages")
|
||||
assistant_msgs = [m for m in self.conversation_history if m.get('role') == 'assistant']
|
||||
tool_msgs = [m for m in self.conversation_history if m.get('role') == 'tool']
|
||||
print(f"[DEBUG] Assistant messages: {len(assistant_msgs)}, Tool messages: {len(tool_msgs)}")
|
||||
if assistant_msgs:
|
||||
first_assistant = assistant_msgs[0]
|
||||
print(f"[DEBUG] First assistant message preview: {first_assistant.get('content', '')[:200]}...")
|
||||
|
||||
summarizer = ReasoningSummarizer(model=self.model)
|
||||
summary = await summarizer.generate_summary(self.conversation_history)
|
||||
|
||||
|
||||
@@ -71,6 +71,12 @@ Provide a concise summary that includes the actual trades executed:"""
|
||||
Returns:
|
||||
Formatted text representation with emphasis on trades
|
||||
"""
|
||||
# Debug: Log what we're formatting
|
||||
print(f"[DEBUG ReasoningSummarizer] Formatting {len(reasoning_log)} messages")
|
||||
assistant_count = sum(1 for m in reasoning_log if m.get('role') == 'assistant')
|
||||
tool_count = sum(1 for m in reasoning_log if m.get('role') == 'tool')
|
||||
print(f"[DEBUG ReasoningSummarizer] Breakdown: {assistant_count} assistant, {tool_count} tool")
|
||||
|
||||
formatted_parts = []
|
||||
trades_executed = []
|
||||
|
||||
|
||||
Reference in New Issue
Block a user