mirror of
https://github.com/NCBM/plyngent.git
synced 2026-07-23 05:55:16 +08:00
core/agent+config: soft context budget in estimated tokens
Replace max_context_chars with max_context_tokens (default 200k est. tokens via char/4); compact and /status use the token budget.
This commit is contained in:
@@ -142,7 +142,7 @@ async def test_rounds(state: ReplState) -> None:
|
||||
assert state.agent.max_rounds == 40
|
||||
|
||||
|
||||
async def test_status_shows_context_chars(
|
||||
async def test_status_shows_context_tokens(
|
||||
state: ReplState, capsys: pytest.CaptureFixture[str]
|
||||
) -> None:
|
||||
from plyngent.lmproto.openai_compatible.model import UserChatMessage
|
||||
@@ -150,6 +150,7 @@ async def test_status_shows_context_chars(
|
||||
state.agent.messages = [UserChatMessage(content="hello")]
|
||||
assert await handle_slash(state, "/status") is True
|
||||
out = capsys.readouterr().out
|
||||
assert "context_tokens~=" in out
|
||||
assert "context_chars=" in out
|
||||
assert "tool_result_max=" in out
|
||||
assert str(state.workspace) in out
|
||||
|
||||
Reference in New Issue
Block a user