fix(chat): raise ModelNotFoundError on legacy discovery-miss#996
Open
tudormatei1 wants to merge 1 commit into
Open
fix(chat): raise ModelNotFoundError on legacy discovery-miss#996tudormatei1 wants to merge 1 commit into
tudormatei1 wants to merge 1 commit into
Conversation
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.
|
There was a problem hiding this comment.
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 bareValueError) on discovery “model not found”. - Bump
uipath-llm-clientanduipath-langchain-clientminimum 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." | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


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 ValueErrorhandlers keep working.Bumps the uipath-llm-client / uipath-langchain-client floors to >=1.17.1 and the package version to 0.14.11.