fix: set litellm.drop_params to support non-OpenAI providers (#63)#85
Open
smwaqas89 wants to merge 1 commit intolm-sys:mainfrom
Open
fix: set litellm.drop_params to support non-OpenAI providers (#63)#85smwaqas89 wants to merge 1 commit intolm-sys:mainfrom
smwaqas89 wants to merge 1 commit intolm-sys:mainfrom
Conversation
Fixes lm-sys#63. Also addresses the issue in lm-sys#32. When using providers like Ollama or Groq as the weak model, litellm raises UnsupportedParamsError for parameters like presence_penalty that these providers don't support. Setting litellm.drop_params = True causes litellm to silently drop unsupported parameters, enabling seamless routing to any provider supported by litellm.
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.
Summary
Fixes #63. Also addresses the issue described in #32.
Problem
When using non-OpenAI providers (Ollama, Groq, local models) as the weak model, litellm raises
UnsupportedParamsErrorbecause parameters likepresence_penaltyandfrequency_penaltyare not supported by all providers.The
ChatCompletionRequestinopenai_server.pydefaults these to0.0, andmodel_dump(exclude_none=True)always includes them since they're notNone. When litellm forwards these to providers that don't support them, it crashes.Solution
Set
litellm.drop_params = Trueat module level incontroller.py. This is litellm's built-in mechanism for handling provider compatibility — unsupported parameters are silently dropped rather than raising errors.This enables RouteLLM to work seamlessly with any provider supported by litellm (Ollama, Groq, Together AI, local models, etc.) without requiring users to manually configure parameter handling.
Changes
routellm/controller.py: Addedimport litellmand setlitellm.drop_params = TrueTesting
drop_paramsflag is set on module loadUnsupportedParamsError