Develop standard flow#

Experimental feature

This is an experimental feature, and may change at any time. Learn more.

From this document, you can learn how to develop a standard flow by writing a flow yaml from scratch. You can find additional information about flow yaml schema in Flow YAML Schema.

Flow input data#

The flow input data is the data that you want to process in your flow.

You can add a flow input in inputs section of flow yaml.

inputs:
  url:
    type: string
    default: https://www.microsoft.com/en-us/d/xbox-wireless-controller-stellar-shift-special-edition/94fbjc7h0h6h

When unfolding Inputs section in the authoring page, you can set and view your flow inputs, including input schema (name and type), and the input value.

flow_input

For Web Classification sample as shown the screenshot above, the flow input is an url of string type. For more input types in a python tool, please refer to Input types.

Develop the flow using different tools#

In one flow, you can consume different kinds of tools. We now support built-in tool like LLM, Python and Prompt and third-party tool like Serp API, Vector Search, etc.

Add tool as your need#

You can add a tool node in nodes section of flow yaml. For example, yaml below shows how to add a Python tool node in the flow.

nodes:
- name: fetch_text_content_from_url
  type: python
  source:
    type: code
    path: fetch_text_content_from_url.py
  inputs:
    url: ${inputs.url}

By selecting the tool card on the very top, you’ll add a new tool node to flow.

add_tool

Edit tool#

You can edit the tool by simply opening the source file and making edits. For example, we provide a simple Python tool code below.

from promptflow import tool

# The inputs section will change based on the arguments of the tool function, after you save the code
# Adding type to arguments and return value will help the system show the types properly
# Please update the function name/signature per need
@tool
def my_python_tool(input1: str) -> str:
  return 'hello ' + input1

We also provide an LLM tool prompt below.

Please summarize the following text in one paragraph. 100 words.
Do not add any information that is not in the text.
Text: {{text}}
Summary:

When a new tool node is added to flow, it will be appended at the bottom of flatten view with a random name by default. At the top of each tool node card, there’s a toolbar for adjusting the tool node. You can move it up or down, you can delete or rename it too. For a python tool node, you can edit the tool code by clicking the code file. For a LLM tool node, you can edit the tool prompt by clicking the prompt file and adjust input parameters like connection, api and etc. edit_tool

Create connection#

Please refer to the Create necessary connections for details.

Set flow output#

When the flow is complicated, instead of checking outputs on each node, you can set flow output and check outputs of multiple nodes in one place. Moreover, flow output helps:

  • Check bulk test results in one single table.

  • Define evaluation interface mapping.

  • Set deployment response schema.

You can add flow outputs in outputs section of flow yaml . The linkage is the same as LLM node, using ${convert_to_dict.output.category} to link category flow output with with category value of upstream node convert_to_dict.

outputs:
  category:
    type: string
    reference: ${convert_to_dict.output.category}
  evidence:
    type: string
    reference: ${convert_to_dict.output.evidence}

First define flow output schema, then select in drop-down the node whose output you want to set as flow output. Since convert_to_dict has a dictionary output with two keys: category and evidence, you need to manually append category and evidence to each. Then run flow, after a while, you can check flow output in a table.

flow_output