![license: MIT](https://cdn.statically.io/img/camo.githubusercontent.com/4d4571869159681d7f373eb6a4f9f340f407b409abd41c0f1ed74ea7c6b47a5b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d707572706c652e737667)
Install dependencies
- Bootstrap your python environment.
- e.g: create a new conda environment.
conda create -n pf-examples python=3.9
.
- install required packages in python environment :
pip install -r requirements.txt
- show installed sdk:
pip show promptflow
Quick start
path |
status |
description |
chat-with-pdf |
![samples_tutorials_e2e_development_chat_with_pdf](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_tutorials_e2e_development_chat_with_pdf.yml/badge.svg?branch=main) |
Retrieval Augmented Generation (or RAG) has become a prevalent pattern to build intelligent application with Large Language Models (or LLMs) since it can infuse external knowledge into the model, which is not trained with those up-to-date or proprietary information |
azure-app-service |
![samples_tutorials_flow_deploy_azure_app_service](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_tutorials_flow_deploy_azure_app_service.yml/badge.svg?branch=main) |
This example demos how to deploy a flow using Azure App Service |
create-service-with-flow |
![samples_tutorials_flow_deploy_create_service_with_flow](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_tutorials_flow_deploy_create_service_with_flow.yml/badge.svg?branch=main) |
This example shows how to create a simple service with flow |
distribute-flow-as-executable-app |
![samples_tutorials_flow_deploy_distribute_flow_as_executable_app](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_tutorials_flow_deploy_distribute_flow_as_executable_app.yml/badge.svg?branch=main) |
This example demos how to package flow as a executable app |
docker |
![samples_tutorials_flow_deploy_docker](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_tutorials_flow_deploy_docker.yml/badge.svg?branch=main) |
This example demos how to deploy flow as a docker app |
kubernetes |
![samples_tutorials_flow_deploy_kubernetes](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_tutorials_flow_deploy_kubernetes.yml/badge.svg?branch=main) |
This example demos how to deploy flow as a Kubernetes app |
promptflow-quality-improvement |
![samples_tutorials_flow_fine_tuning_evaluation_promptflow_quality_improvement](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_tutorials_flow_fine_tuning_evaluation_promptflow_quality_improvement.yml/badge.svg?branch=main) |
This tutorial is designed to enhance your understanding of improving flow quality through prompt tuning and evaluation |
tracing |
![samples_tutorials_tracing](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_tutorials_tracing.yml/badge.svg?branch=main) |
Prompt flow provides the tracing feature to capture and visualize the internal execution details for all flows |
path |
status |
description |
basic |
![samples_prompty_basic](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_prompty_basic.yml/badge.svg?branch=main) |
A basic prompt that uses the chat API to answer questions, with connection configured using environment variables |
chat-basic |
![samples_prompty_chat_basic](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_prompty_chat_basic.yml/badge.svg?branch=main) |
A prompt that uses the chat API to answer questions with chat history, leveraging promptflow connection |
eval-apology |
![samples_prompty_eval_apology](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_prompty_eval_apology.yml/badge.svg?branch=main) |
A prompt that determines whether a chat conversation contains an apology from the assistant |
eval-basic |
![samples_prompty_eval_basic](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_prompty_eval_basic.yml/badge.svg?branch=main) |
Basic evaluator prompt for QA scenario |
format-output |
![samples_prompty_format_output](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_prompty_format_output.yml/badge.svg?branch=main) |
A few examples that demos different prompty response format like text, json_object, and how to enable stream output |
path |
status |
description |
basic |
![samples_flex_flows_basic](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flex_flows_basic.yml/badge.svg?branch=main) |
A basic standard flow define using function entry that calls Azure OpenAI with connection info stored in environment variables |
chat-async-stream |
![samples_flex_flows_chat_async_stream](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flex_flows_chat_async_stream.yml/badge.svg?branch=main) |
A chat flow defined using async class entry that return output in stream mode |
chat-basic |
![samples_flex_flows_chat_basic](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flex_flows_chat_basic.yml/badge.svg?branch=main) |
A basic chat flow defined using class entry |
chat-minimal |
![samples_flex_flows_chat_minimal](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flex_flows_chat_minimal.yml/badge.svg?branch=main) |
A chat flow defined using function with minimal code |
chat-stream |
![samples_flex_flows_chat_stream](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flex_flows_chat_stream.yml/badge.svg?branch=main) |
A chat flow defined using class entry that return output in stream mode |
chat-with-functions |
![samples_flex_flows_chat_with_functions](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flex_flows_chat_with_functions.yml/badge.svg?branch=main) |
This flow covers how to use the LLM chat API in combination with external functions to extend the capabilities of GPT models |
eval-checklist |
![samples_flex_flows_eval_checklist](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flex_flows_eval_checklist.yml/badge.svg?branch=main) |
A example flow defined using class entry which demos how to evaluate the answer pass user specified check list |
eval-code-quality |
![samples_flex_flows_eval_code_quality](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flex_flows_eval_code_quality.yml/badge.svg?branch=main) |
A example flow defined using class based entry which leverages model config to evaluate the quality of code snippet |
eval-criteria-with-langchain |
![samples_flex_flows_eval_criteria_with_langchain](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flex_flows_eval_criteria_with_langchain.yml/badge.svg?branch=main) |
A example flow of converting LangChain criteria evaluator application to flex flow |
path |
status |
description |
autonomous-agent |
![samples_flows_standard_autonomous_agent](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flows_standard_autonomous_agent.yml/badge.svg?branch=main) |
This is a flow showcasing how to construct a AutoGPT agent with promptflow to autonomously figures out how to apply the given functions to solve the goal, which is film trivia that provides accurate and up-to-date information about movies, directors, actors, and more in this sample |
basic |
![samples_flows_standard_basic](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flows_standard_basic.yml/badge.svg?branch=main) |
A basic standard flow using custom python tool that calls Azure OpenAI with connection info stored in environment variables |
basic-with-builtin-llm |
![samples_flows_standard_basic_with_builtin_llm](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flows_standard_basic_with_builtin_llm.yml/badge.svg?branch=main) |
A basic standard flow that calls Azure OpenAI with builtin llm tool |
basic-with-connection |
![samples_flows_standard_basic_with_connection](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flows_standard_basic_with_connection.yml/badge.svg?branch=main) |
A basic standard flow that using custom python tool calls Azure OpenAI with connection info stored in custom connection |
conditional-flow-for-if-else |
![samples_flows_standard_conditional_flow_for_if_else](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flows_standard_conditional_flow_for_if_else.yml/badge.svg?branch=main) |
This example is a conditional flow for if-else scenario |
conditional-flow-for-switch |
![samples_flows_standard_conditional_flow_for_switch](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flows_standard_conditional_flow_for_switch.yml/badge.svg?branch=main) |
This example is a conditional flow for switch scenario |
customer-intent-extraction |
![samples_flows_standard_customer_intent_extraction](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flows_standard_customer_intent_extraction.yml/badge.svg?branch=main) |
This sample is using OpenAI chat model(ChatGPT/GPT4) to identify customer intent from customer's question |
describe-image |
![samples_flows_standard_describe_image](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flows_standard_describe_image.yml/badge.svg?branch=main) |
A flow that take image input, flip it horizontally and uses OpenAI GPT-4V tool to describe it |
flow-with-additional-includes |
![samples_flows_standard_flow_with_additional_includes](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flows_standard_flow_with_additional_includes.yml/badge.svg?branch=main) |
User sometimes need to reference some common files or folders, this sample demos how to solve the problem using additional_includes |
flow-with-symlinks |
![samples_flows_standard_flow_with_symlinks](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flows_standard_flow_with_symlinks.yml/badge.svg?branch=main) |
User sometimes need to reference some common files or folders, this sample demos how to solve the problem using symlinks |
gen-docstring |
![samples_flows_standard_gen_docstring](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flows_standard_gen_docstring.yml/badge.svg?branch=main) |
This example can help you automatically generate Python code's docstring and return the modified code |
maths-to-code |
![samples_flows_standard_maths_to_code](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flows_standard_maths_to_code.yml/badge.svg?branch=main) |
Math to Code is a project that utilizes the power of the chatGPT model to generate code that models math questions and then executes the generated code to obtain the final numerical answer |
named-entity-recognition |
![samples_flows_standard_named_entity_recognition](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flows_standard_named_entity_recognition.yml/badge.svg?branch=main) |
A flow that perform named entity recognition task |
question-simulation |
![samples_flows_standard_question_simulation](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flows_standard_question_simulation.yml/badge.svg?branch=main) |
This question simulation flow is used to generate suggestions for the next question based on the previous chat history |
web-classification |
![samples_flows_standard_web_classification](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flows_standard_web_classification.yml/badge.svg?branch=main) |
This is a flow demonstrating multi-class classification with LLM |
path |
status |
description |
eval-basic |
![samples_flows_evaluation_eval_basic](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flows_evaluation_eval_basic.yml/badge.svg?branch=main) |
This example shows how to create a basic evaluation flow |
eval-chat-math |
![samples_flows_evaluation_eval_chat_math](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flows_evaluation_eval_chat_math.yml/badge.svg?branch=main) |
This example shows how to evaluate the answer of math questions, which can compare the output results with the standard answers numerically |
eval-classification-accuracy |
![samples_flows_evaluation_eval_classification_accuracy](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flows_evaluation_eval_classification_accuracy.yml/badge.svg?branch=main) |
This is a flow illustrating how to evaluate the performance of a classification system |
eval-entity-match-rate |
![samples_flows_evaluation_eval_entity_match_rate](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flows_evaluation_eval_entity_match_rate.yml/badge.svg?branch=main) |
This is a flow evaluates: entity match rate |
eval-groundedness |
![samples_flows_evaluation_eval_groundedness](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flows_evaluation_eval_groundedness.yml/badge.svg?branch=main) |
This is a flow leverage llm to eval groundedness: whether answer is stating facts that are all present in the given context |
eval-multi-turn-metrics |
![samples_flows_evaluation_eval_multi_turn_metrics](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flows_evaluation_eval_multi_turn_metrics.yml/badge.svg?branch=main) |
This evaluation flow will evaluate a conversation by using Large Language Models (LLM) to measure the quality of the responses |
eval-perceived-intelligence |
![samples_flows_evaluation_eval_perceived_intelligence](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flows_evaluation_eval_perceived_intelligence.yml/badge.svg?branch=main) |
This is a flow leverage llm to eval perceived intelligence |
eval-qna-non-rag |
![samples_flows_evaluation_eval_qna_non_rag](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flows_evaluation_eval_qna_non_rag.yml/badge.svg?branch=main) |
This is a flow evaluating the Q&A systems by leveraging Large Language Models (LLM) to measure the quality and safety of responses |
eval-qna-rag-metrics |
![samples_flows_evaluation_eval_qna_rag_metrics](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flows_evaluation_eval_qna_rag_metrics.yml/badge.svg?branch=main) |
This is a flow evaluating the Q&A RAG (Retrieval Augmented Generation) systems by leveraging the state-of-the-art Large Language Models (LLM) to measure the quality and safety of responses |
eval-single-turn-metrics |
![samples_flows_evaluation_eval_single_turn_metrics](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flows_evaluation_eval_single_turn_metrics.yml/badge.svg?branch=main) |
This evaluation flow will evaluate a question and answer pair by using Large Language Models (LLM) to measure the quality of the answer |
eval-summarization |
![samples_flows_evaluation_eval_summarization](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flows_evaluation_eval_summarization.yml/badge.svg?branch=main) |
This flow implements a reference-free automatic abstractive summarization evaluation across four dimensions: fluency, coherence, consistency, relevance |
path |
status |
description |
chat-basic |
![samples_flows_chat_chat_basic](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flows_chat_chat_basic.yml/badge.svg?branch=main) |
This example shows how to create a basic chat flow |
chat-math-variant |
![samples_flows_chat_chat_math_variant](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flows_chat_chat_math_variant.yml/badge.svg?branch=main) |
This is a prompt tuning case with 3 prompt variants for math question answering |
chat-with-image |
![samples_flows_chat_chat_with_image](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flows_chat_chat_with_image.yml/badge.svg?branch=main) |
This flow demonstrates how to create a chatbot that can take image and text as input |
chat-with-pdf |
![samples_flows_chat_chat_with_pdf](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flows_chat_chat_with_pdf.yml/badge.svg?branch=main) |
This is a simple flow that allow you to ask questions about the content of a PDF file and get answers |
chat-with-wikipedia |
![samples_flows_chat_chat_with_wikipedia](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flows_chat_chat_with_wikipedia.yml/badge.svg?branch=main) |
This flow demonstrates how to create a chatbot that can remember previous interactions and use the conversation history to generate next message |
use_functions_with_chat_models |
![samples_flows_chat_use_functions_with_chat_models](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_flows_chat_use_functions_with_chat_models.yml/badge.svg?branch=main) |
This flow covers how to use the LLM tool chat API in combination with external functions to extend the capabilities of GPT models |
path |
status |
description |
cascading-inputs-tool-showcase |
![samples_tools_use_cases_cascading_inputs_tool_showcase](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_tools_use_cases_cascading_inputs_tool_showcase.yml/badge.svg?branch=main) |
This is a flow demonstrating the use of a tool with cascading inputs which frequently used in situations where the selection in one input field determines what subsequent inputs should be shown, and it helps in creating a more efficient, user-friendly, and error-free input process |
custom-strong-type-connection-package-tool-showcase |
![samples_tools_use_cases_custom_strong_type_connection_package_tool_showcase](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_tools_use_cases_custom_strong_type_connection_package_tool_showcase.yml/badge.svg?branch=main) |
This is a flow demonstrating the use of a package tool with custom string type connection which provides a secure way to manage credentials for external APIs and data sources, and it offers an improved user-friendly and intellisense experience compared to custom connections |
custom-strong-type-connection-script-tool-showcase |
![samples_tools_use_cases_custom_strong_type_connection_script_tool_showcase](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_tools_use_cases_custom_strong_type_connection_script_tool_showcase.yml/badge.svg?branch=main) |
This is a flow demonstrating the use of a script tool with custom string type connection which provides a secure way to manage credentials for external APIs and data sources, and it offers an improved user-friendly and intellisense experience compared to custom connections |
custom_llm_tool_showcase |
![samples_tools_use_cases_custom_llm_tool_showcase](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_tools_use_cases_custom_llm_tool_showcase.yml/badge.svg?branch=main) |
This is a flow demonstrating how to use a custom_llm tool, which enables users to seamlessly connect to a large language model with prompt tuning experience using a PromptTemplate |
dynamic-list-input-tool-showcase |
![samples_tools_use_cases_dynamic_list_input_tool_showcase](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_tools_use_cases_dynamic_list_input_tool_showcase.yml/badge.svg?branch=main) |
This is a flow demonstrating how to use a tool with a dynamic list input |
path |
status |
description |
connections |
![samples_connections](https://cdn.statically.io/img/github.com/microsoft/promptflow/actions/workflows/samples_connections.yml/badge.svg?branch=main) |
This folder contains example YAML files for creating connection using pf cli |
We welcome contributions and suggestions! Please see the contributing guidelines for details.
This project has adopted the Microsoft Open Source Code of Conduct. Please see the code of conduct for details.