Skip to content

Commit

Permalink
update chat with pdf example (microsoft#130)
Browse files Browse the repository at this point in the history
Co-authored-by: Jie Tong <[email protected]>
Co-authored-by: Han Wang <[email protected]>
Co-authored-by: Philip Gao <[email protected]>
Co-authored-by: Clement Wang <[email protected]>
  • Loading branch information
5 people authored Aug 22, 2023
1 parent ef76687 commit 35b9471
Show file tree
Hide file tree
Showing 104 changed files with 3,221 additions and 567 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/samples_connections.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ jobs:
- name: Prepare requirements
working-directory: examples/connections
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
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: |
Expand Down Expand Up @@ -57,10 +59,14 @@ jobs:
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Extract Steps
- name: Extract Steps examples/connections/README.md
working-directory: ${{ github.workspace }}
run: |
python scripts/readme/extract_steps_from_readme.py -f examples/connections/README.md -o examples/connections
- name: Cat script
working-directory: examples/connections
run: |
cat bash_script.sh
- name: Run scripts
working-directory: examples/connections
run: |
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/samples_flows_chat_basic_chat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ jobs:
- name: Prepare requirements
working-directory: examples/flows/chat/basic-chat
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
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: |
Expand Down Expand Up @@ -57,10 +59,14 @@ jobs:
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Extract Steps
- name: Extract Steps examples/flows/chat/basic-chat/README.md
working-directory: ${{ github.workspace }}
run: |
python scripts/readme/extract_steps_from_readme.py -f examples/flows/chat/basic-chat/README.md -o examples/flows/chat/basic-chat
- name: Cat script
working-directory: examples/flows/chat/basic-chat
run: |
cat bash_script.sh
- name: Run scripts
working-directory: examples/flows/chat/basic-chat
run: |
Expand Down
19 changes: 14 additions & 5 deletions .github/workflows/samples_flows_chat_chat_with_pdf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ jobs:
- name: Prepare requirements
working-directory: examples/flows/chat/chat-with-pdf
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
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: |
Expand All @@ -48,8 +50,11 @@ jobs:
- name: Create AOAI Connection from ENV file
working-directory: examples/flows/chat/chat-with-pdf
run: |
pf connection create --file .env --name chat_with_pdf_custom_connection
pf connection list
if [[ -e .env ]]; then
pf connection create --file .env --name chat_with_pdf_custom_connection
pf connection list
fi
- name: Create run.yml
working-directory: examples/flows/chat/chat-with-pdf
run: |
Expand All @@ -62,10 +67,14 @@ jobs:
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Extract Steps
- name: Extract Steps examples/flows/chat/chat-with-pdf/README.md
working-directory: ${{ github.workspace }}
run: |
python scripts/readme/extract_steps_from_readme.py -f examples/flows/chat/chat-with-pdf/README.md -o examples/flows/chat/chat-with-pdf
- name: Cat script
working-directory: examples/flows/chat/chat-with-pdf
run: |
cat bash_script.sh
- name: Run scripts
working-directory: examples/flows/chat/chat-with-pdf
run: |
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/samples_flows_chat_chat_with_wikipedia.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ jobs:
- name: Prepare requirements
working-directory: examples/flows/chat/chat-with-wikipedia
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
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: |
Expand Down Expand Up @@ -57,10 +59,14 @@ jobs:
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Extract Steps
- name: Extract Steps examples/flows/chat/chat-with-wikipedia/README.md
working-directory: ${{ github.workspace }}
run: |
python scripts/readme/extract_steps_from_readme.py -f examples/flows/chat/chat-with-wikipedia/README.md -o examples/flows/chat/chat-with-wikipedia
- name: Cat script
working-directory: examples/flows/chat/chat-with-wikipedia
run: |
cat bash_script.sh
- name: Run scripts
working-directory: examples/flows/chat/chat-with-wikipedia
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
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
- name: Create Chat With PDF Custom Connection
working-directory: examples/flows/chat/chat-with-pdf
run: |
AOAI_API_KEY=${{ secrets.AOAI_API_KEY_TEST }}
Expand All @@ -46,6 +46,14 @@ jobs:
mv .env.example .env
pf connection create --file .env --name chat_with_pdf_custom_connection
fi
- name: Create AOAI Connection
working-directory: examples/flows/chat/chat-with-pdf
run: |
AOAI_API_KEY=${{ secrets.AOAI_API_KEY_TEST }}
AOAI_API_ENDPOINT=${{ secrets.AOAI_API_ENDPOINT_TEST }}
if [[ -e azure_openai.yml ]]; then
pf connection create --file azure_openai.yml --set api_key=$AOAI_API_KEY api_base=$AOAI_API_ENDPOINT
fi
- name: Azure Login
uses: azure/login@v1
with:
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/samples_flows_evaluation_basic_eval.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ jobs:
- name: Prepare requirements
working-directory: examples/flows/evaluation/basic-eval
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
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: |
Expand Down Expand Up @@ -57,10 +59,14 @@ jobs:
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Extract Steps
- name: Extract Steps examples/flows/evaluation/basic-eval/README.md
working-directory: ${{ github.workspace }}
run: |
python scripts/readme/extract_steps_from_readme.py -f examples/flows/evaluation/basic-eval/README.md -o examples/flows/evaluation/basic-eval
- name: Cat script
working-directory: examples/flows/evaluation/basic-eval
run: |
cat bash_script.sh
- name: Run scripts
working-directory: examples/flows/evaluation/basic-eval
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ jobs:
- name: Prepare requirements
working-directory: examples/flows/evaluation/classification-accuracy-eval
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
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: |
Expand Down Expand Up @@ -57,10 +59,14 @@ jobs:
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Extract Steps
- name: Extract Steps examples/flows/evaluation/classification-accuracy-eval/README.md
working-directory: ${{ github.workspace }}
run: |
python scripts/readme/extract_steps_from_readme.py -f examples/flows/evaluation/classification-accuracy-eval/README.md -o examples/flows/evaluation/classification-accuracy-eval
- name: Cat script
working-directory: examples/flows/evaluation/classification-accuracy-eval
run: |
cat bash_script.sh
- name: Run scripts
working-directory: examples/flows/evaluation/classification-accuracy-eval
run: |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# 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_entity_match_rate
on:
schedule:
- cron: "10 22 * * *" # Every day starting at 6:10 BJT
pull_request:
branches: [ main ]
paths: [ examples/** ]
workflow_dispatch:

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 }} > ${{ github.workspace }}/examples/config.json
- name: Prepare requirements
working-directory: examples/flows/evaluation/eval-entity-match-rate
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-entity-match-rate
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-entity-match-rate
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-entity-match-rate/README.md
working-directory: ${{ github.workspace }}
run: |
python scripts/readme/extract_steps_from_readme.py -f examples/flows/evaluation/eval-entity-match-rate/README.md -o examples/flows/evaluation/eval-entity-match-rate
- name: Cat script
working-directory: examples/flows/evaluation/eval-entity-match-rate
run: |
cat bash_script.sh
- name: Run scripts
working-directory: examples/flows/evaluation/eval-entity-match-rate
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 }}
bash bash_script.sh
- name: Upload artifact
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: artifact
path: examples/flows/evaluation/eval-entity-match-rate/bash_script.sh
84 changes: 84 additions & 0 deletions .github/workflows/samples_flows_evaluation_groundedness_eval.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# 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_groundedness_eval
on:
schedule:
- cron: "10 22 * * *" # Every day starting at 6:10 BJT
pull_request:
branches: [ main ]
paths: [ examples/** ]
workflow_dispatch:

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 }} > ${{ github.workspace }}/examples/config.json
- name: Prepare requirements
working-directory: examples/flows/evaluation/groundedness-eval
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/groundedness-eval
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/groundedness-eval
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/groundedness-eval/README.md
working-directory: ${{ github.workspace }}
run: |
python scripts/readme/extract_steps_from_readme.py -f examples/flows/evaluation/groundedness-eval/README.md -o examples/flows/evaluation/groundedness-eval
- name: Cat script
working-directory: examples/flows/evaluation/groundedness-eval
run: |
cat bash_script.sh
- name: Run scripts
working-directory: examples/flows/evaluation/groundedness-eval
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 }}
bash bash_script.sh
- name: Upload artifact
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: artifact
path: examples/flows/evaluation/groundedness-eval/bash_script.sh
Loading

0 comments on commit 35b9471

Please sign in to comment.