3.5 GENERATE Function Signature 1
This function generates a response for a given prompt.
Syntax
APEX_AI.GENERATE (
p_prompt IN CLOB,
p_system_prompt IN VARCHAR2 DEFAULT NULL,
p_service_static_id IN VARCHAR2 DEFAULT NULL,
p_temperature IN NUMBER DEFAULT NULL )
RETURN CLOB;
Parameters
Parameter | Description |
---|---|
p_prompt |
The user prompt. |
p_system_prompt |
(Optional) System prompt to pass. Some Generative AI services (such as OpenAI) support the use of passing a system prompt to set the context of a request. |
p_service_static_id |
The Generative AI Service static ID. If not provided, uses the app's default AI Service. |
p_temperature |
The temperature to use. How the temperature is interpreted depends on the Generative AI Service implementation. Higher temperatures result in more "creative" responses. See the documentation of the Generative AI provider for details and allowed values. |
Returns
The response for the given prompt and type.
Example
The following example generates a response with the configured Generative AI Service MY_AI_SERVICE
for the given prompt.
DECLARE
l_response clob;
BEGIN
l_response := apex_ai.generate(
p_prompt => 'What is Oracle APEX',
p_service_static_id => 'MY_AI_SERVICE');
END;
Parent topic: APEX_AI