diff --git a/docs/concepts/concept-flows.md b/docs/concepts/concept-flows.md index ff58925b1a1..626baaf3e4d 100644 --- a/docs/concepts/concept-flows.md +++ b/docs/concepts/concept-flows.md @@ -12,7 +12,7 @@ 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`: @@ -20,6 +20,17 @@ A flow is represented as a YAML file and can be visualized with our [Prompt flow 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: 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 270b131d493..1fc0f156cbd 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 @@ -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) 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 87f0351f327..46307d0dbb7 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 @@ -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 @@ -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) diff --git a/docs/how-to-guides/develop-a-flex-flow/index.md b/docs/how-to-guides/develop-a-flex-flow/index.md index 812ba7d659e..08ca1920893 100644 --- a/docs/how-to-guides/develop-a-flex-flow/index.md +++ b/docs/how-to-guides/develop-a-flex-flow/index.md @@ -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 ``` diff --git a/docs/how-to-guides/develop-a-flex-flow/supported-types.md b/docs/how-to-guides/develop-a-flex-flow/input-output-format.md similarity index 83% rename from docs/how-to-guides/develop-a-flex-flow/supported-types.md rename to docs/how-to-guides/develop-a-flex-flow/input-output-format.md index f25acd642d0..f37a2b45dc5 100644 --- a/docs/how-to-guides/develop-a-flex-flow/supported-types.md +++ b/docs/how-to-guides/develop-a-flex-flow/input-output-format.md @@ -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). @@ -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. \ No newline at end of file diff --git a/docs/how-to-guides/develop-a-flow/index.md b/docs/how-to-guides/develop-a-flow/index.md index eb23ee252b8..04484a9ed5f 100644 --- a/docs/how-to-guides/develop-a-flow/index.md +++ b/docs/how-to-guides/develop-a-flow/index.md @@ -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 diff --git a/docs/how-to-guides/index.md b/docs/how-to-guides/index.md index 2ef3019f381..f66e4267238 100644 --- a/docs/how-to-guides/index.md +++ b/docs/how-to-guides/index.md @@ -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