Skip to content

fix: lazy bedrock import and BYO Anthropic token counting#104

Merged
andreiancuta-uipath merged 2 commits into
mainfrom
fix/bedrock-lazy-import-token-count
Jul 3, 2026
Merged

fix: lazy bedrock import and BYO Anthropic token counting#104
andreiancuta-uipath merged 2 commits into
mainfrom
fix/bedrock-lazy-import-token-count

Conversation

@andreiancuta-uipath

@andreiancuta-uipath andreiancuta-uipath commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

What changed and why

Fixes two regressions introduced in 1.15.1 (#103):

  1. Package unimportable without the bedrock extra. factory.py imported clients.bedrock.model_resolution at module level; importing that submodule executes clients/bedrock/__init__.py, which imports the extras-guarded chat_models.py — so import uipath_langchain_client raised ImportError: The 'bedrock' extra is required... for any install without langchain-aws/anthropic. CI didn't catch it because it installs --all-extras.

    • Fix: Extract the model_resolution module outside of the bedrock/ module, since it's actually pure and does not depend on the bedrock extra dependency.
  2. Added a test and CI step that tries to import the package without the extras installed. This should catch future regressions of this sort.

Affected packages

uipath-langchain-client 1.15.1

Verification

  • Both new tests watched failing with the exact regression errors before the fixes, passing after.
  • ruff check, ruff format, pyright: clean.
  • Full suite failure set is byte-identical to origin/main (local environment-only failures; zero introduced).

🤖 Generated with Claude Code

Comment thread packages/uipath_langchain_client/src/uipath_langchain_client/factory.py Outdated
@andreiancuta-uipath andreiancuta-uipath force-pushed the fix/bedrock-lazy-import-token-count branch from 5565e17 to ae5baf9 Compare July 3, 2026 15:37
@andreiancuta-uipath andreiancuta-uipath merged commit c795d87 into main Jul 3, 2026
12 checks passed
@andreiancuta-uipath andreiancuta-uipath deleted the fix/bedrock-lazy-import-token-count branch July 3, 2026 15:41
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.

2 participants