This quickstart shows how to use the vector store functionality and use HeatWave Chat to create a GenAI-powered Help chat that refers to the HeatWave user guide to respond to HeatWave related queries.
This quickstart assumes that you are familiar with HeatWave Database Systems.
This quickstart contains the following sections:
Review the Requirements.
To run this quickstart, you need HeatWave Database System version 9.0.0 - Innovation or higher. For more information, see Creating a DB System and Editing a DB System.
If not already done, add a HeatWave Cluster to your database system.
If not already done, enable HeatWave Lakehouse on the database system.
Enable the database system to access an OCI bucket. For more information, see Resource Principals.
Download the HeatWave user guide PDF.
Create an Bucket with the name
quickstart_bucket
.Upload the PDF file to the Bucket using the prefix
quickstart/
to create a new folder by the name quickstart.
-
Connect to your HeatWave Database System.
NoteX protocol is not supported for Ingesting Files Using Asynchronous Load. To set up a vector store using this method, ensure that you use the classic MySQL protocol while connecting to the database.
mysqlsh -uDBSystemAdminName -pDBSystemPassword -hDBSystemPrivateIP --sqlc
-
Create and use a new database:
CREATE DATABASE quickstart_db; USE quickstart_db;
-
Create the vector table and load the source document:
CALL sys.VECTOR_STORE_LOAD('oci://quickstart_bucket@Namespace/quickstart/heatwave-en.a4.pdf', '{"table_name": "quickstart_embeddings"}');
Replace
Namespace
with the name of the bucket namespace that you are using.This creates an asynchronous task in the background which loads the vector embeddings into the specified vector store table
quickstart_embeddings
.The routine output that is displayed contains a query with the task ID.
-
To track the progress of the task, run the task query displayed on the screen:
SELECT mysql_tasks.task_status_brief("TaskID");
Replace
TaskID
with the displayed task ID.The output looks similar to the following:
+-----------------------------------------------------------------------------------------+ | mysql_tasks.task_status_brief("TaskID") | +-----------------------------------------------------------------------------------------+ | {"data": {"tables_to_load": "[{\"table_name\": \"quickstart_embeddings\", | | \"load_progress\": 40.0}]"}, "status": "RUNNING", "message": "Loading in progress...", | | "progress": 40} | +-----------------------------------------------------------------------------------------+
-
After the task status has changed to
Completed
, verify that embeddings are loaded in the vector store table:SELECT COUNT(*) FROM quickstart_embeddings;
If you see a numerical value in the output, your embeddings are successfully loaded in the vector store table.
-
Clear the previous chat history and states:
SET @chat_options=NULL;
-
Ask your question using HeatWave Chat:
CALL sys.HEATWAVE_CHAT("What is HeatWave AutoML?");
The
HEATWAVE_CHAT
routine automatically loads the LLM and runs a semantic search on the available vector stores and retrieves context, by default. The output is similar to the following:| HeatWave AutoML is a feature of MySQL HeatWave that makes it easy to use machine learning, whether you are a novice user or an experienced ML practitioner. It analyzes the characteristics of the data and creates an optimized machine learning model that can be used to generate predictions and explanations. The data and models never leave MySQL HeatWave, saving time and effort while keeping the data and models secure. HeatWave AutoML is optimized for HeatWave shapes and scaling, and all processing is performed on the HeatWave Cluster. |
-
Ask a follow-up question:
CALL sys.HEATWAVE_CHAT("How to set it up?");
The output is similar to the following:
| Answer: To set up HeatWave AutoML in MySQL HeatWave, you need to follow these steps: 1. Create a new user with the necessary privileges. 2. Create a new schema named ML_SCHEMA_user_name, where the user_name is the name of the owning user. 3. Create an InnoDB table named MODEL_CATALOG in the ML_SCHEMA_user_name schema. 4. Grant the necessary privileges to the new user for the ML_SCHEMA_user_name schema and the MODEL_CATALOG table. 5. Create a new machine learning model using HeatWave AutoML. To monitor HeatWave AutoML status, you can query the rapid_ml_status variable or the ML_STATUS column of the performance_schema.rpd_nodes table. The rapid_ml_status variable provides the status of HeatWave AutoML, with possible values of ON and OFF. If the value is ON, HeatWave AutoML is up and running, and if it's OFF, HeatWave AutoML is down. You can also query the ML |
You can continue asking follow-up questions in the same chat session.
To avoid being billed for the resources that you created for this quickstart, perform the following steps:
-
Delete the database that you created:
drop database quickstart_db;
If you created a new DB system, then delete the DB system. For more information, see Deleting a DB System.
Delete
quickstart_bucket
. For more information, see Deleting the Bucket.