Skip to content

fix: llm_provider alias + pyright cleanup (v0.4.5)#11

Merged
vitalii-dynamiq merged 1 commit into
mainfrom
fix/pyright-mapping-protocol-keys
May 6, 2026
Merged

fix: llm_provider alias + pyright cleanup (v0.4.5)#11
vitalii-dynamiq merged 1 commit into
mainfrom
fix/pyright-mapping-protocol-keys

Conversation

@vitalii-dynamiq

@vitalii-dynamiq vitalii-dynamiq commented May 6, 2026

Copy link
Copy Markdown
Contributor

Two surgical fixes from the dynamiq end-to-end validation. (1) ArcLLMError accepts llm_provider= as litellm-compat alias for provider=. (2) _DictLike.__getitem__/__contains__ annotate key: object so 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 ArcLLMError kwargs 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) accept llm_provider= as an alias for provider= (with provider taking precedence), and adds regression tests for this behavior.

Cleans up typing around the _DictLike mapping shim by accepting key: object in __getitem__/__contains__ (to match dict() probing behavior), and makes several response structs (ModelResponse, StreamChunk, ImageResponse) constructible with no args by adding defaults. Bumps package version to 0.4.5 in __init__.py and pyproject.toml.

Reviewed by Cursor Bugbot for commit 3048ed0. Bugbot is set up for automated code reviews on this repo. Configure here.

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.
@vitalii-dynamiq vitalii-dynamiq force-pushed the fix/pyright-mapping-protocol-keys branch from 3bf3135 to 3048ed0 Compare May 6, 2026 17:31
@vitalii-dynamiq vitalii-dynamiq merged commit 2610c4d into main May 6, 2026
14 of 15 checks passed
@vitalii-dynamiq vitalii-dynamiq deleted the fix/pyright-mapping-protocol-keys branch May 6, 2026 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant