We not too long ago introduced the availability of MySQL AI which permits predictive and generative AI workflows for on-premise MySQL prospects. MySQL AI contains built-in LLMs and embedding fashions that run on CPUs, a vector retailer, semantic search features, automated machine studying and a graphical console known as MySQL studio. Since its launch there was appreciable curiosity from prospects in numerous industries specifically finance, manufacturing, telecom, and public sector.
This weblog outlines some use instances and get began creating predictive and generative AI functions with MySQL AI
The predictive AI functions are enabled utilizing automated machine studying – examples being monetary fraud detection, monitoring stock and forecasting demand, assessing mortgage default or cost dangers, and detection anomalies in streaming knowledge or log entries.
The generative AI capabilities allow content material era, summarization, translation, semantic search of paperwork, chat and NL2SQL, RAG, or different GenAI use instances. The LLMs and embedding fashions are run inside the database and accessible utilizing easy to make use of APIs. MySQL can now securely question paperwork in your native file system, with all processing remaining inside the database and your setting—no knowledge ever leaves your infrastructure. The system runs in your present infrastructure and the LLMs function on CPUs, so there isn’t a want for integration with a specialised vector database or want for specialised {hardware}/GPUs.
Use Circumstances for MySQL AI
Customers can develop and run functions accessing content material from paperwork in an area file methods and MySQL database. The purpose is to investigate the information, generate helpful responses, and carry out duties, corresponding to prediction or era.
The in-database LLMs show you how to to
- Generate content material in a number of languages for actions corresponding to social media posts, weblog articles, and e mail campaigns.
- Generate concise and proper summaries of paperwork, stories, and logs whereas preserving important info. For instance, ecommerce websites with many SKUs—a whole lot or 1000’s or extra—have a number of critiques per product. Customers can faucet into GenAI’s capabilities to shortly summarize, translate, and even analyze sentiment within the critiques.
- Carry out retrieval augmented era aka RAG: Simply search personal paperwork or generate new content material for contextual, business-specific functions. Retailer and search proprietary paperwork utilizing vector similarity search and increase LLM prompts with related enterprise content material—simply and securely. These strategies allow enterprises to construct chatbots for a wide range of wants corresponding to answering questions on firm insurance policies, or serving to prospects select correct coaching programs.
Along with producing or summarizing content material, think about having the ability to predict for instance, whether or not you must provide a fee to a buyer to encourage them to remain and forestall churn. Predictive AI permits this.
With MySQL AI customers can mix predictive and generative AI for actually revolutionary functions. They may leverage log analytics from predictive AI to determine uncommon patterns indicating an impending failure. For instance, if the variety of connections is rising, reminiscence utilization is growing, or disk utilization is climbing and nearing capability, they’ll obtain an early warning. That is an enchancment over conventional monitoring methods, which solely alert customers after a problem, corresponding to a failed disk or a full disk, has already occurred. The profit is a warning earlier than the failure occurs.
The GenAI half takes these ML outcomes and generates helpful responses. For example, if the system detects {that a} disk is filling up or the variety of connections on an occasion is growing quickly, GenAI can counsel concrete actions based mostly on related issues encountered and addressed previously.
Utilizing MySQL AI
MySQL AI is constructed on the highest of MySQL Enterprise Version and gives ML/Gen AI performance. All of the performance is uncovered by way of SQL features/saved procedures and REST interface, and can be utilized from all present MySQL purchasers corresponding to the favored MySQL Shell or Python and Java connectors.
Let’s take a look at two examples of utilizing the SQL features and saved procedures. The primary outlines the steps and instructions for performing RAG on paperwork. The second exhibits use the predictive analytics capabilities for fraud detection.
Retrieval augmented era on paperwork
The RAG course of entails three steps: (i) add paperwork to a file system location accessible to MySQL, (ii) ingest the paperwork into the vector retailer, and (iii) question the paperwork.
Step 1: copy the recordsdata into an appropriate location, e.g. the /var/lib/mysql-files folder utilizing a replica command corresponding to
sudo cp /residence/john_doe/Olympics_2024.pdf /var/lib/mysql-files
Step 2: ingest the paperwork into the vector retailer, i.e. extract segments and retailer them together with their embeddings and a few metadata, utilizing a load command
CALL sys.VECTOR_STORE_LOAD('file:///var/lib/mysql-files/2024_Summer_Olympics_Wikipedia.pdf', JSON_OBJECT("schema_name","mlcorpus","table_name","vector_store_data_1"))""");
The above command masses and shops the embeddings, segments, and metadata within the mlcorpus.vector_store_data_1 desk (aka the vector retailer) to be used in subsequent semantic search.
Step 3: use the ML_RAG process to question the paperwork in pure language
CALL sys.ML_RAG("The place have been the 2024 Summer time Olympics held?", @output, JSON_OBJECT("model_options",JSON_OBJECT("model_id","llama3.2-3b-instruct-v1"),"vector_store", JSON_ARRAY("mlcorpus.vector_store_data_1")));
SELECT JSON_PRETTY(@output);
This outputs the reply
‘The 2024 Summer time Olympics have been held in France.‘
This RAG operation makes a information base obtainable to the top person.
See this pattern pocket book on Github for an in depth instance.
Bank card fraud detection
Bank card fraud poses a big risk to monetary establishments and people alike, leading to substantial monetary losses and eroded belief. Conventional rule-based methods typically battle to maintain tempo with the evolving techniques of fraudsters, making machine learning-based anomaly detection a significant device.
The instance beneath relies on a public knowledge set with a pattern pocket book on Github explaining all of the steps intimately.
The instance makes use of the unsupervised anomaly detection characteristic of the AutoML pipeline and depends on the inherent patterns and constructions inside the transaction knowledge to determine deviations from the norm.
Step 1: use the ML_TRAIN API to coach the mannequin. Given that is unsupervised anomaly detection, we go the goal column identify as NULL, and AutoML builds a mannequin studying from the patterns inherent within the knowledge.
SET @mannequin = NULL;
CALL sys.ML_TRAIN('mlcorpus.creditcard_train', NULL, JSON_OBJECT('process', 'anomaly_detection', 'exclude_column_list', JSON_ARRAY('Class')), @mannequin);
The mannequin deal with generated on the finish of coaching is saved within the mannequin variable. We are going to use this deal with to confer with the mannequin in future interactions.
Step 2: invoke the ML_PREDICT_TABLE API to generate prediction for the above mannequin on take a look at knowledge. The output desk incorporates an additional column with the prediction.
CALL sys.ML_PREDICT_TABLE('mlcorpus.creditcard_test', '{mannequin}', 'mlcorpus.creditcard_test_predictions', NULL);
SELECT Time, Quantity, ml_results FROM creditcard_test_predictions;
Time Quantity ml_results
74165.0 1.98 "predictions": {"is_anomaly": 0}, "probabilit...
94428.0 0.75 "predictions": {"is_anomaly": 0}, "probabilit...
63603.0 77.50 "predictions": {"is_anomaly": 0}, "probabilit...
131607.0 1.00 "predictions": {"is_anomaly": 0}, "probabilit...
Growing functions
MySQL AI introduces new instruments for builders to construct wealthy AI/ML functions and deploy the functions on-premises or cloud.
The primary is an MCP (Mannequin Context Protocol) server supporting agentic AI. The second is MySQL Studio, a brand new graphical interface that gives an intuitive, built-in setting for database administration and software improvement. The third is a Python SDK.
Help for agentic frameworks corresponding to Mannequin Context Protocol
Mannequin Context Protocol (MCP) is an open commonplace enabling seamless integration between functions powered by massive language fashions and exterior knowledge sources or instruments. The MySQL MCP Server gives a set of specialised instruments that show you how to leverage the total capabilities of each MySQL HeatWave and MySQL AI.
Person functions such chatbots and IDEs execute MCP purchasers, which join immediately with the MCP servers. The LLMs contained in the purchasers acts because the orchestrator or choice maker. The purchasers speak with the MCP server(s) by way of a typical MCP interface and entry uncooked knowledge in addition to processed info (like responses from RAG) from numerous MCP instruments, That is then fed again to the consumer for context, which analyses it and decides on subsequent plan of action, with an intent of fixing a enterprise drawback
The MCP consumer server mannequin simplifies integration of MySQL AI in functions. It permits agentic data-driven software improvement, analytic workflows and infrastructure administration, thus facilitating AI pushed knowledge administration.
MySQL AI additionally gives a set of built-in instruments for database connection administration and question, predictive and generative AI duties, and vector retailer ingestion and utilization. Builders can increase these or add new ones for his or her functions. A few of these instruments are listed beneath:
| Class | Instrument | Description |
| Database Connection Administration | Load connection configs from JSON/env vars | Import database configs from JSON recordsdata or setting variables |
| Listing all configured database connections | Show all obtainable/pre-configured database connections | |
| Validate connectivity and resolve supplier mode | Check database connections and determine DB supplier mode | |
| Database Operations | Execute SQL queries | Run SQL statements towards the related database |
| GenAI Operations | Textual content era with HeatWave GenAI | Use GenAI to generate or increase textual content |
| Create/populate vector columns for embeddings | Generate and save vector representations in DB columns | |
| Retrieval-augmented era from vector shops | Use vector retailer for improved GenAI outcomes | |
| Vector Retailer Ingestion | Load paperwork from Object Storage into vector retailer | Ingest recordsdata/objects from Object Storage to populate vector DB |
MySQL Studio
MySQL Studio is a brand new, unified graphical interface designed to make database administration and AI integration easy and environment friendly, whether or not you’re an information skilled or simply beginning out.
It features a SQL workshop, a chat interface for querying paperwork saved within the vector retailer and knowledge in MySQL, and an interactive pocket book for creating machine studying and generative AI functions. The notebooks are suitable with Jupyter, permitting builders to import present notebooks to be used with MySQL AI and MySQL HeatWave or share and collaborate on ML and GenAI tasks.
With SQL Workshop, you possibly can write, take a look at, and run SQL statements in an intuitive editor, streamlining your workflow. The AI Chat characteristic gives a conversational option to harness superior AI capabilities built-in to MySQL AI, serving to you harness superior AI capabilities immediately from inside MySQL Studio. And, with built-in Python notebooks, you possibly can discover knowledge, construct customized functions and unlock highly effective interactive options utilizing Python and widgets—all inside a single, seamless setting.


The Python SDK
The Python SDK bridges integration gaps for MySQL AI or HeatWave by streamlining knowledge ingestion, automating desk lifecycle administration, and providing parts that interoperate with main GenAI and machine studying libraries.
For generative AI, the SDK delivers three MySQL AI-backed LangChain parts:
MyLLM(generative mannequin)MyEmbeddings(embedding mannequin)MyVectorStore(vector/doc retailer)
These will be built-in into present LangChain pipelines or used to construct new ones.
For predictive AI, the SDK introduces MyModel, which gives direct entry to MySQL AI’s AutoML by way of Scikit-Study-compatible parts:
MyClassifierMyAnomalyDetectorMyRegressorMyGenericTransformer
This flexibility permits builders to simply combine MySQL AI into machine studying workflows.
Core use instances embrace:
- Devoted ML pipelines (e.g., fraud detection) utilizing acquainted Python and Scikit-Study paradigms
- Retrieval-Augmented Era (RAG)
- LLM functions with tool-calling
With clear, composable APIs, the SDK hastens improvement and permits superior use of MySQL HeatWave in each new and present functions.
Key Advantages:
- Seamless integration of MySQL HeatWave GenAI and ML options into Python tasks
- Automated dealing with of knowledge transformations, ingestion, and desk lifecycle duties to reduce handbook work
- Full interoperability with LangChain and Scikit-Study ecosystems
Pure Language to SQL
MySQL AI lets customers question their database utilizing pure language, making it straightforward for anybody—technical or non-technical—to extract info and acquire insights. This boosts productiveness and helps uncover priceless info out of your knowledge.
While you ask a query in pure language, the system mechanically collects solely the related components of your database construction, corresponding to desk and column names and their relationships. This focused info is included together with your query and despatched to the AI mannequin, permitting it to raised perceive your intent and generate correct SQL queries tailor-made to your knowledge.
Earlier than working any question, the system checks the generated SQL for accuracy and consistency, utilizing automated validation to scale back errors. Solely validated queries are executed, so that you obtain dependable outcomes that reply your unique query.
With this streamlined, multi-step course of, knowledge exploration turns into easy, intuitive, and reliable for all customers—no SQL experience required.
Abstract
MySQL AI gives built-in, automated, and safe machine studying (ML) and generative AI capabilities. AutoML simplifies ML processes, serving to you construct, practice, and clarify ML fashions with out knowledge motion or added prices. In-database LLMs, a built-in vector retailer, and embedding fashions allow GenAI, semantic search, and retrieval-augmented era (RAG) at lowered infrastructure prices and with out knowledge motion.
Absolutely suitable performance and APIs present the choice of prototyping on-premises and migrating to the cloud for the advantages of a totally managed service, larger scalability, and higher price-performance. Prospects in numerous industries are constructing and deploying functions with MySQL AI and we encourage you to strive constructing an software your self.
Get a trial obtain from Oracle E-Supply at this time.
Study Extra
Python SDK weblog (the SDK is similar for MySQL AI and MySQL HeatWave)
