This lab demonstrates to use the vector store functionality and use HeatWave Chat to create an AI-powered Help chat that refers to the HeatWave user guide to respond to HeatWave related queries.
Note: This lab assumes that you’re familiar with the HeatWave Database Systems.
About HeatWave GenAI
HeatWave GenAI is an inbuilt functionality of HeatWave that lets you communicate with the HeatWave environment using natural language queries. It uses large language models (LLMs) to enable natural language communication and provides an inbuilt vector store that you can use to store enterprise-specific proprietary content.
HeatWave Chat is a chatbot that extends text-generation and vector search to let you ask multiple follow-up questions about a topic in a single session. It can even draw its knowledge from documents ingested by the vector store.
Database System Requirements
To run this lab, you need a HeatWave Database System that meets the following requirements:
The HeatWave Database System must be version 9.0.0 - Innovation or higher.
The ECPU Shape of the HeatWave Database System must be MySQL.32.
Ensure that you use the --sqlc flag while connecting to your database system:
mysqlsh -uAdmin -pPassword -hPrivateIP --sqlc
Replace Admin with the database system admin name, Password with the database system password, and PrivateIP with the private IP of the database system.
Create an Object Storage Bucket
In the OCI Console, open the navigation menu and click Storage, and then click Buckets under Object Storage & Archive Storage.
Under List Scope, select a compartment from the list. All buckets in that compartment are listed in tabular form.
Click Create Bucket.
On the Create Bucket dialog box that appears, in the Bucket Name field, enterquickstart_bucket.
Click Create. The bucket is listed with all over buckets available in that compartment in tabular form.
Upload the PDF File to the Object Storage Bucket
Select quickstart_bucket. The buckets Details page appears.
Under Objects, click Upload.
On the Upload Objects dialog box that appears, in the Object Name Prefix field, enter quickstart/.
In the Choose Files from your Computer, click select files to upload the heatwave-en.a4.pdf which you downloaded earlier in this lab.
Click Upload.
After the file upload is complete, click Close to close the Upload Objects dialog box.
Setting Up the Vector Store
After you've connected to your database system, create a new database:
create database quickstart_db;
Create the new database:
use quickstart_db;
Call the following method to create a schema used for task management:
selectmysql_task_management_ensure_schema();
Create the vector table and load the source document:
call sys.heatwave_chat("What is HeatWave AutoML?");
The heatwave_chat method automatically loads the LLM and runs a contextual search on the available vector stores 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.
Cleaning Up
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;
Delete quickstart_bucket.
Deleting the Bucket
In the OCI Console, open the navigation menu and click Storage, and then click Buckets under Object Storage & Archive Storage.
Under List Scope, select a compartment from the list. All buckets in that compartment are listed in tabular form.
Select quickstart_bucket. The buckets Details page appears.
Click Delete.
In the Delete Bucket dialog box that appears, enter quickstart_bucket to confirm resource and bucket deletion, and then click Delete. The bucket is deleted and no longer appears in the list of buckets in the compartment.