
{"id":7058,"date":"2024-12-10T10:26:48","date_gmt":"2024-12-10T09:26:48","guid":{"rendered":"https:\/\/dasini.net\/blog\/?p=7058"},"modified":"2025-03-08T15:40:01","modified_gmt":"2025-03-08T14:40:01","slug":"simplifying-ai-development-a-practical-guide-to-heatwave-genais-rag-vector-store-features","status":"publish","type":"post","link":"https:\/\/dasini.net\/blog\/2024\/12\/10\/simplifying-ai-development-a-practical-guide-to-heatwave-genais-rag-vector-store-features\/","title":{"rendered":"Simplifying AI Development: A Practical Guide to HeatWave GenAI\u2019s RAG &amp; Vector Store Features"},"content":{"rendered":"\n<p>This article builds upon the concepts introduced in my previous blog posts:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/dasini.net\/blog\/2024\/09\/10\/heatwave-genai-sentiment-analysis-made-easy-peasy\/\" target=\"_blank\" rel=\"noopener\" title=\"HeatWave GenAI: Sentiment Analysis Made Easy-Peasy\">HeatWave GenAI: Sentiment Analysis Made Easy-Peasy<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/dasini.net\/blog\/2024\/08\/07\/heatwave-genai-your-ai-powered-content-creation-partner\/\" target=\"_blank\" rel=\"noopener\" title=\"\u00a0HeatWave GenAI: Your AI-Powered Content Creation Partner\">HeatWave GenAI: Your AI-Powered Content Creation Partner<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/dasini.net\/blog\/2024\/08\/13\/in-database-llms-for-efficient-text-translation-with-heatwave-genai\/\" target=\"_blank\" rel=\"noopener\" title=\"In-Database LLMs for Efficient Text Translation with HeatWave GenAI\">In-Database LLMs for Efficient Text Translation with HeatWave GenAI<\/a> <\/li>\n\n\n\n<li><a href=\"https:\/\/dasini.net\/blog\/2024\/09\/10\/heatwave-genai-sentiment-analysis-made-easy-peasy\/\" target=\"_blank\" rel=\"noopener\" title=\"HeatWave GenAI: Sentiment Analysis Made Easy-Peasy\">HeatWave GenAI: Sentiment Analysis Made Easy-Peasy<\/a><\/li>\n<\/ul>\n\n\n\n<p>For a deeper understanding, also consider reading these articles.<\/p>\n\n\n<div class=\"wp-block-image is-style-default\">\n<figure data-wp-context=\"{&quot;imageId&quot;:&quot;69e745af16a7b&quot;}\" data-wp-interactive=\"core\/image\" data-wp-key=\"69e745af16a7b\" class=\"aligncenter size-thumbnail wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"830\" height=\"271\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2024\/12\/HeatWave_logo.png?resize=150%2C150&amp;ssl=1\" alt=\"HeatWave\" class=\"wp-image-7222\" srcset=\"https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2024\/12\/HeatWave_logo.png?w=830&amp;ssl=1 830w, https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2024\/12\/HeatWave_logo.png?resize=300%2C98&amp;ssl=1 300w, https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2024\/12\/HeatWave_logo.png?resize=800%2C261&amp;ssl=1 800w, https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2024\/12\/HeatWave_logo.png?resize=768%2C251&amp;ssl=1 768w\" sizes=\"auto, (max-width: 830px) 100vw, 830px\" \/><button\n\t\t\tclass=\"lightbox-trigger\"\n\t\t\ttype=\"button\"\n\t\t\taria-haspopup=\"dialog\"\n\t\t\taria-label=\"Agrandir\"\n\t\t\tdata-wp-init=\"callbacks.initTriggerButton\"\n\t\t\tdata-wp-on--click=\"actions.showLightbox\"\n\t\t\tdata-wp-style--right=\"state.imageButtonRight\"\n\t\t\tdata-wp-style--top=\"state.imageButtonTop\"\n\t\t>\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewBox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\" \/>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure>\n<\/div>\n\n\n<p class=\"has-text-align-left has-vivid-green-cyan-color has-black-background-color has-text-color has-background has-link-color wp-elements-5074030437a9894823c769805c20dd9a\" style=\"font-size:18px;font-style:normal;font-weight:500\">This tutorial explores HeatWave GenAI, a cloud service that simplifies interacting with unstructured data using natural language. It combines large language models, vector stores, and SQL queries to enable tasks like content generation, chatbot, and retrieval-augmented generation (RAG). The focus is on RAG and how HeatWave GenAI&rsquo;s architecture helps users gain insights from their data. By the end, you\u2019ll learn how to implement these features effectively to unlock the full potential of generative AI for your applications.<\/p>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>HeatWave GenAI empowers you to interact with unstructured data seamlessly using natural language. Whether you\u2019re performing content generation, summarization, sentiment analysis, or retrieval-augmented generation (RAG), HeatWave GenAI simplifies the process with its intuitive design and robust features.<\/p>\n\n\n\n<p>Here\u2019s why HeatWave GenAI stands out:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Natural-Language Queries<\/strong>: Communicate with your data effortlessly by running natural-language searches using in-database or external large language models (LLMs).<\/li>\n\n\n\n<li><strong>SQL Familiarity<\/strong>: The system leverages a SQL-based interface, making it accessible and easy to adopt for users already familiar with relational databases.<\/li>\n\n\n\n<li><strong>Integrated and Optimized Pipeline<\/strong>: All the necessary components\u2014vector store generation, RAG-based vector search, and chatbot capabilities\u2014are seamlessly integrated, ensuring smooth performance and ease of use.<\/li>\n\n\n\n<li><strong>End-to-End Generative AI Capabilities<\/strong>: HeatWave GenAI supports direct integration of generative AI into your applications, providing a complete pipeline for data retrieval, analysis, and interaction.<\/li>\n<\/ul>\n\n\n\n<div style=\"height:25px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">What is RAG?<\/h2>\n\n\n\n<p>RAG stands for Retrieval-Augmented Generation. It&rsquo;s a technique that combines the power of Large Language Models (LLMs) with external knowledge bases. The primary goal of RAG is to enhance the quality, relevance, and accuracy of AI-generated responses by retrieving relevant information from these sources.<\/p>\n\n\n\n<p>Essentially, it&rsquo;s like giving an LLM access to a vast library, allowing it to provide more informative and contextually relevant answers.<\/p>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>How RAG Works<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Data Retrieval<\/strong>: The system retrieves relevant information from a connected knowledge base, vector store, or database using a query.<\/li>\n\n\n\n<li><strong>Generation<\/strong>: The retrieved data is then used as context to guide the language model in generating a response.<\/li>\n\n\n\n<li><strong>Output<\/strong>: The result is a response that blends the creative capabilities of the LLM with factual, targeted insights from the retrieved data.<\/li>\n<\/ol>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Key Features of RAG<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Accuracy<\/strong>: Responses are grounded in real-world data, reducing errors and hallucinations typical of standalone LLMs.<\/li>\n\n\n\n<li><strong>Relevance<\/strong>: Ensures the output directly addresses user queries by relying on contextually relevant information.<\/li>\n\n\n\n<li><strong>Scalability<\/strong>: Can handle large datasets stored in vector databases for quick, efficient searches.<\/li>\n<\/ul>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Some u<strong>se Cases for RAG<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Customer Support<\/strong>: Enhancing chatbot responses with real-time company knowledge or product details.<\/li>\n\n\n\n<li><strong>Content Creation<\/strong>: Generating articles or summaries based on specific datasets.<\/li>\n\n\n\n<li><strong>Research<\/strong>: Assisting with document retrieval and summarization for academic or industry research.<\/li>\n\n\n\n<li><strong>Personalization<\/strong>: Tailoring recommendations or messages based on customer data.<\/li>\n<\/ul>\n\n\n\n<div style=\"height:25px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">What is a Vector Store?<\/h2>\n\n\n\n<p>Vectors are numerical representations that capture the meaning, context, or characteristics of data, often used to represent text, images, or other complex data types. By storing these vectors, vector stores enable efficient similarity search, making it possible to find similar items based on their underlying semantic meaning.<\/p>\n\n\n\n<p>Vector stores are crucial for modern AI applications like recommendation systems, natural language processing, and retrieval-augmented generation (RAG). They provide a powerful tool for understanding and analyzing complex data.<\/p>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>How a Vector Store Works<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Data Vectorization<\/strong>: Input data, such as text or images, is transformed into vector embeddings using a model like a large language model (LLM) or an image encoder.<\/li>\n\n\n\n<li><strong>Storage<\/strong>: These embeddings are stored in the vector store, often alongside metadata about the original data.<\/li>\n\n\n\n<li><strong>Search and Retrieval<\/strong>: When a query is made, it is also converted into a vector, and the store performs similarity searches to retrieve the most relevant results based on distance measures like cosine similarity or Euclidean distance.<\/li>\n<\/ol>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Use Cases for Vector Stores<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Search and Retrieval<\/strong>: Powering AI-driven search engines that find relevant documents, images, or videos based on content rather than keywords.<\/li>\n\n\n\n<li><strong>Recommendation Systems<\/strong>: Suggesting products, movies, or music by comparing user preferences to stored vectors.<\/li>\n\n\n\n<li><strong>Chatbots and Virtual Assistants<\/strong>: Retrieving knowledge or context to answer user queries more accurately.<\/li>\n\n\n\n<li><strong>Content Matching<\/strong>: Identifying similar or related content, such as plagiarism detection or duplicate image recognition.<\/li>\n<\/ul>\n\n\n\n<div style=\"height:25px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">What is HeatWave?<\/h2>\n\n\n\n<p>Oracle\u2019s&nbsp;<a href=\"https:\/\/www.oracle.com\/heatwave\/\" target=\"_blank\" rel=\"noopener\" title=\"HeatWave\"><strong>HeatWave<\/strong><\/a>&nbsp;is a fully-managed Oracle Cloud Infrastructure service. It offered different solutions for different workloads:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>HeatWave MySQL<\/strong>: built on MySQL, for your transactional needs.<\/li>\n\n\n\n<li><strong>HeatWave Analytics<\/strong>: get real-time analytics on your data.<\/li>\n\n\n\n<li><strong>HeatWave Lakehouse<\/strong>: query data in various formats in object storage<\/li>\n\n\n\n<li><strong>HeatWave AutoML<\/strong>: automate the pipeline to build, train, and explain ML models<\/li>\n\n\n\n<li><strong>HeatWave GenAI<\/strong>: integrated &amp; automated GenAI with in-database LLMs<\/li>\n<\/ul>\n\n\n\n<figure data-wp-context=\"{&quot;imageId&quot;:&quot;69e745af1777c&quot;}\" data-wp-interactive=\"core\/image\" data-wp-key=\"69e745af1777c\" class=\"wp-block-image size-large wp-lightbox-container\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"415\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2024\/07\/hw_product_image.png?resize=800%2C415&#038;ssl=1\" alt=\"Data processing with HeatWave\" class=\"wp-image-6723\" srcset=\"https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2024\/07\/hw_product_image.png?resize=800%2C415&amp;ssl=1 800w, https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2024\/07\/hw_product_image.png?resize=300%2C156&amp;ssl=1 300w, https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2024\/07\/hw_product_image.png?resize=768%2C399&amp;ssl=1 768w, https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2024\/07\/hw_product_image.png?resize=1536%2C797&amp;ssl=1 1536w, https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2024\/07\/hw_product_image.png?resize=2048%2C1063&amp;ssl=1 2048w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><button\n\t\t\tclass=\"lightbox-trigger\"\n\t\t\ttype=\"button\"\n\t\t\taria-haspopup=\"dialog\"\n\t\t\taria-label=\"Agrandir\"\n\t\t\tdata-wp-init=\"callbacks.initTriggerButton\"\n\t\t\tdata-wp-on--click=\"actions.showLightbox\"\n\t\t\tdata-wp-style--right=\"state.imageButtonRight\"\n\t\t\tdata-wp-style--top=\"state.imageButtonTop\"\n\t\t>\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewBox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\" \/>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure>\n\n\n\n<p><strong><a href=\"https:\/\/www.oracle.com\/heatwave\/genai\/\" target=\"_blank\" rel=\"noopener\" title=\"HeatWave GenaI\">HeatWave GenAI<\/a><\/strong>&nbsp; (from version 9.0.1 onward) is an powerful integrated platform that combines automated in-database <a href=\"https:\/\/en.wikipedia.org\/wiki\/Large_language_model\" target=\"_blank\" rel=\"noreferrer noopener\">large language models<\/a>&nbsp;(LLMs),&nbsp;<a href=\"https:\/\/en.wikipedia.org\/wiki\/Vector_database\" target=\"_blank\" rel=\"noreferrer noopener\">vector stores<\/a>, and scalable vector processing. This simplifies content generation, enabling businesses to harness generative AI without requiring AI expertise, data transfer, or extra costs.<\/p>\n\n\n\n<p>The key benefits of such architecture are:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Effortless LLM Integration<\/strong>: Simple SQL queries unlock AI power.<\/li>\n\n\n\n<li><strong>Seamless Database Integration<\/strong>: No complex external connections.<\/li>\n\n\n\n<li><strong>Simplified Architecture<\/strong>: Easy management and scalability.<\/li>\n\n\n\n<li><strong>Scalable Performance<\/strong>: Handles large datasets and high traffic.<\/li>\n\n\n\n<li><strong>Always Up-to-Date Data<\/strong>: In-database LLMs ensure data freshness.<\/li>\n<\/ul>\n\n\n\n<p>HeatWave GenAI is available on major cloud platforms: Oracle Cloud Infrastructure (OCI), Amazon Web Services (AWS), and Microsoft Azure.<\/p>\n\n\n\n<div style=\"height:25px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>In this article I&rsquo;m using HeatWave&nbsp;<strong>9.1.0<\/strong>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"SQL\" class=\"language-SQL\">SQL &gt; SELECT version();\n+-------------+\n| version()   |\n+-------------+\n| 9.1.0-cloud |\n+-------------+\n<\/code><\/pre>\n\n\n\n<div style=\"height:25px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>I&rsquo;ll leverage <strong>HeatWave<\/strong> <strong>Lakehouse<\/strong> and <strong>GenAI<\/strong> capabilities.<\/p>\n\n\n\n<p><strong><span style=\"text-decoration: underline;\">HeatWave Lakehouse<br><\/span><\/strong>Allows to process data stored in OCI Object Storage. Data are retrieved from Object Storage, transformed into a memory-optimized format, and stored in the HeatWave persistence layer. This ensures efficient data processing, with the data loaded into the HeatWave cluster for real-time analytics and insights.<\/p>\n\n\n\n<p><strong><span style=\"text-decoration: underline;\">HeatWave Generative AI<br><\/span><\/strong>Enables natural-language interactions with unstructured data, using SQL-based queries for content generation, summarization, and retrieval-augmented generation (RAG). This makes it easy to generate and extract valuable insights from your data with minimal complexity.<\/p>\n\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Preparation<\/h2>\n\n\n\n<p>The data sources that will augmented the LLM are 6 pdf files based on the following Wikipedia pages:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/Iris_versicolor\" target=\"_blank\" rel=\"noopener\" title=\"Iris versicolor\">https:\/\/en.wikipedia.org\/wiki\/<\/a><a href=\"https:\/\/en.wikipedia.org\/wiki\/Iris_versicolor\" target=\"_blank\" rel=\"noopener\" title=\"Iris Versicolor\">Iris_versicolor<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/species.wikimedia.org\/wiki\/Iris_versicolor\" target=\"_blank\" rel=\"noopener\" title=\"Iris versicolor\">https:\/\/species.wikimedia.org\/wiki\/Iris_versicolor<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/Iris_virginica\" target=\"_blank\" rel=\"noopener\" title=\"Iris Virginica\">https:\/\/en.wikipedia.org\/wiki\/Iris_virginica<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/species.wikimedia.org\/wiki\/Iris_virginica\" target=\"_blank\" rel=\"noopener\" title=\"Iris virginica\">https:\/\/species.wikimedia.org\/wiki\/Iris_virginica<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/Iris_setosa\" target=\"_blank\" rel=\"noopener\" title=\"Iris Setosa\">https:\/\/en.wikipedia.org\/wiki\/Iris_setosa<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/species.wikimedia.org\/wiki\/Iris_setosa\" target=\"_blank\" rel=\"noopener\" title=\"Iris setosa\">https:\/\/species.wikimedia.org\/wiki\/Iris_setosa<\/a><\/li>\n<\/ul>\n\n\n\n<p>They were loaded into an OCI Object Storage bucket.<\/p>\n\n\n<div class=\"wp-block-image is-style-default wp-duotone-unset-1\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"341\" height=\"395\" src=\"https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2024\/12\/Screenshot-from-2024-12-05-14-37-55.png?fit=341%2C395&amp;ssl=1\" alt=\"The data sources that will augmented the LLM are 6 pdf files based on Wikipedia pages\" class=\"wp-image-7079\" srcset=\"https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2024\/12\/Screenshot-from-2024-12-05-14-37-55.png?w=341&amp;ssl=1 341w, https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2024\/12\/Screenshot-from-2024-12-05-14-37-55.png?resize=259%2C300&amp;ssl=1 259w\" sizes=\"auto, (max-width: 341px) 100vw, 341px\" \/><\/figure>\n<\/div>\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Load data into the HeatWave cluster,  generate vector embedding &amp; load them into a vector store table<\/h2>\n\n\n\n<p>If you\u2019re loading a vector store table on HeatWave for the first time, call the following method to create a schema used for task management:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"SQL\" class=\"language-SQL\">sql&gt; SELECT mysql_task_management_ensure_schema();<\/code><\/pre>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">RAG &amp; Vector Store preparation<\/h3>\n\n\n\n<p>There are many ways to do this, the easiest is probably to use the <a href=\"https:\/\/dev.mysql.com\/doc\/heatwave\/en\/mys-hw-auto-parallel-load.html\" target=\"_blank\" rel=\"noopener\" title=\"Loading Data into HeatWave Using Auto Parallel Load\"><strong>sys.HEATWAVE_LOAD<\/strong><\/a> stored procedure with a <a href=\"https:\/\/docs.oracle.com\/en-us\/iaas\/Content\/Object\/Tasks\/usingpreauthenticatedrequests.htm\" target=\"_blank\" rel=\"noopener\" title=\"Object Storage Pre-Authenticated Requests\">Pre-Authenticated Requests (PAR)<\/a>.<\/p>\n\n\n\n<p>An alternative is to use <strong><a href=\"https:\/\/dev.mysql.com\/doc\/heatwave\/en\/mys-hwgenai-vector-store-load.html\" target=\"_blank\" rel=\"noopener\" title=\"Generate vector embedding for the specified files or folders that are stored in the Object Storage bucket, and loads the embeddings into a new vector store table.\">sys.vector_store_load<\/a><\/strong>. More info <a href=\"https:\/\/dev.mysql.com\/doc\/heatwave\/en\/mys-hw-genai-vector-store-load.html\" target=\"_blank\" rel=\"noopener\" title=\"Setting Up a Vector Store\">here<\/a>.<\/p>\n\n\n\n<p>In short, the PDF files (stored in the Object Storage bucket) will be uploaded to the HeatWave cluster, where they will be split into smaller segments, transformed into numerical representations (vector embeddings), and stored in a dedicated vector store table for efficient search and retrieval.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"SQL\" class=\"language-SQL\">-- Load unstructured data (pdf) to HeatWave Lakehouse.\n-- Ingesting Files Using Auto Parallel Load\nSET @dl_tables = '[ { \"db_name\": \"Iris_AI\",\n\"tables\": [\n{\"table_name\": \"IrisAIembeddings\", \"engine_attribute\": { \"dialect\": {\"format\": \"pdf\", \"language\": \"en\"},\n\"file\": [ {\"par\": \"https:\/\/objectstorage.eu-frankfurt...\/Iris_AI\/o\/\"}\n]}}] }]';\n\nSET @options = JSON_OBJECT('mode', 'normal');\n\nCALL sys.HEATWAVE_LOAD(CAST(@dl_tables AS JSON), @options);\n\n-- Checks (count embeddings):\nSELECT count(*) FROM Iris_AI.IrisAIembeddings;\n<\/code><\/pre>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>The vector store table is: <strong>Iris_AI.IrisAIembeddings<\/strong>. Its structure is:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"SQL\" class=\"language-SQL\">SQL &gt; \nSHOW CREATE TABLE Iris_AI.IrisAIembeddings\\G\n*************************** 1. row ***************************\n       Table: IrisAIembeddings\nCreate Table: CREATE TABLE `IrisAIembeddings` (\n  `document_name` varchar(1024) NOT NULL COMMENT 'RAPID_COLUMN=ENCODING=VARLEN',\n  `metadata` json NOT NULL COMMENT 'RAPID_COLUMN=ENCODING=VARLEN',\n  `document_id` int unsigned NOT NULL,\n  `segment_number` int unsigned NOT NULL,\n  `segment` varchar(1024) NOT NULL COMMENT 'RAPID_COLUMN=ENCODING=VARLEN',\n  `segment_embedding` vector(384) NOT NULL COMMENT 'RAPID_COLUMN=ENCODING=VARLEN' \/*!80021 ENGINE_ATTRIBUTE '{\"model\": \"minilm\"}' *\/,\n  PRIMARY KEY (`document_id`,`segment_number`)\n) ENGINE=Lakehouse DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci SECONDARY_ENGINE=RAPID \/*!80021 ENGINE_ATTRIBUTE='{\"file\": [{\"par\": \"https:\/\/objectstorage.eu-frankfurt...\/Iris_AI\/o\/\"}], \"dialect\": {\"format\": \"pdf\", \"language\": \"en\", \"is_strict_mode\": false}}' *\/\n<\/code><\/pre>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>Some data:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"SQL\" class=\"language-SQL\">SELECT document_name, metadata, document_id, segment_number, segment FROM Iris_AI.IrisAIembeddings ORDER BY RAND() LIMIT 2\\G\n*************************** 1. row ***************************\n document_name: https:\/\/objectstorage.eu-frankfurt...\/Iris_AI\/o\/Iris_versicolor_Wikipedia.pdf\n      metadata: {\"TITLE\": \"Iris versicolor - Wikipedia\", \"PUBLISHER\": \"Skia\/PDF m128\", \"CREATIONDATE\": \"  9\/14\/2024 02:36:16 PM\", \"REVISIONDATE\": \"  9\/14\/2024 02:36:16 PM\", \"USERDEFINEDPROP\": \"Creator Mozilla\/5.0 (X11; Linux x86_64) AppleWebKit\/537.36 (KHTML, like Gecko) HeadlessChrome\/128.0.0.0 Safari\/537.36\"}\n   document_id: 2\nsegment_number: 8\n       segment: The purple iris is the official flower of Kappa Pi International Honorary Art Fraternity.[13]\nIris versicolor 'Blue Flag'\n \nIris versicolor\n \nIris versicolor \u2013 botanical illustration in American Medicinal Plants, 1887\n \nSaint-Prosper-de-Champlain, Quebec, Canada\nBatiscan, Quebec floral emblem, Canada[14]\n*************************** 2. row ***************************\n document_name: https:\/\/objectstorage.eu-frankfurt...\/Iris_versicolor_Wikispecies.pdf\n      metadata: {\"TITLE\": \"Iris versicolor - Wikispecies\", \"PUBLISHER\": \"Skia\/PDF m128\", \"CREATIONDATE\": \"  9\/14\/2024 02:39:44 PM\", \"REVISIONDATE\": \"  9\/14\/2024 02:39:44 PM\", \"USERDEFINEDPROP\": \"Creator Mozilla\/5.0 (X11; Linux x86_64) AppleWebKit\/537.36 (KHTML, like Gecko) HeadlessChrome\/128.0.0.0 Safari\/537.36\"}\n   document_id: 3\nsegment_number: 6\n       segment: References: BRUMMITT, R.K. 2001. TDWG \u2013 World Geographical Scheme for Recording Plant Distributions, 2nd Edition (https:\/\/github.com\/tdwg\/wgsrpd\/blob\/master\/109-488-1 -ED\/2nd%20Edition\/TDWG_geo2.pdf)\nLINNAEUS, C. 1753. Species Plantarum. Tomus I: 39 (http:\/\/www.biodiversitylibrary.org\/ite m\/13829#page\/51\/mode\/1up). Reference page. \nFlora of North America Editorial Committee (2002). Flora of North America North of Mexico 26: 1-723. Oxford University Press, New York, Oxford.\n<\/code><\/pre>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>We can find the PDF references:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"SQL\" class=\"language-SQL\">SELECT DISTINCT document_name FROM Iris_AI.IrisAIembeddings;\n+---------------------------------------------------------------------------------+\n| document_name                                                                   |\n+---------------------------------------------------------------------------------+\n| https:\/\/objectstorage.eu-frankfurt...\/Iris_AI\/o\/Iris_versicolor_Wikispecies.pdf |\n| https:\/\/objectstorage.eu-frankfurt...\/Iris_AI\/o\/Iris_virginica_Wikispecies.pdf  |\n| https:\/\/objectstorage.eu-frankfurt...\/Iris_AI\/o\/Iris_setosa_Wikispecies.pdf     |\n| https:\/\/objectstorage.eu-frankfurt...\/Iris_AI\/o\/Iris_virginica_Wikipedia.pdf    |\n| https:\/\/objectstorage.eu-frankfurt...\/Iris_AI\/o\/Iris_setosa_Wikipedia.pdf       |\n| https:\/\/objectstorage.eu-frankfurt...\/Iris_AI\/o\/Iris_versicolor_Wikipedia.pdf   |\n+---------------------------------------------------------------------------------+\n<\/code><\/pre>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>If you have ever wondered what a vector (stored in the <a href=\"https:\/\/dev.mysql.com\/doc\/refman\/9.1\/en\/vector.html\" target=\"_blank\" rel=\"noopener\" title=\"The MySQL VECTOR Type\">VECTOR<\/a> data type) might look like, you can use <a href=\"https:\/\/dev.mysql.com\/doc\/refman\/9.1\/en\/vector-functions.html#function_vector-to-string\" target=\"_blank\" rel=\"noopener\" title=\"Get the string representation of a VECTOR column, given its value as a binary string\"><code>VECTOR_TO_STRING()<\/code><\/a> or <a href=\"https:\/\/dev.mysql.com\/doc\/refman\/9.1\/en\/vector-functions.html#function_vector-to-string\" target=\"_blank\" rel=\"noopener\" title=\"Get the string representation of a VECTOR column, given its value as a binary string\">FROM_VECTOR()<\/a>&#8230;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"SQL\" class=\"language-SQL\">SELECT VECTOR_DIM(segment_embedding), FROM_VECTOR(segment_embedding) FROM Iris_AI.IrisAIembeddings LIMIT 1\\G\n*************************** 1. row ***************************\n VECTOR_DIM(segment_embedding): 384\nFROM_VECTOR(segment_embedding): [8.00615e-02,2.11577e-02,1.61691e-02,4.23411e-02,-3.24994e-02,4.45356e-02,-9.23082e-02,-3.37680e-02,-2.03409e-02,6.48912e-02,4.07830e-02,1.68436e-02,-3.48651e-02,5.55622e-02,-3.63239e-02,6.86629e-02,4.45186e-02,3.82741e-02,1.09397e-02,1.40209e-03,2.67049e-02,2.23335e-03,5.67095e-02,-2.48191e-02,-5.93457e-02,5.69686e-02,1.88271e-03,7.52686e-02,3.77259e-02,-2.84845e-02,-3.70396e-02,1.23335e-01,6.92697e-02,-4.33865e-02,6.80390e-03,-1.47766e-02,2.61221e-02,4.78904e-02,5.68956e-02,7.15472e-02,-5.28972e-02,-1.00536e-02,-1.24508e-02,-5.44387e-02,7.01239e-03,2.39283e-03,-4.52311e-02,-1.01765e-02,1.66316e-02,-5.89363e-03,-7.39317e-02,-4.40087e-02,-4.70511e-02,-7.55958e-04,7.00977e-02,1.76238e-02,-3.46344e-02,3.42340e-02,3.16051e-03,2.01610e-02,6.16689e-02,-3.29546e-02,-1.77070e-02,-3.53866e-02,-4.38236e-02,2.54502e-02,-9.36790e-02,-9.03236e-03,8.05398e-03,-1.30124e-01,-2.29885e-02,4.14870e-02,7.31113e-02,4.12350e-02,-5.03330e-02,1.53553e-03,1.31312e-02,1.68512e-02,-7.28380e-02,-2.29530e-02,-5.44221e-02,-2.94721e-02,1.01206e-01,-1.42966e-02,3.71721e-02,1.80400e-02,-2.11835e-02,2.84860e-02,-3.72609e-02,1.53701e-02,-4.35036e-02,-5.51637e-02,1.50130e-02,-3.49194e-02,-1.39024e-02,7.81750e-02,6.52888e-02,-8.32752e-02,-1.03520e-02,-1.13159e-02,-6.32495e-02,-1.73173e-02,-3.33632e-02,-1.90669e-02,-3.64169e-02,2.54803e-03,-8.01785e-02,-1.22022e-01,-2.22540e-02,-2.70522e-03,3.12901e-02,3.36771e-02,-6.77026e-02,5.30156e-02,2.64821e-02,-7.79997e-03,-5.18856e-02,-1.98439e-02,1.09730e-01,4.17542e-02,1.41583e-02,-8.88374e-03,1.00671e-02,9.43218e-03,3.44302e-03,5.37422e-02,-3.77832e-02,-1.26111e-02,2.97282e-02,-2.65987e-02,-2.07729e-02,-1.04494e-02,-8.58481e-03,-7.74056e-02,-4.44796e-02,-6.00447e-02,2.15521e-02,9.89563e-03,-5.55751e-03,3.89642e-02,-6.50692e-02,-7.91098e-02,-7.90359e-02,-3.78152e-03,-2.96150e-02,5.58467e-02,4.15553e-02,1.22073e-01,2.91632e-02,1.20790e-01,-1.12918e-03,1.55323e-02,-2.26794e-03,2.69730e-02,2.47722e-02,-1.58608e-01,-6.48694e-03,7.97874e-02,1.30401e-01,-7.63800e-02,5.34007e-02,1.20450e-01,9.73293e-03,3.36432e-02,-4.79591e-02,-8.73279e-02,8.55590e-03,5.65378e-02,4.04146e-02,2.00272e-02,-1.53599e-02,3.70622e-02,5.86816e-02,1.57900e-02,-3.75850e-02,-6.28287e-02,2.97302e-02,-6.33792e-02,-1.58955e-01,4.47092e-02,-2.49065e-03,4.68349e-02,6.57920e-03,4.96956e-02,-5.24389e-04,1.12109e-02,-5.98008e-02,8.31092e-03,4.62907e-04,7.37732e-03,-5.63335e-02,-3.69826e-02,6.56116e-02,4.68743e-02,-3.02025e-02,-1.07677e-02,-3.90057e-02,3.40080e-02,1.53216e-02,4.84835e-02,-1.91672e-02,-2.53384e-03,4.27504e-02,-1.87664e-02,6.07610e-02,4.13199e-02,4.74177e-03,-8.20841e-02,-2.18529e-02,-8.70064e-04,-3.18450e-02,9.38491e-03,-7.51281e-02,6.61539e-02,2.76727e-03,9.03535e-03,5.58634e-02,-1.13491e-01,1.05393e-01,7.08349e-02,-3.90654e-02,-9.73421e-02,-2.31931e-02,2.50503e-34,-1.33356e-03,-8.12520e-02,-3.57421e-02,6.36865e-03,6.98303e-02,-3.79885e-02,1.89998e-03,4.15160e-02,2.64551e-02,-7.81740e-02,-6.01936e-02,8.89259e-02,6.85453e-02,-4.35710e-02,6.15102e-03,-4.12384e-02,-2.30391e-02,8.04307e-02,-4.20083e-02,4.30390e-02,-6.42659e-02,-4.87679e-02,-2.36370e-02,-6.97454e-02,-3.80549e-02,8.03606e-03,4.82721e-02,-8.53376e-02,-1.30280e-01,-4.02262e-02,-1.85272e-02,-7.64051e-02,-6.02972e-02,-8.30899e-03,-3.24592e-02,-6.51084e-02,-3.45417e-02,-5.57729e-02,-2.41541e-02,9.03948e-02,-6.26660e-03,-2.82211e-02,7.14078e-02,-7.29852e-04,-9.84422e-02,-4.61796e-03,-8.73099e-02,6.90387e-02,-3.40576e-02,-4.15616e-02,1.83394e-02,1.00965e-02,-1.69803e-02,-6.09804e-02,-8.52834e-03,-7.98361e-02,3.18808e-04,4.31007e-02,4.49218e-02,3.58964e-02,-2.11669e-02,-2.59622e-02,-2.92579e-02,5.19722e-02,-2.18184e-02,1.11915e-02,7.29237e-02,-1.75118e-02,-1.87051e-02,-5.20259e-02,7.49990e-02,-3.41171e-02,-6.95442e-03,1.92275e-02,5.38307e-02,-1.38445e-02,1.54541e-03,-5.89235e-02,4.19111e-02,8.50421e-02,-1.25453e-02,2.32194e-02,3.06071e-02,-1.00385e-02,9.18060e-02,-1.00535e-02,-1.32639e-01,-5.87926e-03,5.28075e-02,2.70706e-02,-2.62010e-02,4.78546e-02,-5.04491e-02,5.85774e-02,8.84199e-02,8.55492e-32,3.13937e-02,-7.58448e-03,-1.08424e-02,5.32128e-02,7.68471e-03,-4.37979e-02,-8.93071e-02,5.37401e-02,-9.28643e-03,-1.31074e-01,-3.15308e-02,1.66151e-04,-2.33636e-02,6.18941e-02,4.06328e-04,-8.38102e-02,4.22972e-02,6.47196e-02,-3.49144e-02,-5.97541e-03,2.07894e-02,2.67512e-02,5.52530e-02,-8.61502e-02,-6.22585e-02,1.19297e-01,-3.34995e-02,-6.14199e-03,4.33000e-02,3.92206e-02,5.98244e-02,-1.97159e-02,5.18834e-02,1.14972e-02,1.28108e-02,2.56998e-02,-4.65825e-02,1.79345e-02,-5.45621e-02,-3.79862e-02,2.39628e-02,-5.79710e-02,2.82440e-02,1.96145e-02,9.74760e-03,-4.65814e-02,1.20515e-02,-5.32089e-02,9.85598e-02,-6.20520e-03,-4.63758e-02,-6.89194e-03,-1.66197e-02,-1.36524e-02,-9.35889e-02,3.43503e-02,3.12809e-02,-1.08981e-01,4.64091e-02,2.83066e-02,8.21929e-02,4.31020e-02,2.17023e-02,9.03776e-02]\n<\/code><\/pre>\n\n\n\n<p><a href=\"https:\/\/dev.mysql.com\/doc\/refman\/9.1\/en\/vector-functions.html#function_vector-dim\"><code>VECTOR_DIM()<\/code><\/a> gets the length of a vector, that is, the number of entries it contains.<\/p>\n\n\n\n<p>More vector functions <a href=\"https:\/\/dev.mysql.com\/doc\/heatwave\/en\/mys-hw-vector-functions.html\" target=\"_blank\" rel=\"noopener\" title=\"HeatWave vector functions\">here<\/a>.<\/p>\n\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Update Vector Store<\/h2>\n\n\n\n<p>You can update your vector store by either drop the table and recreate it or by using the <strong><a href=\"https:\/\/dasini.net\/blog\/wp-admin\/undefined\" target=\"_blank\" rel=\"noreferrer noopener\">refresh_external_tables<\/a><\/strong> clause.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"SQL\" class=\"language-SQL\">-- Updating the Vector Store using Auto Parallel Load\nSET @dl_tables = '[\n{ \"db_name\": \"DBName\", \"tables\": [ { \"table_name\": \"VectorStoreTableName\" }] }\n]';\n\nSET @options = JSON_OBJECT('mode', 'normal', 'refresh_external_tables', true);\n\nCALL sys.HEATWAVE_LOAD(CAST(@dl_tables AS JSON), @options);\n<\/code><\/pre>\n\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Running Retrieval-Augmented Generation<\/h2>\n\n\n\n<p>The <a href=\"https:\/\/dev.mysql.com\/doc\/heatwave\/en\/mys-hwgenai-ml-rag.html\" target=\"_blank\" rel=\"noopener\" title=\"The ML_RAG routine performs retrieval-augmented generation (RAG)\"><strong>ML_RAG<\/strong><\/a> routine performs retrieval-augmented generation (RAG), but the LLM that you will use must be loaded.<br>You can get the list of the supported LLMs within HeatWave GenAI by querying the <strong><em>ML_SUPPORTED_LLMS<\/em><\/strong> table in <strong><em>sys<\/em><\/strong> schema:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"SQL\" class=\"language-SQL\">-- List of supported LLMs\nSELECT * FROM sys.ML_SUPPORTED_LLMS;\n+--------------------------------------+------------+\n| model_name                           | model_type |\n+--------------------------------------+------------+\n| llama2-7b-v1                         | generation |\n| mistral-7b-instruct-v1               | generation |\n| llama3-8b-instruct-v1                | generation |\n| cohere.command-text-v14              | generation |\n| cohere.command-light-text-v14        | generation |\n| meta.llama2-70b-chat-v1              | generation |\n| meta.llama3-70b-instruct-v1:0        | generation |\n| cohere.command-r-plus                | generation |\n| cohere.command-r-16k                 | generation |\n| meta.llama-3-70b-instruct            | generation |\n| qwen2-7b-instruct-v1                 | generation |\n| all_minilm_l12_v2                    | embedding  |\n| multilingual-e5-small                | embedding  |\n| cohere.embed-english-light-v3.0      | embedding  |\n| cohere.embed-multilingual-v3.0       | embedding  |\n| cohere.embed-multilingual-light-v3.0 | embedding  |\n| cohere.embed-english-v3.0            | embedding  |\n+--------------------------------------+------------+<\/code><\/pre>\n\n\n\n<p>At the time of writing &#8211; December 2024 &#8211; the HeatWave in-database LLMs are:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>mistral-7b-instruct-v1<\/strong><\/li>\n\n\n\n<li><strong>llama3-8b-instruct-v1<\/strong><\/li>\n\n\n\n<li><em>llama2-7b-v1<\/em> is deprecated<\/li>\n<\/ul>\n\n\n\n<p>the HeatWave in-Database Embedding models are:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>all_minilm_l12_v2<\/strong><\/li>\n\n\n\n<li><strong>multilingual-e5-small<\/strong><\/li>\n<\/ul>\n\n\n\n<p>The other models are from <a href=\"https:\/\/www.oracle.com\/artificial-intelligence\/generative-ai\/generative-ai-service\/\" target=\"_blank\" rel=\"noopener\" title=\"Oracle Cloud Infrastructure Generative AI Service\"><strong>OCI Generative AI Service<\/strong><\/a>. They can also be used in the HeatWave workflow however their use will incur additional costs.<\/p>\n\n\n\n<p>The comprehensive list of the languages, embedding models, and large language models (LLMs) that HeatWave GenAI supports is available <a href=\"https:\/\/dev.mysql.com\/doc\/heatwave\/en\/mys-hw-genai-supported-models.html\" target=\"_blank\" rel=\"noopener\" title=\"Supported Languages, Embedding Models, and LLMs\">here<\/a>.<\/p>\n\n\n\n<div style=\"height:25px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>In order to run your RAG, you should load the model, specify some options like the <strong><em>vector store table<\/em><\/strong>, the <strong><em>distance metric<\/em><\/strong>, the <strong><em>language<\/em><\/strong>, and also options like <strong><em>temperature<\/em><\/strong>, <strong><em>top_k<\/em><\/strong>, <strong><em>top_p<\/em><\/strong>, <strong><em>repeat_penalty<\/em><\/strong>, <a href=\"https:\/\/dev.mysql.com\/doc\/heatwave\/en\/mys-hwgenai-ml-generate.html#mys-hwgenai-ml-generate-syntax\" target=\"_blank\" rel=\"noopener\" title=\"fine tuning options\">etc&#8230;<\/a>), then define your natural language query and finally run the <strong><a href=\"https:\/\/dev.mysql.com\/doc\/heatwave\/en\/mys-hwgenai-ml-rag.html\" target=\"_blank\" rel=\"noopener\" title=\"The ML_RAG routine performs retrieval-augmented generation (RAG) \">sys.ML_RAG<\/a><\/strong> stored procedure:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"SQL\" class=\"language-SQL\">-- Load the model: ex. Llama 3 8B\nCALL sys.ML_MODEL_LOAD(\"llama3-8b-instruct-v1\", NULL);\n\n-- Specify the table for retrieving the vector embeddings, \/ ['distance_metric', {'COSINE'|'DOT'|'EUCLIDEAN'}]\nSET @irisAI_model_info = JSON_OBJECT(\"vector_store\", JSON_ARRAY(\"Iris_AI.IrisAIembeddings\"), \"distance_metric\",\n\"COSINE\", \"model_options\", JSON_OBJECT(\"model_id\", \"llama3-8b-instruct-v1\", \"language\", \"en\", \"temperature\",0));\n\n-- Define your natural language query\nSET @query=\"Describe the appearance of the Iris versicolor flower\";\n\n-- Retrieve the prompt and print the output:\nCALL sys.ML_RAG(@query, @output, @irisAI_model_info);\n<\/code><\/pre>\n\n\n\n<p>HeatWave GenAI currently supports 3 distance metrics: <strong>COSINE<\/strong>, <strong>DOT<\/strong> &amp; <strong>EUCLIDEAN<\/strong>. Other options are available <a href=\"https:\/\/dev.mysql.com\/doc\/heatwave\/en\/mys-hwgenai-ml-rag.html\" target=\"_blank\" rel=\"noopener\" title=\"ML_RAG options\">here<\/a>.<\/p>\n\n\n\n<div style=\"height:25px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>The result of the query is stored in <a href=\"https:\/\/dev.mysql.com\/doc\/refman\/9.1\/en\/json.html\" target=\"_blank\" rel=\"noopener\" title=\"The MySQL JSON Data Type\">JSON<\/a> format in the variable<em> @output <\/em>(in this example). This result includes the answer and also citations referring to segments from the loaded documents (my PDF files).<br>In MySQL, when dealing with JSON documents, it is usually important to know the following functions: <a href=\"https:\/\/dev.mysql.com\/doc\/refman\/9.1\/en\/json-utility-functions.html#function_json-pretty\" target=\"_blank\" rel=\"noopener\" title=\"Provides pretty-printing of JSON values\">JSON_PRETTY<\/a>, <a href=\"https:\/\/dev.mysql.com\/doc\/refman\/9.1\/en\/json-modification-functions.html#function_json-unquote\" target=\"_blank\" rel=\"noopener\" title=\"Unquotes JSON value and returns the result as a utf8mb4 string.\">JSON_UNQUOTE<\/a> &amp; <a href=\"https:\/\/dev.mysql.com\/doc\/refman\/9.1\/en\/json-search-functions.html#function_json-extract\" target=\"_blank\" rel=\"noopener\" title=\"Returns data from a JSON document\">JSON_EXTRACT<\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"SQL\" class=\"language-SQL\">-- Print the outputs\nSELECT JSON_PRETTY(@output)\\G\n\n*************************** 1. row ***************************\nJSON_PRETTY(@output): {\n  \"text\": \"\\n\\nAccording to the provided context, the well-developed blue flower of Iris versicolor has 6 petals and sepals that are spread out nearly flat. The longer sepals are hairless and have a greenish-yellow blotch at their base.\",\n  \"citations\": [\n    {\n      \"segment\": \"Iris versicolor is a flowering herbaceous perennial plant, growing 10\u201380 cm (4\u201331 in) high. It tends to form large clumps from thick, creeping rhizomes. The unwinged, erect stems generally have basal leaves that are more than 1 cm (1?2 in) wide. Leaves are folded on the midribs so that they form an overlapping flat fan. The well developed blue flower has 6 petals and sepals spread out nearly flat and have two forms. The longer sepals are hairless and have a greenish-yellow blotch at their base.\",\n      \"distance\": 0.1099172830581665,\n      \"document_name\": \"https:\/\/objectstorage.eu-frankfurt...\/Iris_versicolor_Wikipedia.pdf\"\n    },\n    {\n      \"segment\": \"Iris versicolor\\nIris versicolor\\nTaxonavigation: Asparagales \\nClassification System: APG IV Superregnum: Eukaryota Regnum: Plantae Cladus: Angiosperms Cladus: Monocots Ordo: Asparagales\\nFamilia: Iridaceae Subfamilia: Iridoideae Tribus: Irideae Genus: Iris Subgenus: I. subg. Limniris Sectio: I. sect. Limniris Series: Iris ser. Laevigatae Species: Iris versicolor\\nIris versicolor L., Sp. Pl. 1: 39 (1753).\",\n      \"distance\": 0.2635544538497925,\n      \"document_name\": \"https:\/\/objectstorage.eu-frankfurt...\/Iris_versicolor_Wikispecies.pdf\"\n    },\n    {\n      \"segment\": \"Homotypic Iris versicolor f. virginica (L.) VOSS, Vilm. Blumengaertn., ed. 3. 1: 978. 1895. Iris versicolor var. virginica (L.) BAKER, J. Linn. Soc., Bot. 16: 141 (1877). Xiphion virginicum (L.) ALEF., Bot. Zeitung (Berlin) 21: 297 (1863).\\nHeterotypic Iris albilinea ALEXANDER SMALL &amp; ALEXANDER, Contr. New York Bot. Gard. 327: 349 (1931).\\nTaxonavigation\\nName\\nSynonyms\",\n      \"distance\": 0.27319884300231934,\n      \"document_name\": \"https:\/\/objectstorage.eu-frankfurt...\/Iris_virginica_Wikispecies.pdf\"\n    }\n  ],\n  \"vector_store\": [\n    \"Iris_AI.IrisAIembeddings\"\n  ]\n}\n<\/code><\/pre>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>To display only the answer:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"SQL\" class=\"language-SQL\">-- Get the answer from the generated JSON result.\nSELECT JSON_UNQUOTE(JSON_EXTRACT(@output, '$.text')) AS answer\\G\n\n*************************** 1. row ***************************\nanswer: \n\nAccording to the provided context, the well-developed blue flower of Iris versicolor has 6 petals and sepals that are spread out nearly flat. The longer sepals are hairless and have a greenish-yellow blotch at their base.\n<\/code><\/pre>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>To display only the citations:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"SQL\" class=\"language-SQL\">-- You can also get the citations referring to segments from the loaded documents.\nSELECT JSON_UNQUOTE(JSON_EXTRACT(@output, '$.citations')) AS citations\\G\n\n*************************** 1. row ***************************\ncitations: [{\"segment\": \"Iris versicolor is a flowering herbaceous perennial plant, growing 10\u201380 cm (4\u201331 in) high. It tends to form large clumps from thick, creeping rhizomes. The unwinged, erect stems generally have basal leaves that are more than 1 cm (1?2 in) wide. Leaves are folded on the midribs so that they form an overlapping flat fan. The well developed blue flower has 6 petals and sepals spread out nearly flat and have two forms. The longer sepals are hairless and have a greenish-yellow blotch at their base.\", \"distance\": 0.1099172830581665, \"document_name\": \"https:\/\/objectstorage.eu-frankfurt...\/Iris_versicolor_Wikipedia.pdf\"}, {\"segment\": \"Iris versicolor\\nIris versicolor\\nTaxonavigation: Asparagales \\nClassification System: APG IV Superregnum: Eukaryota Regnum: Plantae Cladus: Angiosperms Cladus: Monocots Ordo: Asparagales\\nFamilia: Iridaceae Subfamilia: Iridoideae Tribus: Irideae Genus: Iris Subgenus: I. subg. Limniris Sectio: I. sect. Limniris Series: Iris ser. Laevigatae Species: Iris versicolor\\nIris versicolor L., Sp. Pl. 1: 39 (1753).\", \"distance\": 0.2635544538497925, \"document_name\": \"https:\/\/objectstorage.eu-frankfurt...\/Iris_versicolor_Wikispecies.pdf\"}, {\"segment\": \"Homotypic Iris versicolor f. virginica (L.) VOSS, Vilm. Blumengaertn., ed. 3. 1: 978. 1895. Iris versicolor var. virginica (L.) BAKER, J. Linn. Soc., Bot. 16: 141 (1877). Xiphion virginicum (L.) ALEF., Bot. Zeitung (Berlin) 21: 297 (1863).\\nHeterotypic Iris albilinea ALEXANDER SMALL &amp; ALEXANDER, Contr. New York Bot. Gard. 327: 349 (1931).\\nTaxonavigation\\nName\\nSynonyms\", \"distance\": 0.27319884300231934, \"document_name\": \"https:\/\/objectstorage.eu-frankfurt...\/Iris_virginica_Wikispecies.pdf\"}]\n<\/code><\/pre>\n\n\n\n<p>Et voil\u00e0!<br>As simple as that.<\/p>\n\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Create your chatbot with HeatWave Chat<\/h2>\n\n\n\n<p><strong><a href=\"https:\/\/dev.mysql.com\/doc\/heatwave\/en\/mys-hw-genai-heatwave-chat.html\" target=\"_blank\" rel=\"noopener\" title=\"Running HeatWave Chat\">HeatWave Chat<\/a><\/strong> is an advanced conversational agent powered by LLMs. It utilizes RAG and a vector store to deliver accurate, data-driven insights. By simulating human-like conversations, it provides users with a dynamic and informative experience, offering deep knowledge and meaningful insights in a conversational format.<br>HeatWave Chat is designed to understand user inputs and respond naturally. It enhances text generation by leveraging chat history for follow-up questions and utilizes vector search to access knowledge stored in its built-in vector store. With all communication and processing securely managed within the HeatWave service, HeatWave Chat delivers fast and reliable responses.<\/p>\n\n\n\n<div style=\"height:25px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>In order to run your chat, you should load the model, specify some chat options like the&nbsp;<strong><em>vector store table<\/em><\/strong>, the&nbsp;<strong><em>distance metric<\/em><\/strong>, the&nbsp;<strong><em>language<\/em><\/strong>, and also options like <strong><em>temperature<\/em><\/strong>,&nbsp;<strong><em>top_k<\/em><\/strong>, <strong><em>top_p<\/em><\/strong>, <strong><em>repeat_penalty<\/em><\/strong>, <a href=\"https:\/\/dev.mysql.com\/doc\/heatwave\/en\/mys-hwgenai-ml-generate.html#mys-hwgenai-ml-generate-syntax\" target=\"_blank\" rel=\"noreferrer noopener\">etc\u2026<\/a>), then define your natural language query and finally run the <strong><a href=\"https:\/\/dev.mysql.com\/doc\/heatwave\/en\/mys-hwgenai-hw-chat.html\" target=\"_blank\" rel=\"noopener\" title=\"runs a semantic search on the available vector stores and\/or LLM\">sys.HEATWAVE_CHAT<\/a><\/strong> stored procedure:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"SQL\" class=\"language-SQL\">-- Load the model: ex. Mistral 7B\nCALL sys.ML_MODEL_LOAD(\"mistral-7b-instruct-v1\", NULL);\n\n-- Setup HeatWave Chat options\nSET @chat_options = JSON_OBJECT(\"tables\", JSON_ARRAY(JSON_OBJECT(\"schema_name\", \"`Iris_AI`\",\n\"table_name\",\"`IrisAIembeddings`\")), \"model_options\", JSON_OBJECT(\"model_id\", \"mistral-7b-instruct-v1\", \"language\",\n\"en\", \"temperature\", 0));\n\n-- Query in natural language (en, fr, de, es, hi...)\nSET @question = \"Where is Iris setosa native to?\";\n\n-- Add your query to HeatWave Chat\nCALL sys.HEATWAVE_CHAT(@question);\n+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n| response                                                                                                                                                                                                                                                                                                                                                                                            |\n+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n|  Iris setosa is native to a circum-arctic distribution ranging from coastal Aleutian islands, Alaska, Maine in USA, within Canada (including British Columbia, Newfoundland, Quebec, and the Yukon), within Russia (including near to the lower Lena River, Siberia), northeastern Asia, China (including Manchuria and east Jilin), Korea and southwards to Japan (including Honshu and Hokkaido). |\n+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n\n\n\n-- Another query in natural language (en, fr, de, es, hi...)\nSET @question = \"How is Iris virginica used in Seminole culture?\";\n\n-- Add your query to HeatWave Chat\nCALL sys.HEATWAVE_CHAT(@question);\n+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n| response                                                                                                                                                                                                                                                                                  |\n+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n|  Answer: Iris virginica has a cultural significance in Seminole culture as it is one of the Iris species used to treat \"shock following alligator-bite\". However, there is limited information available on how Iris virginica is specifically used in Seminole culture for this purpose. |\n+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n\n<\/code><\/pre>\n\n\n\n<div style=\"height:25px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>The <strong>HEATWAVE_CHAT<\/strong> routine leverages the  <strong><a href=\"https:\/\/dev.mysql.com\/doc\/heatwave\/en\/mys-hwgenai-hw-chat.html#mys-hwgenai-hw-chat-options\" target=\"_blank\" rel=\"noopener\" title=\"For specifying additional chat parameter settings, the HEATWAVE_CHAT routine reserves a variable, @chat_options. \">@chat_options<\/a><\/strong> variable as a dynamic parameter store. This variable is populated with additional context and configuration settings, which are subsequently utilized to refine the response generation process.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"SQL\" class=\"language-SQL\">SELECT JSON_PRETTY(@chat_options)\\G\n*************************** 1. row ***************************\nJSON_PRETTY(@chat_options): {\n  \"tables\": [\n    {\n      \"table_name\": \"`IrisAIembeddings`\",\n      \"schema_name\": \"`Iris_AI`\"\n    }\n  ],\n  \"response\": \"\\n\\nAccording to the provided context, it is mentioned that Iris virginica may be one of the Iris species used by the Seminole tribe to treat \\\"shock following alligator-bite\\\". This suggests that the plant has been traditionally used by the Seminole people for medicinal purposes in treating a specific condition related to alligator bites.\",\n  \"documents\": [\n    {\n      \"id\": \"https:\/\/objectstorage.eu-frankfurt...\/Iris_virginica_Wikipedia.pdf\",\n      \"title\": \"Iris_virginica_Wikipedia.pdf\",\n      \"segment\": \"p:\/\/herb.umd.umich.edu\/herb\/search.pl?searchstring=Iris+virginica) 12. Hamel, Paul B. and Mary U. Chiltoskey 1975 Cherokee Plants and Their Uses -- A 400 Year History. Sylva, N.C. Herald Publishing Co. (p. 41) 13. \\\"USDA Plants Database\\\" (https:\/\/plants.usda.gov\/home\/plantProfile?symbol=IRVI).\\nplants.usda.gov.\\nKemper Center for Home Gardening.org: Iris virginica (Virginia iris) (http:\/\/www.missouribota nicalgarden.org\/PlantFinder\/PlantFinderDetails.aspx?kempercode=y390)\",\n      \"distance\": 0.2979528307914734\n    },\n    {\n      \"id\": \"https:\/\/objectstorage.eu-frankfurt...\/Iris_virginica_Wikipedia.pdf\",\n      \"title\": \"Iris_virginica_Wikipedia.pdf\",\n      \"segment\": \"It may be one of the Iris species used by the Seminole to treat \\\"shock following alligator-bite\\\".[13]\\nIris virginica is one of three iris species in Ronald Fisher's Iris flower data set.\",\n      \"distance\": 0.3149242401123047\n    },\n    {\n      \"id\": \"https:\/\/objectstorage.eu-frankfurt...\/Iris_virginica_Wikispecies.pdf\",\n      \"title\": \"Iris_virginica_Wikispecies.pdf\",\n      \"segment\": \"Retrieved from \\\"https:\/\/species.wikimedia.org\/w\/index.php?title=Iris_virginica&amp;oldid=8735713\\\"\\nThis page was last edited on 5 April 2022, at 21:56.\\nText is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy.\\nVernacular names\",\n      \"distance\": 0.3498268127441406\n    }\n  ],\n  \"chat_history\": [\n    {\n      \"user_message\": \"Where is Iris setosa native to?\",\n      \"chat_query_id\": \"d2dd2c8e-b3e8-11ef-bdb3-020017081917\",\n      \"chat_bot_message\": \" Iris setosa is native to a circum-arctic distribution ranging from coastal Aleutian islands, Alaska, Maine in USA, within Canada (including British Columbia, Newfoundland, Quebec, and the Yukon), within Russia (including near to the lower Lena River, Siberia), northeastern Asia, China (including Manchuria and east Jilin), Korea and southwards to Japan (including Honshu and Hokkaido).\"\n    },\n    {\n      \"user_message\": \"How is Iris virginica used in Seminole culture?\",\n      \"chat_query_id\": \"7d4ea547-b3e9-11ef-bdb3-020017081917\",\n      \"chat_bot_message\": \" Answer: Iris virginica has a cultural significance in Seminole culture as it is one of the Iris species used to treat \\\"shock following alligator-bite\\\". However, there is limited information available on how Iris virginica is specifically used in Seminole culture for this purpose.\"\n    }\n  ],\n  \"model_options\": {\n    \"language\": \"en\",\n    \"model_id\": \"mistral-7b-instruct-v1\",\n    \"temperature\": 0\n  },\n  \"request_completed\": true\n}\n<\/code><\/pre>\n\n\n\n<p>The list of all the parameters that you can set in the @chat_options variable is available <a href=\"https:\/\/dev.mysql.com\/doc\/heatwave\/en\/mys-hwgenai-hw-chat.html#mys-hwgenai-hw-chat-options\" target=\"_blank\" rel=\"noopener\" title=\"@chat_options Parameters\">here<\/a> and <a href=\"https:\/\/dev.mysql.com\/doc\/heatwave\/en\/mys-hw-genai-chat-details.html\" target=\"_blank\" rel=\"noopener\" title=\"Viewing Chat Session Details\">here<\/a>.<\/p>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>You can modify chat parameters using the&nbsp;<code>@chat_options<\/code>&nbsp;variable, <span style=\"text-decoration: underline;\"><strong>without<\/strong><\/span> resetting the chat session:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"SQL\" class=\"language-SQL\">-- Modifying a chat parameter, here the model, without resetting the chat session:\n\n-- Load the new model if needed\nCALL sys.ML_MODEL_LOAD(\"llama3-8b-instruct-v1\", NULL);\n\nSET @chat_options = JSON_SET(@chat_options, '$.model_options.model_id', \"llama3-8b-instruct-v1\");<\/code><\/pre>\n\n\n\n<div style=\"height:10px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>or <span style=\"text-decoration: underline;\">by<\/span> resetting the chat session:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"SQL\" class=\"language-SQL\">-- Modifying a chat parameter, here the model, and resetting the chat session:\n\n-- Load the new model if needed\nCALL sys.ML_MODEL_LOAD(\"llama3-8b-instruct-v1\", NULL);\n\nSET @chat_options = JSON_OBJECT(\"model_options\", JSON_OBJECT(\"model_id\", \"llama3-8b-instruct-v1\", \"language\", \"en\", \"temperature\", 0));<\/code><\/pre>\n\n\n\n<p>More examples <a href=\"https:\/\/dev.mysql.com\/doc\/heatwave\/en\/mys-hwgenai-hw-chat.html#mys-hwgenai-hw-chat-options\" target=\"_blank\" rel=\"noopener\" title=\"Modifying chat parameters\">here<\/a>.<\/p>\n\n\n\n<p>As you have seen, HeatWave GenAI simplifies LLM integration with SQL queries, streamlines database connections, and offers a user-friendly architecture that lets you quickly develop applications.<\/p>\n\n\n\n<figure data-wp-context=\"{&quot;imageId&quot;:&quot;69e745af1849e&quot;}\" data-wp-interactive=\"core\/image\" data-wp-key=\"69e745af1849e\" class=\"wp-block-image size-full wp-lightbox-container\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"2556\" height=\"1434\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2024\/12\/HeatWave_chatbot1.gif?resize=2556%2C1434&#038;ssl=1\" alt=\"\" class=\"wp-image-7178\"\/><button\n\t\t\tclass=\"lightbox-trigger\"\n\t\t\ttype=\"button\"\n\t\t\taria-haspopup=\"dialog\"\n\t\t\taria-label=\"Agrandir\"\n\t\t\tdata-wp-init=\"callbacks.initTriggerButton\"\n\t\t\tdata-wp-on--click=\"actions.showLightbox\"\n\t\t\tdata-wp-style--right=\"state.imageButtonRight\"\n\t\t\tdata-wp-style--top=\"state.imageButtonTop\"\n\t\t>\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewBox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\" \/>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure>\n\n\n\n<figure data-wp-context=\"{&quot;imageId&quot;:&quot;69e745af188c1&quot;}\" data-wp-interactive=\"core\/image\" data-wp-key=\"69e745af188c1\" class=\"wp-block-image size-full wp-lightbox-container\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"2556\" height=\"1434\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2024\/12\/HeatWave_chatbot2.gif?resize=2556%2C1434&#038;ssl=1\" alt=\"\" class=\"wp-image-7179\"\/><button\n\t\t\tclass=\"lightbox-trigger\"\n\t\t\ttype=\"button\"\n\t\t\taria-haspopup=\"dialog\"\n\t\t\taria-label=\"Agrandir\"\n\t\t\tdata-wp-init=\"callbacks.initTriggerButton\"\n\t\t\tdata-wp-on--click=\"actions.showLightbox\"\n\t\t\tdata-wp-style--right=\"state.imageButtonRight\"\n\t\t\tdata-wp-style--top=\"state.imageButtonTop\"\n\t\t>\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewBox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\" \/>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure>\n\n\n\n<figure data-wp-context=\"{&quot;imageId&quot;:&quot;69e745af18e50&quot;}\" data-wp-interactive=\"core\/image\" data-wp-key=\"69e745af18e50\" class=\"wp-block-image size-full wp-lightbox-container\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"2556\" height=\"1434\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2024\/12\/HeatWave_chatbot3.gif?resize=2556%2C1434&#038;ssl=1\" alt=\"\" class=\"wp-image-7177\"\/><button\n\t\t\tclass=\"lightbox-trigger\"\n\t\t\ttype=\"button\"\n\t\t\taria-haspopup=\"dialog\"\n\t\t\taria-label=\"Agrandir\"\n\t\t\tdata-wp-init=\"callbacks.initTriggerButton\"\n\t\t\tdata-wp-on--click=\"actions.showLightbox\"\n\t\t\tdata-wp-style--right=\"state.imageButtonRight\"\n\t\t\tdata-wp-style--top=\"state.imageButtonTop\"\n\t\t>\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewBox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\" \/>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure>\n\n\n\n<p>That&rsquo;s all for today\u2014it&rsquo;s time to wrap things up! \ud83d\ude42<\/p>\n\n\n\n<div style=\"height:75px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Peroration<\/h2>\n\n\n\n<p><strong>HeatWave GenAI<\/strong> offers a seamless and powerful platform for integrating generative AI capabilities into your data workflows. <br>By combining advanced features like <strong>retrieval-augmented generation (RAG)<\/strong>, an integrated <strong>vector store<\/strong>, and user-friendly <strong>SQL-based interfaces<\/strong>, HeatWave GenAI empowers users to unlock insights from unstructured data with minimal complexity. <br>Its efficient and secure in-database architecture ensures real-time performance, scalability, and always up-to-date data access.<\/p>\n\n\n\n<p>Whether you aim to streamline content generation, enhance search and retrieval tasks, or build interactive chatbots, HeatWave GenAI provides all the tools you need within a single ecosystem. By leveraging the tutorials and techniques shared in this guide, you can fully harness the capabilities of HeatWave GenAI to transform how you interact with data and elevate your applications to new heights.<\/p>\n\n\n\n<p><strong><span style=\"text-decoration: underline;\">Key Features, Unmatched Benefits<\/span><\/strong><br>Here&rsquo;s what sets HeatWave GenAI apart:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Effortless LLM Integration:<\/strong> Harness the power of large language models with simple SQL queries.<\/li>\n\n\n\n<li><strong>Seamless Database Integration:<\/strong> No need for intricate external connections, simplifying your workflow.<\/li>\n\n\n\n<li><strong>Simplified Architecture:<\/strong> Easy to manage and scale, ensuring a smooth user experience.<\/li>\n\n\n\n<li><strong>Always Up-to-Date Data:<\/strong> In-database LLMs guarantee data freshness for accurate results.<\/li>\n<\/ul>\n\n\n\n<div style=\"height:25px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>Stay tuned for more insights!<\/p>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p><a href=\"https:\/\/www.linkedin.com\/groups\/12524512\/\" target=\"_blank\" rel=\"noopener\" title=\"Olivier DASINI on Linkedin\">Follow me on Linkedin<\/a><\/p>\n\n\n\n<p>Watch my videos on my <a href=\"https:\/\/www.youtube.com\/channel\/UC12TulyJsJZHoCmby3Nm3WQ\" target=\"_blank\" rel=\"noreferrer noopener\" title=\"Olivier's MySQL Channel\">YouTube channel<\/a> and <a href=\"https:\/\/www.youtube.com\/channel\/UC12TulyJsJZHoCmby3Nm3WQ\/?sub_confirmation=1\" target=\"_blank\" rel=\"noreferrer noopener\" title=\"Subscribe\">subscribe<\/a>.<\/p>\n\n\n\n<p>My <a href=\"https:\/\/www.slideshare.net\/freshdaz\" target=\"_blank\" rel=\"noreferrer noopener\" title=\"Olivier DASINI on Slideshare\">Slideshare account<\/a>.<\/p>\n\n\n\n<p>My <a href=\"https:\/\/speakerdeck.com\/freshdaz\/\" target=\"_blank\" rel=\"noreferrer noopener\" title=\"Olivier DASINI on Speaker Deck\">Speaker Deck account<\/a>.<\/p>\n\n\n\n<div style=\"height:25px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"has-vivid-red-color has-text-color\"><strong>Thanks for using HeatWave &amp; MySQL!<\/strong><\/p>\n\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial explores HeatWave GenAI, a cloud service that simplifies interacting with unstructured data using natural language. It combines large language models, vector stores, and SQL queries to enable tasks like content generation, chatbot, and retrieval-augmented generation (RAG). The focus is on RAG and how HeatWave GenAI\u2019s architecture helps users gain insights from their data.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"footnotes":""},"categories":[1702,1694,203,339],"tags":[1700,1697],"class_list":["post-7058","post","type-post","status-publish","format-standard","hentry","category-ai","category-heatwave-en","category-mysql-en","category-tuto-en","tag-genai","tag-heatwave-fr-en"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9LfWW-1PQ","jetpack-related-posts":[{"id":7363,"url":"https:\/\/dasini.net\/blog\/2025\/03\/13\/build-an-ai-powered-search-engine-with-heatwave-genai-part-1\/","url_meta":{"origin":7058,"position":0},"title":"Build an AI-Powered Search Engine with HeatWave GenAI (part 1)","author":"Olivier DASINI","date":"13 mars 2025","format":false,"excerpt":"Discover how to build an AI-powered search engine for your applications using HeatWave GenAI. This approach leverages large language models (LLMs) for semantic search, offering a smarter alternative to traditional SQL and full-text search methods. By using embeddings\u2014vector representations of words\u2014the search engine understands context and intent, delivering more relevant\u2026","rel":"","context":"Dans &quot;AI&quot;","block_context":{"text":"AI","link":"https:\/\/dasini.net\/blog\/category\/ai\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2025\/03\/HW_GenaI_search_engine.gif?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2025\/03\/HW_GenaI_search_engine.gif?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2025\/03\/HW_GenaI_search_engine.gif?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2025\/03\/HW_GenaI_search_engine.gif?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2025\/03\/HW_GenaI_search_engine.gif?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2025\/03\/HW_GenaI_search_engine.gif?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":6752,"url":"https:\/\/dasini.net\/blog\/2024\/08\/07\/heatwave-genai-your-ai-powered-content-creation-partner\/","url_meta":{"origin":7058,"position":1},"title":"HeatWave GenAI: Your AI-Powered Content Creation Partner","author":"Olivier DASINI","date":"7 ao\u00fbt 2024","format":false,"excerpt":"Generative artificial intelligence (GenAI) is reshaping the content creation landscape. By training on vast datasets, these \"intelligent\" systems can produce new, human-quality content across a multitude of domains. Oracle's HeatWave GenAI (starting with version 9.0.1) is at the forefront of this revolution, offering an integrated platform that combines in-database large\u2026","rel":"","context":"Dans &quot;AI&quot;","block_context":{"text":"AI","link":"https:\/\/dasini.net\/blog\/category\/ai\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2024\/07\/hw_product_image.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2024\/07\/hw_product_image.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2024\/07\/hw_product_image.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2024\/07\/hw_product_image.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2024\/07\/hw_product_image.png?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2024\/07\/hw_product_image.png?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":7711,"url":"https:\/\/dasini.net\/blog\/2025\/04\/15\/build-an-ai-powered-search-engine-with-heatwave-genai-part-3\/","url_meta":{"origin":7058,"position":2},"title":"Build an AI-Powered Search Engine with HeatWave GenAI (part 3)","author":"Olivier DASINI","date":"15 avril 2025","format":false,"excerpt":"In this latest post, the final part of my series on building an AI-powered search engine with HeatWave GenAI, I dive into enhancing AI-powered search by embedding full article content into HeatWave. By cleaning HTML, chunking content, generating embeddings, and running semantic similarity searches directly within HeatWave, we unlock highly\u2026","rel":"","context":"Dans &quot;AI&quot;","block_context":{"text":"AI","link":"https:\/\/dasini.net\/blog\/category\/ai\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":7252,"url":"https:\/\/dasini.net\/blog\/2025\/02\/11\/building-an-interactive-llm-chatbot-with-heatwave-using-python\/","url_meta":{"origin":7058,"position":3},"title":"Building an Interactive LLM Chatbot with  HeatWave Using Python","author":"Olivier DASINI","date":"11 f\u00e9vrier 2025","format":false,"excerpt":"AI-powered applications require robust and scalable database solutions to manage and process large amounts of data efficiently. HeatWave is an excellent choice for such applications, providing high-performance OLTP, analytics, machine learning and generative artificial intelligence capabilities. In this article, we will explore a Python 3 script that connects to an\u2026","rel":"","context":"Dans &quot;HeatWave&quot;","block_context":{"text":"HeatWave","link":"https:\/\/dasini.net\/blog\/category\/heatwave-en\/"},"img":{"alt_text":"simple but robust chatbot system leveraging HeatWave GenAI and its in-database Mistral LLM","src":"https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2025\/02\/HW-Chat-mistral-7b.gif?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2025\/02\/HW-Chat-mistral-7b.gif?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2025\/02\/HW-Chat-mistral-7b.gif?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2025\/02\/HW-Chat-mistral-7b.gif?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2025\/02\/HW-Chat-mistral-7b.gif?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":7566,"url":"https:\/\/dasini.net\/blog\/2025\/04\/08\/build-an-ai-powered-search-engine-with-heatwave-genai-part-2\/","url_meta":{"origin":7058,"position":4},"title":"Build an AI-Powered Search Engine with HeatWave GenAI (part 2)","author":"Olivier DASINI","date":"8 avril 2025","format":false,"excerpt":"In this part 2 we focused on enhancing search relevance. We introduced reranking techniques using weighted distances of titles and excerpts to refine initial search results. Then we delved into leveraging article summaries for more effective semantic search, utilizing HeatWave's capability to execute JavaScript stored procedures for sanitizing HTML content\u2026","rel":"","context":"Dans &quot;AI&quot;","block_context":{"text":"AI","link":"https:\/\/dasini.net\/blog\/category\/ai\/"},"img":{"alt_text":"Similarity search across title, excerpt and summary","src":"https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2025\/04\/HWGenAIsearchEngine2.gif?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2025\/04\/HWGenAIsearchEngine2.gif?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2025\/04\/HWGenAIsearchEngine2.gif?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2025\/04\/HWGenAIsearchEngine2.gif?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2025\/04\/HWGenAIsearchEngine2.gif?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2025\/04\/HWGenAIsearchEngine2.gif?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":7812,"url":"https:\/\/dasini.net\/blog\/2025\/05\/13\/oracle-dev-days-2025-french-edition\/","url_meta":{"origin":7058,"position":5},"title":"Oracle Dev Days 2025 \u2013 French Edition","author":"Olivier DASINI","date":"13 mai 2025","format":false,"excerpt":"Join the Oracle Dev Days \u2013 French Edition, from May 20 to 22, 2025! This must-attend event (in French) offers a rich program exploring the latest advancements in AI, databases, cloud, and Java. Join me on May 21 at 2:00 PM for the day dedicated to \u201cDatabase & AI.\u201d I\u2019ll\u2026","rel":"","context":"Dans &quot;Conf\u00e9rence&quot;","block_context":{"text":"Conf\u00e9rence","link":"https:\/\/dasini.net\/blog\/category\/conference-en\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2025\/05\/Olivier_Dasini_HeatWave.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2025\/05\/Olivier_Dasini_HeatWave.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2025\/05\/Olivier_Dasini_HeatWave.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2025\/05\/Olivier_Dasini_HeatWave.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2025\/05\/Olivier_Dasini_HeatWave.png?resize=1050%2C600&ssl=1 3x"},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/dasini.net\/blog\/wp-json\/wp\/v2\/posts\/7058","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dasini.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dasini.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dasini.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/dasini.net\/blog\/wp-json\/wp\/v2\/comments?post=7058"}],"version-history":[{"count":153,"href":"https:\/\/dasini.net\/blog\/wp-json\/wp\/v2\/posts\/7058\/revisions"}],"predecessor-version":[{"id":7451,"href":"https:\/\/dasini.net\/blog\/wp-json\/wp\/v2\/posts\/7058\/revisions\/7451"}],"wp:attachment":[{"href":"https:\/\/dasini.net\/blog\/wp-json\/wp\/v2\/media?parent=7058"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dasini.net\/blog\/wp-json\/wp\/v2\/categories?post=7058"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dasini.net\/blog\/wp-json\/wp\/v2\/tags?post=7058"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}