Skip to content

Commit

Permalink
[Internal] Update connection not found message to make it more clear (#…
Browse files Browse the repository at this point in the history
…2350)

# Description

This pull request includes changes to the
`src/promptflow/promptflow/executor/_tool_resolver.py` and
`src/promptflow/tests/executor/e2etests/test_executor_happypath.py`
files to improve error messaging and testing.

The main changes are:

*
[`src/promptflow/promptflow/executor/_tool_resolver.py`](diffhunk://#diff-714d8202b40acb4053e3f9b366ee4972b32f98afc8a2efe8a1750842f1facc65L350-R351):
The error message in the `ConnectionNotFound` exception raised in the
`_get_llm_node_connection` method has been updated to include the name
of the missing connection. This change will make it easier to debug
issues related to missing connections.
*
[`src/promptflow/tests/executor/e2etests/test_executor_happypath.py`](diffhunk://#diff-44d4009e9df8029bb88432b7a843d3a887764cd6a67070afc49557334af3cbaaL182-R182):
The assertion in the `test_executor_node_overrides` method has been
updated to reflect the change in the error message. This ensures that
the test will still pass with the updated error messaging.
# All Promptflow Contribution checklist:
- [ ] **The pull request does not introduce [breaking changes].**
- [ ] **CHANGELOG is updated for new features, bug fixes or other
significant changes.**
- [ ] **I have read the [contribution guidelines](../CONTRIBUTING.md).**
- [ ] **Create an issue and link to the pull request to get dedicated
review from promptflow team. Learn more: [suggested
workflow](../CONTRIBUTING.md#suggested-workflow).**

## General Guidelines and Best Practices
- [ ] Title of the pull request is clear and informative.
- [ ] There are a small number of commits, each of which have an
informative message. This means that previously merged commits do not
appear in the history of the PR. For more information on cleaning up the
commits in your PR, [see this
page](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md).

### Testing Guidelines
- [ ] Pull request includes test coverage for the included changes.

Co-authored-by: Heyi <[email protected]>
Co-authored-by: Brynn Yin <[email protected]>
  • Loading branch information
3 people authored Mar 14, 2024
1 parent cb2b5d2 commit 75ef3e8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/promptflow/promptflow/executor/_tool_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,8 @@ def _get_llm_node_connection(self, node: Node):
connection = self._connection_manager.get(node.connection)
if connection is None:
raise ConnectionNotFound(
message_format="Connection of LLM node '{node_name}' is not found.",
message_format="Connection '{connection}' of LLM node '{node_name}' is not found.",
connection=node.connection,
node_name=node.name,
target=ErrorTarget.EXECUTOR,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def test_executor_node_overrides(self, dev_connections):
raise_ex=True,
)
assert isinstance(e.value.inner_exception, ConnectionNotFound)
assert "Connection of LLM node 'classify_with_llm' is not found." in str(e.value)
assert "Connection 'dummy_connection' of LLM node 'classify_with_llm' is not found." in str(e.value)

@pytest.mark.parametrize(
"flow_folder",
Expand Down

0 comments on commit 75ef3e8

Please sign in to comment.