diff --git a/docs/how-to-guides/develop-a-flex-flow/class-based-flow.md b/docs/how-to-guides/develop-a-flex-flow/class-based-flow.md index 1fc0f156cbd..d86539daaa4 100644 --- a/docs/how-to-guides/develop-a-flex-flow/class-based-flow.md +++ b/docs/how-to-guides/develop-a-flex-flow/class-based-flow.md @@ -73,11 +73,26 @@ Check [here](../chat-with-a-flow/index.md) for more information. User can also batch run a flex flow without YAML. Instead of calling `pf.save` to create flow YAML first. +::::{tab-set} +:::{tab-item} CLI +:sync: CLI + +```bash +pf run create --flow "path.to.module:ClassName" --data "./data.jsonl" +``` + +::: + +:::{tab-item} SDK +:sync: SDK ```python # user can also directly use entry in `flow` param for batch run pf.run(flow="path.to.module:ClassName", data="./data.jsonl") ``` +::: +:::: + Or directly run the imported flow class or flow instance. **Note**: this only works in local. @@ -94,6 +109,32 @@ pf.run(flow=flow_obj, data="./data.jsonl") User can batch run a flex flow. Flow init function's param is supported by `init` parameter. +::::{tab-set} +:::{tab-item} CLI +:sync: CLI + +User need to write an JSON file as init's value since it's hard to write model config in command line. + +```json +{ + "model_config": { + "azure_endpoint": "my_endpoint", + "azure_deployment": "my_deployment", + "api_key": "actual_api_key" + }, + "flow_config": {} +} +``` + +```bash +pf run create --flow "./flow.flex.yaml" --data "./data.jsonl" --init init.json +``` + +::: + +:::{tab-item} SDK +:sync: SDK + ```python pf = PFClient() @@ -113,6 +154,8 @@ config = AzureOpenAIModelConfiguration( pfazure.run(flow="./flow.flex.yaml", init={"model_config": config, "flow_config": {}}, data="./data.jsonl") ``` +::: +:::: ## Serve diff --git a/docs/how-to-guides/develop-a-flex-flow/function-based-flow.md b/docs/how-to-guides/develop-a-flex-flow/function-based-flow.md index 46307d0dbb7..7c6a43da65c 100644 --- a/docs/how-to-guides/develop-a-flex-flow/function-based-flow.md +++ b/docs/how-to-guides/develop-a-flex-flow/function-based-flow.md @@ -61,20 +61,51 @@ Check [here](../chat-with-a-flow/index.md) for more information. User can also batch run a flex flow without YAML. Instead of calling `pf.save` to create flow YAML first. +::::{tab-set} +:::{tab-item} CLI +:sync: CLI + +```bash +pf run create --flow "path.to.module:function_name" --data "./data.jsonl" +``` + +::: + +:::{tab-item} SDK +:sync: SDK ```python # user can also directly use entry in `flow` param for batch run pf.run(flow="path.to.module:function_name", data="./data.jsonl") ``` +::: +:::: + ## Batch run with YAML User can batch run a flex flow with YAML. +::::{tab-set} +:::{tab-item} CLI +:sync: CLI + +```bash +pf run create --flow "./flow.flex.yaml" --data "./data.jsonl" +``` + +::: + +:::{tab-item} SDK +:sync: SDK + ```python pf = PFClient() pf.run(flow="./flow.flex.yaml", data="./data.jsonl") ``` +::: +:::: + Or directly run the imported function. **Note**: this only works in local. diff --git a/docs/how-to-guides/index.md b/docs/how-to-guides/index.md index f66e4267238..4a72d7f2650 100644 --- a/docs/how-to-guides/index.md +++ b/docs/how-to-guides/index.md @@ -8,6 +8,12 @@ Simple and short articles grouped by topics, each introduces a core feature of p tracing/index ``` +```{toctree} +:caption: FlexFlow +:maxdepth: 1 +develop-a-flex-flow/index +``` + ```{toctree} :caption: Flow :maxdepth: 1