Repository navigation
fix(litellm): Support litellm 1.101+ and lift test upper bound - #8303
Draft
sentry-junior[bot] wants to merge 2 commits into
Draft
sentry-junior[bot] wants to merge 2 commits into
sentry-junior[bot] wants to merge 2 commits into
Conversation
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>
Contributor
Coverage Results 📊✅ 139741 passed | ⏭️ 7857 skipped | Total: 147598 | Pass Rate: 94.68% | Execution Time: 431m 43s 📊 Comparison with Base Branch
➖ Removed Tests (1)View removed tests
All tests are passing successfully. ❌ Patch coverage is 50.00% (2 of 4 changed executable lines covered; target 80%). Changed files with executable lines (1)
Generated by Coverage Action |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removes the
<=1.96upper bound from thelitellmtest suite and fixes the integration for newer litellm.What broke
openai_client.post("/chat/completions", ...)instead ofchat.completions.create(). The OpenAI integration no longer sees these calls, so the nested OpenAI span and its error event are gone.(kwargs, None, start_time, end_time), with the exception inkwargs["exception"]._failure_callbackpassedNonetoevent_from_exception, and litellm swallowed the resulting error. The OpenAI integration used to hide this. On 1.101+ these errors go unreported.claude-3-opus-20240229from its model map, so a bare model name no longer resolves to a provider.Messageis not fully defined BerriAI/litellm#36384).Changes
_failure_callbackreads the exception fromkwargs, so errors are reported with thelitellmmechanism on every litellm version.LiteLLMIntegrationdeactivates the auto-enabledOpenAIIntegration, aslangchain,openai_agents, andpydantic_aialready do. Otherwise litellm <1.101 would report OpenAI-backed calls and errors twice. Users who also callopenaidirectly can passOpenAIIntegration()explicitly.anthropic/claude-3-opus-20240229and no longer expect the OpenAI span.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 IDsched_57d71837349462e137066dfbc6e253e5:1794902400000, @sentrivana.--
View Session [Sentry]