
{"id":6825,"date":"2024-08-13T09:08:56","date_gmt":"2024-08-13T08:08:56","guid":{"rendered":"https:\/\/dasini.net\/blog\/?p=6825"},"modified":"2024-08-13T09:09:00","modified_gmt":"2024-08-13T08:09:00","slug":"in-database-llms-for-efficient-text-translation-with-heatwave-genai","status":"publish","type":"post","link":"https:\/\/dasini.net\/blog\/2024\/08\/13\/in-database-llms-for-efficient-text-translation-with-heatwave-genai\/","title":{"rendered":"In-Database LLMs for Efficient Text Translation with HeatWave GenAI"},"content":{"rendered":"\n<p>This article builds upon the concepts introduced in my previous blog post, <a href=\"https:\/\/dasini.net\/blog\/2024\/08\/07\/heatwave-genai-your-ai-powered-content-creation-partner\/\" target=\"_blank\" rel=\"noopener\" title=\"HeatWave GenAI: Your AI-Powered Content Creation Partner\"><em>HeatWave GenAI: Your AI-Powered Content Creation Partner<\/em><\/a>. For a deeper understanding, consider reading that article first.<\/p>\n\n\n\n<p><a href=\"https:\/\/www.oracle.com\/heatwave\/\" target=\"_blank\" rel=\"noopener\" title=\"HeatWave\"><strong>HeatWave<\/strong><\/a> offered different solutions for your different workload:<\/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;69e8eae47eb19&quot;}\" data-wp-interactive=\"core\/image\" data-wp-key=\"69e8eae47eb19\" 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>In this article you&rsquo;ll experience the power of In-database translation with <strong>HeatWave GenAI<\/strong>. I am using HeatWave <strong>9.0.1<\/strong>.<\/p>\n\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>As demonstrated in my previous article, <a href=\"https:\/\/dasini.net\/blog\/2024\/08\/07\/heatwave-genai-your-ai-powered-content-creation-partner\/\" target=\"_blank\" rel=\"noopener\" title=\"HeatWave GenAI: Your AI-Powered Content Creation Partner\"><em>HeatWave GenAI: Your AI-Powered Content Creation Partner<\/em><\/a>, HeatWave GenAI streamlines content generation by seamlessly integrating LLMs into the database. This innovative approach eliminates the complexities of external connections, allowing for effortless AI integration via straightforward SQL queries.<\/p>\n\n\n\n<p>While HeatWave GenAI excels at generating English text, its capabilities extend to translation as well. Let&rsquo;s explore how we can effectively translate English content into French using this powerful tool.<\/p>\n\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Load the LLM in HeatWave memory<\/h3>\n\n\n\n<p>Use the <a href=\"https:\/\/dev.mysql.com\/doc\/heatwave\/en\/mys-hwaml-ml-model-load.html\" target=\"_blank\" rel=\"noopener\" title=\"ML_MODEL_LOAD\"><strong>ML_MODEL_LOAD<\/strong><\/a> stored procedure: <em>CALL sys.ML_MODEL_LOAD(&lsquo;&lt;LLM&gt;&rsquo;, NULL);<\/em><br>The model needs to be loaded only once before generating text. It remains accessible within HeatWave as long as the service is running. This means you don&rsquo;t have to reload the model for each text generation.<\/p>\n\n\n\n<p>At the time of writing (August 2024) the available models are <strong><a href=\"https:\/\/mistral.ai\/news\/announcing-mistral-7b\/\" target=\"_blank\" rel=\"noopener\" title=\"Mistral 7B\">Mistral 7B<\/a><\/strong> (<strong><em>mistral-7b-instruct-v1<\/em><\/strong>) and <strong><a href=\"https:\/\/llama.meta.com\/llama2\/\" target=\"_blank\" rel=\"noopener\" title=\"Llama 2\">Llama 2<\/a><\/strong> (<strong><em>llama2-7b-v1<\/em><\/strong>).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"sql\" class=\"language-sql\">-- Load Mistral 7B model\nmysql&gt;\nCALL sys.ML_MODEL_LOAD('mistral-7b-instruct-v1', NULL);<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Define your prompt in natural language<\/h3>\n\n\n\n<p>We obviously need a text to translate:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"SQL\" class=\"language-SQL\">mysql&gt; \n-- Text for Translation\nSET @ENtext = \"Dracula is a gothic horror novel by Bram Stoker, published on 26 May 1897. An epistolary novel, the narrative is related through letters, diary entries, and newspaper articles. It has no single protagonist and opens with solicitor Jonathan Harker taking a business trip to stay at the castle of a Transylvanian nobleman, Count Dracula. Harker escapes the castle after discovering that Dracula is a vampire, and the Count moves to England and plagues the seaside town of Whitby. A small group, led by Abraham Van Helsing, investigate, hunt and kill Dracula.\";<\/code><\/pre>\n\n\n\n<div style=\"height:25px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"has-small-font-size\"><em>Text extracted from Wikipedia: <a href=\"https:\/\/en.wikipedia.org\/wiki\/Dracula\">https:\/\/en.wikipedia.org\/wiki\/Dracula<\/a><\/em><\/p>\n\n\n\n<p>With the text ready for translation, we need to provide clear instructions to the model about the desired output.<br>Actually, the most difficult part is here. The quality of the translation will be highly impacted by the quality of your prompt.<\/p>\n\n\n\n<p>For now, let&rsquo;s try a very simple prompt like: \u00ab\u00a0<em>Translate the following text into French, ensuring natural and grammatically correct phrasing<\/em>\u00ab\u00a0.  <br>It will be concatenated (<a href=\"https:\/\/dev.mysql.com\/doc\/refman\/8.4\/en\/string-functions.html#function_concat\" target=\"_blank\" rel=\"noopener\" title=\"Return concatenated string\">CONCAT<\/a>) with the provided English text :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"SQL\" class=\"language-SQL\">mysql&gt; \n-- Enhanced prompt\nSET @finalPrompt = CONCAT(\"Translate the following text into French, ensuring natural and grammatically correct phrasing: \", @ENtext);<\/code><\/pre>\n\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Inference setting<\/h3>\n\n\n\n<p>Here, you select the desired task, choose the appropriate model, and fine-tune parameters to influence the output.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"SQL\" class=\"language-SQL\">mysql&gt; \n-- Inference setting\nSET @inferenceSetup  = '{\"task\": \"generation\", \"model_id\": \"mistral-7b-instruct-v1\"}';<\/code><\/pre>\n\n\n\n<p>For simplicity, this example uses default parameters. A more complex example is provided below.<\/p>\n\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Generate the translation using HeatWave GenAI<\/h3>\n\n\n\n<p>And finally, send the enhanced prompt to the LLM using the <strong>ML_GENERATE<\/strong> function. The second parameter of this function is a JSON object that allows you to specify the task, the LLM, and the tuning options.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"sql\" class=\"language-sql line-numbers\">mysql&gt;\n-- Translation\nSELECT sys.ML_GENERATE(@finalPrompt, @inferenceSetup)\\G\n\n*************************** 1. row ***************************\nsys.ML_GENERATE(@finalPrompt, @inferenceSetup): {\"text\": \" R\u00e9ponse : Le roman gothique horreur de Bram Stoker, intitul\u00e9 \u00ab Dracula \u00bb, a \u00e9t\u00e9 publi\u00e9 le 26 mai 1897. C'est un roman \u00e9pistolaire dont la narration se fait par les lettres, les entr\u00e9es dans le journal et les articles de presse. Il n'a pas d'h\u00e9ro\u00efne principale et commence avec l'avocat Jonathan Harker qui effectue une visite d'affaires au ch\u00e2teau d'un nobleman transylvanien, le comte Dracula. Harker s'\u00e9vade du ch\u00e2teau apr\u00e8s avoir d\u00e9couvert que Dracula est un vampire, et le comte se rend en Angleterre et pille la ville c\u00f4ti\u00e8re de Whitby. Un petit groupe, dirig\u00e9 par Abraham Van Helsing, enqu\u00eate, chasse et tue Dracula.\"\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 output in a JSON that is not really nice to read. <br>But SQL is very powerful and you can easily improve the output using  <a href=\"https:\/\/dev.mysql.com\/doc\/refman\/8.4\/en\/json-table-functions.html\" target=\"_blank\" rel=\"noopener\" title=\"JSON_TABLE\">JSON_TABLE<\/a> function.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"SQL\" class=\"language-SQL\">SELECT TranslationFR AS TranslationFR FROM ( SELECT sys.ML_GENERATE(@finalPrompt, @inferenceSetup) AS textGen ) AS dt INNER JOIN JSON_TABLE ( dt.textGen, \"$\" COLUMNS( TranslationFR text PATH \"$.text\") ) AS jt \\G\n\n*************************** 1. row ***************************\nTranslationFR:  R\u00e9ponse : Le roman gothique horreur de Bram Stoker, intitul\u00e9 \u00ab Dracula \u00bb, a \u00e9t\u00e9 publi\u00e9 le 26 mai 1897. C'est un roman \u00e9pistolaire dont la narration se fait par les lettres, les entr\u00e9es dans le journal et les articles de presse. Il n'a pas d'h\u00e9ro\u00efne principale et commence avec l'avocat Jonathan Harker qui effectue une visite d'affaires au ch\u00e2teau d'un nobleman transylvanien, le comte Dracula. Harker s'\u00e9vade du ch\u00e2teau apr\u00e8s avoir d\u00e9couvert que Dracula est un vampire, et le comte se rend en Angleterre et pille la ville c\u00f4ti\u00e8re de Whitby. Un petit groupe, dirig\u00e9 par Abraham Van Helsing, enqu\u00eate, chasse et tue Dracula.\n<\/code><\/pre>\n\n\n\n<p>An alternative is the following query:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"SQL\" class=\"language-SQL\">SELECT TranslationFR-&gt;&gt;\"$.text\" AS \"TranslationFR\" FROM (SELECT sys.ML_GENERATE(@finalPrompt, @inferenceSetup) AS TranslationFR ) AS dt \\G\n\n*************************** 1. row ***************************\nTranslationFR:  R\u00e9ponse : Le roman gothique horreur de Bram Stoker, intitul\u00e9 \u00ab Dracula \u00bb, a \u00e9t\u00e9 publi\u00e9 le 26 mai 1897. C'est un roman \u00e9pistolaire dont la narration se fait par les lettres, les entr\u00e9es dans le journal et les articles de presse. Il n'a pas d'h\u00e9ro\u00efne principale et commence avec l'avocat Jonathan Harker qui effectue une visite d'affaires au ch\u00e2teau d'un nobleman transylvanien, le comte Dracula. Harker s'\u00e9vade du ch\u00e2teau apr\u00e8s avoir d\u00e9couvert que Dracula est un vampire, et le comte se rend en Angleterre et pille la ville c\u00f4ti\u00e8re de Whitby. Un petit groupe, dirig\u00e9 par Abraham Van Helsing, enqu\u00eate, chasse et tue Dracula.\n<\/code><\/pre>\n\n\n\n<div style=\"height:25px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>Although the translation isn&rsquo;t perfect, French speakers should grasp the gist, even if it reads like a particularly polite <a href=\"https:\/\/en.wikipedia.org\/wiki\/Advance-fee_scam\" target=\"_blank\" rel=\"noopener\" title=\"Advance-fee scam\">Advance-fee scam<\/a>. \ud83d\ude00 <\/p>\n\n\n\n<p>Let&rsquo;s see how to improve that! <\/p>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Areas for improvement<\/h3>\n\n\n\n<p>You now have all the essential components to implement real-time translation within your applications.<\/p>\n\n\n\n<p>Although the generated output may not always align with expectations, you can refine results by adjusting the prompt or modifying inference parameters.<\/p>\n\n\n\n<p>Inference parameters for text generation include:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>task<\/li>\n\n\n\n<li>model_id<\/li>\n\n\n\n<li>temperature<\/li>\n\n\n\n<li>max_tokens<\/li>\n\n\n\n<li>top_k<\/li>\n\n\n\n<li>top_p<\/li>\n\n\n\n<li>repeat_penalty<\/li>\n\n\n\n<li>stop_sequences<\/li>\n\n\n\n<li>token_likelihoods<\/li>\n\n\n\n<li>echo<\/li>\n\n\n\n<li>logprobs<\/li>\n\n\n\n<li>stream<\/li>\n\n\n\n<li>context<\/li>\n<\/ul>\n\n\n\n<div style=\"height:25px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>While <a href=\"https:\/\/en.wikipedia.org\/wiki\/Prompt_engineering\" target=\"_blank\" rel=\"noopener\" title=\"Prompt engineering\">prompt engineering<\/a> is a critical skill, it&rsquo;s beyond the scope of this article. I strongly recommend dedicating time to mastering this discipline for optimal results.<\/p>\n\n\n\n<p>Let&rsquo;s try to do some fine tuning.<\/p>\n\n\n\n<p>The text for translation is the same:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"SQL\" class=\"language-SQL\">-- Text for Translation\nSET @ENtext = \"Dracula is a gothic horror novel by Bram Stoker, published on 26 May 1897. An epistolary novel, the narrative is related through letters, diary entries, and newspaper articles. It has no single protagonist and opens with solicitor Jonathan Harker taking a business trip to stay at the castle of a Transylvanian nobleman, Count Dracula. Harker escapes the castle after discovering that Dracula is a vampire, and the Count moves to England and plagues the seaside town of Whitby. A small group, led by Abraham Van Helsing, investigate, hunt and kill Dracula.\";\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 enhanced prompt contains more information:<br><em>You are an expert translator from English to French. Your task is to translate the original text from English to French. Ensure the French translation is accurate, natural-sounding, and grammatically correct. Preserve the original text&rsquo;s meaning, style, and context. Only generate the French translation of the original text. \\n &#8211; Original Text: \u00ab\u00a0, @ENtext, \u00a0\u00bb \\n &#8211; French Translation:<\/em><br><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"SQL\" class=\"language-SQL\">-- Enhanced prompt\nSET @finalPrompt = CONCAT(\"You are an expert translator from English to French. Your task is to translate the original text from English to French. Ensure the French translation is accurate, natural-sounding, and grammatically correct. Preserve the original text's meaning, style, and context. Only generate the French translation of the original text. \\n  - Original Text: \", @ENtext, \" \\n  - French Translation: \"); \n<\/code><\/pre>\n\n\n\n<p>I modified the inference parameters &#8211; temperature, repeat_penalty, top_k and top_p:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"SQL\" class=\"language-SQL\">-- Inference setting\nSET @inferenceSetup  = '{\"task\": \"generation\", \"temperature\": 0.9, \"repeat_penalty\": 1, \"top_k\": 0, \"top_p\": 0.2, \"model_id\": \"mistral-7b-instruct-v1\"}';\n<\/code><\/pre>\n\n\n\n<p>And finally, generate the translation:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"SQL\" class=\"language-SQL\">-- Translation\nSELECT TranslationFR-&gt;&gt;\"$.text\" AS \"TranslationFR\" FROM (SELECT sys.ML_GENERATE(@finalPrompt, @inferenceSetup) AS TranslationFR ) AS dt \\G\n\n*************************** 1. row ***************************\nTranslationFR:  Dracula est un roman gothique d'horreur de Bram Stoker, publi\u00e9 le 26 mai 1897. C'est un roman \u00e9pistolaire, la narration se fait par des lettres, des entr\u00e9es de journal et des articles de journaux. Il n'a pas de h\u00e9ros principaux et commence par le soliciteur Jonathan Harker qui se rend \u00e0 l'abbaye du comte Dracula, un nobleman de Transylvanie. Harker s'\u00e9vade de l'abbaye apr\u00e8s avoir d\u00e9couvert que Dracula est un vampire, et le comte s'installe en Angleterre et pille la ville c\u00f4ti\u00e8re de Whitby. Un petit groupe, dirig\u00e9 par Abraham Van Helsing, enqu\u00eate, chasse et tue Dracula.\n<\/code><\/pre>\n\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>The results show an improvement. Further refinements can be achieved by optimizing inference parameters and prompt engineering.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure data-wp-context=\"{&quot;imageId&quot;:&quot;69e8eae47f859&quot;}\" data-wp-interactive=\"core\/image\" data-wp-key=\"69e8eae47f859\" class=\"aligncenter size-large wp-lightbox-container\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"431\" 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\/08\/HeatWave_GenAI_Translation-2.gif?resize=800%2C431&#038;ssl=1\" alt=\"\" class=\"wp-image-6908\" srcset=\"https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2024\/08\/HeatWave_GenAI_Translation-2.gif?resize=800%2C431&amp;ssl=1 800w, https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2024\/08\/HeatWave_GenAI_Translation-2.gif?resize=300%2C162&amp;ssl=1 300w, https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2024\/08\/HeatWave_GenAI_Translation-2.gif?resize=768%2C413&amp;ssl=1 768w, https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2024\/08\/HeatWave_GenAI_Translation-2.gif?resize=1536%2C827&amp;ssl=1 1536w, https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2024\/08\/HeatWave_GenAI_Translation-2.gif?resize=2048%2C1103&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<\/div>\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Peroration<\/h3>\n\n\n\n<p>This article explored the use of <strong>HeatWave GenAI for text translation<\/strong>. By integrating LLMs into the database, users can efficiently translate text. While this article provided a basic overview, further experimentation with prompts and parameters can enhance results. <\/p>\n\n\n\n<p>By leveraging the power of in-database AI, organizations can unlock new opportunities for global communication and collaboration.<\/p>\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","protected":false},"excerpt":{"rendered":"<p>While HeatWave GenAI excels at generating English text, its capabilities extend to translation as well. Let&rsquo;s explore how we can effectively translate English content into French using this powerful tool.<\/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],"tags":[1704,1700,1697],"class_list":["post-6825","post","type-post","status-publish","format-standard","hentry","category-ai","category-heatwave-en","tag-ai","tag-genai","tag-heatwave-fr-en"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9LfWW-1M5","jetpack-related-posts":[{"id":6752,"url":"https:\/\/dasini.net\/blog\/2024\/08\/07\/heatwave-genai-your-ai-powered-content-creation-partner\/","url_meta":{"origin":6825,"position":0},"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":7363,"url":"https:\/\/dasini.net\/blog\/2025\/03\/13\/build-an-ai-powered-search-engine-with-heatwave-genai-part-1\/","url_meta":{"origin":6825,"position":1},"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":7252,"url":"https:\/\/dasini.net\/blog\/2025\/02\/11\/building-an-interactive-llm-chatbot-with-heatwave-using-python\/","url_meta":{"origin":6825,"position":2},"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":7711,"url":"https:\/\/dasini.net\/blog\/2025\/04\/15\/build-an-ai-powered-search-engine-with-heatwave-genai-part-3\/","url_meta":{"origin":6825,"position":3},"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":6960,"url":"https:\/\/dasini.net\/blog\/2024\/09\/10\/heatwave-genai-sentiment-analysis-made-easy-peasy\/","url_meta":{"origin":6825,"position":4},"title":"HeatWave GenAI: Sentiment Analysis Made Easy-Peasy","author":"Olivier DASINI","date":"10 septembre 2024","format":false,"excerpt":"This new AI tech, called generative AI (or GenAI), can dive deep into what people are saying and tell us if they\u2019re feeling positive, negative, or neutral. Let\u2019s see how HeatWave GenAI, can help you to enhance your understanding of customer sentiment, improve decision-making, and drive business success.","rel":"","context":"Dans &quot;HeatWave&quot;","block_context":{"text":"HeatWave","link":"https:\/\/dasini.net\/blog\/category\/heatwave-en\/"},"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":4462,"url":"https:\/\/dasini.net\/blog\/2021\/04\/13\/heatwave-a-mysql-cloud-feature-to-speed-up-your-queries\/","url_meta":{"origin":6825,"position":5},"title":"HeatWave &#8211; A MySQL cloud feature to speed up your queries","author":"Olivier DASINI","date":"13 avril 2021","format":false,"excerpt":"If you have (too) long running select queries it is probably because of lack of relevant indexes, problematic schema that lead to poor queries or inadequate hardware. That said, sometime even if you doing it right, the query execution time could be too long regarding of what the application or\u2026","rel":"","context":"Dans &quot;Cloud&quot;","block_context":{"text":"Cloud","link":"https:\/\/dasini.net\/blog\/category\/cloud\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2021\/04\/MySQL-Database-Service-HeatWave-Replication.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2021\/04\/MySQL-Database-Service-HeatWave-Replication.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2021\/04\/MySQL-Database-Service-HeatWave-Replication.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/dasini.net\/blog\/wp-content\/uploads\/2021\/04\/MySQL-Database-Service-HeatWave-Replication.png?resize=700%2C400&ssl=1 2x"},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/dasini.net\/blog\/wp-json\/wp\/v2\/posts\/6825","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=6825"}],"version-history":[{"count":87,"href":"https:\/\/dasini.net\/blog\/wp-json\/wp\/v2\/posts\/6825\/revisions"}],"predecessor-version":[{"id":6949,"href":"https:\/\/dasini.net\/blog\/wp-json\/wp\/v2\/posts\/6825\/revisions\/6949"}],"wp:attachment":[{"href":"https:\/\/dasini.net\/blog\/wp-json\/wp\/v2\/media?parent=6825"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dasini.net\/blog\/wp-json\/wp\/v2\/categories?post=6825"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dasini.net\/blog\/wp-json\/wp\/v2\/tags?post=6825"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}