Skip to content

Commit 8f58b07

Browse files
committed
updated test
1 parent e253dcd commit 8f58b07

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

tests/test_handlers_llm_provider.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2467,11 +2467,17 @@ def test_compaction_with_tool_calls_does_not_break_api(model):
24672467
history = provider._histories.get(bot.__agent_id__, {})
24682468
tool_use_ids: set[str] = set()
24692469
for msg in history.values():
2470+
# Anthropic format: tool_use blocks in content
24702471
content = msg.get("content", "")
24712472
if isinstance(content, list):
24722473
for block in content:
24732474
if isinstance(block, dict) and block.get("type") == "tool_use":
24742475
tool_use_ids.add(block["id"])
2476+
# OpenAI format: tool_calls field on assistant messages
2477+
for tc in msg.get("tool_calls") or []:
2478+
tc_id = tc.get("id") if isinstance(tc, dict) else getattr(tc, "id", None)
2479+
if tc_id:
2480+
tool_use_ids.add(tc_id)
24752481

24762482
for msg in history.values():
24772483
if msg.get("role") == "tool":

0 commit comments

Comments
 (0)