A helpful steward on your Flyte
flyte-attendant
is a tool that you can deploy to help answer your questions
about Flyte, an open source workflow orchestrator for data,
machine learning, and analytics.
Create a virtual environment using virtualenv
:
python -m venv ~/venvs/flyte-attendant
source ~/venvs/flyte-attendant/bin/activate
Install dependencies
pip install -r requirements.txt
Get an OpenAI API key here and add it to a
secrets.txt
file in the root of this repo:
OPENAI_API_KEY="..."
Then, export it with:
export $(grep -v '^#' secrets.txt | xargs)
Call the script:
python flyte_attendant/run.py "Can you explain what a Flyte workflow is at a high level?"
pyflyte run flyte_attendant/workflows/chat_support.py ask \
--question "Can you explain what a Flyte workflow is at a high level?"
Docker build and push:
./docker_build.sh
docker login ghcr.io
docker push <tag>
Set the config you're using to access the Union Cloud cluster:
export FLYTECTL_CONFIG=<config-file>
Create a new project (do this once):
flytectl --config $FLYTECTL_CONFIG create project \
--id "flyte-attendant" \
--labels "my-label=flyte-attendant" \
--description "Flyte Attendant Chat Bot" \
--name "flyte-attendant"
Register to a Flyte cluster:
pyflyte --config $FLYTECTL_CONFIG \
register flyte_attendant \
--project flytesnacks \
--domain development \
--image ghcr.io/unionai-oss/flyte-attendant:latest
Define Secret on the Flyte cluster:
kubectl create secret \
-n flytesnacks-development \
generic openai-api-key \
--from-literal=OPENAI_API_KEY='<SECRET>'
Run the workflow:
python scripts/ask_remote.py \
--config-file $FLYTECTL_CONFIG \
--project flyte-attendant \
"Can you explain what a Flyte workflow is at a high level?"
Install uctl
in your $HOME
directory:
cd $HOME
curl -sL https://raw.githubusercontent.com/unionai/uctl/main/install.sh | bash
Initialize the config file:
cd <path/to/flyte-attendant/repo>
~/bin/uctl config init --host <host_url>
Set the config you're using to access the Union Cloud cluster:
export UCTL_CONFIG=<config-file>
Create a new project (do this once):
~/bin/uctl --config $UCTL_CONFIG create project \
--id "flyte-attendant" \
--labels "my-label=flyte-attendant" \
--description "Flyte Attendant Chat Bot" \
--name "flyte-attendant"
Register the workflow:
pyflyte --config $UCTL_CONFIG \
register flyte_attendant \
--project flyte-attendant \
--domain development \
--image ghcr.io/unionai-oss/flyte-attendant:latest
Define a secret on AWS via the AWS Secrets Manager. Make sure to use plaintext secrets with only the secret value itself.
Then, run:
python scripts/ask_remote.py \
--config-file $UCTL_CONFIG \
--project flyte-attendant \
"Can you explain what a Flyte workflow is at a high level?"
In Union Cloud, an app allows you to authenticate to the cluster with a secret
key. We'll use the app.yaml
file defined in the root of this repo to create
an app:
~/bin/uctl create app --config $UCTL_CONFIG --appSpecFile app.yaml
You should see a client NAME
and SECRET
associated with the app. Store the
SECRET
value somewhere secure: this will be the last time you'll have access
to it.
export UNIONAI_APP_CLIENT_SECRET='<SECRET_VALUE>'
Run the streamlit app:
streamlit run app/ask_app.py