Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
wangchao1230 committed Apr 24, 2024
2 parents d78d8ff + 768b5b2 commit 3f8c8ef
Showing 3 changed files with 80 additions and 0 deletions.
43 changes: 43 additions & 0 deletions docs/how-to-guides/develop-a-flex-flow/class-based-flow.md
Original file line number Diff line number Diff line change
@@ -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

31 changes: 31 additions & 0 deletions docs/how-to-guides/develop-a-flex-flow/function-based-flow.md
Original file line number Diff line number Diff line change
@@ -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.

6 changes: 6 additions & 0 deletions docs/how-to-guides/index.md
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 3f8c8ef

Please sign in to comment.