fix: llm_provider alias + pyright cleanup (v0.4.5)#11
Merged
Conversation
Two surgical fixes from the dynamiq end-to-end validation pass: 1. ``ArcLLMError.__init__`` (and every subclass via ``**kwargs``) now accepts ``llm_provider=`` as a litellm-compat alias for ``provider=``. dynamiq's fallback-trigger test does ``RateLimitError(message=..., model=..., llm_provider="openai")`` — the litellm-canonical kwarg name. Explicit ``provider=`` still wins if both are passed, so arcllm-native callers see no behaviour change. 2. ``_DictLike.__getitem__`` and ``__contains__`` now annotate ``key`` as ``object`` (not ``str``). Pyright was flagging the runtime isinstance(key, str) check on the ``str``-typed signature as redundant — but the runtime check matters because ``dict()`` falls back to integer indexing when the mapping protocol isn't recognised, and the int needs to short-circuit to KeyError instead of crashing with TypeError. The looser annotation is the honest contract. Bumps to 0.4.5. Validation against dynamiq's unit suite drops from 13 → 1 fixable failure (the ``llm_provider`` test). Two remaining failures are dynamiq-test-fixture-side issues unrelated to arcllm contract: - ``test_action_parsing_failure_emits_tool_input_error_event`` — patches ``BaseLLM._completion`` (class) which is shadowed by the per-instance ``self._completion`` set in ``__init__``. The mock never applies; the real arcllm.completion runs and fails on a fake-key auth round-trip. - ``test_fa_stub_orphan_dropped`` — assertion ``role != MessageRole.TOOL`` vs identical TOOL values; test logic mismatch.
3bf3135 to
3048ed0
Compare
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.
Two surgical fixes from the dynamiq end-to-end validation. (1) ArcLLMError accepts
llm_provider=as litellm-compat alias forprovider=. (2)_DictLike.__getitem__/__contains__annotatekey: objectso pyright stops flagging the runtime isinstance check. Drops dynamiq's unit-test failure count from 13 → 2 (remaining 2 are test-fixture-side issues unrelated to arcllm). Bumps to 0.4.5.Note
Low Risk
Low risk compatibility tweaks: expands
ArcLLMErrorkwargs and adjusts dict-like typing/defaults to satisfy downstream fixtures, with small potential for edge-case behavior changes in error metadata or no-arg response construction.Overview
Improves LiteLLM drop-in compatibility by letting
ArcLLMError(and subclasses) acceptllm_provider=as an alias forprovider=(withprovidertaking precedence), and adds regression tests for this behavior.Cleans up typing around the
_DictLikemapping shim by acceptingkey: objectin__getitem__/__contains__(to matchdict()probing behavior), and makes several response structs (ModelResponse,StreamChunk,ImageResponse) constructible with no args by adding defaults. Bumps package version to0.4.5in__init__.pyandpyproject.toml.Reviewed by Cursor Bugbot for commit 3048ed0. Bugbot is set up for automated code reviews on this repo. Configure here.