Repository navigation
Conversation
…or format Remove the `"block"` keyword requirement from is_anthropic_invalid_thinking_signature_error. The Vertex AI error format uses "messages.N.content.M.thinking.signature.str: Input should be a valid string" which contains "invalid", "signature", and "thinking" but not "block". The triple combination is already specific enough to avoid false positives. Fixes BerriAI#26005
|
|
Greptile SummaryThis PR relaxes the Confidence Score: 5/5Safe to merge — a one-line logic relaxation with a matching new test and no regressions to existing coverage. All findings are P2 (test coverage suggestion). The functional change is minimal and correct, no existing tests are weakened, and no real network calls are introduced. No files require special attention.
|
| Filename | Overview |
|---|---|
| litellm/llms/anthropic/common_utils.py | Removes the "block" keyword requirement from the thinking-signature error detector, allowing it to match the Vertex AI error format that omits the word "block" |
| tests/test_litellm/llms/anthropic/test_anthropic_common_utils.py | Adds a new positive test for the Vertex AI error format; existing positive and negative tests are preserved and unmodified |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[error_text received] --> B{empty?}
B -- yes --> C[return False]
B -- no --> D[lowercase error_text]
D --> E{"'invalid' in lower?"}
E -- no --> C
E -- yes --> F{"'signature' in lower?"}
F -- no --> C
F -- yes --> G{"'thinking' in lower?"}
G -- no --> C
G -- yes --> H[return True: self-heal strip thinking blocks and retry]
style H fill:#d4edda,stroke:#28a745
style C fill:#f8d7da,stroke:#dc3545
Comments Outside Diff (1)
-
tests/test_litellm/llms/anthropic/test_anthropic_common_utils.py, line 1170-1179 (link)Negative test doesn't cover relaxed condition
With the removal of the
"block"guard,"invalid"is now satisfied by the"invalid_request_error"error-type string rather than the human-readable message text. The existing negative tests only check empty input and a completely unrelated error string — neither exercises the scenario where a realinvalid_request_errorcontains"thinking"and"signature"in a non-thinking-block context. Adding one targeted negative case would confirm the triple-match is tight enough to avoid false positives.
Reviews (1): Last reviewed commit: "fix(anthropic): detect invalid thinking ..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
please help review @ishaan-berri , thanks |
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Summary
"block"keyword requirement fromis_anthropic_invalid_thinking_signature_error"messages.N.content.M.thinking.signature.str: Input should be a valid string"which contains"invalid","signature", and"thinking"but not"block"Test Plan
test_is_anthropic_invalid_thinking_signature_error_vertex_aiwith the Vertex AI error formatFixes #26005