mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-06-13 19:06:01 +00:00
chore(todo): remove unused completion reminder counter (#3530)
This commit is contained in:
@@ -46,11 +46,6 @@ def _reminder_in_messages(messages: list[Any]) -> bool:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def _completion_reminder_count(messages: list[Any]) -> int:
|
|
||||||
"""Return the number of todo_completion_reminder HumanMessages in *messages*."""
|
|
||||||
return sum(1 for msg in messages if isinstance(msg, HumanMessage) and getattr(msg, "name", None) == "todo_completion_reminder")
|
|
||||||
|
|
||||||
|
|
||||||
def _format_todos(todos: list[Todo]) -> str:
|
def _format_todos(todos: list[Todo]) -> str:
|
||||||
"""Format a list of Todo items into a human-readable string."""
|
"""Format a list of Todo items into a human-readable string."""
|
||||||
lines: list[str] = []
|
lines: list[str] = []
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ from pydantic import PrivateAttr
|
|||||||
|
|
||||||
from deerflow.agents.middlewares.todo_middleware import (
|
from deerflow.agents.middlewares.todo_middleware import (
|
||||||
TodoMiddleware,
|
TodoMiddleware,
|
||||||
_completion_reminder_count,
|
|
||||||
_format_todos,
|
_format_todos,
|
||||||
_has_tool_call_intent_or_error,
|
_has_tool_call_intent_or_error,
|
||||||
_reminder_in_messages,
|
_reminder_in_messages,
|
||||||
@@ -189,10 +188,6 @@ class TestAbeforeModel:
|
|||||||
assert result["messages"][0].name == "todo_reminder"
|
assert result["messages"][0].name == "todo_reminder"
|
||||||
|
|
||||||
|
|
||||||
def _completion_reminder_msg():
|
|
||||||
return HumanMessage(name="todo_completion_reminder", content="finish your todos")
|
|
||||||
|
|
||||||
|
|
||||||
def _todo_completion_reminders(messages):
|
def _todo_completion_reminders(messages):
|
||||||
reminders = []
|
reminders = []
|
||||||
for message in messages:
|
for message in messages:
|
||||||
@@ -264,20 +259,6 @@ def _all_completed_todos():
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class TestCompletionReminderCount:
|
|
||||||
def test_zero_when_no_reminders(self):
|
|
||||||
msgs = [HumanMessage(content="hi"), _ai_no_tool_calls()]
|
|
||||||
assert _completion_reminder_count(msgs) == 0
|
|
||||||
|
|
||||||
def test_counts_completion_reminders(self):
|
|
||||||
msgs = [_completion_reminder_msg(), _completion_reminder_msg()]
|
|
||||||
assert _completion_reminder_count(msgs) == 2
|
|
||||||
|
|
||||||
def test_does_not_count_todo_reminders(self):
|
|
||||||
msgs = [_reminder_msg(), _completion_reminder_msg()]
|
|
||||||
assert _completion_reminder_count(msgs) == 1
|
|
||||||
|
|
||||||
|
|
||||||
class TestToolCallIntentOrError:
|
class TestToolCallIntentOrError:
|
||||||
def test_false_for_plain_final_answer(self):
|
def test_false_for_plain_final_answer(self):
|
||||||
assert _has_tool_call_intent_or_error(_ai_no_tool_calls()) is False
|
assert _has_tool_call_intent_or_error(_ai_no_tool_calls()) is False
|
||||||
|
|||||||
Reference in New Issue
Block a user