Skip to content

fix(eval): stop stripping -community-agents model suffix before calling LLM Gateway#1803

Open
Chibionos wants to merge 3 commits into
mainfrom
fix/community-agents-model-suffix-llm-gateway
Open

fix(eval): stop stripping -community-agents model suffix before calling LLM Gateway#1803
Chibionos wants to merge 3 commits into
mainfrom
fix/community-agents-model-suffix-llm-gateway

Conversation

@Chibionos

Copy link
Copy Markdown
Contributor

Summary

LLM-judge evaluators (both current-gen and legacy) strip the -community-agents
suffix off the configured model name before calling UiPathLlmChatService. That
suffix is not cosmetic — Community/EU tenants' LLM Gateway routing rules are keyed
on the suffixed model id, the same id AgentHub sends unmodified when it runs
the agent itself. Stripping it before the eval call sends a bare model id the
Gateway has no EU routing rule for:

Status Code: 417
Message: "No llm routing rule found for product agentsplaygroundfallback in EU
using model gpt-5.4-2026-03-05 - check data residency configuration."

...even though the agent using the identical gpt-5.4-2026-03-05-community-agents
id runs fine, and the evaluator's own config has the identical suffixed id.

Confirmed via production trace: the "Autonomous Agent" span completes successfully
while the llm-judge-trajectory-eval-001 evaluator span 417s on the very same
model string minus the suffix.

The strip was introduced from-scratch in #483 (Jul 2025) with no recorded
rationale (no PR description/review comment references it), and was copy-pasted
into 3 more evaluator files as the eval framework grew. It never accounted for
Community/EU Gateway routing.

Changes

  • llm_as_judge_evaluator.py (LLMJudgeMixin._get_llm_response) — covers both
    current-gen uipath-llm-judge-output-semantic-similarity and
    uipath-llm-judge-trajectory-similarity evaluators (this is the exact path hit
    in the production incident).
  • legacy_llm_as_judge_evaluator.py, legacy_trajectory_evaluator.py — same strip,
    legacy evaluator classes.
  • legacy_evaluator_utils.py — removed the now-dead clean_model_name() helper
    and its two call sites in legacy_context_precision_evaluator.py /
    legacy_faithfulness_evaluator.py.

The COMMUNITY_agents_SUFFIX constant itself is left in place in
uipath.platform.constants (still covered by the backward-compat shim test) —
only its use inside these six evaluator call sites is removed.

Test plan

  • Added tests/evaluators/test_llm_judge_model_suffix.py — one test per fixed
    code path, mocking the LLM service and asserting the model id reaching
    chat_completions(...) matches the configured (suffixed) value exactly.
    Watched all 6 fail against the pre-fix code (bare model name), then pass
    after the fix.
  • Full uipath package test suite passes (uv run pytest, no regressions).
  • ruff check, ruff format --check, mypy clean on all touched files.

Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com

https://claude.ai/code/session_01P5DrPWsvEMA5UdzVtnsvuM

… Gateway

LLM-judge evaluators (current-gen and legacy) removed the
"-community-agents" suffix from the configured model name before calling
UiPathLlmChatService. That suffix is not cosmetic: Community/EU tenants'
LLM Gateway routing rules are keyed on the suffixed model id -- the same
id AgentHub sends unmodified when it runs the agent itself. Stripping it
sends a bare model id the Gateway has no EU routing rule for, causing a
417 "No llm routing rule found for product agentsplaygroundfallback in EU
using model ..." on every Community/EU evaluation run, even though the
identical model id works for the agent.

Removes the strip from llm_as_judge_evaluator.py (covers both the
output-similarity and trajectory current-gen judges),
legacy_llm_as_judge_evaluator.py, legacy_trajectory_evaluator.py, and the
shared clean_model_name() helper used by legacy_context_precision and
legacy_faithfulness evaluators.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P5DrPWsvEMA5UdzVtnsvuM
Copilot AI review requested due to automatic review settings July 7, 2026 20:44
@github-actions github-actions Bot added test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-integrations labels Jul 7, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes LLM-judge evaluators to pass the configured model ID to the LLM Gateway unchanged, specifically preserving the -community-agents suffix required for Community/EU routing rules.

Changes:

  • Removed -community-agents suffix stripping in both current-gen and legacy LLM-judge evaluator call paths.
  • Deleted the legacy clean_model_name() helper and updated its prior call sites to use the model value as-is.
  • Added regression tests to assert the exact model string is forwarded into chat_completions(...) for each affected evaluator path.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/uipath/src/uipath/eval/evaluators/llm_as_judge_evaluator.py Stop stripping -community-agents in LLMJudgeMixin._get_llm_response so the Gateway receives the configured model ID.
packages/uipath/src/uipath/eval/evaluators/legacy_llm_as_judge_evaluator.py Stop stripping -community-agents in the legacy LLM-as-a-judge evaluator request path.
packages/uipath/src/uipath/eval/evaluators/legacy_trajectory_evaluator.py Stop stripping -community-agents in the legacy trajectory evaluator request path.
packages/uipath/src/uipath/eval/evaluators/legacy_context_precision_evaluator.py Remove use of clean_model_name() and forward self.model directly.
packages/uipath/src/uipath/eval/evaluators/legacy_faithfulness_evaluator.py Remove use of clean_model_name() and forward self.model directly.
packages/uipath/src/uipath/eval/evaluators/legacy_evaluator_utils.py Remove now-dead clean_model_name() helper.
packages/uipath/tests/evaluators/test_llm_judge_model_suffix.py Add regression tests asserting the configured (suffixed) model ID is what reaches the LLM call for each fixed code path.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Patch release for the -community-agents suffix fix so it can publish to
PyPI once merged.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P5DrPWsvEMA5UdzVtnsvuM
- Fix mypy errors in the new suffix test: missing config_type /
  evaluation_criteria_type / justification_type on the legacy
  context-precision and faithfulness constructors, and use AsyncMock
  instead of SimpleNamespace for the .llm attribute (typed as
  UiPathLlmChatService | None).
- Drop the explanatory comments left over the four fixed call sites --
  the code (model = self.model) is self-evident on its own.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P5DrPWsvEMA5UdzVtnsvuM
@sonarqubecloud

sonarqubecloud Bot commented Jul 7, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

🚨 Heads up: uipath-langchain cross-tests are FAILING 🚨

Your changes may break the uipath-langchain-python integration.

⚠️ These checks are NOT enforced by branch protection rules. Please review the failures before merging.

🔍 Inspect the failed run →

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:uipath-integrations test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants