Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
wangchao1230 committed Apr 24, 2024
1 parent fbe9591 commit d78d8ff
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 19 deletions.
13 changes: 12 additions & 1 deletion docs/concepts/concept-flows.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,25 @@ Our [examples](https://github.com/microsoft/promptflow/tree/main/examples/flex-f

Thus LLM apps can be defined as Directed Acyclic Graphs (DAGs) of function calls. These DAGs are flows in prompt flow.

A flow in prompt flow is a DAG of functions (we call them [tools](./concept-tools.md)). These functions/tools connected via input/output dependencies and executed based on the topology by prompt flow executor.
A `DAG flow` in prompt flow is a DAG of functions (we call them [tools](./concept-tools.md)). These functions/tools connected via input/output dependencies and executed based on the topology by prompt flow executor.

A flow is represented as a YAML file and can be visualized with our [Prompt flow for VS Code extension](https://marketplace.visualstudio.com/items?itemName=prompt-flow.prompt-flow). Here is an example `flow.dag.yaml`:

![flow_dag](../media/how-to-guides/quick-start/flow_dag.png)

Please refer to our [examples](https://github.com/microsoft/promptflow/tree/main/examples/flows) to learn how to write a `DAG flow`.

## When to use Flex or DAG flow

`Dag flow` provides a UI-frienctly way to develop your LLM app, which has the following benifits:
- **Low code**: user can drag-and-drop in UI to create a LLM app.
- **DAG Visualization**: user can easily understand the logic structure of the app with DAG view.

`Flex flow` provides a code-friendly way to develop your LLM app, which has the following benifits:
- **Quick start**: Users can quickly test with a simple prompt, then customize with python code with Tracing visuliazation UI.
- **More advanced orchestration**: Users can write complex flow with Python built-in control operators (if-else, foreach) or other 3rd party / open-source library.
- **Easy onboard from other platforms**: user might already onboard platforms like `langchain` and `sematic kernel` with existing code. User can easily onboard promptflow with a few code changes.

## Flow types

Prompt flow examples organize flows by three categories:
Expand Down
2 changes: 1 addition & 1 deletion docs/how-to-guides/develop-a-flex-flow/class-based-flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,6 @@ There's several limitations on aggregation support:

## Next steps

- [Supported types](./supported-types.md)
- [Input output format](./input-output-format.md)
- [Class based flex flow sample](https://github.com/microsoft/promptflow/blob/main/examples/flex-flows/chat-basic/README.md)
- [Class based flex flow evaluation sample](https://github.com/microsoft/promptflow/blob/main/examples/flex-flows/eval-code-quality/README.md)
6 changes: 3 additions & 3 deletions docs/how-to-guides/develop-a-flex-flow/function-based-flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
This is an experimental feature, and may change at any time. Learn [more](../faq.md#stable-vs-experimental).
:::

User can directly use a function(see [supported types](./supported-types.md) for typing support) as flex flow's entry.
User can directly use a function (see [supported types](./input-output-format.md#supported-types) for typing support) as flex flow's entry.

## Authoring

Expand Down Expand Up @@ -93,10 +93,10 @@ pf flow serve --source "./flow.flex.yaml" --port 8088 --host localhost

## Build & deploy

Build & deploy a flex flow is supported like [DAG flow](../deploy-a-flow/index.md).
Build & deploy a flex flow is supported, see [Deploy a flow](../deploy-a-flow/index.md).

## Next steps

- [Class based flex flow](./class-based-flow.md)
- [Supported types](./supported-types.md)
- [Input output format](./input-output-format.md)
- [Function based flex flow sample](https://github.com/microsoft/promptflow/blob/main/examples/flex-flows/basic/README.md)
19 changes: 8 additions & 11 deletions docs/how-to-guides/develop-a-flex-flow/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,23 @@
This is an experimental feature, and may change at any time. Learn [more](../faq.md#stable-vs-experimental).
:::

Flex flow is short cut for flexible flow. Which means it works for most scenarios with little adjustment.
You can create LLM apps using a Python function or class as the entry point, which encapsulating your app logic. You can directly test or run these entries with pure code experience.

We provide guides on how to develop a flow by writing a flow yaml from scratch in this section.
In PromptFlow, these functions or classes are referred to as `flex flow`.

Flex flow provides a new way to deploy your LLM app in prompt flow.
Which has the following benifits:
Alternatively, you can define a `flow.flex.yaml` that points to these entries (`entry:function_name` or `entry:ClassName`). This enables testing, running, or viewing traces via the [Promptflow VS Code Extension](https://marketplace.visualstudio.com/items?itemName=prompt-flow.prompt-flow).

- Quick start (playground experience). Users can quickly test with prompt + python code with UI visualize experience. For example, user don't necessarily have to create YAML to run flex flow. See [batch run without YAML](./function-based-flow.md#batch-run-without-yaml) for more information.
- More advanced orchestration. Users can write complex flow with Python built-in control operators (if-else, foreach) or other 3rd party / open-source library.
- Easy onboard from other platforms: other platforms like langchain and sematic kernel already have code first flow authoring experience. We can onboard those customers with a few code changes.
Our [examples](https://github.com/microsoft/promptflow/tree/main/examples/flex-flows) should give you a good idea on how to write `flex flows`.

## Stream
Note:
- The term *Flex* is a shorthand for *flexible*, indicating its adaptability to most scenarios with minimal adjustments.
- PromptFlow also supports the development of a `dag flow`. learn more on comparasion of these two [flow concepts](../../concepts/concept-flows.md).

Stream is supported in flex flow.
Reference this [sample](https://microsoft.github.io/promptflow/tutorials/stream-flex-flow.html) for details.

```{toctree}
:maxdepth: 1
function-based-flow
class-based-flow
supported-types
input-output-format
```
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Supported types
# Input output format

## Supported types

:::{admonition} Experimental feature
This is an experimental feature, and may change at any time. Learn [more](../faq.md#stable-vs-experimental).
Expand Down Expand Up @@ -30,3 +32,10 @@ def my_flow(my_own_obj: MyOwnClass):
```

Sample validation error: "The input 'my_own_obj' is of a complex python type. Please use a dict instead."



## Stream

Stream is supported in flex flow.
Reference this [sample](https://microsoft.github.io/promptflow/tutorials/stream-flex-flow.html) for details.
16 changes: 14 additions & 2 deletions docs/how-to-guides/develop-a-flow/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Develop a flow
We provide guides on how to develop a flow by writing a flow yaml from scratch in this section.
# Develop a dag flow

LLM apps can be defined as Directed Acyclic Graphs (DAGs) of function calls. These DAGs are flows in prompt flow.

A `DAG flow` in prompt flow is a DAG of functions (we call them [tools](../../concepts//concept-tools.md)). These functions/tools connected via input/output dependencies and executed based on the topology by prompt flow executor.

A flow is represented as a YAML file and can be visualized with our [Prompt flow for VS Code extension](https://marketplace.visualstudio.com/items?itemName=prompt-flow.prompt-flow). Here is an example `flow.dag.yaml`:

![flow_dag](../../media/how-to-guides/quick-start/flow_dag.png)

Please refer to our [examples](https://github.com/microsoft/promptflow/tree/main/examples/flows) and guides in this section to learn how to write a `DAG flow`.

Note:
- promptflow also support user develop a `flex flow`. learn more on comparasion of these two [flow concepts](../../concepts/concept-flows.md).

```{toctree}
:maxdepth: 1
Expand Down
1 change: 1 addition & 0 deletions docs/how-to-guides/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ tracing/index
```{toctree}
:caption: Flow
:maxdepth: 1
develop-a-flex-flow/index
develop-a-flow/index
execute-flow-as-a-function
chat-with-a-flow/index
Expand Down

0 comments on commit d78d8ff

Please sign in to comment.