promptflow README

The project's README from github.com/microsoft/promptflow. As one markdown file: README.md.

Prompt flow

Python package Python PyPI - Downloads CLI vsc extension

Doc Issue Discussions CONTRIBUTING License: MIT

Welcome to join us to make prompt flow better by participating discussions, opening issues, submitting PRs.

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.

With prompt flow, you will be able to:


Installation

To get started quickly, you can use a pre-built development environment. Click the button below to open the repo in GitHub Codespaces, and then continue the readme!

Open in GitHub Codespaces

If you want to get started in your local environment, first install the packages:

Ensure you have a python environment, python>=3.9, <=3.11 is recommended.

pip install promptflow promptflow-tools

Quick Start ⚡

Create a chatbot with prompt flow

Run the command to initiate a prompt flow from a chat template, it creates folder named my_chatbot and generates required files within it:

pf flow init --flow ./my_chatbot --type chat

Setup a connection for your API key

For OpenAI key, establish a connection by running the command, using the openai.yaml file in the my_chatbot folder, which stores your OpenAI key (override keys and name with --set to avoid yaml file changes):

pf connection create --file ./my_chatbot/openai.yaml --set api_key=<your_api_key> --name open_ai_connection

For Azure OpenAI key, establish the connection by running the command, using the azure_openai.yaml file:

pf connection create --file ./my_chatbot/azure_openai.yaml --set api_key=<your_api_key> api_base=<your_api_base> --name open_ai_connection

Chat with your flow

In the my_chatbot folder, there's a flow.dag.yaml file that outlines the flow, including inputs/outputs, nodes, connection, and the LLM model, etc

Note that in the chat node, we're using a connection named open_ai_connection (specified in connection field) and the gpt-35-turbo model (specified in deployment_name field). The deployment_name filed is to specify the OpenAI model, or the Azure OpenAI deployment resource.

Interact with your chatbot by running: (press Ctrl + C to end the session)

pf flow test --flow ./my_chatbot --interactive

Core value: ensuring "High Quality” from prototype to production

Explore our 15-minute tutorial that guides you through prompt tuning ➡ batch testing ➡ evaluation, all designed to ensure high quality ready for production.

Next Step! Continue with the Tutorial 👇 section to delve deeper into prompt flow.

Tutorial 🏃‍♂️

Prompt flow is a tool designed to build high quality LLM apps, the development process in prompt flow follows these steps: develop a flow, improve the flow quality, deploy the flow to production.

Develop your own LLM apps

VS Code Extension

We also offer a VS Code extension (a flow designer) for an interactive flow development experience with UI.

vsc

You can install it from the visualstudio marketplace.

Deep delve into flow development

Getting started with prompt flow: A step by step guidance to invoke your first flow run.

Learn from use cases

Tutorial: Chat with PDF: An end-to-end tutorial on how to build a high quality chat application with prompt flow, including flow development and evaluation with metrics.

More examples can be found here. We welcome contributions of new use cases!

Setup for contributors

If you're interested in contributing, please start with our dev setup guide: dev_setup.md.

Next Step! Continue with the Contributing 👇 section to contribute to prompt flow.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Data Collection

The software may collect information about you and your use of the software and send it to Microsoft if configured to enable telemetry. Microsoft may use this information to provide services and improve our products and services. You may turn on the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft's privacy statement. Our privacy statement is located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.

Telemetry Configuration

Telemetry collection is on by default.

To opt out, please run pf config set telemetry.enabled=false to turn it off.

License

Copyright (c) Microsoft Corporation. All rights reserved.

Licensed under the MIT license.

promptflow (microsoft/promptflow)

Searching Database…

这是什么?Prompt flow 是微软推出的一套开发工具,用于端到端地构建基于大语言模型(LLM)的 AI 应用,涵盖原型设计、提示词调优、测试、评估,以及生产环境的部署和监控。
它是一个库、VS Code 扩展,还是两者都是?两者都是:它是一个 Python 软件包和命令行工具(pf),用于构建和运行流程;此外还提供一个可选的 VS Code 扩展,可以使用可视化的流程设计器。
我该如何开始构建流程?可以使用 GitHub Codespaces 获取预先构建好的开发环境,也可以在本地安装 Python 软件包(需要 Python 3.9+),然后按照“Getting started with prompt flow”教程运行第一个流程。
使用它是否需要 OpenAI 或 Azure OpenAI 连接?需要。调用大语言模型的流程必须配置连接,例如名为 'openaiconnection' 的连接,指向 gpt-35-turbo 等模型,或指向 Azure OpenAI 的部署。
它会向微软回传使用数据吗?会。遥测功能默认开启,软件可以向微软发送使用数据;你可以通过一条配置命令将其关闭。
它会收集我的哪些数据?如果启用了遥测功能,该软件可能会收集关于你及你使用情况的信息,并发送给微软,用于提供和改进服务。
我能否在 CI/CD 中运行测试和评估步骤?可以。promptflow 的设计支持将流程测试和评估集成到你的 CI/CD 系统中,以便在投入生产部署之前确保质量达标。
有没有教程可以学习完整的工作流程?有。有一个 15 分钟的教程,涵盖提示词调优、批量测试和评估;还有一个“Chat with PDF”示例,用于构建带有评估指标的完整聊天应用。
我能否把它与 Azure AI 中的云版本一起使用?可以。Azure AI 中提供可选的云版 Prompt flow,支持团队协作,同时仍保留开源的本地工具。
promptflow 中的“流程(flow)”是什么?流程是一条可执行的流水线,将大语言模型、提示词、Python 代码及其他工具连接在一起。在部署到生产环境之前,你可以对其进行开发、调试、追踪和迭代。
Creator
microsoft
Size
169.6 MB
Stars
11.3K
Age
3y
Commits · 90 Days