Walkthrough
This walkthrough will guide you through a basic installation of the Oracle AI Optimizer and Toolkit (the AI Optimizer). It will allow you to experiment with GenAI, using Retrieval-Augmented Generation (RAG) and Natural Language to SQL (NL2SQL) with the Oracle AI Database at the core.
By the end of the walkthrough you will be familiar with:
- Configuring a Language Model
- Configuring an Embedding Model
- Configuring the Vector Storage
- Splitting, Embedding, and Storing vectors
- Experimenting with the AI Optimizer
What you'll need for the walkthrough:
- Internet Access (docker.io and container-registry.oracle.com)
- Access to an environment where you can run container images (Podman or Docker).
- 100G of free disk space.
- 12G of usable memory.
- Sufficient GPU/CPU resources to run the language model, embedding model, and database (see below).
The performance will vary depending on the infrastructure.
Language and Embedding Models are designed to use GPUs, but this walkthrough can work on machines with just CPUs; albeit much slower! When testing the Language Model, if you don't get a response in a couple of minutes; your hardware is not sufficient to continue with the walkthrough.
Installation
You will run four container images to establish the "Infrastructure":
- On-Premises Language Model - granite4.1:8b
- On-Premises Embedding Model - mxbai-embed-large
- Vector Storage - Oracle AI Database Free
- The AI Optimizer
Language Model - granite4.1:8b
To enable the ChatBot functionality, access to a Language Model is required. The walkthrough will use Ollama to run the granite4.1:8b model.
The commands in this section work in a macOS/Linux shell or PowerShell 7. The documentation will reference podman commands. If applicable to your environment, podman can be substituted with docker.
If you are using docker, consider aliasing the podman command for convenience:
- Linux/macOS
- PowerShell
alias podman=docker
Set-Alias podman docker
-
Start the Ollama container:
- Linux
- macOS
- Windows
The Container Runtime is native. The command below makes all configured GPUs available; omit
--gpus=allwhen running with CPUs only.podman run -d --gpus=all -v ollama:$HOME/.ollama -p 11434:11434 --name ollama docker.io/ollama/ollamaThe Container Runtime is backed by a virtual machine. Configure the VM with at least 12G of memory and 100G of disk space. The LibKrun provider can expose the Apple Metal GPU to compatible container workloads, but does not by itself enable GPU acceleration for Ollama. The command below uses the CPUs assigned to the VM.
podman run -d -e OLLAMA_NUM_PARALLEL=1 -v ollama:$HOME/.ollama -p 11434:11434 --name ollama docker.io/ollama/ollamaThe Container Runtime is backed by a virtual machine using WSL2 or Hyper-V. Configure the VM with at least 12G of memory and 100G of disk space. GPU acceleration with an NVIDIA GPU requires WSL2, a compatible driver, and the NVIDIA Container Toolkit configured in the Podman machine. The command below is a CPU-safe default.
podman run -d -e OLLAMA_NUM_PARALLEL=1 -v ollama:$HOME/.ollama -p 11434:11434 --name ollama docker.io/ollama/ollama -
Pull the Language Model into the container:
podman exec -it ollama ollama pull granite4.1:8b -
Test the Language Model:
Performance: Fail Fast...Unfortunately, if the below
curldoes not respond within 5-10 minutes, the rest of the walkthrough will be unbearable. If this is the case, please consider using different hardware.curl http://127.0.0.1:11434/api/generate -d '{"model": "granite4.1:8b","prompt": "Why is the sky blue?","stream": false}'
Embedding - mxbai-embed-large
To enable the RAG functionality, access to an embedding model is required. The walkthrough will use Ollama to run the mxbai-embed-large embedding model.
-
Pull the embedding model into the container:
podman exec -it ollama ollama pull mxbai-embed-large
The AI Optimizer
The AI Optimizer provides an easy-to-use front-end for experimenting with Language Model parameters and RAG.
-
Download and extract the latest release into a new directory:
Latest Release: TAR.GZ archive
For example:
curl -LO https://github.com/oracle/ai-optimizer/releases/latest/download/ai-optimizer-src.tar.gzmkdir ai-optimizertar zxf ai-optimizer-src.tar.gz -C ai-optimizercd ai-optimizer -
Build the container image.
notemacOS Silicon users may need to specify
--arch amd64podman build -f src/Dockerfile -t localhost/ai-optimizer-aio:latest .
-
Start the AI Optimizer:
podman run -d --name ai-optimizer-aio --network=host localhost/ai-optimizer-aio:latest
Vector Storage - Oracle AI Database Free
AI Vector Search in Oracle AI Database provides the ability to store and query private business data using a natural language interface. The AI Optimizer uses these capabilities to provide more accurate and relevant Language Model responses via Retrieval-Augmented Generation (RAG). Oracle AI Database Free provides an ideal, no-cost vector store for this walkthrough.
-
Start the database container:
podman run -d --name ai-optimizer-db -p 1521:1521 container-registry.oracle.com/database/free:latest-lite -
Wait until the database is ready:
- Linux/macOS
- PowerShell
until podman logs ai-optimizer-db 2>&1 | grep -q 'DATABASE IS READY TO USE!'; do sleep 5; donewhile (-not (podman logs ai-optimizer-db 2>&1 | Select-String -Quiet 'DATABASE IS READY TO USE!')) { Start-Sleep -Seconds 5 } -
Set
vector_memory_size:podman exec -it ai-optimizer-db sqlplus '/ as sysdba'ALTER SYSTEM SET vector_memory_size=512M SCOPE=spfile;EXIT; -
Restart the database and wait for a new ready message:
- Linux/macOS
- PowerShell
ready_lines=$(podman logs ai-optimizer-db 2>&1 | grep -c 'DATABASE IS READY TO USE!' || true)podman container restart ai-optimizer-dbuntil [ "$(podman logs ai-optimizer-db 2>&1 | grep -c 'DATABASE IS READY TO USE!')" -gt "$ready_lines" ]; do sleep 5; done$readyLines = @(podman logs ai-optimizer-db 2>&1 | Select-String 'DATABASE IS READY TO USE!').Countpodman container restart ai-optimizer-dbwhile (@(podman logs ai-optimizer-db 2>&1 | Select-String 'DATABASE IS READY TO USE!').Count -le $readyLines) { Start-Sleep -Seconds 5 }
-
Create a database user for the walkthrough:
podman exec -it ai-optimizer-db sqlplus '/ as sysdba'alter session set container=FREEPDB1;CREATE TABLESPACE IF NOT EXISTS USERS DATAFILE '/opt/oracle/oradata/FREE/FREEPDB1/users_01.dbf' SIZE 100M;CREATE USER "WALKTHROUGH" IDENTIFIED BY OrA_41_OpTIMIZERDEFAULT TABLESPACE "USERS"TEMPORARY TABLESPACE "TEMP";GRANT "DB_DEVELOPER_ROLE" TO "WALKTHROUGH";ALTER USER "WALKTHROUGH" DEFAULT ROLE ALL;ALTER USER "WALKTHROUGH" QUOTA UNLIMITED ON USERS;-- For Deep Data SecurityCREATE ROLE AIO_DDS_ROLE;GRANT CREATE SESSION TO AIO_DDS_ROLE;GRANT AIO_DDS_ROLE TO "WALKTHROUGH" WITH ADMIN OPTION;EXIT;
Configuration
Operating System specific instructions:
- Linux
- macOS/Windows
If you are running on a remote host, you may need to allow access to the 8501 port.
For example, in Oracle Linux 8/9 with firewalld:
firewall-cmd --zone=public --add-port=8501/tcp
As the container is running in a VM, a port-forward is required from the localhost to the Podman VM:
podman machine ssh -- -N -L 8501:localhost:8501
This command does not return as it holds the tunnel open. Leave it running in its own terminal for the duration of the walkthrough, and open a new terminal for the remaining commands.
With the "Infrastructure" in-place, you're ready to configure the AI Optimizer.
In a web browser, navigate to http://localhost:8501:

