|
| 1 | +# Getting Started with Prompt flow |
| 2 | + |
| 3 | +This application explains how to get started with [Prompt flow](https://github.com/microsoft/promptflow), a Python library that provides a simple and easy way to build conversational AI applications. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- Python 3.10 or later |
| 8 | +- Azure OpenAI Service |
| 9 | + |
| 10 | +## Overview |
| 11 | + |
| 12 | +Prompt flow is a suite of development tools designed to streamline the end-to-end development cycle of LLM-based AI applications, from ideation, prototyping, testing, evaluation to production deployment and monitoring. It makes prompt engineering much easier and enables you to build LLM apps with production quality. |
| 13 | + |
| 14 | +## Usage |
| 15 | + |
| 16 | +1. Get the API key for Azure OpenAI Service |
| 17 | +1. Copy [.env.template](../../.env.template) to `.env` in the same directory |
| 18 | +1. Set credentials in `.env` |
| 19 | +1. Run scripts in the [apps/11_promptflow](./) directory |
| 20 | + |
| 21 | +Set up the environment and install dependencies: |
| 22 | + |
| 23 | +```shell |
| 24 | +# Create a virtual environment |
| 25 | +$ python -m venv .venv |
| 26 | + |
| 27 | +# Activate the virtual environment |
| 28 | +$ source .venv/bin/activate |
| 29 | + |
| 30 | +# Install dependencies |
| 31 | +$ pip install -r requirements.txt |
| 32 | +``` |
| 33 | + |
| 34 | +## Examples |
| 35 | + |
| 36 | +[Prompt flow > Quick start](https://microsoft.github.io/promptflow/how-to-guides/quick-start.html) provides a quick start guide to Prompt flow. |
| 37 | + |
| 38 | +### [chat_minimal](https://github.com/microsoft/promptflow/tree/main/examples/flex-flows/chat-minimal) |
| 39 | + |
| 40 | +**Run as normal Python script** |
| 41 | + |
| 42 | +```shell |
| 43 | +$ python apps/11_promptflow/chat_minimal/main.py |
| 44 | +``` |
| 45 | + |
| 46 | +**Run from CLI** |
| 47 | + |
| 48 | +```shell |
| 49 | +$ cd apps/11_promptflow/chat_minimal |
| 50 | + |
| 51 | +# Test flow |
| 52 | +$ pf flow test \ |
| 53 | + --flow main:chat \ |
| 54 | + --inputs question="What's the capital of France?" |
| 55 | + |
| 56 | +# Test flow: multi turn, access to http://localhost:{EPHEMERAL_PORT} |
| 57 | +$ pf flow test \ |
| 58 | + --flow main:chat \ |
| 59 | + --ui |
| 60 | + |
| 61 | +# Create run with multiple lines data |
| 62 | +$ pf run create \ |
| 63 | + --flow main:chat \ |
| 64 | + --data ./data.jsonl \ |
| 65 | + --column-mapping question='${data.question}' \ |
| 66 | + --stream |
| 67 | +``` |
| 68 | + |
| 69 | +## References |
| 70 | + |
| 71 | +- [Prompt flow > repos](https://github.com/microsoft/promptflow) |
| 72 | +- [Prompt flow > documents](https://microsoft.github.io/promptflow/) |
0 commit comments