Follow the below steps to launch End-to-End pipeline as a Service on Snowflake and interact with it.
<your_project_repository> is the path to the local directory where <git_repo> has been cloned.
export SETUP_PATH="<your_project_directory>/kgqa_demo/kgqa_demo_setup"cd <your_project_directory>/kgqa_docker/- Update the config parameters in the config file 'config.json'
NOTE: Anything prefixed with temp_ can be customized by the user, along with account and sf_login_email. Everything else should remain unchanged.
Execute the below sf_db_initialization script to produce SQL File to load and populate the Database and Tables in Snowflake ( copy-paste on Snowflake SQL Worksheet and Run)
NOTE:
- To execute SQL commands in Snowflake Worksheet, you first need to select a database. Initially, this could be any database. Later in the script, you will create a custom database and switch to it for subsequent commands.
- You may already have your custom data in Snowflake, as outlined in the DB File. The setup requires four tables. For the schema details, refer to the "CREATE OR REPLACE TABLE..." commands in the file.
python3 $SETUP_PATH/setup.py --config $SETUP_PATH/config.json --output_dir $SETUP_PATH/ sf_db_initializationAn Image Repository in Snowflake is a storage location where you can store and manage container images. These images are like snapshots of applications and their environments, which can be run on Snowflake's platform.
Execute the below create_image_repo script to produce SQL File to create Image Repository on Snowflake ( copy-paste on Snowflake SQL Worksheet and Run)
python3 $SETUP_PATH/setup.py --config $SETUP_PATH/config.json --output_dir $SETUP_PATH/ create_image_repoThe Similarity Search using FAISS relies on index files to find the best matching results. These index files must be included in the container image for the search to function properly.
Execute the below generate_embeddings script to create the index files
python3 $SETUP_PATH/setup.py --config $SETUP_PATH/config.json --output_dir $SETUP_PATH/ generate_embeddings --option model="e5-base-v2"Execute the below build_push_docker_image script to push docker image to Snowflake's Image Repository.
python3 $SETUP_PATH/setup.py --config $SETUP_PATH/config.json --output_dir $SETUP_PATH/ build_push_docker_imageExecute the below create_service script to produce SQL File to create Snowflake Service ( copy-paste on Snowflake SQL Worksheet and RUN)
python3 $SETUP_PATH/setup.py --config $SETUP_PATH/config.json --output_dir $SETUP_PATH/ create_serviceNOTE: After running the "CREATE SERVICE .." command in SF Worksheet, wait for the service to get Status="READY" ( takes around 3-4 minutes ) before creating the UDFs and testing them in the below Worksheet.