OCI Generative AI Service
1. Introduction: What is OCI Generative AI Service?
Oracle Cloud Infrastructure (OCI) Generative AI Service is a fully
managed, serverless platform that gives you access to powerful large
language models (LLMs) through a single API.
👉 Key idea: With just one API, you can experiment with different AI models
(from providers like Meta and Cohere) without rewriting a lot of code.
Serverless = You don’t need to worry about setting up or managing
servers. OCI takes care of the infrastructure for you.
Generative AI = The AI can create text (answers, summaries,
dialogues, etc.) when given an input prompt.
Example:
You type → “Summarize this product review into one sentence.”
The model replies → “This product is affordable but has average build
quality.”
2. How Does It Work?
The service follows a prompt-and-response system:
1. You give the AI a prompt (a text input, like a question, a document,
or even a review).
2. The AI processes it using its large trained model.
3. It gives you a natural language response.
🔎 The models are trained to understand, generate, and reason with
human language at scale.
3. Three Main Characteristics of OCI Generative AI Service
(A) Pre-trained Foundational Models
These are models already trained on massive amounts of data. They come in
two types:
i. Chat Models
Designed for conversation and following instructions.
Examples:
o Command-R (by Cohere) → affordable, handles up to 16,000
tokens.
o Command-R Plus → more powerful, handles up to 128,000
tokens, but more expensive.
o LLaMA 3–70B Instruct (by Meta) → very large, advanced
instruction-following model.
How they work:
They remember context → meaning you can ask follow-up questions.
They are instruction-tuned, so they understand directions like:
o “Write an email.”
o “Summarize this paragraph.”
o “Explain this like I’m 10 years old.”
ii. Embedding Models 🔢
Convert text into vectors (numbers) called embeddings.
These vectors capture meaning rather than just words.
Use cases:
Semantic Search → searching based on meaning, not just exact
keywords.
Multilingual Support → can work across 100+ languages.
o Example: Search in Chinese on a database of French documents.
👉 Example:
Word: “car” → Embedding = [0.21, –0.55, 1.10, …]
Word: “automobile” → Embedding = [0.19, –0.53, 1.08, …]
These embeddings are close in vector space, meaning the AI knows
they are related.
(B) Flexible Fine-Tuning
Sometimes, the general models are not perfect for your specific task.
That’s where fine-tuning comes in.
Definition: Training an existing large model on your own domain-
specific data (e.g., medical data, legal documents, product reviews).
Benefits:
1. Improves accuracy for your use case.
2. Saves cost by making the model more efficient.
OCI uses T-Few Fine-Tuning, which:
Adds new layers instead of retraining the whole model.
Updates only a small part of the model’s weights.
Makes customization faster and cheaper compared to traditional
fine-tuning.
Example:
Base model knows general English.
You fine-tune it with legal contracts → It becomes much better at
understanding legal questions.
(C) Dedicated AI Clusters
When you need high performance for fine-tuning or running large models,
OCI provides dedicated GPU clusters.
GPU = specialized processors for heavy AI workloads.
These clusters are:
o Isolated (your tasks don’t share GPUs with others → better
security).
o Connected with ultra-fast RDMA networking (lets GPUs talk
to each other very quickly, with low delay).
Benefit: Large AI workloads can run faster, more securely, and at scale.
4. Use Cases of OCI Generative AI
Here are some real-world applications:
1. Chatbots & Virtual Assistants → Customer support, healthcare, HR
bots.
2. Text Generation → Emails, blogs, product descriptions.
3. Information Retrieval → Search systems that return meaningful
results.
4. Semantic Search → Smarter document/database search beyond
keyword matching.
5. Cross-Language Queries → Global businesses searching data across
multiple languages.
Flashcard 1
Q: What is OCI Generative AI Service?
A: A fully managed, serverless service that provides access to large
language models (LLMs) via a single API for building AI applications.
Flashcard 2
Q: What does serverless mean in OCI Generative AI?
A: You don’t manage infrastructure—Oracle handles servers and scaling for
you.
Flashcard 3
Q: How does the service work in simple steps?
A: You provide a text prompt, the AI processes it, and gives a response.
Flashcard 4
Q: Name the three key characteristics of OCI Generative AI.
A: 1) Pre-trained foundational models, 2) Flexible fine-tuning, 3) Dedicated AI
clusters.
Flashcard 5
Q: What are the two classes of pre-trained models?
A: Chat models and Embedding models 🔢.
Flashcard 6
Q: Give examples of chat models in OCI Generative AI.
A: Command-R, Command-R Plus, and LLaMA 3–70B Instruct.
Flashcard 7
Q: What’s the difference between Command-R and Command-R Plus?
A:
Command-R → Cheaper, supports up to 16k tokens.
Command-R Plus → More powerful, supports up to 128k tokens, but
more expensive.
Flashcard 8
Q: What is an instruction-tuned model?
A: A model trained to follow human instructions (e.g., “summarize this” or
“write an email”).
Flashcard 9
Q: What are embeddings?
A: Text converted into vectors of numbers that capture meaning, not just
words.
Flashcard 10
Q: What are embeddings mainly used for?
A: Semantic search (meaning-based search) and multilingual search.
Flashcard 11
Q: What is semantic search?
A: Search that focuses on the meaning of text, not just keywords.
Flashcard 12
Q: How many languages does the multilingual embedding model support?
A: 100+ languages.
Flashcard 13
Q: What is fine-tuning?
A: Optimizing a pre-trained model with your own domain-specific dataset.
Flashcard 14
Q: Why do we use fine-tuning?
A: To improve accuracy on specific tasks and make the model more efficient.
Flashcard 15
Q: What is T-Few fine-tuning?
A: A fast, cost-effective method that updates only a small fraction of model
weights instead of retraining everything.
Flashcard 16
Q: Give an example of when fine-tuning is needed.
A: Training a base model with legal contracts so it performs better in law-
related tasks.
Flashcard 17
Q: What are dedicated AI clusters?
A: GPU-based compute resources reserved for fine-tuning and inference
tasks.
Flashcard 18
Q: What makes dedicated AI clusters secure?
A: GPUs are isolated per customer and connected with ultra-fast RDMA
networking.
Flashcard 19
Q: List 3 common use cases of OCI Generative AI.
A: Chatbots, text generation, semantic search.
Flashcard 20
Q: Why choose OCI Generative AI Service?
A: Easy single API access, no infrastructure management, customizable fine-
tuning, and secure GPU clusters for scaling.
AI Vector Search in Oracle Database 23ai
1. Introduction: What is AI Vector Search?
Oracle Database 23ai introduces AI Vector Search as a built-in feature.
Goal: Help businesses perform semantic searches – searching by
meaning rather than exact keywords.
Why important?
o Traditional databases store numbers, text, and structured rows.
o Modern AI and Generative AI need to work with unstructured
data (documents, images, resumes, product reviews, etc.).
o Vector Search bridges the gap by allowing AI-powered similarity
searches directly inside the database.
👉 Instead of using a separate “vector database,” Oracle combines relational
data (tables, SQL) and vectors in the same database → known as a
converged database approach.
2. Oracle Database 23ai: Converged Database Approach
Oracle Database doesn’t just store rows and columns. It also supports:
JSON
XML
Graph data
Spatial data (maps/locations)
Text
Vectors
This makes it powerful because all data types live in one place and can
be queried with SQL.
3. How Does AI Vector Search Work?
The process looks like this:
1. Embedding Generation
o Use a machine learning model (e.g., resnet_50) to convert data
(image, text, etc.) into a vector embedding (a long list of
numbers).
o In Oracle, this is done using the VECTOR_EMBEDDING function.
Example:
o Query image → goes into the model → outputs a vector like [0.12,
–0.45, 0.89, …].
o This embedding is stored in the database.
2. Storing Vectors
o Oracle Database introduces a VECTOR datatype to store
embeddings.
o You can add a vector column to a relational table.
o Flexible design: schema remains valid even if newer embedding
models come out.
3. Similarity Search
o Use the function VECTOR_DISTANCE to compare vectors.
o The smaller the distance → the more similar the two items.
o Default metric = cosine similarity, but you can change it
depending on your model.
Example: Compare resume embeddings with job embeddings → find closest
matches.
4. Example: Job Matching with AI Vector Search
Oracle makes it simple with SQL:
Candidate’s resume → converted to vector.
Job descriptions in preferred cities → also stored as vectors.
A five-line SQL query can return the top 10 best matches.
👉 Benefit: Combines applicant data, job data, and similarity search all inside
one SQL query.
5. Vector Indexing: Performance + Accuracy
Searching large amounts of data requires indexing for speed. Oracle
provides:
Vector Indexes → just like normal SQL indexes, but designed for
vectors.
Organization Options:
o INMEMORY NEIGHBOR GRAPH → if the index fits in memory.
o NEIGHBOR PARTITIONS → if it doesn’t.
Distance Options: Default is cosine, but can change.
Target Accuracy: You can set accuracy level (e.g., 80%).
o Approximate search → faster, less exact.
o Exact search → slower, more precise.
Example:
Top 5 similar customers at 80% target accuracy → 4 out of 5 results
will be correct.
6. Vector Search + Joins: A Key Differentiator
Many vector databases don’t handle joins well. Oracle does.
Example:
Tables: Author, Books, Pages.
Each page has its own embedding.
Query:
o Find top 5 books similar to query text (qVec).
o Condition: Genre = fiction AND Author = from India.
👉 Result: Combines embeddings with relational joins in a single SQL query.
7. Vector Search in Gen AI Pipelines
Vector Search is not just for searching – it’s a critical part of Generative
AI (Gen AI) pipelines.
Typical Gen AI pipeline with Oracle Database 23ai:
1. Data Sources → database, CSV files, social media, etc.
2. Document Loader → brings documents into the database.
3. Transform → split, summarize, or embed data.
4. Vector Storage → embeddings stored in VECTOR datatype.
5. Similarity Search / RAG → user queries are matched against vectors.
6. LLM Integration → Oracle supports LangChain and LlamaIndex for
advanced apps.
8. Benefits of AI Vector Search in Oracle Database 23ai
✅ Built-in → No need for a separate vector database.
✅ Single SQL query can combine vectors, text, JSON, spatial, and
relational data.
✅ High performance → vector indexes tuned for speed + accuracy.
✅ Enterprise-grade → security, reliability, scalability.
✅ Seamless integration → works with LLM frameworks like
LangChain.
✅ Supports RAG pattern (Retrieval-Augmented Generation) for
smarter AI apps.
Flashcard 1
Q: What is AI Vector Search in Oracle Database 23ai?
A: A built-in feature that enables semantic similarity search across structured
and unstructured data using vectors.
Flashcard 2
Q: What is the advantage of Oracle’s converged database approach?
A: It supports multiple data types (JSON, XML, graph, spatial, text, relational,
and vectors) in one database.
Flashcard 3
Q: What is a vector embedding?
A: A list of numbers representing the meaning of data (text, image, etc.),
making it easier for AI to compare and search.
Flashcard 4
Q: Which SQL function generates vector embeddings in Oracle 23ai?
A: VECTOR_EMBEDDING.
Flashcard 5
Q: Which datatype is used to store embeddings in Oracle Database 23ai?
A: VECTOR datatype.
Flashcard 6
Q: What is the purpose of the VECTOR_DISTANCE function?
A: To calculate how similar two vectors are by measuring the distance
between them.
Flashcard 7
Q: Which distance metric is the default for vector comparisons?
A: Cosine similarity.
Flashcard 8
Q: Why is the VECTOR datatype flexible for schemas?
A: It allows the schema to remain the same even if newer embedding
models with different dimensions are used.
Flashcard 9
Q: Give an example of a real-world use case of AI Vector Search.
A: Matching candidate resumes to job descriptions in preferred cities.
Flashcard 10
Q: How many lines of SQL are needed to combine applicant data, job data,
and vector similarity search?
A: About five lines.
Flashcard 11
Q: What are vector indexes used for?
A: To speed up similarity searches and control accuracy in AI Vector Search.
Flashcard 12
Q: What are the two vector index organizations?
A:
1. INMEMORY NEIGHBOR GRAPH → if index fits in memory.
2. NEIGHBOR PARTITIONS → if it doesn’t.
Flashcard 13
Q: What does the TARGET ACCURACY clause do in vector indexes?
A: Defines the accuracy level (e.g., 80%) for approximate similarity search
results.
Flashcard 14
Q: What does the APPROXIMATE keyword in a SQL query indicate?
A: It requests a similarity search using a vector index for faster results.
Flashcard 15
Q: What is the trade-off between approximate and exact searches?
A: Approximate searches are faster but less precise, while exact searches
are slower but 100% accurate.
Flashcard 16
Q: What makes Oracle different from other vector databases in similarity
search?
A: Oracle supports similarity search with joins across multiple tables.
Flashcard 17
Q: Why are joins important in enterprise data?
A: Enterprise data is usually normalized and spread across multiple tables,
so joins provide more complete results.
Flashcard 18
Q: Give an example of a SQL query using joins with vector search.
A: Finding the top 5 fiction books (Pages table embeddings) by Indian
authors, similar to a query text.
Flashcard 19
Q: How does AI Vector Search fit into a Gen AI pipeline?
A: It generates embeddings, stores them, and supports similarity search or
RAG with LLMs.
Flashcard 20
Q: Which third-party frameworks integrate with Oracle Vector Search for Gen
AI apps?
A: LangChain and LlamaIndex.
Natural Language Queries with Select AI in Oracle Autonomous
Database: Comprehensive Note
Introduction
Oracle Autonomous Database offers Select AI, a powerful feature that
allows users to query and analyze their data using natural
language instead of needing to know SQL or database structures. This
capability is part of Oracle's broader AI ecosystem, designed to bring large
language model (LLM) intelligence directly to enterprise data.
Oracle AI Landscape and Select AI Positioning
Oracle delivers AI across multiple layers of technology.
Select AI focuses on the data layer, leveraging Autonomous Database
and integrated LLMs.
It enables users to simply ask questions in plain English and receive
answers via generated SQL queries or narrative results.
This democratizes data access by removing the need for users to
understand complex data models or write SQL.
How Select AI Works
1. User Interaction
Users pose questions naturally, e.g., "Show top 10 streamed
movies" or "Give total number of movies streamed."
No need to know table names, column names, or SQL syntax.
2. Query Processing
Select AI connects to LLMs trained on public data but not on
your private data.
The system engineers optimized prompts combining user
questions with metadata about your database schemas.
It generates SQL statements that query your Autonomous
Database to produce results.
3. Result Delivery
Results can be returned as:
Query result sets (tables of data)
Narrative summaries
Generated SQL for review and modification
Results can be integrated into interactive interfaces or
applications, such as Oracle APEX.
Demonstration and Application Examples
An app built with Oracle APEX demonstrates natural language queries:
Query returning top 10 streamed movies.
Follow-up queries on actors in those movies.
Aggregations, e.g., total number of movies streamed.
The same app supports:
Filtering, charting, and interactive reporting on queried data.
Reviewing the underlying SQL generated by Select AI to
understand or refine queries.
Technical Foundations and Features
SQL Integration:
Select AI uses special SQL syntax, e.g., SELECT AI ... where the
natural language question substitutes for traditional SQL clauses.
The database parses the question, opts the best LLM, and
produces a corresponding SQL query.
You can use commands like SELECT AI SHOWSQL to display the
generated SQL.
AI Profiles and Pluggability:
AI Profiles define:
Which LLM provider/model to use (OCI Generative AI,
Cohere, OpenAI, Llama, etc.).
Which database schemas, tables, or views are accessible
for querying.
Profiles enable businesses to tailor AI behavior and compliance
while choosing the best models for their needs.
Security and Privacy:
Queries and data processing happen within the customer's
Oracle tenancy.
Data is never exposed or sent to external LLM providers.
Oracle Autonomous Database ensures enterprise-grade security
at every layer.
Building AI-Powered Applications with Select AI
Using Select AI, developers can embed natural language query
capabilities into:
Existing applications
New generative AI-powered apps
It is future-proof:
Ability to switch between LLMs or fine-tune models.
Integrates easily with SQL tools like SQL Developer or low-code
platforms like Oracle APEX.
Allows data analysts and business users to extract insights without SQL
expertise.
Example SQL Workflow Using Select AI
Typical query command:
sql
SELECT AI 'Find the top customer segments for George Clooney movies';
The system:
Parses the prompt,
Maps it to database metadata,
Generates the SQL query,
Executes the query,
Returns the result set or SQL for review.
Flashcard 1
Q: What is Select AI in Oracle Autonomous Database?
A: A feature that lets you query your data using natural language instead of
SQL.
Flashcard 2
Q: What technology does Select AI use to understand natural language?
A: Large Language Models (LLMs).
Flashcard 3
Q: Why is Select AI useful for business users?
A: They can get insights without knowing SQL or database structures.
Flashcard 4
Q: What happens when you ask a question in Select AI?
A: It is translated into SQL, executed, and results are returned.
Flashcard 5
Q: What are the three possible outputs of Select AI?
A:
1. A result set (data rows)
2. A narrative (explanation)
3. The SQL query itself
Flashcard 6
Q: Example: What happens if you ask, “Show me the top 10 streamed
movies”?
A: Select AI generates SQL, finds the data, and returns the top 10 movies.
Flashcard 7
Q: What Oracle tool can display Select AI results with filters and charts?
A: Oracle APEX Interactive Reports.
Flashcard 8
Q: Which SQL keyword shows the query generated by Select AI?
A: SHOWSQL.
Flashcard 9
Q: Write an example Select AI query.
A:
SELECT AI 'Find the top customer segments for George Clooney movies';
Flashcard 10
Q: How does Select AI benefit developers?
A: They can build AI-powered apps quickly using natural language queries.
Flashcard 11
Q: Does Select AI require knowledge of table names or joins?
A: No, it figures them out automatically.
Flashcard 12
Q: What protects your data when using Select AI?
A: Oracle’s Autonomous Database security—data stays within your tenancy.
Flashcard 13
Q: What is an AI profile in Select AI?
A: A configuration that defines which LLM to use and which schemas/tables
to include.
Flashcard 14
Q: Which PL/SQL package is used to configure AI profiles?
A: DBMS_CLOUD_AI.
Flashcard 15
Q: Can you choose which LLM provider Select AI uses?
A: Yes—OCI Gen AI, Cohere, OpenAI, Llama, etc.
Flashcard 16
Q: Why is Select AI described as “pluggable”?
A: Because you can plug in different AI models depending on business
needs.
Flashcard 17
Q: What is a major design principle of Select AI?
A: Pluggability—flexibility to switch models and schemas easily.
Flashcard 18
Q: What is the difference between public LLM training data and your
organization’s data?
A: LLMs are trained on public data, but Select AI uses your private business
data for queries.
Flashcard 19
Q: How does Select AI improve learning SQL indirectly?
A: You can view the generated queries and understand the joins and tables
used.
Flashcard 20
Q: List 3 key benefits of Select AI.
A:
1. Easy natural language querying.
2. Secure and private data usage.
3. Future-ready with multiple LLM support.