Skip to content

Commit e532340

Browse files
enystopenhands-agent
authored andcommitted
Normalize SDK errors for clients (#980)
Co-authored-by: openhands <[email protected]>
1 parent 40bd3f0 commit e532340

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

openhands-sdk/openhands/sdk/llm/exceptions/classifier.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"please reduce the length of",
1414
"the request exceeds the available context size",
1515
"context length exceeded",
16-
"input exceeds the context window",
1716
]
1817

1918

tests/sdk/llm/test_exception_classifier.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,10 @@ def test_is_context_window_exceeded_direct_type():
1919

2020
def test_is_context_window_exceeded_via_text():
2121
# BadRequest containing context-window-ish text should be detected
22-
e1 = BadRequestError(
22+
e = BadRequestError(
2323
"The request exceeds the available context size", MODEL, PROVIDER
2424
)
25-
e2 = BadRequestError(
26-
(
27-
"Your input exceeds the context window of this model. "
28-
"Please adjust your input and try again."
29-
),
30-
MODEL,
31-
PROVIDER,
32-
)
33-
assert is_context_window_exceeded(e1) is True
34-
assert is_context_window_exceeded(e2) is True
25+
assert is_context_window_exceeded(e) is True
3526

3627

3728
def test_is_context_window_exceeded_negative():

0 commit comments

Comments
 (0)