Use natural language to interact with your database and LLMs through SQL
to enhance user productivity and develop AI-based applications. Select AI simplifies and
automates using generative AI, whether generating, running, and explaining SQL from a
natural language prompt, using retrieval augmented generation with vector stores, generating
synthetic data, or chatting with the LLM.
When you use Select AI, Autonomous Database manages the process of converting natural language into SQL. This
means you can provide a natural language prompt instead of SQL code to interact with
your data. Select AI serves as a productivity tool for SQL users and developers and
enables non-expert SQL users to derive useful insights from their data, without
having to understand data structures or technical languages.
Select AI also automates the retrieval augmented generation (RAG) process
from generating vector embeddings to retrieving relevant content based on your
prompt through semantic similarity search using your vector store. Other features
include synthetic data generation, supporting chat history for conversations, and
other features, all from a SQL interface.
The DBMS_CLOUD_AI
package
enables
integration with a user-specified LLM for generating SQL code using natural language
prompts. For natural language to SQL generation, this package provides an augmented
prompt to the LLM containing the relevant database schema metadata. This enables
generating, running, and explaining SQL queries based on natural language
prompts.
It also facilitates retrieval augmented generation using vector stores, synthetic
data generation, and allows for chatting with the
LLM. The DBMS_CLOUD_AI package works with AI
providers listed in Select your AI Provider and LLMs.
Note
You must have an account with the AI provider and provide
the credentials through DBMS_CLOUD_AI objects that the Autonomous Database
uses.
You can submit prompts in multiple languages. The
quality of the result depends on the abilities of the specific LLM
or the embedding model (transformer) being used. Check your LLM or
embedding model documentation for multi-language support.
Topics
Usage Guidelines Provides usage guidelines to assist in the use of Select AI for natural language to SQL generation..
Supported Platforms Select AI is supported on Autonomous Database Serverless and Autonomous Database on Dedicated Exadata Infrastructure and Cloud at Customers.
Select your AI Provider and LLMs Choose an AI provider and LLM that meets your security standards and aligns with your specific needs, like text or code generation.
Provides usage guidelines to assist in the use of Select AI for natural
language to SQL
generation..
Intended Use
This
feature generates, runs, and explains SQL queries from user-provided natural language
prompts. It automates tasks that users would otherwise perform manually using their
schema metadata and a large language model (LLM) of their choice. Additionally, it
facilitates retrieval augmented generation with vector stores and enables chatting with
the LLM.
Depending
on the Select AI action you specify, you provide a prompt, whether for natural language
to SQL generation, RAG, or pass-through chat, and Select AI automates the interaction
with LLMs and your database using SQL and PL/SQL interfaces. Specifically, it generates
SQL queries from natural language based on metadata from the specified schema and
tables. Additionally, it facilitates chat-based generative AI, optionally enhanced with
content from vector stores through retrieval augmented generation (RAG) for improved
response quality. It also explains SQL queries based on natural language prompts and
supports synthetic data generation for one or multiple schema tables. Select AI enables
submitting general requests with the chat action.
Prompt Augmentation Data
For SQL query generation, the database augments the user-specified prompt
with database metadata to mitigate hallucinations from the LLM. The augmented prompt is
then sent to the user-specified LLM to produce the query. When using vector stores
with retrieval augmented generation (RAG), content from the vector store is retrieved
using semantic similarity search with the provided prompt. This content becomes part of
the augmented prompt that is sent to the LLM.
The database augments the prompt with schema metadata only. This metadata
may include schema definitions, table and column comments, and content available from
the data dictionary. For the purposes of SQL generation, the database
does not provide table or view contents (actual row or column values) when augmenting
the prompt.
The narrate action, however, does provide to the LLM
either:
the result of a natural language to SQL query, which contains database data, or
the result of semantic similarity search as retrieved from the vector store
supporting retrieval augmented generation (RAG).
The LLM uses these results to generate a natural language text response.
WARNING:
Large language models (LLMs) have been trained on a broad set of
text documentation and content, typically from the Internet. As a result, LLMs
may have incorporated patterns from invalid or malicious content, including SQL
injection. Thus, while LLMs are adept at generating useful and relevant content,
they also can generate incorrect and false information including SQL queries
that produce inaccurate results and/or compromise security of your data.
The queries generated on your behalf by the user-specified LLM
provider will be run in your database. Your use of this feature is solely at
your own risk, and, notwithstanding any other terms and conditions related to
the services provided by Oracle, constitutes your acceptance of that risk and
express exclusion of Oracle’s responsibility or liability for any damages
resulting from that use.
Choose an AI provider and LLM that meets your security standards and
aligns with your specific needs, like text or code generation.
Different LLMs excel at various tasks based on their training data and
intended purpose. Some models are excellent for text generation but may not perform
well in code generation, while others are specifically optimized for coding tasks.
Choose an LLM that best suits your needs.
AI Provider
LLMs
Embedding Model for RAG
Purpose
OCI Generative AI
meta.llama-3.1-70b-instruct (default)
meta.llama-3.1-405b-instruct
meta.llama-3.2-90b-vision-instruct
cohere.command-r-16k (deprecated)
cohere.command–r-plus (deprecated)
cohere.command-r-08-2024
cohere.command-r-plus-08-2024
cohere.embed-english-v3.0 (default)
cohere.embed-multilingual-v3.0
cohere.embed-english-light-v3.0
cohere.embed-multilingual-light-v3.0
The OCI Generative AI Chat models are supported for
all SELECT AI actions such as
runsql, showsql,
explainsql, narrate, and
chat.
The OCI Generate text models are supported only for
SELECT AIchat action.
Note
For models that accept images,
use meta.llama-3.2-90b-vision-instruct.
To learn more, see Chat in
OCI Generative AI.
The meta.llama-3.2-90b-vision-instruct model
is specifically trained for vision and images. While it
can be used for text and SQL generation, the model is
best suited for images.