Skip to content

fix(chat): raise ModelNotFoundError on legacy discovery-miss#996

Open
tudormatei1 wants to merge 1 commit into
mainfrom
feat/model-not-found-error
Open

fix(chat): raise ModelNotFoundError on legacy discovery-miss#996
tudormatei1 wants to merge 1 commit into
mainfrom
feat/model-not-found-error

Conversation

@tudormatei1

Copy link
Copy Markdown

The legacy chat model factory raised a bare ValueError when a model was not returned by the discovery API, indistinguishable from other ValueErrors without matching on the error message text.

Raise uipath-llm-client's ModelNotFoundError instead (added in uipath-llm-client 1.17.1). It subclasses ValueError, so existing except ValueError handlers keep working.

Bumps the uipath-llm-client / uipath-langchain-client floors to >=1.17.1 and the package version to 0.14.11.

The legacy chat model factory raised a bare ValueError when a model was
not returned by the discovery API, indistinguishable from other
ValueErrors without matching on the error message text.

Raise uipath-llm-client's ModelNotFoundError instead (added in
uipath-llm-client 1.17.1). It subclasses ValueError, so existing
`except ValueError` handlers keep working.

Bumps the uipath-llm-client / uipath-langchain-client floors to >=1.17.1
and the package version to 0.14.11.
Copilot AI review requested due to automatic review settings July 17, 2026 13:14
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 90%)

See analysis details on SonarQube Cloud

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Updates the legacy chat model factory to raise a more specific exception when a requested model is not returned by the discovery API, aligning behavior with uipath-llm-client’s newer ModelNotFoundError while keeping backward compatibility with except ValueError handlers.

Changes:

  • Raise uipath.llm_client.utils.exceptions.ModelNotFoundError (instead of a bare ValueError) on discovery “model not found”.
  • Bump uipath-llm-client and uipath-langchain-client minimum versions to >=1.17.1.
  • Bump package version to 0.14.11.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/uipath_langchain/chat/_legacy/chat_model_factory.py Switches the “no matching models” error to ModelNotFoundError for clearer, typed handling.
pyproject.toml Raises dependency floors to ensure ModelNotFoundError is available and bumps package version.

Comment on lines 236 to 242
if not matching_models:
raise ValueError(
from uipath.llm_client.utils.exceptions import ModelNotFoundError

raise ModelNotFoundError(
f"model='{model}' and byo_connection_id={byo_connection_id}"
+ " is not available. It was not returned by the discovery API."
)
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