Skip to content

Commit

Permalink
Add schema link for custom strong type connection (#835)
Browse files Browse the repository at this point in the history
# Description

Add schema link for custom strong type connection.

**vscode extension create connection test:**

![image](https://github.com/microsoft/promptflow/assets/75061414/1f1acd44-b803-4b92-b23f-f93763049bfa)

**flow test with connection:**

![image](https://github.com/microsoft/promptflow/assets/75061414/07150c90-dc0a-40b1-9ea3-a0defe464381)


# All Promptflow Contribution checklist:
- [x] **The pull request does not introduce [breaking changes].**
- [ ] **CHANGELOG is updated for new features, bug fixes or other
significant changes.**
- [x] **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
- [x] Title of the pull request is clear and informative.
- [x] 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: cs_lucky <[email protected]>
  • Loading branch information
chenslucky and cs_lucky authored Oct 23, 2023
1 parent eeb1df6 commit 6df5507
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/promptflow/promptflow/_utils/connection_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def generate_custom_strong_type_connection_spec(cls, package, package_version):

def generate_custom_strong_type_connection_template(cls, connection_spec, package, package_version):
connection_template_str = """
$schema: https://azuremlschemas.azureedge.net/promptflow/latest/CustomStrongTypeConnection.schema.json
name: "to_replace_with_connection_name"
type: custom
custom_type: {{ custom_type }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ def test_collect_package_tools_and_connections(self, install_custom_tool_pkg):
}

expected_template = {
"$schema": "https://azuremlschemas.azureedge.net/promptflow/latest/CustomStrongTypeConnection.schema.json",
"name": "to_replace_with_connection_name",
"type": "custom",
"custom_type": "MyFirstConnection",
Expand Down Expand Up @@ -197,5 +198,4 @@ def test_collect_package_tools_and_connections(self, install_custom_tool_pkg):

content = templates["my_tool_package.tools.my_tool_with_custom_strong_type_connection.MyCustomConnection"]
expected_template_str = textwrap.dedent(expected_template)

assert content in expected_template_str
assert expected_template_str in content

0 comments on commit 6df5507

Please sign in to comment.