Notice that there are no language models configured to use. Let's start the configuration.
Configure the Language Model
To configure the On-Premises Language Model, navigate to Configuration > Models:
- Enable the
granite4.1:8bmodel that you pulled earlier by clicking the Edit button
- Tick the Enabled checkbox, leave all other settings as-is, and Save
⭐️ More information about configuring Language Models can be found in the Model Configuration documentation.
Say "Hello?"
Navigate to the ChatBot screen:

The error about language models will have disappeared, but there is a new warning about the database. You'll take care of that in the next steps.
The Chat model: will have been pre-set to the only enabled Language Model and a dialog box to interact with the Language Model will be ready for input.
Feel free to play around with the different Language Model Parameters, hovering over the ︖ icons to get more information on what they do.
You'll come back to the ChatBot later to experiment further.
Configure the Embedding Model
To configure the On-Premises Embedding Model, navigate back to the Configuration screen and Models tab:
- Enable the
mxbai-embed-largeEmbedding Model following the same process as you did for the Language Model.
⭐️ More information about configuring embedding models can be found in the Model Configuration documentation.
Configure the Database
To configure Oracle AI Database Free, navigate to the Configuration screen and Databases tab:
- Enter the Database Username:
WALKTHROUGH - Enter the Database Password for the database user:
OrA_41_OpTIMIZER - Enter the Database Connection String:
//localhost:1521/FREEPDB1 - Save Database

