fix(exceptions): apply provider-name heuristic to single-positional B…#15
Merged
vitalii-dynamiq merged 1 commit intoMay 10, 2026
Merged
Conversation
…adRequestError
BadRequestError's docstring promises a SUPPORTED_PROVIDERS lookup to
disambiguate arcllm's ``(message, provider, model)`` from litellm's
``(message, model, llm_provider)``. The lookup was only wired into the
two-positional branch — a single positional was unconditionally stored as
``provider``.
That broke litellm callers using the most common pattern,
``BadRequestError("Bad input", "gpt-4o-mini")``, which silently landed as
``provider="gpt-4o-mini"`` instead of ``model="gpt-4o-mini"``. The fix
extends the same SUPPORTED_PROVIDERS heuristic to the single-arg branch.
Six new tests pin both shapes (provider-then-model, model-then-provider)
across one- and two-positional inputs plus the param-kwarg path. Full
unit suite: 798 passed.
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.
…adRequestError
BadRequestError's docstring promises a SUPPORTED_PROVIDERS lookup to disambiguate arcllm's
(message, provider, model)from litellm's(message, model, llm_provider). The lookup was only wired into the two-positional branch — a single positional was unconditionally stored asprovider.That broke litellm callers using the most common pattern,
BadRequestError("Bad input", "gpt-4o-mini"), which silently landed asprovider="gpt-4o-mini"instead ofmodel="gpt-4o-mini". The fix extends the same SUPPORTED_PROVIDERS heuristic to the single-arg branch.Six new tests pin both shapes (provider-then-model, model-then-provider) across one- and two-positional inputs plus the param-kwarg path. Full unit suite: 798 passed.
Note
Low Risk
Low risk: narrowly adjusts
BadRequestErrorpositional-argument parsing to avoid mislabeling model names as providers, with added unit tests covering the supported positional shapes andparampassthrough.Overview
Fixes
BadRequestErrorpositional-argument disambiguation to apply theSUPPORTED_PROVIDERSheuristic to single-positional calls, soBadRequestError(msg, "gpt-4o-mini")is treated asmodelrather than incorrectly landing inprovider.Adds a focused test suite to pin both arcllm and litellm positional shapes (one- and two-argument forms) and to ensure the
param=keyword continues to be preserved.Reviewed by Cursor Bugbot for commit b4a24b6. Bugbot is set up for automated code reviews on this repo. Configure here.