๐Ÿ—„๏ธ Database Configuration

To use the Retrieval-Augmented Generation (RAG) functionality of the AI Explorer, you will need to setup/enable an embedding model and have access to an Oracle Database 23ai. Both the Always Free Oracle Autonomous Database Serverless (ADB-S) and the Oracle Database 23ai Free are supported. They are a great, no-cost, way to get up and running quickly.

Configuration

The database can either be configured through the AI Explorer interface or by using environment variables.

AI Explorer Interface

To configure the Database from the AI Explorer, navigate to Configuration -> Database:

Database Config Database Config

Provide the following input:

  • DB Username: The pre-created database username where the embeddings will be stored
  • DB Password: The password for the DB Username
  • Database Connect String: The full connection string or TNS Alias for the Database. This is normally in the form of (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=<hostname>)(PORT=<port>))(CONNECT_DATA=(SERVICE_NAME=<service_name>))) or //<hostname>:<port>/<service_name>
  • Wallet Password (Optional): If the connection to the database uses mTLS, provide the wallet password. Review Using a Wallet for additional setup instructions.

Once all fields are set, click the Save button.

Environment Variables

The following environment variables can be set, prior to starting the AI Explorer, to automatically configure the database:

  • DB_USERNAME: The pre-created database username where the embeddings will be stored
  • DB_PASSWORD: The password for the DB Username
  • DB_DSN: The connection string or TNS Alias for the Database. This is normally in the form of (description=... (service_name=<service_name>)) or //host:port/service_name.
  • DB_WALLET_PASSWORD (Optional): If the connection to the database uses mTLS, provide the wallet password. Review Using a Wallet for additional setup instructions.

For Example:

export DB_USERNAME="DEMO"
export DB_PASSWORD=MYCOMPLEXSECRET
export DB_DSN="//localhost:1521/EXPLORER"
export DB_WALLET_PASSWORD=MYCOMPLEXWALLETSECRET

Using a Wallet/TNS_ADMIN Directory

For mTLS database connectivity or, if you prefer to specify a TNS alias instead of a full connect string, you can use the contents of a TNS_ADMIN directory.

Great things come from unzipped files.

If using and ADB-S wallet, unzip the contents into the TNS_ADMIN directory. The .zip file will not be recognized.

Bare-Metal Installation

For bare-metal installations, set the TNS_ADMIN environment variable, or copy the contents of your current TNS_ADMIN to src/tns_admin before starting the AI Explorer.

Container Installation

For container installations, there are a couple of ways to include the contents of your TNS_ADMIN in the image:

  • Before building the image, copy the contents of your TNS_ADMIN to src/tns_admin. This will include your TNS_ADMIN as part of the image build.
  • Mount your TNS_ADMIN directory into the container on startup, for example: podman run -p 8501:8501 -v $TNS_ADMIN:/tns_admin -it --rm ai-explorer-server
  • Copy the TNS_ADMIN directory into an existing running container, for example: podman cp $TNS_ADMIN /app/tns_admin ai-explorer-server

Database User

A database user is required to store the embeddings, used for RAG, into the Oracle Database. A non-privileged user with a non-SYSTEM tablespace should be used for this purpose. Use the below syntax as an example of creating a new user:

CREATE USER "DEMO" IDENTIFIED BY MYCOMPLEXSECRET
    DEFAULT TABLESPACE "DATA"
    TEMPORARY TABLESPACE "TEMP";
GRANT "DB_DEVELOPER_ROLE" TO "DEMO";
ALTER USER "DEMO" DEFAULT ROLE ALL;
ALTER USER "DEMO" QUOTA UNLIMITED ON DATA;

Replace “DEMO” as required.

One schema fits none…

Creating multiple users in the same database allows developers to separate their experiments simply by changing the “Database User”