⭐️ More information about configuring the database can be found in the Database Configuration documentation.
Split and Embed
With the embedding model and database configured, you can now split and embed documents for use in Vector Search.
Navigate to Tools > Split/Embed:
-
Change the Knowledge Base Source to
Web
-
Enter the URL and press Enter:
https://docs.oracle.com/en/database/oracle/oracle-database/26/xeinl/oracle-ai-database-free-installation-guide-linux.pdf -
Give the Vector Store an Alias:
WALKTHROUGHand press Enter
-
Click Populate Vector Store
-
Please be patient...
Depending on the infrastructure, the embedding process can take a few minutes. As long as the "Populating Vector Store..." timer is running... it's working.
You can watch the progress of the embedding by streaming the server logs:
podman exec -it ai-optimizer-aio tail -f /app/src/apiserver_8000.log
Query the Vector Store
After the splitting and embedding process completes, you can query the Vector Store to see the chunked and embedded document:
From the command line:
-
Connect to the Oracle AI Database:
podman exec -it ai-optimizer-db sqlplus 'WALKTHROUGH/OrA_41_OpTIMIZER@FREEPDB1' -
Query the Vector Store:
SELECT * FROMWALKTHROUGH_OLLAMA_MXBAI_EMBED_LARGE_512_103_COSINE_HNSW;
Experiment with Vector Search
With the AI Optimizer configured, you're ready for some experimentation.
Navigate back to the ChatBot.
For this guided experiment, perform the following:
- Ask the ChatBot:
What are the required packages for a successfulinstallation of an Oracle AI Database?
Responses may vary, but generally the ChatBot's response will be inaccurate, including:
- Not understanding that there is an Oracle AI Database release. This is known as knowledge-cutoff.
- Suggestions of requiring unrelated software. These are hallucinations.
Now select "Vector Search" in the Toolkit options, ensure "Store Discovery" and "Document Grading" are disabled, while "Prompt Rephrase" is enabled.

and simply ask: Are you sure?
With RAG enabled, all the services (Language/Embedding Models and Database) are being utilized simultaneously:
- The Language Model is rephrasing "Are you sure?" into a query that takes into account the conversation history and context
- The embedding model is being used to convert the rephrased query into vectors for a similarity search
- The database is being queried for documentation chunks similar to the rephrased query (AI Vector Search)
- The Language Model is completing its response using the documents from the database (if the documents are relevant)
Depending on your hardware, this may cause the response to be significantly delayed.
By asking Are you sure?, you are taking advantage of the AI Optimizer's history and context functionality. The response should be different and include a list of Operating System packages and maybe even an apology!
Under "Vector Search Details" you should see the PDF source, the vector store tables searched, and the rephrased query.
What's Next?
You should now have a solid foundation using the AI Optimizer.
The Use Cases walk you through using your new AI Optimizer installation through an end-to-end demo that shows the progressive value of NL2SQL, Vector Search, and combined-mode grounding a synthetic dataset.
To take your experiments further, consider exploring:
- Turn On/Off/Clear history
- Experiment with different Language Models and Embedding Models
- Tweak Language Model parameters, including Temperature and Penalties, to fine-tune model performance
- Investigate various strategies for splitting and embedding text data, such as adjusting chunk-sizes, overlaps, and distance metrics
Clean Up
To cleanup the walkthrough "Infrastructure", stop and remove the containers.
podman container rm ai-optimizer-db --force
podman container rm ai-optimizer-aio --force
podman container rm ollama --force