Skip to content

Fix: detect Anthropic-family models by name for BYOM (core + langchain)#64

Merged
cosminacho merged 5 commits intomainfrom
fix/anthropic-keyword-detection
Apr 17, 2026
Merged

Fix: detect Anthropic-family models by name for BYOM (core + langchain)#64
cosminacho merged 5 commits intomainfrom
fix/anthropic-keyword-detection

Conversation

@cosminacho
Copy link
Copy Markdown
Collaborator

@cosminacho cosminacho commented Apr 17, 2026

Summary

BYOM discovery does not expose modelFamily, so is_claude == (model_family == ANTHROPIC_CLAUDE) silently fell through for custom-named Claude deployments. Add a shared name-keyword heuristic in core and use it as a fallback everywhere modelFamily is the Claude signal.

  • Core: new is_anthropic_model_name() helper + ANTHROPIC_MODEL_NAME_KEYWORDS (anthropic, claude, opus, sonnet, haiku, mythos) in settings/constants.py.
  • LiteLLM client (client.py:220-232,248-250): is_claude and default-flavor resolution (Bedrock INVOKE, Vertex anthropic-claude) now fall back to the name heuristic when modelFamily is None. This fixes BYOM Claude routing.
  • Langchain factory (factory.py:174-178): Bedrock INVOKE routing uses the shared helper.
  • Langchain normalized client (normalized/chat_models.py:413-419): empty tool-call content workaround uses the shared helper.

Packages affected

  • uipath-llm-client 1.9.0 → 1.9.1 (new helper + litellm BYOM fix)
  • uipath-langchain-client 1.9.0 → 1.9.1; minimum core dep bumped to 1.9.1

Test plan

  • ruff check && ruff format
  • pyright
  • pytest tests (1514 passed, 736 skipped, 9 xpassed)

🤖 Generated with Claude Code

Expand the model-name heuristic to treat `anthropic`, `opus`, `sonnet`,
`haiku`, and `mythos` as Claude-family indicators alongside `claude`.
Applies to the Bedrock INVOKE factory routing and the normalized
client's empty tool-call content workaround.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
BYOM discovery does not expose modelFamily, so the LiteLLM client's
is_claude checks silently fell through for custom-named Claude
deployments. Extract the keyword heuristic into a shared
is_anthropic_model_name() helper in core and use it as a fallback
whenever modelFamily is None. Refactor the two langchain call sites
to consume the same helper.

Core 1.9.0 -> 1.9.1. Langchain now requires core >= 1.9.1.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@cosminacho cosminacho changed the title Fix: detect Anthropic-family models by additional name keywords Fix: detect Anthropic-family models by name for BYOM (core + langchain) Apr 17, 2026
constants.py is for enums and mappings, not utility functions.
Relocate the helper + keyword tuple to a dedicated utils module and
update all call sites to import from the new path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Expose the helper via uipath_langchain_client.utils alongside other
re-exported core utilities (exceptions, RetryConfig). Internal callers
now import from the package-local utils module instead of reaching
across to uipath.llm_client.utils.model_family directly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@cosminacho cosminacho merged commit 96b2a50 into main Apr 17, 2026
7 checks passed
@cosminacho cosminacho deleted the fix/anthropic-keyword-detection branch April 17, 2026 11:15
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