Prompt flow is a powerful tool that enables developers to create, customize, and run flows easily and efficiently. With its ability to generate flows and iterate on them, Prompt flow is perfect for prototyping, experimentation, and deployment of AI applications powered by Large Language Models.
In this tutorial, we will guide you through the process of creating a Prompt flow in Azure AI Studio. By the end of this tutorial, you will have an understanding of how to leverage the power of Prompt flow to streamline your AI development workflow.
What is Prompt Flow?
Prompt flow is a development tool designed to streamline the entire development cycle of AI applications powered by Large Language Models (LLMs).
Prompt flow provides a comprehensive solution that simplifies the process of prototyping, experimenting, iterating, and deploying your AI applications.
Prompt flow is a feature that can be used to generate, customize, or run a flow.
A flow is an executable instruction set that can implement the AI logic. Flows can be created or run via multiple tools, like a prebuilt canvas, LangChain, etcetera.
Iterations of a flow can be saved as assets; once deployed a flow becomes an API. Not all flows are prompt flows; rather, prompt flow is one way to create a flow.
Benefits of prompt flow
With prompt flow in Azure AI Studio, you can:
- Orchestrate executable flows with LLMs, prompts, and Python tools through a visualized graph.
- Debug, share, and iterate your flows with ease through team collaboration.
- Create prompt variants and compare their performance.
Flow types
In Azure AI Studio, you can start a new flow by selecting a flow type or a template from the gallery.
Overview of prompt flow tools in Azure AI Studio
Prompt flow is available independently as an open-source project on GitHub, with its own SDK and VS Code extension.
Prompt flow is also available and recommended to use as a feature within both Azure AI Studio and Azure Machine Learning studio.
Let’s explore the prompt flow available in Azure AI Studio.
The following table provides an index of tools in prompt flow.
| Tool (set) name | Description | Environment | Package name |
| LLM | Use Azure OpenAI large language models (LLM) for tasks such as text completion or chat. | Default | promptflow-tools |
| Prompt | Craft a prompt by using Jinja as the templating language. | Default | promptflow-tools |
| Python | Run Python code. | Default | promptflow-tools |
| Azure OpenAI GPT-4 Turbo with Vision | Use AzureOpenAI GPT-4 Turbo with Vision model deployment to analyze images and provide textual responses to questions about them. | Default | promptflow-tools |
| Content Safety (Text) | Use Azure AI Content Safety to detect harmful content. | Default | promptflow-tools |
| Index Lookup* | Search an Azure Machine Learning Vector Index for relevant results using one or more text queries. | Default | promptflow-vectordb |
| Vector Index Lookup* | Search text or a vector-based query from a vector index. | Default | promptflow-vectordb |
| Faiss Index Lookup* | Search a vector-based query from the Faiss index file. | Default | promptflow-vectordb |
| Vector DB Lookup* | Search a vector-based query from an existing vector database. | Default | promptflow-vectordb |
| Embedding | Use Azure OpenAI embedding models to create an embedding vector that represents the input text. | Default | promptflow-tools |
| Serp API | Use Serp API to obtain search results from a specific search engine. | Default | promptflow-tools |
| Azure AI Language tools* | This collection of tools is a wrapper for various Azure AI Language APIs, which can help effectively understand and analyze documents and conversations. The capabilities currently supported include: Abstractive Summarization, Extractive Summarization, Conversation Summarization, Entity Recognition, Key Phrase Extraction, Language Detection, PII Entity Recognition, Conversational PII, Sentiment Analysis, Conversational Language Understanding, Translator. You can learn how to use them by the Sample flows. Support contact: taincidents@microsoft.com | Custom | promptflow-azure-ai-language |
Demo:
Lets get started with creating basic Prompt flow in Azure AI Studio.
Below are the options available in AI Studio.
In Azure AI Studio, tool options include the LLM tool, Prompt tool, Python tool, and more.
| LLM | Use Open AI’s Large Language Model for text completion or chat. For more details, refer to this document |
| Prompt | Craft prompt using Jinja as the templating language. For more details, refer to this document |
| Python | Craft prompt using Jinja as the templating language. For more details, refer to this document |
In this demo, we will explore Prompt tool for flows in Azure AI Studio
Prerequisites
- If you don’t have an Azure AI project already, first create a project.
- Prompt flow requires a runtime. If you don’t have a runtime, you can create one in Azure AI Studio.
- You need a deployed model.
Create and develop your Prompt flow
You can create a flow by either cloning the samples available in the gallery or creating a flow from scratch. If you already have flow files in local or file share, you can also import the files to create a flow.
To create a prompt flow from the gallery in Azure AI Studio:
- Sign in to Azure AI Studio and
- Create a New Project or select your project from the Build page.
- From the collapsible left menu, select Prompt flow.
- Select + Create.
- In the Standard flow tile, select Create.
- On the Create a new flow page, enter a folder name and then select Create.
Sign in to Azure AI Studio and create a New AI Project.
Click Next.
Once the AI project is provisioned, go to your Project.
Create a new Flow
The prompt flow authoring page opens. You can start authoring your flow now. By default you see a sample flow. This example flow has nodes for the LLM and Python tools
You will see below screen:
In order to run this Prompt Flow, you need to set up the connection and deployment in the LLM tool editor.
In case, you don’t select the run time.
Select the below settings:
Select Run to run the flow.
You can choose your own topic 😊
Once the flow run is completed, select View outputs to view the flow results.
Now, lets create your own Prompt Flow that has a Conditional control:
At its core, conditional control provides the capability to associate each node in a flow with an activate config. This configuration is essentially a “when” statement that determines when a node should be executed. The power of this feature is realized when you have complex flows where the execution of certain tasks depends on the outcome of previous tasks.
By using the conditional control, you can configure your specific nodes to execute only when the specified conditions are met.
Create your own Prompt Flow
Lets create a new Prompt Flow.
Select + Prompt to add the Prompt tool to your flow as shown below.
In this example, the prompt incorporates Jinja templating syntax to dynamically generate the welcome message and personalize it based on the user’s name.
It also presents a menu of options for the user to choose from. Depending on whether the user_name variable is provided, it either addresses the user by name or uses a generic greeting.
Welcome to {{ website_name }}!
{% if user_name %}
Hello, {{ user_name }}!
{% else %}
Hello there!
{% endif %}
Click-> Validate and parse input.
You can see the output based on the above condition!
Conclusion:
Wrapping Up!
We’ve covered a lot in this blog post, but there is still a lot more to understand and learn about creating and managing prompts. The purpose of this post was simply to get you started with creating your own conditional prompt flow.
In upcoming posts, we will take a deeper dive into the power of prompt flow and explore how to leverage its capabilities. Stay tuned for more exciting content!
Until then, keep practicing with conditional prompts and exploring the endless possibilities they offer. Happy coding! 🎉✨
References:
https://learn.microsoft.com/en-us/azure/ai-studio/how-to/flow-develop
https://learn.microsoft.com/en-us/azure/ai-studio/how-to/prompt-flow-tools/prompt-tool
https://learn.microsoft.com/en-us/azure/ai-studio/how-to/prompt-flow-tools/llm-tool

