Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New tutorial on prompt tunning and evaluation #524

Merged
merged 45 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
57bdf58
new tutorial on prompt tunning
jiaochenlu Sep 15, 2023
f1ff9a6
update
jiaochenlu Sep 16, 2023
30e31c3
prompt the conn
jiaochenlu Sep 16, 2023
6ff4ec0
modify the tutorial doc and update the sample flow
ChenJieting Sep 19, 2023
a8ff1e7
refine the doc
ChenJieting Sep 19, 2023
0d28004
updates
ChenJieting Sep 25, 2023
c5ae098
delete run_name definition
ChenJieting Sep 25, 2023
2079f7e
update command
jiaochenlu Sep 25, 2023
25589ec
Merge branch 'chenlu/tutorial_prompt_eval' of https://github.com/micr…
ChenJieting Sep 25, 2023
5677853
refine
ChenJieting Sep 25, 2023
3455ee5
Merge branch 'main' into chenlu/tutorial_prompt_eval
crazygao Sep 26, 2023
546c960
Flow chat math
crazygao Sep 26, 2023
466e243
add README for eval flow, refine the tutorial doc
ChenJieting Sep 27, 2023
233a083
updates for the contributing standards
ChenJieting Sep 27, 2023
4175e9e
updates
ChenJieting Sep 27, 2023
cc00f83
update
ChenJieting Sep 27, 2023
339ec41
Merge branch 'main' of https://github.com/microsoft/promptflow into c…
ChenJieting Sep 28, 2023
c66445a
More style fixing
crazygao Sep 28, 2023
932d548
Fix
crazygao Sep 28, 2023
ff18e3d
Merge branch 'chenlu/tutorial_prompt_eval' of https://github.com/micr…
ChenJieting Sep 28, 2023
92c4f16
fix typo and some math language
ChenJieting Sep 28, 2023
7963dfd
Update README.md
jiaochenlu Sep 28, 2023
5574596
Fix
crazygao Sep 28, 2023
1ed8089
Fix
crazygao Sep 28, 2023
1441433
Merge branch 'main' into chenlu/tutorial_prompt_eval
ChenJieting Oct 7, 2023
abc6941
pull 1441433b
ChenJieting Oct 7, 2023
48132db
Update line_process.py
jiaochenlu Oct 17, 2023
2621591
Merge branch 'main' of https://github.com/microsoft/promptflow into c…
ChenJieting Oct 20, 2023
3feba86
updates according to the comments
ChenJieting Oct 20, 2023
8e9f76b
modify the code and add comment
ChenJieting Oct 25, 2023
9aef7bc
update the code
ChenJieting Oct 25, 2023
3c93ff1
update
ChenJieting Oct 25, 2023
bbe2e12
Merge branch 'main' of https://github.com/microsoft/promptflow into c…
ChenJieting Oct 27, 2023
55da724
Merge branch 'main' into chenlu/tutorial_prompt_eval
ChenJieting Oct 31, 2023
fb47f6e
refine the code style
ChenJieting Nov 6, 2023
95cf825
Merge branch 'chenlu/tutorial_prompt_eval' of https://github.com/micr…
ChenJieting Nov 6, 2023
d18abb7
refine
ChenJieting Nov 6, 2023
76bf193
refine
ChenJieting Nov 6, 2023
5249cd8
Merge branch 'main' into chenlu/tutorial_prompt_eval
ChenJieting Nov 7, 2023
6186b8b
lowercase prompt flow
ChenJieting Nov 9, 2023
b926461
Merge branch 'chenlu/tutorial_prompt_eval' of https://github.com/micr…
ChenJieting Nov 9, 2023
c93b675
merge and solve conflicts
ChenJieting Nov 9, 2023
ac0bf36
delete banner img
ChenJieting Nov 9, 2023
0e0f528
delete logo in readme file
ChenJieting Nov 9, 2023
2f3f031
solve some conflicts
ChenJieting Nov 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions .github/workflows/samples_flows_chat_chat_math_variant.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# This code is autogenerated.
# Code is generated by running custom script: python3 readme.py
# Any manual changes to this file may cause incorrect behavior.
# Any manual changes will be overwritten if the code is regenerated.

