We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cacc3a0 commit 42db4d1Copy full SHA for 42db4d1
1 file changed
src/smolagents/agents.py
@@ -873,13 +873,18 @@ def _debug_save_context(self, messages: list) -> None:
873
return
874
lines = []
875
for i, msg in enumerate(messages):
876
+ total_len = 0
877
lines.append(f"=== Message {i} | role={msg.role} ===")
878
if isinstance(msg.content, list):
879
for part in msg.content:
- lines.append(str(part))
880
+ str_part = str(part)
881
+ lines.append(str_part)
882
+ total_len += len(str_part)
883
else:
- lines.append(str(msg.content) if msg.content else "")
- lines.append("")
884
+ str_part = str(msg.content) if msg.content else ""
885
886
887
+ lines.append("LEN: "+str(total_len))
888
with open(f"/tmp/bpsa_debug_context_{os.getpid()}.txt", "w") as f:
889
f.write("\n".join(lines))
890
0 commit comments