v2.2.1 (#403)
Co-authored-by: Quentin Torroba <quentin.torroba@mistral.ai> Co-authored-by: Vincent Guilloux <vincent.guilloux@mistral.ai> Co-authored-by: Thomas Kenbeek <thomas.kenbeek@mistral.ai> Co-authored-by: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
parent
ec7f3b25ea
commit
a560a47ce8
52 changed files with 1026 additions and 562 deletions
|
|
@ -535,6 +535,27 @@ class TestAutoCompactIntegration:
|
|||
|
||||
|
||||
class TestClearHistoryFullReset:
|
||||
@pytest.mark.asyncio
|
||||
async def test_clear_history_preserves_listeners(self) -> None:
|
||||
backend = FakeBackend(mock_llm_chunk(content="Response"))
|
||||
agent = build_test_agent_loop(config=make_config(), backend=backend)
|
||||
|
||||
listener_calls: list[int] = []
|
||||
agent.stats.add_listener(
|
||||
"context_tokens", lambda s: listener_calls.append(s.context_tokens)
|
||||
)
|
||||
|
||||
async for _ in agent.act("Hello"):
|
||||
pass
|
||||
|
||||
assert agent.stats.context_tokens > 0
|
||||
listener_calls.clear()
|
||||
|
||||
await agent.clear_history()
|
||||
|
||||
assert agent.stats.context_tokens == 0
|
||||
assert any(v == 0 for v in listener_calls)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_clear_history_fully_resets_stats(self) -> None:
|
||||
backend = FakeBackend(mock_llm_chunk(content="Response"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue