Class OpenAiModerationApi
java.lang.Object
org.springframework.ai.openai.api.OpenAiModerationApi
OpenAI Moderation API.
- Author:
- Ahmed Yousri, Ilayaperumal Gopinathan
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder to constructOpenAiModerationApiinstance.static final recordstatic final recordstatic final recordstatic final recordstatic final recordstatic final record -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionOpenAiModerationApi(String openAiToken) Deprecated, for removal: This API element is subject to removal in a future version.OpenAiModerationApi(String baseUrl, String openAiToken, org.springframework.web.client.RestClient.Builder restClientBuilder, org.springframework.web.client.ResponseErrorHandler responseErrorHandler) Deprecated, for removal: This API element is subject to removal in a future version.useOpenAiModerationApi.Builderinstead.OpenAiModerationApi(String baseUrl, ApiKey apiKey, org.springframework.util.MultiValueMap<String, String> headers, org.springframework.web.client.RestClient.Builder restClientBuilder, org.springframework.web.client.ResponseErrorHandler responseErrorHandler) Create a new OpenAI Moderation API with the provided base URL. -
Method Summary
Modifier and TypeMethodDescriptionstatic OpenAiModerationApi.Builderbuilder()org.springframework.http.ResponseEntity<OpenAiModerationApi.OpenAiModerationResponse>createModeration(OpenAiModerationApi.OpenAiModerationRequest openAiModerationRequest)
-
Field Details
-
DEFAULT_MODERATION_MODEL
- See Also:
-
-
Constructor Details
-
OpenAiModerationApi
Deprecated, for removal: This API element is subject to removal in a future version.useOpenAiModerationApi.Builderinstead.Create a new OpenAI Moderation api with base URL set to https://api.openai.com- Parameters:
openAiToken- OpenAI apiKey.
-
OpenAiModerationApi
@Deprecated(forRemoval=true, since="1.0.0-M6") public OpenAiModerationApi(String baseUrl, String openAiToken, org.springframework.web.client.RestClient.Builder restClientBuilder, org.springframework.web.client.ResponseErrorHandler responseErrorHandler) Deprecated, for removal: This API element is subject to removal in a future version.useOpenAiModerationApi.Builderinstead. -
OpenAiModerationApi
public OpenAiModerationApi(String baseUrl, ApiKey apiKey, org.springframework.util.MultiValueMap<String, String> headers, org.springframework.web.client.RestClient.Builder restClientBuilder, org.springframework.web.client.ResponseErrorHandler responseErrorHandler) Create a new OpenAI Moderation API with the provided base URL.- Parameters:
baseUrl- the base URL for the OpenAI API.apiKey- OpenAI apiKey.restClientBuilder- the rest client builder to use.
-
-
Method Details
-
createModeration
public org.springframework.http.ResponseEntity<OpenAiModerationApi.OpenAiModerationResponse> createModeration(OpenAiModerationApi.OpenAiModerationRequest openAiModerationRequest) -
builder
-
OpenAiModerationApi.Builderinstead.