mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
fix(copilot): align service_helpers_test with prompt-too-long pattern removal
The max_tokens_exceeded pattern was intentionally removed from _PROMPT_TOO_LONG_PATTERNS (too broad, matches non-context errors). prompt_too_long_test.py correctly asserts it does NOT match, but service_helpers_test.py still expected it to match. Fix the test to align with the intended behavior.
This commit is contained in:
@@ -103,7 +103,6 @@ _PROMPT_TOO_LONG_PATTERNS: tuple[str, ...] = (
|
||||
"request too large",
|
||||
"maximum context length",
|
||||
"context_length_exceeded",
|
||||
"max_tokens_exceeded",
|
||||
"input tokens exceed",
|
||||
"input is too long",
|
||||
"content length exceeds",
|
||||
|
||||
@@ -41,8 +41,9 @@ class TestIsPromptTooLong:
|
||||
def test_context_length_exceeded(self) -> None:
|
||||
assert _is_prompt_too_long(Exception("context_length_exceeded")) is True
|
||||
|
||||
def test_max_tokens_exceeded(self) -> None:
|
||||
assert _is_prompt_too_long(Exception("max_tokens_exceeded")) is True
|
||||
def test_max_tokens_exceeded_not_matched(self) -> None:
|
||||
"""'max_tokens_exceeded' is intentionally excluded (too broad)."""
|
||||
assert _is_prompt_too_long(Exception("max_tokens_exceeded")) is False
|
||||
|
||||
def test_max_tokens_config_error_no_match(self) -> None:
|
||||
"""'max_tokens must be at least 1' should NOT match."""
|
||||
@@ -88,7 +89,6 @@ class TestIsPromptTooLong:
|
||||
"request too large",
|
||||
"maximum context length",
|
||||
"context_length_exceeded",
|
||||
"max_tokens_exceeded",
|
||||
"input tokens exceed",
|
||||
"input is too long",
|
||||
"content length exceeds",
|
||||
|
||||
Reference in New Issue
Block a user