HeatWave on AWS  /  HeatWave GenAI  /  HeatWave GenAI In-database Vector Store

13.4 HeatWave GenAI In-database Vector Store

The automated, in-database vector store enables customers to use HeatWave GenAI with their business documents without moving data to a separate vector database. All the steps to create a vector store and vector embeddings are automated and executed inside the database, including discovering the documents in object storage, parsing them, generating embeddings in a highly parallel and optimized way, and inserting them into the vector store, making the HeatWave vector store efficient and easy to use. When in-database LLMs are used, data does not leave your HeatWave Cluster, thus enhancing the security for your data. The in-database vector store enables the use of Retrieval Augmented Generation (RAG), allowing the LLMs to search proprietary data with appropriate context to provide more accurate and relevant answers.

To generate embedding for a file stored in your Amazon S3 bucket, connect to your DB System, create a database, and use the heatwave_load() stored procedure routine to load the file. For example:

drop database if exists vector_store; 
create database vector_store;
use vector_store; 
DROP TABLE IF EXISTS vector_test;
SET @dl_tables = '[{ 
  "db_name": "vector_store",
  "tables": [{
     "table_name": "vector_test",
     "dialect": {
       "format":"pdf"
     },
     "file": [{"prefix": "s3://<bucket-name>/<prefix>/<filename>"}]
   }]
 }]';
SET @options = JSON_OBJECT('policy', 'disable_unsupported_columns',
      'external_tables', 
      CAST(@dl_tables AS JSON));
CALL sys.heatwave_load(@dl_tables, @options);
select count(*) from vector_test;

When format of the loaded file is one of pdf, txt, html, json, doc, or ppt, HeatWave Lakehouse automatically creates a vector store out of the database you created, parses the loaded file, and generates an embedding for the file in the table you created. The vector store can now be used with the ML_RAG and ML_RAG_TABLE routines; see HeatWave GenAI Routines.

You can learn more about the HeatWave GenAI in-database vector store by looking at Performing a Vector Search, but note that the VECTOR_STORE_LOAD routine, which operates asynchronously, is not supported by HeatWave on AWS; use heatwave_load() stored procedure instead for loading a file.