Skip to content

Commit

Permalink
fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
yalu4 committed Oct 23, 2023
1 parent 57444be commit 431f58b
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Make sure that you adhere to the following guidelines:
To develop a flow with a package tool that uses a custom strong type connection, follow these steps:
* Step1: Refer to the [create and use tool package](create-and-use-tool-package.md#create-custom-tool-package) documentation to build and install your tool package in your local environment.
> [!Note] After installing the new tool package in your local environment, you will need to reload the window for the changes to take effect.
* Step2: Develop a flow with custom tools. Please take this [folder](../../../examples/flows/standard/flow-with-package-tool-using-custom-strong-type-connection/) as an example.
* Step2: Develop a flow with custom tools. Please take this [folder](https://github.com/microsoft/promptflow/blob/main/examples/flows/standard/flow-with-package-tool-using-custom-strong-type-connection/) as an example.
* Step3: Create a custom strong type connection using one of the following methods:
- Click the 'Add connection' button in the node interface.
![create_custom_strong_type_connection_in_node_interface](../../media/how-to-guides/develop-a-tool/create_custom_strong_type_connection_in_node_interface.png)
Expand All @@ -89,7 +89,7 @@ To develop a flow with a package tool that uses a custom strong type connection,

## Develop a flow with a script tool with custom strong type connection
To develop a flow with a script tool that uses a custom strong type connection, follow these steps:
* Step1: Develop a flow with custom tools. Please take this [folder](../../../examples/flows/standard/flow-with-script-tool-using-custom-strong-type-connection/) as an example.
* Step1: Develop a flow with custom tools. Please take this [folder](https://github.com/microsoft/promptflow/blob/main/examples/flows/standard/flow-with-script-tool-using-custom-strong-type-connection/) as an example.
* Step2: Using a custom strong type connection in a script tool is slightly different from using it in a package tool. When creating the connection, you will create a `CustomConnection`. Fill in the `keys` and `values` in the connection template.
![custom](../../media/how-to-guides/develop-a-tool/custom_connection_template.png)
* Step3: Use the created custom connection in your flow.
Expand All @@ -98,13 +98,9 @@ To develop a flow with a script tool that uses a custom strong type connection,
## Local to cloud
Whether you are using a custom strong type connection in a package tool or a script tool, when creating the necessary connections in Azure AI, you will need to create a `CustomConnection`. In the node interface of the flow, the input type would be displayed as `CustomConnection` type.

For more details on running PromptFlow in Azure AI, please refer to this [documentation](https://microsoft.github.io/promptflow/cloud/azureai/quick-start.html?highlight=pfazure).
For more details on running PromptFlow in Azure AI, please refer to this [documentation](../../cloud/azureai/quick-start.html?highlight=pfazure).

Here are some example commands:
```
pfazure run create --subscription 96aede12-2f73-41cb-b983-6d11a904839b -g promptflow -w chjinche-pf-eus --flow D:\proj\github\ms\promptflow\examples\flows\standard\flow-with-package-tool-using-custom-strong-type-connection --data D:\proj\github\ms\promptflow\examples\flows\standard\flow-with-package-tool-using-custom-strong-type-connection\data.jsonl --runtime test-compute
```

```
pfazure run create --subscription 96aede12-2f73-41cb-b983-6d11a904839b -g promptflow -w chjinche-pf-eus --flow D:\proj\github\ms\promptflow\examples\flows\standard\flow-with-script-tool-using-custom-strong-type-connection --data D:\proj\github\ms\promptflow\examples\flows\standard\flow-with-script-tool-using-custom-strong-type-connection\data.jsonl --runtime test-compute
pfazure run create --subscription 96aede12-2f73-41cb-b983-6d11a904839b -g promptflow -w my-pf-eus --flow D:\proj\github\ms\promptflow\examples\flows\standard\flow-with-package-tool-using-custom-strong-type-connection --data D:\proj\github\ms\promptflow\examples\flows\standard\flow-with-package-tool-using-custom-strong-type-connection\data.jsonl --runtime test-compute
```
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pip install -r requirements.txt
Create connection if you haven't done that.
```bash
# Override keys with --set to avoid yaml file changes
pf connection create -f my_custom_connection.yml --set secrets.api_key='<your_api_key>' configs.api_url='<your_api_url>'
pf connection create -f my_custom_connection.yml --set secrets.api_key='<your_api_key>' configs.api_base='<your_api_base>'
```

Ensure you have created `my_custom_connection` connection.
Expand All @@ -36,7 +36,7 @@ pf flow test --flow .

# test with flow inputs
pf flow test --flow . --inputs text="Promptflow"

```

### Run with multiple lines data

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: "to_replace_with_connection_name"
name: "my_custom_connection"
type: custom
custom_type: MyCustomConnection
module: my_tool_package.tools.my_tool_with_custom_strong_type_connection
package: test-custom-tools
package_version: 0.0.2
module: my_tool_package.tools.tool_with_custom_strong_type_connection
package: my-tools-package
package_version: 0.0.3
configs:
api_url: "This is a fake api url." # String, The api url.
secrets:
api_key: <user-input> # Don't replace the '<user-input>' placeholder. The application will prompt you to enter a value when it runs.
api_base: "This is a fake api base." # String, The api base.
secrets: # must-have
api_key: "to_replace_with_api_key" # String, The api key get from "https://xxx.com".
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
promptflow
test-custom-tools
--extra-index-url https://azuremlsdktestpypi.azureedge.net/promptflow
promptflow==0.0.108028960

my-tools-package==0.0.3
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pf flow test --flow .

# test with flow inputs
pf flow test --flow . --inputs text="Promptflow"

```

### Run with multiple lines data

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ class MyCustomConnection(CustomStrongTypeConnection):
:type api_base: String
"""
api_key: Secret
api_url: str = "This is a fake api url."
api_base: str = "This is a fake api base."


@tool
def my_tool(connection: MyCustomConnection, input_text: str) -> str:
# Replace with your tool code.
# Use custom strong type connection like: connection.api_key, connection.api_url
# Use custom strong type connection like: connection.api_key, connection.api_base
return "Hello " + input_text
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
promptflow
--extra-index-url https://azuremlsdktestpypi.azureedge.net/promptflow
promptflow==0.0.108028960

0 comments on commit 431f58b

Please sign in to comment.