18.8.4.3 Managing AI Configurations and RAG Sources
Create AI Configurations and RAG Sources to enable richer interactions with Generative AI services.
- About AI Configurations and RAG Sources
Learn about AI Configurations and RAG Sources. - Creating an AI Configuration
Create an AI Configuration in Shared Components on the Generative AI Configurations page. - Editing or Deleting an AI Configuration
Edit or delete an AI Configuration or RAG Source from the Generative AI Services, Create/Edit page. - Copying or Subscribing to an AI Configuration
Copy an AI Configuration from the current application or from another application. When copying an AI Configuration from another application, you can also subscribe to it. - Viewing AI Configuration Utilization
View a report that details where AI Configurations are used within the current workspace. - Viewing AI Configuration History
View a report of recent modifications made to AI Configurations in this workspace.
Parent topic: Including Generative AI in Applications
18.8.4.3.1 About AI Configurations and RAG Sources
Learn about AI Configurations and RAG Sources.
An AI Configuration is a shared component that centralizes key Generative AI
settings, including the System Prompt, Welcome Message, and Retrieval-Augmented
Generation (RAG) sources. Creating an AI Configuration enables the reusability of these
settings across multiple AI-enabled components such as Show AI Assistant and Generate
Text With AI dynamic actions. You can also use AI Configurations with PL/SQL APIs
available in the APEX_AI
package.
About AI Configurations
An AI Configuration contains the following:
- Name - Identifies the AI Configuration in the App Builder UI.
- Static ID - Use this ID to reference the AI Configuration in the
APIs in the
APEX_AI
package. - Service - Refers to the AI Service to be used by the AI Configuration. By default, the Application Default is used.
- System Prompt - Initial instructions or context for the AI Service.
- Welcome Message - The first message shown by the AI Assistant. Note that only components with a UI, such as Show AI Assistant, can utilize this setting.
- Temperature - Sets the level of randomness or predictability of the generated content.
- RAG Sources - Additional data to be sent to the AI Service.
About RAG Sources
Each AI Configuration can contain zero or more RAG Sources which help enrich the AI conversation with data specific to the application. A RAG Source can be a SQL Query, a Function Body Returning CLOB, or simply Static text. RAG Sources are dynamic and can individually be protected by a Server-side Condition. If the condition passes, the resulting content is sent with the System Prompt to the AI Service with each request, in essence acting as additional System Prompts.
A RAG Source contains the following:
- Name - A name of the RAG Source in the App Builder UI.
- Description - A description of the included data to be sent to the AI Service.
- Source Type:
- SQL Query - When chosen, the result set is included in CSV format. Make sure to only include the relavant columns, and limit the result set to the relevant rows.
- Function Body Returning CLOB
- Static text
RAG Sources and Server-side Conditions
Each RAG Source that passes a Server-side Condition is evaluated and included as an additional system message. Note that the RAG Sources are re-evaluated and sent with each call, which depending on the payload might have a large token usage.
To ensure only the relevant data to the conversation is included, you can use one of the following approaches for conditionally including RAG data:
- Using a Security, Authorization Scheme can be helpful for providing certain data sets for certain users only.
- Using a Server-side Condition offers even more flexibility. Besides the typical Condition types, RAG Sources support two Generative AI-specific Condition types: Any User Prompt Contains and Last User Prompt Contains. You can use these condition types to provide a comma-separated list of case-insensitive keywords. If any of the user prompts, or the last user prompts contains such a keyword, the RAG Source will be evaluated and the data will be included.
- For maximum flexibility, two new bind variables are available both
when executing Server-side Condition code, as well as within the SQL Query or
Function Body.
APEX$AI_ALL_USER_PROMPTS
andAPEX$AI_LAST_USER_PROMPT
areCLOB
bind variables that you can use to perform custom RAG logic.
Available Dictionary Views
You can also use the following dictionary views to query an application's AI Configurations:
APEX_APPL_AI_CONFIGS
APEX_APPL_AI_CONFIG_RAG_SRCS
Parent topic: Managing AI Configurations and RAG Sources
18.8.4.3.2 Creating an AI Configuration
Create an AI Configuration in Shared Components on the Generative AI Configurations page.
Tip:
Before you can create an AI configuration, you must define a Generative AI Service and create an application. See Managing Generative AI Services and Creating Applications.To create an AI Configuration:
Parent topic: Managing AI Configurations and RAG Sources
18.8.4.3.3 Editing or Deleting an AI Configuration
Edit or delete an AI Configuration or RAG Source from the Generative AI Services, Create/Edit page.
To edit or delete an AI Configuration or RAG Source:
Parent topic: Managing AI Configurations and RAG Sources
18.8.4.3.4 Copying or Subscribing to an AI Configuration
Copy an AI Configuration from the current application or from another application. When copying an AI Configuration from another application, you can also subscribe to it.
To copy an AI Configuration:
- Navigate to the AI Configuration page:
- On the AI Configuration, click Copy.
- Copy From - Choose where to copy the AI Configuration from. Options
include:
- This Application
- Other Application
- To copy from the current application:
- Copy From - Select This Application.
- Copy Configuration - Select the configuration to copy.
- Name - Enter the name of the configuration you would like to create.
- Click Copy.
- To copy from another application:
- Copy From - Select Other Application.
- Application - Select the application from which you want to copy.
- Copy Configuration - Select the configuration to copy.
- Subscribe - Enable Subscribe to subscribe to the configuration.
- Click Copy.
Parent topic: Managing AI Configurations and RAG Sources
18.8.4.3.5 Viewing AI Configuration Utilization
View a report that details where AI Configurations are used within the current workspace.
To view the AI Configurations Utilization report:
Parent topic: Managing AI Configurations and RAG Sources
18.8.4.3.6 Viewing AI Configuration History
View a report of recent modifications made to AI Configurations in this workspace.
To view the AI Configurations History report:
Parent topic: Managing AI Configurations and RAG Sources