forked from microsoft/genaiops-promptflow-template
-
Notifications
You must be signed in to change notification settings - Fork 0
165 lines (153 loc) · 6.53 KB
/
platform_ci_dev_workflow.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: platform_ci_dev_workflow
on:
workflow_call:
inputs:
env_name:
type: string
description: "Execution Environment"
required: true
default: "dev"
flow_type:
type: string
description: "The flow use-case to execute"
required: true
default: "web_classification"
deployment_type:
type: string
description: "Determine type of deployment - aml, aks, docker, webapp"
required: true
secrets:
azure_credentials:
description: "service principal authentication to Azure"
required: true
connection_details:
description: "prompt flow connection details"
required: false
registry_details:
description: "prompt flow registry details"
required: false
jobs:
flow-experiment-and_evaluation:
name: prompt flow experiment and evaluation job
runs-on: ubuntu-latest
steps:
- name: Checkout Actions
uses: actions/checkout@v4
- name: Azure login
uses: azure/login@v1
with:
creds: ${{ secrets.azure_credentials }}
- name: Configure Azure ML Agent
uses: ./.github/actions/configure_azureml_agent
- name: load the current Azure subscription details
id: subscription_details
shell: bash
run: |
export subscriptionId=$(az account show --query id -o tsv)
echo "SUBSCRIPTION_ID=$subscriptionId" >> $GITHUB_OUTPUT
#=====================================
# Registers experiment dataset in Azure ML as Data Asset
# Reads appropriate field values from data_config.json based on environment and data purpose
#=====================================
- name: Register experiment data asset
uses: ./.github/actions/execute_script
with:
step_name: "Register experiment data asset"
script_parameter: |
python -m llmops.common.register_data_asset \
--subscription_id ${{ steps.subscription_details.outputs.SUBSCRIPTION_ID }} \
--data_purpose "training_data" \
--flow_to_execute ${{ inputs.flow_type }} \
--env_name ${{ inputs.env_name }}
#=====================================
# Executes Standard flow for a scenario
# Generates Reports for each RUN as well as consolidated one
# Execute a RUN for each unique variant combination (keeping default variant id for other nodes)
# Loads appropriate experiment data from Azure ML data asset
# Reads appropriate field values from mapping_config.json based on environment and evaluation flow name
# Prompt Flow connections should pre-exist
# used automatic (serverless) runtime by default
# writes the RUN ID in run_id.txt file. Used in next step
#=====================================
- name: Execute prompt flow bulk run
uses: ./.github/actions/execute_script
with:
step_name: "Execute prompt flow bulk run"
script_parameter: |
python -m llmops.common.prompt_pipeline \
--subscription_id ${{ steps.subscription_details.outputs.SUBSCRIPTION_ID }} \
--build_id ${{ github.run_id }} \
--flow_to_execute ${{ inputs.flow_type }} \
--env_name ${{ inputs.env_name }} \
--data_purpose "training_data" \
--output_file run_id.txt
#=====================================
# Reads run_id.txt file. Assigns it to variable RUN_NAME
# RUN_NAME Used in next step for evaluation of flows
#=====================================
- name: Read PromptFlow Runs
shell: bash
run: |
readarray arr <"run_id.txt"
run_name=${arr[0]}
echo $run_name
echo "RUN_NAME=${run_name}" >> "$GITHUB_ENV"
echo $PWD
#=====================================
# Registers evaluation dataset in Azure ML as Data Asset
# Reads appropriate field values from data_config.json based on environment and data purpose
#=====================================
- name: Register evaluation data asset
uses: ./.github/actions/execute_script
with:
step_name: "Register evaluation data asset"
script_parameter: |
python -m llmops.common.register_data_asset \
--subscription_id ${{ steps.subscription_details.outputs.SUBSCRIPTION_ID }} \
--data_purpose "test_data" \
--flow_to_execute ${{ inputs.flow_type }} \
--env_name ${{ inputs.env_name }}
#=====================================
# Executes all Evaluation flows available for a scenario
# Generates Reports for each RUN as well as consolidated one
# Uses each RUN ID as input to run evaluation against
# Loads appropriate evaluation data from Azure ML data asset
# Reads appropriate field values from mapping_config.json based on environment and evaluation flow name
# Prompt Flow connections should pre-exist
# used automatic (serverless) runtime by default
#=====================================
- name: Execute bulk run evaluations
uses: ./.github/actions/execute_script
with:
step_name: "Execute bulk run evaluations"
script_parameter: |
python -m llmops.common.prompt_eval \
--subscription_id ${{ steps.subscription_details.outputs.SUBSCRIPTION_ID }} \
--build_id ${{ github.run_id }} \
--flow_to_execute ${{ inputs.flow_type }} \
--env_name ${{ inputs.env_name }} \
--data_purpose "test_data" \
--run_id "$RUN_NAME"
#=====================================
# Published generated reports in csv and html format
# Available as pipeline artifacts
#=====================================
- name: Archive CSV
uses: actions/upload-artifact@v3
with:
name: evaluation-reports
path: ./reports
#=====================================
# Execute platform_cd_dev_workflow flow for deployment of flows
#=====================================
deploy-flow:
uses: ./.github/workflows/platform_cd_dev_workflow.yml
needs: flow-experiment-and_evaluation
with:
env_name: ${{ inputs.env_name }}
flow_type: ${{ inputs.flow_type }}
deployment_type: ${{ inputs.deployment_type }}
secrets:
azure_credentials: ${{ secrets.azure_credentials }}
connection_details: ${{ secrets.connection_details }}
registry_details: ${{ secrets.registry_details }}