Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Update truncate and summarize tests to check for sytem prompt t… #42

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion tests/test_summarizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,9 @@ def complete(self, model, system, messages, tools):
raise ValueError("ToolResult should not be the first message")

if len(messages) == 1 and messages[0].text == "a":
# adding a +1 for the "a"
return Message.assistant("Getting system prompt size"), Usage(
input_tokens=80, output_tokens=20, total_tokens=system_prompt_tokens
input_tokens=80 + 1, output_tokens=20, total_tokens=system_prompt_tokens + 1
)

for i in range(len(messages)):
Expand Down Expand Up @@ -223,3 +224,4 @@ def test_summarizer_generic_conversation(conversation_exchange_instance: Exchang
assert checkpoints[-1].end_index == 29
assert conversation_exchange_instance.checkpoint_data.message_index_offset == 20
assert conversation_exchange_instance.provider.summarized_count == 12
assert conversation_exchange_instance.moderator.system_prompt_token_count == 100
4 changes: 3 additions & 1 deletion tests/test_truncate.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ def complete(self, model, system, messages, tools):
raise ValueError("ToolResult should not be the first message")

if len(messages) == 1 and messages[0].text == "a":
# adding a +1 for the "a"
return Message.assistant("Getting system prompt size"), Usage(
input_tokens=80, output_tokens=20, total_tokens=SYSTEM_PROMPT_TOKENS
input_tokens=80 + 1, output_tokens=20, total_tokens=SYSTEM_PROMPT_TOKENS + 1
)

for i in range(len(messages)):
Expand Down Expand Up @@ -128,3 +129,4 @@ def test_truncate_on_generic_conversation(conversation_exchange_instance: Exchan
i += 2
# ensure the total token count is not anything exhorbitant
assert conversation_exchange_instance.checkpoint_data.total_token_count < 700
assert conversation_exchange_instance.moderator.system_prompt_token_count == 100