Skip to content

Commit 910fa5b

Browse files
committed
doc: pf validate
1 parent c4f95c5 commit 910fa5b

File tree

2 files changed

+37
-6
lines changed

2 files changed

+37
-6
lines changed

docs/how-to-guides/use-flow-in-pipeline.md

+11-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ After you have developed and tested the flow in [init and test a flow](./init-an
99
:::{admonition} Pre-requirements
1010
- Customer need to install the extension `ml>=2.21.0` to enable this feature in CLI and package `azure-ai-ml>=1.11.0` to enable this feature in SDK;
1111
- Customer need to put `$schema` in the target `flow.dag.yaml` to enable this feature;
12-
- Customer need to generate `flow.tools.json` for the target flow before below usage. Usually the generation can be done by `pf flow validate`.
12+
- `flow.dag.yaml`: `$schema`: `https://azuremlschemas.azureedge.net/promptflow/latest/Flow.schema.json`
13+
- `run.yaml`: `$schema`: `https://azuremlschemas.azureedge.net/promptflow/latest/Run.schema.json`
14+
- Customer need to generate `flow.tools.json` for the target flow before below usage. The generation can be done by `pf flow validate`.
1315
:::
1416

1517
For more information about AzureML and component:
@@ -46,16 +48,17 @@ from azure.ai.ml import MLClient, load_component
4648
ml_client = MLClient()
4749

4850
# Register flow as a component
49-
# Default component name will be the name of flow folder, which is web-classification here; default version will be "1"
5051
flow_component = load_component("standard/web-classification/flow.dag.yaml")
52+
# Default component name will be the name of flow folder, which is not a valid component name, so we override it here; default version will be "1"
53+
flow_component.name = "web_classification"
5154
ml_client.components.create_or_update(flow_component)
5255

5356
# Register flow as a component with parameters override
5457
ml_client.components.create_or_update(
5558
"standard/web-classification/flow.dag.yaml",
5659
version="2",
5760
params_override=[
58-
{"name": "web-classification_updated"}
61+
{"name": "web_classification_updated"}
5962
]
6063
)
6164
```
@@ -69,5 +72,8 @@ After registered a flow as a component, they can be referred in a pipeline job l
6972
## Directly use a flow in a pipeline job
7073

7174
Besides explicitly registering a flow as a component, customer can also directly use flow in a pipeline job:
72-
- [CLI sample](https://github.com/Azure/azureml-examples/tree/zhangxingzhi/flow-in-pipeline/cli/jobs/pipelines-with-components/flow_in_pipeline/1a_flow_in_pipeline)
73-
- [SDK sample](https://github.com/Azure/azureml-examples/blob/zhangxingzhi/flow-in-pipeline/sdk/python/jobs/pipelines/1l_flow_in_pipeline/flow_in_pipeline.ipynb)
75+
- [CLI example](https://github.com/Azure/azureml-examples/tree/main/cli/jobs/pipelines-with-components/pipeline_job_with_flow_as_component)
76+
- [SDK example](https://github.com/Azure/azureml-examples/tree/main/sdk/python/jobs/pipelines/1l_flow_in_pipeline)
77+
78+
All connections and flow inputs will be exposed as input parameters of the component. Default value can be provided in flow/run definition; they can also be set/overwrite on job submission:
79+
- [CLI/SDK example](../../examples/tutorials/flow-in-pipeline/pipeline.ipynb)

docs/reference/pf-command-reference.md

+26-1
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ Manage promptflow flow flows.
2020
| --- | --- |
2121
| [pf flow init](#pf-flow-init) | Initialize a prompt flow directory. |
2222
| [pf flow test](#pf-flow-test) | Test the prompt flow or flow node. |
23+
| [pf flow validate](#pf-flow-validate) | Validate a flow and generate `flow.tools.json` for it. |
2324
| [pf flow build](#pf-flow-build) | Build a flow for further sharing or deployment. |
24-
| [pf flow serve](#pf-flow-serve) | Serving a flow as an endpoint. |
25+
| [pf flow serve](#pf-flow-serve) | Serve a flow as an endpoint. |
2526

2627
### pf flow init
2728

@@ -167,6 +168,30 @@ Start a interactive chat session for chat flow.
167168

168169
Displays the output for each step in the chat flow.
169170

171+
### pf flow validate
172+
173+
Validate the prompt flow and generate a `flow.tools.json` under `.promptflow`. This file is required when using flow as a component in a Azure ML pipeline.
174+
175+
```bash
176+
pf flow validate --source
177+
[--debug]
178+
[--verbose]
179+
```
180+
181+
#### Examples
182+
183+
Validate the flow.
184+
185+
```bash
186+
pf flow validate --source <path-to-flow>
187+
```
188+
189+
#### Required Parameter
190+
191+
`--source`
192+
193+
The flow source to validate.
194+
170195
### pf flow build
171196

172197
Build a flow for further sharing or deployment.

0 commit comments

Comments
 (0)