Conversation
…max_completion_tokens Presets saved by the v2.11 preset UI can carry max_completion_tokens in the Vision Model slot kwargs (OpenAI-style models). build_vision_model() unconditionally setdefault-ed max_tokens on top of those kwargs, so every litellm call carried both token keys and OpenAI rejected the request with: BadRequestError: Setting 'max_tokens' and 'max_completion_tokens' at the same time is not supported. This broke the native vision_load delegation path for such presets. Default whichever token key the preset already uses: max_completion_tokens when present, else max_tokens. No behavior change for presets without max_completion_tokens.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
Problem
With a Vision Model preset whose kwargs include
max_completion_tokens(as the v2.11 preset UI saves for OpenAI-style models), every vision-model call fails with:The native
vision_loaddelegation path is broken for these presets.Root cause
build_vision_model()unconditionallysetdefaultsmax_tokenson top of preset kwargs that already carrymax_completion_tokens; both keys reach the provider.Fix
Default whichever token key the preset already uses (
max_completion_tokenswhen present, elsemax_tokens). No behavior change for presets withoutmax_completion_tokens.Test
test_vision_model_does_not_duplicate_token_params— asserts the built vision model kwargs carry exactly one token key when the preset usesmax_completion_tokens.