ballerinax/openai.moderations Ballerina library
This is a generated connector for the OpenAI
moderations API OpenAPI Specification. OpenAI is an American artificial intelligence research laboratory consisting of a non-profit corporation and a for-profit subsidiary. OpenAI conducts AI research with the declared intention of promoting and developing friendly AI. The OpenAI Moderations API provides a way to access new moderation models developed by OpenAI for content moderation tasks.
Before using this connector in your Ballerina application, complete the following:
To use the OpenAI
moderations connector in your Ballerina application, update the
.bal file as follows:
Step 1: Import the connector
First, import the
ballerinax/openai.moderations module (along with the other required imports) as given below.
Step 2: Create a new connector instance
Create and initialize a
moderations:Client with the obtained
Step 3: Invoke the connector operation
Now you can use the operations available within the connector.
Following is an example on identifying harmful content using the OpenAI moderations model:
bal runcommand to compile and run the Ballerina program.
Released date: 6 months ago
Ballerina version: 2201.4.1
Current verison: 0