Skip to content

fix(litellm): Support litellm 1.101+ and lift test upper bound - #8303

Draft
sentry-junior[bot] wants to merge 2 commits into
masterfrom
ci/lift-litellm-upper-bound-2026-11-17
Draft

sentry-junior[bot] wants to merge 2 commits into
masterfrom
ci/lift-litellm-upper-bound-2026-11-17

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Removes the <=1.96 upper bound from the litellm test suite and fixes the integration for newer litellm.

What broke

  • Since litellm 1.101.0, OpenAI chat requests use openai_client.post("/chat/completions", ...) instead of chat.completions.create(). The OpenAI integration no longer sees these calls, so the nested OpenAI span and its error event are gone.
  • The LiteLLM integration never reported errors itself. litellm calls failure callbacks as (kwargs, None, start_time, end_time), with the exception in kwargs["exception"]. _failure_callback passed None to event_from_exception, and litellm swallowed the resulting error. The OpenAI integration used to hide this. On 1.101+ these errors go unreported.
  • Newer litellm dropped claude-3-opus-20240229 from its model map, so a bare model name no longer resolves to a provider.
  • litellm 1.97.0 to 1.100.x is broken on Python 3.10 ([Bug]: pydantic.errors.PydanticUserError: Message is not fully defined BerriAI/litellm#36384).

Changes

  • _failure_callback reads the exception from kwargs, so errors are reported with the litellm mechanism on every litellm version.
  • Enabling LiteLLMIntegration deactivates the auto-enabled OpenAIIntegration, as langchain, openai_agents, and pydantic_ai already do. Otherwise litellm <1.101 would report OpenAI-backed calls and errors twice. Users who also call openai directly can pass OpenAIIntegration() explicitly.
  • Tests use anthropic/claude-3-opus-20240229 and no longer expect the OpenAI span.
  • litellm 1.97.0 to 1.100.x is no longer tested on Python 3.10.

Open question: do you want the OpenAI integration deactivated when LiteLLM is enabled? The alternative is to keep both and accept duplicate error events for OpenAI-backed calls on litellm <1.101.

via automation sched_57d71837349462e137066dfbc6e253e5 · Run ID sched_57d71837349462e137066dfbc6e253e5:1794902400000, @sentrivana.

--

View Session [Sentry]

sentry-junior Bot and others added 2 commits November 17, 2026 08:06
Remove the `<=1.96` include bound from the litellm test suite config and
regenerate the test matrix.
… 1.101+

litellm 1.101.0 sends OpenAI chat requests with openai_client.post()
instead of chat.completions.create(), so the OpenAI integration no longer
records a nested span or captures the error. The tests relied on that.

- Read the exception from kwargs in the failure callback. litellm passes
  None as the second argument, so the integration never reported errors
  itself.
- Deactivate the OpenAI integration when the LiteLLM integration is
  enabled, so older litellm versions don't report each call and error
  twice.
- Use the anthropic/ prefix in tests, since newer litellm no longer
  knows claude-3-opus-20240229.
- Don't test litellm 1.97.0-1.100.x on Python 3.10, where it is broken.

Co-Authored-By: Ivana Kellyer <131587164+sentrivana@users.noreply.github.com>
@sentry-junior sentry-junior Bot changed the title ci: Lift upper bound for litellm test suite fix(litellm): Support litellm 1.101+ and lift test upper bound Nov 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Coverage Results 📊

✅ 139741 passed | ⏭️ 7857 skipped | Total: 147598 | Pass Rate: 94.68% | Execution Time: 431m 43s

📊 Comparison with Base Branch

Metric Change
Total Tests 📈 +513
Passed Tests 📈 +514
Failed Tests 📉 -1
Skipped Tests —

➖ Removed Tests (1)

View removed tests
  • test_profile_captured
    • File: tests.profiler.test_transaction_profiler

All tests are passing successfully.

❌ Patch coverage is 50.00% (2 of 4 changed executable lines covered; target 80%).
Project statement coverage is 90.21%.

Changed files with executable lines (1)
File Patch coverage Changed executable lines
sentry_sdk/integrations/litellm.py 50.00% 2/4 covered; missed: 328, 329; partial branches: 327

Generated by Coverage Action

This branch has not been deployed

No deployments
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.

0 participants