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 Object Storage bucket. For more information, see Resource Principals.
Download the HeatWave user guide PDF (A4) - 1.7Mb.
Create an Object Storage Bucket with the name
quickstart_bucket
.Upload the PDF file to the Object Storage Bucket using the prefix
quickstart/
to create a new folder by the name quickstart.
-
Connect to your HeatWave Database System.
mysqlsh -uAdmin -pPassword -hPrivateIP --sqlc
NoteX protocol is not supported for setting up a vector store using asynchronous load. To run this quickstart, ensure that you use the classic MySQL protocol while connecting to the database.
Replace the following:
Admin
: the database system admin name.Password
: the database system password.PrivateIP
: the private IP address of the database system.
-
Create and use a new database:
create database quickstart_db; use quickstart_db;
-
To create a schema to be used for task management, run the following command:
select mysql_task_management_ensure_schema();
-
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 Object Storage 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 id, name, message, progress, status, scheduled_time,estimated_completion_time, estimated_remaining_time, progress_bar FROM mysql_task_management.task_status WHERE id=TaskID\G
Replace
TaskID
with the displayed task ID.The output looks similar to the following:
id: 1 name: Vector Store Loader message: Task starting. progress: 0 status: RUNNING scheduled_time: 2024-07-02 14:42:38 estimated_completion_time: 2024-07-22 10:19:53 estimated_remaining_time: 52.50000 progress_bar: __________
-
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:
| To set up HeatWave AutoML in MySQL HeatWave, you need to follow these steps: 1. Ensure that you have an operational MySQL DB System and are able to connect to it using a MySQL client. If not, complete the steps described in Getting Started with MySQL HeatWave. 2. Ensure that your MySQL DB System has an operational HeatWave Cluster. If not, complete the steps described in Adding a HeatWave Cluster. 3. Obtain the MySQL user privileges described in Section 3.2, Before You Begin. 4. Prepare and load training and test data. See Section 3.4, Preparing Data. 5. Train a machine learning model. See Section 3.5, Training a Model. 6. Make predictions using the trained model. See Section 3.6, Making Predictions. 7. Generate explanations for the predictions made by the model. See Section 3.7, Generating Explanations. 8. Monitor and manage the performance of the model. See Section 3.8, Monitoring and Managing Performance. |
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 database system, then delete the database system. For more information, see Deleting a DB System.
Delete
quickstart_bucket
. For more information, see Deleting the Object Storage Bucket.