Skip to content

[litellm-agent] Staging → litellm_internal_staging (5/14/2026) - #27895

Closed
oss-pr-review-agent-shin[bot] wants to merge 3 commits into
litellm_internal_stagingfrom
shin_agent_oss_staging_05_14_2026
Closed

[litellm-agent] Staging → litellm_internal_staging (5/14/2026)#27895
oss-pr-review-agent-shin[bot] wants to merge 3 commits into
litellm_internal_stagingfrom
shin_agent_oss_staging_05_14_2026

Conversation

@oss-pr-review-agent-shin

@oss-pr-review-agent-shin oss-pr-review-agent-shin Bot commented May 14, 2026

Copy link
Copy Markdown
Contributor

Squash-merged by litellm-agent from oss-agent-shin's PR.
@oss-pr-review-agent-shin

Copy link
Copy Markdown
Contributor Author

@greptile please review

@CLAassistant

CLAassistant commented May 14, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ Cyberfilo
❌ oss-agent-shin
You have signed the CLA already but the status is still pending? Let us recheck it.

@greptile-apps

greptile-apps Bot commented May 14, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This merge batch delivers two changes: a docstring addition to _disable_debugging() and a fix for Anthropic /v1/messages requests that 400 when conversation history contains empty text blocks alongside tool_use blocks.

  • strip_empty_text_blocks_from_anthropic_messages is added to common_utils.py and called at the top of anthropic_messages(), bringing the native Messages path in line with the guard already present in the /v1/chat/completions path.
  • jp.anthropic.claude-sonnet-4-6 is added to model_prices_and_context_window.json with the same capability flags and pricing as the au./eu. regional profiles, backed by a new config pin test.

Confidence Score: 5/5

Safe to merge — both changes are narrowly scoped, well-tested with mock-only tests, and do not touch auth or critical request routing.

The empty-text-block sanitizer is non-mutating, correctly implemented, and covered by six unit tests plus an integration-level regression test. The JSON model entry is consistent with the other regional profiles and is validated by a new config pin test. The docstring change is cosmetic.

No files require special attention.

Important Files Changed

Filename Overview
litellm/_logging.py Adds a one-line docstring to _disable_debugging() — cosmetic only, no functional change.
litellm/llms/anthropic/common_utils.py Adds strip_empty_text_blocks_from_anthropic_messages and _is_empty_text_block helpers; logic is correct, non-mutating, and well-documented.
litellm/llms/anthropic/experimental_pass_through/messages/handler.py Applies the new empty-text-block sanitizer at the entry point of anthropic_messages() before any backend dispatch, mirroring the guard already in the /v1/chat/completions path.
model_prices_and_context_window.json Adds jp.anthropic.claude-sonnet-4-6 entry matching the capability and pricing of the existing au./eu. regional profiles; intentionally omits cache_creation_input_token_cost_above_1hr which only us. carries.
tests/test_litellm/llms/anthropic/test_anthropic_common_utils.py Adds six pure unit tests for strip_empty_text_blocks_from_anthropic_messages, covering the core regression scenario, whitespace/null/missing text, non-mutation, and block-type preservation.
tests/test_litellm/llms/anthropic/experimental_pass_through/messages/test_anthropic_experimental_pass_through_messages_handler.py Adds a regression test verifying that anthropic_messages() forwards sanitized messages to the backend handler; uses mocks only, no real network calls.
tests/test_litellm/test_claude_sonnet_4_6_config.py New test file that pins the expected set of Bedrock region-prefixed claude-sonnet-4-6 entries and validates that jp. pricing matches au.; reads local JSON, no network calls.

Reviews (3): Last reviewed commit: "Sanitize empty text content blocks on /v..." | Re-trigger Greptile

@codecov

codecov Bot commented May 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

…27831)

Squash-merged by litellm-agent from Cyberfilo's PR.
@oss-pr-review-agent-shin

Copy link
Copy Markdown
Contributor Author

@greptile please review

Squash-merged by litellm-agent from Cyberfilo's PR.
@oss-pr-review-agent-shin

Copy link
Copy Markdown
Contributor Author

@greptile please review

@Sameerlite Sameerlite closed this May 18, 2026
@Sameerlite
Sameerlite deleted the shin_agent_oss_staging_05_14_2026 branch May 22, 2026 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants