Noizu.OpenAI.Api.Moderation (Noizu Labs: OpenAI v0.1.3)

Noizu.OpenAI.Api.Moderation is a module that provides functionality for content moderation using OpenAI's API.

This module offers one main function:

  1. create/2 - Moderates the given input content using the specified options.

usage

Usage

{:ok, moderation_response} = Noizu.OpenAI.Api.Moderation.create(input, options)

Link to this section Summary

Functions

Performs content moderation using the OpenAI API.

Link to this section Types

Link to this type

moderation_options()

@type moderation_options() ::
  %{
    optional(:model) => Noizu.OpenAI.model_option(atom()),
    optional(:stream) => Noizu.OpenAI.stream_option()
  }
  | Keyword.t()
Link to this type

moderation_response()

@type moderation_response() :: map()

Link to this section Functions

Link to this function

moderate(input, options \\ nil)

@spec moderate(input :: String.t(), options :: moderation_options()) ::
  {:ok, moderation_response()} | {:error, term()}

Performs content moderation using the OpenAI API.

parameters

Parameters

  • input: The text content to be moderated
  • options: An optional keyword list or map containing model and stream options

returns

Returns

Returns a tuple {:ok, moderation_response()} on successful moderation. Returns {:error, term} on failure, where term contains error details.

example

Example

text_to_moderate = "Text to moderate."
{:ok, response} = Noizu.OpenAI.Api.Moderation.moderate(text_to_moderate)