Class OpenAiModerationApi
java.lang.Object
org.springframework.ai.openai.api.OpenAiModerationApi
OpenAI Moderation API.
- Author:
- Ahmed Yousri, Ilayaperumal Gopinathan, Filip Hrisafov
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilder to constructOpenAiModerationApiinstance.static final recordstatic final recordstatic final recordstatic final recordstatic final recordstatic final record -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionOpenAiModerationApi(String baseUrl, org.springframework.ai.model.ApiKey apiKey, String moderationPath, org.springframework.http.HttpHeaders 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.OpenAiModerationApi(String moderationPath, org.springframework.web.client.RestClient restClient) Create a new OpenAI Moderation API with the provided rest client. -
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
public OpenAiModerationApi(String baseUrl, org.springframework.ai.model.ApiKey apiKey, String moderationPath, org.springframework.http.HttpHeaders 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.moderationPath- The path to the moderation endpoint.restClientBuilder- the rest client builder to use.
-
OpenAiModerationApi
public OpenAiModerationApi(String moderationPath, org.springframework.web.client.RestClient restClient) Create a new OpenAI Moderation API with the provided rest client.- Parameters:
moderationPath- The path to the moderation endpoint.restClient- the rest client instance to use.
-
-
Method Details
-
createModeration
public org.springframework.http.ResponseEntity<OpenAiModerationApi.OpenAiModerationResponse> createModeration(OpenAiModerationApi.OpenAiModerationRequest openAiModerationRequest) -
builder
-