All URIs are relative to https://api.openai.com/v1
Method | HTTP request | Description |
---|---|---|
create_moderation | POST /moderations | Classifies if text violates OpenAI's Content Policy |
create_moderation(create_moderation_request)
Classifies if text violates OpenAI's Content Policy
require 'time'
require 'openapi_client'
# setup authorization
OpenapiClient.configure do |config|
# Configure Bearer authorization: ApiKeyAuth
config.access_token = 'YOUR_BEARER_TOKEN'
end
api_instance = OpenapiClient::ModerationsApi.new
create_moderation_request = OpenapiClient::CreateModerationRequest.new({input: nil}) # CreateModerationRequest |
begin
# Classifies if text violates OpenAI's Content Policy
result = api_instance.create_moderation(create_moderation_request)
p result
rescue OpenapiClient::ApiError => e
puts "Error when calling ModerationsApi->create_moderation: #{e}"
end
This returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> create_moderation_with_http_info(create_moderation_request)
begin
# Classifies if text violates OpenAI's Content Policy
data, status_code, headers = api_instance.create_moderation_with_http_info(create_moderation_request)
p status_code # => 2xx
p headers # => { ... }
p data # => <CreateModerationResponse>
rescue OpenapiClient::ApiError => e
puts "Error when calling ModerationsApi->create_moderation_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
create_moderation_request | CreateModerationRequest |
- Content-Type: application/json
- Accept: application/json