Skip to content

Commit

Permalink
Merge branch 'main' into task/addSimulator
Browse files Browse the repository at this point in the history
  • Loading branch information
nagkumar91 authored Apr 17, 2024
2 parents 62ea4c5 + 670226b commit 02334be
Show file tree
Hide file tree
Showing 246 changed files with 7,661 additions and 2,192 deletions.
10 changes: 10 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
"**/*.xml",
"**/*.txt",
".gitignore",
"examples/README.md",
"examples/flex-flows/README.md",
"examples/prompty/README.md",
"scripts/docs/_build/**",
"src/promptflow-azure/promptflow/azure/_restclient/flow/**",
"src/promptflow-azure/promptflow/azure/_restclient/swagger.json",
Expand Down Expand Up @@ -191,6 +194,13 @@
"spawnv",
"fstring",
"pydantic",
"arxiv",
"autogen",
"spawnve",
"mltable",
"prompty",
"nologo",
"wscript",
"raisvc",
"restx",
"WBITS",
Expand Down
28 changes: 8 additions & 20 deletions .github/workflows/promptflow-core-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,12 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- uses: snok/install-poetry@v1
- name: install promptflow-tracing
run: poetry install
working-directory: ${{ env.TRACING_DIRECTORY }}
- name: install promptflow-core
run: poetry install
working-directory: ${{ env.WORKING_DIRECTORY }}
- name: install test dependency group
run: poetry install --only test
run: |
poetry install -E executor-service --with ci,test
poetry run pip show promptflow-tracing
poetry run pip show promptflow-core
working-directory: ${{ env.WORKING_DIRECTORY }}
- name: install recording
run: poetry install
working-directory: ${{ env.RECORD_DIRECTORY }}
- name: run core tests
run: poetry run pytest ./tests/core --cov=promptflow --cov-config=pyproject.toml --cov-report=term --cov-report=html --cov-report=xml
working-directory: ${{ env.WORKING_DIRECTORY }}
Expand Down Expand Up @@ -74,18 +68,12 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- uses: snok/install-poetry@v1
- name: install promptflow-tracing
run: poetry install
working-directory: ${{ env.TRACING_DIRECTORY }}
- name: install promptflow-core[azureml-serving]
run: poetry install -E azureml-serving
working-directory: ${{ env.WORKING_DIRECTORY }}
- name: install test dependency group
run: poetry install --only test
run: |
poetry install -E azureml-serving --with ci,test
poetry run pip show promptflow-tracing
poetry run pip show promptflow-core
working-directory: ${{ env.WORKING_DIRECTORY }}
- name: install recording
run: poetry install
working-directory: ${{ env.RECORD_DIRECTORY }}
- name: run azureml-serving tests
run: poetry run pytest ./tests/azureml-serving --cov=promptflow --cov-config=pyproject.toml --cov-report=term --cov-report=html --cov-report=xml
working-directory: ${{ env.WORKING_DIRECTORY }}
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/promptflow-sdk-cli-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ on:
- .github/workflows/promptflow-sdk-cli-test.yml
- src/promptflow-recording/**
workflow_dispatch:
inputs:
filepath:
description: file or paths you want to trigger a test
required: true
default: "./tests/sdk_cli_test ./tests/sdk_pfs_test"
type: string
env:
IS_IN_CI_PIPELINE: "true"
RECORD_DIRECTORY: ${{ github.workspace }}/src/promptflow-recording
Expand All @@ -30,7 +36,9 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: set test mode
run: echo "PROMPT_FLOW_TEST_MODE=$(if [[ "${{ github.event_name }}" == "pull_request" ]]; then echo replay; else echo live; fi)" >> $GITHUB_ENV
run: |
echo "PROMPT_FLOW_TEST_MODE=$(if [[ "${{ github.event_name }}" == "pull_request" ]]; then echo replay; else echo live; fi)" >> $GITHUB_ENV
echo "FILE_PATHS=$(if [[ "${{ inputs.filepath }}" == "" ]]; then echo "./tests/sdk_cli_test ./tests/sdk_pfs_test"; else echo ${{ inputs.filepath }}; fi)" >> $GITHUB_ENV
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
Expand All @@ -39,15 +47,7 @@ jobs:
- name: install test dependency group
run: |
set -xe
poetry install --only test
poetry run pip install ${{ env.TRACING_DIRECTORY }}
poetry run pip install ${{ env.CORE_DIRECTORY }}[azureml-serving]
poetry run pip install -e ${{ env.WORKING_DIRECTORY }}[pyarrow]
echo "Need to install promptflow to avoid tool dependency issue"
poetry run pip install ${{ env.PROMPTFLOW_DIRECTORY }}
poetry run pip install ${{ env.TOOL_DIRECTORY }}
poetry run pip install -e ${{ env.RECORD_DIRECTORY }}
poetry install -E pyarrow --with ci,test
poetry run pip show promptflow-tracing
poetry run pip show promptflow-core
Expand All @@ -71,7 +71,7 @@ jobs:
cp ${{ github.workspace }}/src/promptflow/dev-connections.json.example ${{ github.workspace }}/src/promptflow/connections.json
- name: run devkit tests
run: |
poetry run pytest ./tests/sdk_cli_test ./tests/sdk_pfs_test -p promptflow --cov=promptflow --cov-config=pyproject.toml \
poetry run pytest ${{ env.FILE_PATHS }} -p promptflow --cov=promptflow --cov-config=pyproject.toml \
--cov-report=term --cov-report=html --cov-report=xml -n auto -m "unittest or e2etest" \
--ignore-glob ./tests/sdk_cli_test/e2etests/test_executable.py
working-directory: ${{ env.WORKING_DIRECTORY }}
Expand All @@ -84,7 +84,7 @@ jobs:
${{ env.WORKING_DIRECTORY }}/*.xml
${{ env.WORKING_DIRECTORY }}/htmlcov/
${{ env.WORKING_DIRECTORY }}/tests/sdk_cli_test/count.json
- run: poetry run pip install -e ${{ env.WORKING_DIRECTORY }}[executable]
- run: poetry install -E executable
working-directory: ${{ env.WORKING_DIRECTORY }}
- name: run devkit executable tests
run: |
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/samples_connections.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ jobs:
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
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/connections
run: |
Expand All @@ -74,6 +79,8 @@ jobs:
run: |
export aoai_api_key=${{secrets.AOAI_API_KEY_TEST }}
export aoai_api_endpoint=${{ secrets.AOAI_API_ENDPOINT_TEST }}
export AZURE_OPENAI_API_KEY=${{secrets.AOAI_API_KEY_TEST }}
export AZURE_OPENAI_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 }}
Expand All @@ -84,6 +91,8 @@ jobs:
run: |
export aoai_api_key=${{secrets.AOAI_API_KEY_TEST }}
export aoai_api_endpoint=${{ secrets.AOAI_API_ENDPOINT_TEST }}
export AZURE_OPENAI_API_KEY=${{secrets.AOAI_API_KEY_TEST }}
export AZURE_OPENAI_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_PROD }}
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/samples_connections_connection.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,22 @@ 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: setup .env file
working-directory: examples/connections
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
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 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: Test Notebook
Expand Down
110 changes: 110 additions & 0 deletions .github/workflows/samples_flex_flows_basic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# 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_flex_flows_basic
on:
schedule:
- cron: "30 20 * * *" # Every day starting at 4:30 BJT
pull_request:
branches: [ main ]
paths: [ examples/flex-flows/basic/**, examples/*requirements.txt, .github/workflows/samples_flex_flows_basic.yml ]
workflow_dispatch:

env:
IS_IN_CI_PIPELINE: "true"

jobs:
samples_flex_flows_basic:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python 3.9 environment
uses: actions/setup-python@v4
with:
python-version: "3.9"
- 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/flex-flows/basic
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
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/flex-flows/basic
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/flex-flows/basic/README.md
working-directory: ${{ github.workspace }}
run: |
python scripts/readme/extract_steps_from_readme.py -f examples/flex-flows/basic/README.md -o examples/flex-flows/basic
- name: Cat script
working-directory: examples/flex-flows/basic
run: |
cat bash_script.sh
- name: Run scripts against canary workspace (scheduled runs only)
if: github.event_name == 'schedule'
working-directory: examples/flex-flows/basic
run: |
export aoai_api_key=${{secrets.AOAI_API_KEY_TEST }}
export aoai_api_endpoint=${{ secrets.AOAI_API_ENDPOINT_TEST }}
export AZURE_OPENAI_API_KEY=${{secrets.AOAI_API_KEY_TEST }}
export AZURE_OPENAI_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: Run scripts against production workspace
if: github.event_name != 'schedule'
working-directory: examples/flex-flows/basic
run: |
export aoai_api_key=${{secrets.AOAI_API_KEY_TEST }}
export aoai_api_endpoint=${{ secrets.AOAI_API_ENDPOINT_TEST }}
export AZURE_OPENAI_API_KEY=${{secrets.AOAI_API_KEY_TEST }}
export AZURE_OPENAI_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_PROD }}
bash bash_script.sh
- name: Pip List for Debug
if : ${{ always() }}
working-directory: examples/flex-flows/basic
run: |
pip list
- name: Upload artifact
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: artifact
path: examples/flex-flows/basic/bash_script.sh
Loading

0 comments on commit 02334be

Please sign in to comment.