From 377597e7d62fdc30d5e0324fe83f2c391b1d4745 Mon Sep 17 00:00:00 2001 From: Han Wang Date: Tue, 16 Apr 2024 15:50:39 +0800 Subject: [PATCH] fix CI --- examples/flex-flows/basic/README.md | 51 +++++++++-------------------- 1 file changed, 15 insertions(+), 36 deletions(-) diff --git a/examples/flex-flows/basic/README.md b/examples/flex-flows/basic/README.md index 59379f6e2e7..7d8bca0847c 100644 --- a/examples/flex-flows/basic/README.md +++ b/examples/flex-flows/basic/README.md @@ -25,7 +25,20 @@ cat ../.env python programmer.py ``` -- Test flow +- Test flow with connection + +Storing connection info in .env with plaintext is not safe. We recommend to use `pf connection` to guard secrets like `api_key` from leak. + +- Show or create `open_ai_connection` +```bash +# create connection from `azure_openai.yml` file +# Override keys with --set to avoid yaml file changes +pf connection create --file ../../connections/azure_openai.yml --set api_key= api_base= + +# check if connection exists +pf connection show -n open_ai_connection +``` + ```bash # test with default input value in flow.flex.yaml pf flow test --flow . @@ -62,39 +75,6 @@ pf run show-details --name $name pf run visualize --name $name ``` -## Run flow with connection -Storing connection info in .env with plaintext is not safe. We recommend to use `pf connection` to guard secrets like `api_key` from leak. - -- Show or create `open_ai_connection` -```bash -# create connection from `azure_openai.yml` file -# Override keys with --set to avoid yaml file changes -pf connection create --file ../../connections/azure_openai.yml --set api_key= api_base= - -# check if connection exists -pf connection show -n open_ai_connection -``` - -- Test using connection secret specified in environment variables -**Note**: we used `'` to wrap value since it supports raw value without escape in powershell & bash. For windows command prompt, you may remove the `'` to avoid it become part of the value. - -```bash -# test with default input value in flow.flex.yaml -pf flow test --flow . --environment-variables AZURE_OPENAI_API_KEY='${open_ai_connection.api_key}' AZURE_OPENAI_ENDPOINT='${open_ai_connection.api_base}' -``` - -- Create run using connection secret binding specified in environment variables, see [run.yml](run.yml) -```bash -# create run -pf run create --flow . --data ./data.jsonl --stream --environment-variables AZURE_OPENAI_API_KEY='${open_ai_connection.api_key}' AZURE_OPENAI_ENDPOINT='${open_ai_connection.api_base}' --column-mapping text='${data.text}' -# create run using yaml file -pf run create --file run.yml --stream - -# show outputs -name=$(pf run list -r 10 | jq '.[] | select(.name | contains("basic_")) | .name'| head -n 1 | tr -d '"') -pf run show-details --name $name -``` - ## Run flow in cloud with connection - Assume we already have a connection named `open_ai_connection` in workspace. ```bash @@ -106,7 +86,7 @@ az configure --defaults group= workspace=