In this blog, I will show you two methods to establish a connection to the AI service.
Method 1: Using Oracle APEX 24.1
Step 1: Set Up AI Service
- Select AI Service
Choose the OpenAI provider. - Obtain API Key
Register to get an API key: https://platform.openai.com/ - Set API Key
Set your API key: - name: Service_OpenAIapy
Step 2: Define AI Model
- View Models
Here are the models you can use: https://platform.openai.com/docs/models - Check Pricing
Here are the prices: https://openai.com/api/pricing/
Step 3: Create AI Service in Oracle APEX 24.1
- Navigate to AI Services
In Oracle APEX 24.1, go to SQL Workshop > RESTful Services. - Create New AI Service
Click on Create and select AI Service. - Enter Service Details
- Service Name:
Service_OpenAI
- API Key: Enter your API key.
- Endpoint URL:
https://api.openai.com/v1
- Define Parameters
Add the required parameters, e.g.: - prompt
- max_tokens
- Save and Test Service
Save the service and test it to ensure the connection works.
Method 2: Direct Use with PL/SQL (For Advanced Users)
If you have an older version of Oracle APEX and still want to use AI, you can do this directly via PL/SQL.
Step 1: Insert PL/SQL Code
Here is the code you can use. Replace the value
API_KEY
with your actual API key.Step 2: Adjust and Execute Code
- Insert API Key
Replace'API_KEY'
with your actual API key. - Execute SQL Script
Execute the SQL script in your Oracle APEX environment.
Note: This guide aims to help you establish a connection between Oracle APEX and OpenAI. If you have further questions, you can use the official documentation and resources from OpenAI.
Resources:
Good luck with your implementation!
{fullWidth}
0 $type={blogger}:
Kommentar veröffentlichen