name: samples_flows_chat_chat_math_variant
on:
schedule:
- cron: "35 20 * * *" # Every day starting at 4:35 BJT
pull_request:
branches: [ main ]
paths: [ examples/flows/chat/chat-math-variant/**, examples/*requirements.txt, .github/workflows/samples_flows_chat_chat_math_variant.yml ]
workflow_dispatch:

env:
IS_IN_CI_PIPELINE: "true"

jobs:
samples_readme_ci:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Python 3.9 environment
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Generate config.json
run: echo '${{ secrets.TEST_WORKSPACE_CONFIG_JSON_CANARY }}' > ${{ github.workspace }}/examples/config.json
ChenJieting marked this conversation as resolved.
Show resolved Hide resolved
- name: Prepare requirements
working-directory: examples
run: |
if [[ -e requirements.txt ]]; then
python -m pip install --upgrade pip
pip install -r requirements.txt
fi
- name: Prepare dev requirements
working-directory: examples
run: |
python -m pip install --upgrade pip
pip install -r dev_requirements.txt
- name: Refine .env file
working-directory: examples/flows/chat/chat-math-variant
run: |
AOAI_API_KEY=${{ secrets.AOAI_API_KEY_TEST }}
AOAI_API_ENDPOINT=${{ secrets.AOAI_API_ENDPOINT_TEST }}
AOAI_API_ENDPOINT=$(echo ${AOAI_API_ENDPOINT//\//\\/})
if [[ -e .env.example ]]; then
echo "env replacement"
sed -i -e "s/<your_AOAI_key>/$AOAI_API_KEY/g" -e "s/<your_AOAI_endpoint>/$AOAI_API_ENDPOINT/g" .env.example
mv .env.example .env
fi
- name: Create run.yml
working-directory: examples/flows/chat/chat-math-variant
run: |
gpt_base=${{ secrets.AOAI_API_ENDPOINT_TEST }}
gpt_base=$(echo ${gpt_base//\//\\/})
if [[ -e run.yml ]]; then
sed -i -e "s/\${azure_open_ai_connection.api_key}/${{ secrets.AOAI_API_KEY_TEST }}/g" -e "s/\${azure_open_ai_connection.api_base}/$gpt_base/g" run.yml
fi
- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Extract Steps examples/flows/chat/chat-math-variant/README.md
working-directory: ${{ github.workspace }}
run: |
python scripts/readme/extract_steps_from_readme.py -f examples/flows/chat/chat-math-variant/README.md -o examples/flows/chat/chat-math-variant
- name: Cat script
working-directory: examples/flows/chat/chat-math-variant
run: |
cat bash_script.sh
- name: Run scripts
working-directory: examples/flows/chat/chat-math-variant
run: |
export aoai_api_key=${{secrets.AOAI_API_KEY_TEST }}
export aoai_api_endpoint=${{ secrets.AOAI_API_ENDPOINT_TEST }}
export test_workspace_sub_id=${{ secrets.TEST_WORKSPACE_SUB_ID }}
export test_workspace_rg=${{ secrets.TEST_WORKSPACE_RG }}
export test_workspace_name=${{ secrets.TEST_WORKSPACE_NAME_CANARY }}
bash bash_script.sh
- name: Pip List for Debug
if : ${{ always() }}
working-directory: examples/flows/chat/chat-math-variant
run: |
pip list
- name: Upload artifact
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: artifact
path: examples/flows/chat/chat-math-variant/bash_script.sh
92 changes: 92 additions & 0 deletions .github/workflows/samples_flows_evaluation_eval_chat_math.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# This code is autogenerated.
# Code is generated by running custom script: python3 readme.py
# Any manual changes to this file may cause incorrect behavior.
# Any manual changes will be overwritten if the code is regenerated.

name: samples_flows_evaluation_eval_chat_math
on:
schedule:
- cron: "52 19 * * *" # Every day starting at 3:52 BJT
pull_request:
branches: [ main ]
paths: [ examples/flows/evaluation/eval-chat-math/**, examples/*requirements.txt, .github/workflows/samples_flows_evaluation_eval_chat_math.yml ]
workflow_dispatch:

env:
IS_IN_CI_PIPELINE: "true"

jobs:
samples_readme_ci:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Python 3.9 environment
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Generate config.json
run: echo '${{ secrets.TEST_WORKSPACE_CONFIG_JSON_CANARY }}' > ${{ github.workspace }}/examples/config.json
- name: Prepare requirements
working-directory: examples
run: |
if [[ -e requirements.txt ]]; then
python -m pip install --upgrade pip
pip install -r requirements.txt
fi
- name: Prepare dev requirements
working-directory: examples
run: |
python -m pip install --upgrade pip
pip install -r dev_requirements.txt
- name: Refine .env file
working-directory: examples/flows/evaluation/eval-chat-math
run: |
AOAI_API_KEY=${{ secrets.AOAI_API_KEY_TEST }}
AOAI_API_ENDPOINT=${{ secrets.AOAI_API_ENDPOINT_TEST }}
AOAI_API_ENDPOINT=$(echo ${AOAI_API_ENDPOINT//\//\\/})
if [[ -e .env.example ]]; then
echo "env replacement"
sed -i -e "s/<your_AOAI_key>/$AOAI_API_KEY/g" -e "s/<your_AOAI_endpoint>/$AOAI_API_ENDPOINT/g" .env.example
mv .env.example .env
fi
- name: Create run.yml
working-directory: examples/flows/evaluation/eval-chat-math
run: |
gpt_base=${{ secrets.AOAI_API_ENDPOINT_TEST }}
gpt_base=$(echo ${gpt_base//\//\\/})
if [[ -e run.yml ]]; then
sed -i -e "s/\${azure_open_ai_connection.api_key}/${{ secrets.AOAI_API_KEY_TEST }}/g" -e "s/\${azure_open_ai_connection.api_base}/$gpt_base/g" run.yml
fi
- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Extract Steps examples/flows/evaluation/eval-chat-math/README.md
working-directory: ${{ github.workspace }}
run: |
python scripts/readme/extract_steps_from_readme.py -f examples/flows/evaluation/eval-chat-math/README.md -o examples/flows/evaluation/eval-chat-math
- name: Cat script
working-directory: examples/flows/evaluation/eval-chat-math
run: |
cat bash_script.sh
- name: Run scripts
working-directory: examples/flows/evaluation/eval-chat-math
run: |
export aoai_api_key=${{secrets.AOAI_API_KEY_TEST }}
export aoai_api_endpoint=${{ secrets.AOAI_API_ENDPOINT_TEST }}
export test_workspace_sub_id=${{ secrets.TEST_WORKSPACE_SUB_ID }}
export test_workspace_rg=${{ secrets.TEST_WORKSPACE_RG }}
export test_workspace_name=${{ secrets.TEST_WORKSPACE_NAME_CANARY }}
bash bash_script.sh
- name: Pip List for Debug
if : ${{ always() }}
working-directory: examples/flows/evaluation/eval-chat-math
run: |
pip list
- name: Upload artifact
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: artifact
path: examples/flows/evaluation/eval-chat-math/bash_script.sh
52 changes: 52 additions & 0 deletions .github/workflows/samples_getstarted_flowasfunction.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# This code is autogenerated.
# Code is generated by running custom script: python3 readme.py
# Any manual changes to this file may cause incorrect behavior.
# Any manual changes will be overwritten if the code is regenerated.

name: samples_getstarted_flowasfunction
on:
schedule:
- cron: "17 21 * * *" # Every day starting at 5:17 BJT
pull_request:
branches: [ main ]
paths: [ examples/**, .github/workflows/samples_getstarted_flowasfunction.yml ]
workflow_dispatch:

env:
IS_IN_CI_PIPELINE: "true"

jobs:
samples_notebook_ci:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Generate config.json
run: echo '${{ secrets.TEST_WORKSPACE_CONFIG_JSON_CANARY }}' > ${{ github.workspace }}/examples/config.json
- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Setup Python 3.9 environment
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Prepare requirements
run: |
python -m pip install --upgrade pip
pip install -r ${{ github.workspace }}/examples/requirements.txt
pip install -r ${{ github.workspace }}/examples/dev_requirements.txt
- name: Create Aoai Connection
run: pf connection create -f ${{ github.workspace }}/examples/connections/azure_openai.yml --set api_key="${{ secrets.AOAI_API_KEY_TEST }}" api_base="${{ secrets.AOAI_API_ENDPOINT_TEST }}"
- name: Create new Aoai Connection
run: pf connection create -f ${{ github.workspace }}/examples/connections/azure_openai.yml --set api_key="${{ secrets.AOAI_API_KEY_TEST }}" api_base="${{ secrets.AOAI_API_ENDPOINT_TEST }}" name=new_ai_connection
- name: Test Notebook
working-directory: examples/tutorials/get-started
run: |
papermill -k python flow-as-function.ipynb flow-as-function.output.ipynb
- name: Upload artifact
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: artifact
path: examples/tutorials/get-started
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# This code is autogenerated.
# Code is generated by running custom script: python3 readme.py
# Any manual changes to this file may cause incorrect behavior.
# Any manual changes will be overwritten if the code is regenerated.

name: samples_tutorials_flow_fine_tuning_evaluation_promptflow_quality_improvement
on:
schedule:
- cron: "15 19 * * *" # Every day starting at 3:15 BJT
pull_request:
branches: [ main ]
paths: [ examples/**, .github/workflows/samples_tutorials_flow_fine_tuning_evaluation_promptflow_quality_improvement.yml ]
workflow_dispatch:

env:
IS_IN_CI_PIPELINE: "true"

jobs:
samples_readme_ci:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Python 3.9 environment
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Generate config.json
run: echo '${{ secrets.TEST_WORKSPACE_CONFIG_JSON_CANARY }}' > ${{ github.workspace }}/examples/config.json
- name: Prepare requirements
working-directory: examples
run: |
if [[ -e requirements.txt ]]; then
python -m pip install --upgrade pip
pip install -r requirements.txt
fi
- name: Prepare dev requirements
working-directory: examples
run: |
python -m pip install --upgrade pip
pip install -r dev_requirements.txt
- name: Refine .env file
working-directory: examples/tutorials/flow-fine-tuning-evaluation
run: |
AOAI_API_KEY=${{ secrets.AOAI_API_KEY_TEST }}
AOAI_API_ENDPOINT=${{ secrets.AOAI_API_ENDPOINT_TEST }}
AOAI_API_ENDPOINT=$(echo ${AOAI_API_ENDPOINT//\//\\/})
if [[ -e .env.example ]]; then
echo "env replacement"
sed -i -e "s/<your_AOAI_key>/$AOAI_API_KEY/g" -e "s/<your_AOAI_endpoint>/$AOAI_API_ENDPOINT/g" .env.example
mv .env.example .env
fi
- name: Create run.yml
working-directory: examples/tutorials/flow-fine-tuning-evaluation
run: |
gpt_base=${{ secrets.AOAI_API_ENDPOINT_TEST }}
gpt_base=$(echo ${gpt_base//\//\\/})
if [[ -e run.yml ]]; then
sed -i -e "s/\${azure_open_ai_connection.api_key}/${{ secrets.AOAI_API_KEY_TEST }}/g" -e "s/\${azure_open_ai_connection.api_base}/$gpt_base/g" run.yml
fi
- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Extract Steps examples/tutorials/flow-fine-tuning-evaluation/promptflow-quality-improvement.md
working-directory: ${{ github.workspace }}
run: |
python scripts/readme/extract_steps_from_readme.py -f examples/tutorials/flow-fine-tuning-evaluation/promptflow-quality-improvement.md -o examples/tutorials/flow-fine-tuning-evaluation
- name: Cat script
working-directory: examples/tutorials/flow-fine-tuning-evaluation
run: |
cat bash_script.sh
- name: Run scripts
working-directory: examples/tutorials/flow-fine-tuning-evaluation
run: |
export aoai_api_key=${{secrets.AOAI_API_KEY_TEST }}
export aoai_api_endpoint=${{ secrets.AOAI_API_ENDPOINT_TEST }}
export test_workspace_sub_id=${{ secrets.TEST_WORKSPACE_SUB_ID }}
export test_workspace_rg=${{ secrets.TEST_WORKSPACE_RG }}
export test_workspace_name=${{ secrets.TEST_WORKSPACE_NAME_CANARY }}
bash bash_script.sh
- name: Pip List for Debug
if : ${{ always() }}
working-directory: examples/tutorials/flow-fine-tuning-evaluation
run: |
pip list
- name: Upload artifact
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: artifact
path: examples/tutorials/flow-fine-tuning-evaluation/bash_script.sh
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,19 @@ 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**](examples/tutorials/flow-fine-tuning-evaluation/promptflow-quality-improvement.md) 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.
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<img src="examples/tutorials/quick-start/media/logo_pf.png" alt="logo" width="25"/>
#### VS Code Extension

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

Expand Down
Loading
Loading