From 6278d680bb00531c7daa0167c3c3bc7de89a974f Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Sun, 18 Oct 2026 04:28:19 +0000 Subject: [PATCH] chore(api): use neutral moderation examples Castiron-Internal-PR: https://github.com/openai/openai-java-internal/pull/304 Castiron-Source-SHA: 2ee505f1e132ece0965649049289f67ae4f9f30d Castiron-Public-Base-SHA: 5d6fc3c5a58bf7ce1988f06ad3db770c61f469f8 --- .castiron.stats.yml | 12 +-- api_reference/openapi.transformed.yml | 95 ++----------------- .../moderations/ModerationCreateParamsTest.kt | 11 ++- .../ModerationMultiModalInputTest.kt | 4 +- .../moderations/ModerationTextInputTest.kt | 8 +- .../async/ModerationServiceAsyncTest.kt | 2 +- .../blocking/ModerationServiceTest.kt | 2 +- .../example/ModerationsAsyncExample.java | 2 +- .../openai/example/ModerationsExample.java | 2 +- scripts/castiron/generated-files.json | 10 +- 10 files changed, 35 insertions(+), 113 deletions(-) diff --git a/.castiron.stats.yml b/.castiron.stats.yml index 543cbf88a..1e9c73baa 100644 --- a/.castiron.stats.yml +++ b/.castiron.stats.yml @@ -1,8 +1,8 @@ schema_version: 1 -generation_id: 4b29feea-a2f3-426e-9c53-bb23ba478b9f -openapi_spec_hash: 3aebd9125b881b9422d89d907baa74d9 -openapi_transformed_spec_hash: 8712a2e6d88eea8af4198e5658af8812 +generation_id: 5f6f5dd1-c1c1-40cf-803e-399ed0822cfd +openapi_spec_hash: 86f0056b84c47e55b90ea99412b41c3e +openapi_transformed_spec_hash: d063687b42c4b6ae1a969d6f852b2494 config_hash: 419271eddbf93da788a7b3e9edf93d7e -codegen_sha: f5feb9903f4481e087b367f2ded90ec717029105 -codegen_hash: 1ad6538dd8df86ca34e1d12107010d7f507ded1bc1483610975b7e03c5c90add -public_codegen_sha: 325575d95209958038513e81dc07b12d3590da36 +codegen_sha: 38c542ba2bd367f4cf88bc295c6bb84707a30fd1 +codegen_hash: a4862382a91b6430d2eae9eb02496f83fe50929581d4f1431f9455881a163ff6 +public_codegen_sha: b8c84b57831df1beffe4aeb4c9e0078040a9033e diff --git a/api_reference/openapi.transformed.yml b/api_reference/openapi.transformed.yml index 7520c11df..37952e7d6 100644 --- a/api_reference/openapi.transformed.yml +++ b/api_reference/openapi.transformed.yml @@ -9620,7 +9620,7 @@ paths: -H "Authorization: Bearer $OPENAI_API_KEY" \ -d '{ "model": "omni-moderation-latest", - "input": "I want to kill them." + "input": "...text to classify goes here..." }' python: | from openai import OpenAI @@ -9628,7 +9628,7 @@ paths: moderation = client.moderations.create( model="omni-moderation-latest", - input="I want to kill them.", + input="...text to classify goes here...", ) print(moderation) javascript: | @@ -9639,7 +9639,7 @@ paths: async function main() { const moderation = await openai.moderations.create({ model: "omni-moderation-latest", - input: "I want to kill them.", + input: "...text to classify goes here...", }); console.log(moderation); @@ -9656,88 +9656,7 @@ paths: apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") ); - ClientResult moderation = client.ClassifyText("I want to kill them."); - response: | - { - "id": "modr-AB8CjOTu2jiq12hp1AQPfeqFWaORR", - "model": "omni-moderation-latest", - "results": [ - { - "flagged": true, - "categories": { - "sexual": false, - "hate": false, - "harassment": true, - "self-harm": false, - "sexual/minors": false, - "hate/threatening": false, - "violence/graphic": false, - "self-harm/intent": false, - "self-harm/instructions": false, - "harassment/threatening": true, - "violence": true, - "illicit": false, - "illicit/violent": false - }, - "category_scores": { - "sexual": 1.1726012417057063e-05, - "hate": 0.22706663608551025, - "harassment": 0.5215635299682617, - "self-harm": 2.227119921371923e-06, - "sexual/minors": 7.107352217872176e-08, - "hate/threatening": 0.023547329008579254, - "violence/graphic": 3.391829886822961e-05, - "self-harm/intent": 1.646940972932498e-06, - "self-harm/instructions": 1.1198755256458526e-09, - "harassment/threatening": 0.5694745779037476, - "violence": 0.9971134662628174, - "illicit": 0.001, - "illicit/violent": 0.001 - }, - "category_applied_input_types": { - "sexual": [ - "text" - ], - "hate": [ - "text" - ], - "harassment": [ - "text" - ], - "self-harm": [ - "text" - ], - "sexual/minors": [ - "text" - ], - "hate/threatening": [ - "text" - ], - "violence/graphic": [ - "text" - ], - "self-harm/intent": [ - "text" - ], - "self-harm/instructions": [ - "text" - ], - "harassment/threatening": [ - "text" - ], - "violence": [ - "text" - ], - "illicit": [ - "text" - ], - "illicit/violent": [ - "text" - ] - } - } - ] - } + ClientResult moderation = client.ClassifyText("...text to classify goes here..."); - title: Image and text request: curl: | @@ -43770,13 +43689,13 @@ components: - type: string description: A string of text to classify for moderation. default: '' - example: I want to kill them. + example: '...text to classify goes here...' - type: array description: An array of strings to classify for moderation. items: type: string default: '' - example: I want to kill them. + example: '...text to classify goes here...' - type: array description: An array of multi-modal inputs to the moderation model. items: @@ -107262,7 +107181,7 @@ components: text: description: A string of text to classify. type: string - example: I want to kill them + example: '...text to classify goes here...' required: - type - text diff --git a/openai-java-core/src/test/kotlin/com/openai/models/moderations/ModerationCreateParamsTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/moderations/ModerationCreateParamsTest.kt index 785d2a6c5..1e59ef39c 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/moderations/ModerationCreateParamsTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/moderations/ModerationCreateParamsTest.kt @@ -10,7 +10,7 @@ internal class ModerationCreateParamsTest { @Test fun create() { ModerationCreateParams.builder() - .input("I want to kill them.") + .input("...text to classify goes here...") .model(ModerationModel.OMNI_MODERATION_2024_09_26) .build() } @@ -19,24 +19,25 @@ internal class ModerationCreateParamsTest { fun body() { val params = ModerationCreateParams.builder() - .input("I want to kill them.") + .input("...text to classify goes here...") .model(ModerationModel.OMNI_MODERATION_2024_09_26) .build() val body = params._body() assertThat(body.input()) - .isEqualTo(ModerationCreateParams.Input.ofString("I want to kill them.")) + .isEqualTo(ModerationCreateParams.Input.ofString("...text to classify goes here...")) assertThat(body.model()).contains(ModerationModel.OMNI_MODERATION_2024_09_26) } @Test fun bodyWithoutOptionalFields() { - val params = ModerationCreateParams.builder().input("I want to kill them.").build() + val params = + ModerationCreateParams.builder().input("...text to classify goes here...").build() val body = params._body() assertThat(body.input()) - .isEqualTo(ModerationCreateParams.Input.ofString("I want to kill them.")) + .isEqualTo(ModerationCreateParams.Input.ofString("...text to classify goes here...")) } } diff --git a/openai-java-core/src/test/kotlin/com/openai/models/moderations/ModerationMultiModalInputTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/moderations/ModerationMultiModalInputTest.kt index 4ada6992e..f1f42be10 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/moderations/ModerationMultiModalInputTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/moderations/ModerationMultiModalInputTest.kt @@ -56,7 +56,7 @@ internal class ModerationMultiModalInputTest { @Test fun ofText() { - val text = ModerationTextInput.builder().text("I want to kill them").build() + val text = ModerationTextInput.builder().text("...text to classify goes here...").build() val moderationMultiModalInput = ModerationMultiModalInput.ofText(text) @@ -69,7 +69,7 @@ internal class ModerationMultiModalInputTest { val jsonMapper = jsonMapper() val moderationMultiModalInput = ModerationMultiModalInput.ofText( - ModerationTextInput.builder().text("I want to kill them").build() + ModerationTextInput.builder().text("...text to classify goes here...").build() ) val roundtrippedModerationMultiModalInput = diff --git a/openai-java-core/src/test/kotlin/com/openai/models/moderations/ModerationTextInputTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/moderations/ModerationTextInputTest.kt index e7490a27e..82e6cda54 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/moderations/ModerationTextInputTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/moderations/ModerationTextInputTest.kt @@ -11,15 +11,17 @@ internal class ModerationTextInputTest { @Test fun create() { - val moderationTextInput = ModerationTextInput.builder().text("I want to kill them").build() + val moderationTextInput = + ModerationTextInput.builder().text("...text to classify goes here...").build() - assertThat(moderationTextInput.text()).isEqualTo("I want to kill them") + assertThat(moderationTextInput.text()).isEqualTo("...text to classify goes here...") } @Test fun roundtrip() { val jsonMapper = jsonMapper() - val moderationTextInput = ModerationTextInput.builder().text("I want to kill them").build() + val moderationTextInput = + ModerationTextInput.builder().text("...text to classify goes here...").build() val roundtrippedModerationTextInput = jsonMapper.readValue( diff --git a/openai-java-core/src/test/kotlin/com/openai/services/async/ModerationServiceAsyncTest.kt b/openai-java-core/src/test/kotlin/com/openai/services/async/ModerationServiceAsyncTest.kt index e806e31b5..e95644eb4 100644 --- a/openai-java-core/src/test/kotlin/com/openai/services/async/ModerationServiceAsyncTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/services/async/ModerationServiceAsyncTest.kt @@ -25,7 +25,7 @@ internal class ModerationServiceAsyncTest { val moderationFuture = moderationServiceAsync.create( ModerationCreateParams.builder() - .input("I want to kill them.") + .input("...text to classify goes here...") .model(ModerationModel.OMNI_MODERATION_2024_09_26) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/services/blocking/ModerationServiceTest.kt b/openai-java-core/src/test/kotlin/com/openai/services/blocking/ModerationServiceTest.kt index d9d8038e1..02e9a9d16 100644 --- a/openai-java-core/src/test/kotlin/com/openai/services/blocking/ModerationServiceTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/services/blocking/ModerationServiceTest.kt @@ -25,7 +25,7 @@ internal class ModerationServiceTest { val moderation = moderationService.create( ModerationCreateParams.builder() - .input("I want to kill them.") + .input("...text to classify goes here...") .model(ModerationModel.OMNI_MODERATION_2024_09_26) .build() ) diff --git a/openai-java-example/src/main/java/com/openai/example/ModerationsAsyncExample.java b/openai-java-example/src/main/java/com/openai/example/ModerationsAsyncExample.java index 382d66361..4d5b5c3ed 100644 --- a/openai-java-example/src/main/java/com/openai/example/ModerationsAsyncExample.java +++ b/openai-java-example/src/main/java/com/openai/example/ModerationsAsyncExample.java @@ -15,7 +15,7 @@ public static void main(String[] args) { OpenAIClientAsync client = OpenAIOkHttpClientAsync.fromEnv(); ModerationCreateParams createParams = ModerationCreateParams.builder() - .input("I want to kill them.") + .input("...text to classify goes here...") .model(ModerationModel.OMNI_MODERATION_LATEST) .build(); diff --git a/openai-java-example/src/main/java/com/openai/example/ModerationsExample.java b/openai-java-example/src/main/java/com/openai/example/ModerationsExample.java index a87e183bb..f88512b3a 100644 --- a/openai-java-example/src/main/java/com/openai/example/ModerationsExample.java +++ b/openai-java-example/src/main/java/com/openai/example/ModerationsExample.java @@ -15,7 +15,7 @@ public static void main(String[] args) { OpenAIClient client = OpenAIOkHttpClient.fromEnv(); ModerationCreateParams createParams = ModerationCreateParams.builder() - .input("I want to kill them.") + .input("...text to classify goes here...") .model(ModerationModel.OMNI_MODERATION_LATEST) .build(); diff --git a/scripts/castiron/generated-files.json b/scripts/castiron/generated-files.json index 2ed18b561..3f252cc1e 100644 --- a/scripts/castiron/generated-files.json +++ b/scripts/castiron/generated-files.json @@ -12643,7 +12643,7 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/moderations/ModerationCreateParamsTest.kt": { "mode": "100644", - "sha256": "22cd4b72092f844cc62406412e17d0433bb7cce7b2634c8491411680b65d301d" + "sha256": "13dd73e4e9f7b6b48ac5a23561a26bc16fb7e2b8e05e4f6f71c040dbc8758df7" }, "openai-java-core/src/test/kotlin/com/openai/models/moderations/ModerationCreateResponseTest.kt": { "mode": "100644", @@ -12655,7 +12655,7 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/moderations/ModerationMultiModalInputTest.kt": { "mode": "100644", - "sha256": "cde26d29b8a5bcc0ff1ddfaf695f29e3020b152ce078ded0bd4c4725b0904b7e" + "sha256": "2b0c86fcbcd3e2ad612183faf050aa2a2d9d84bcdc1e942181dc5b2cbb55be76" }, "openai-java-core/src/test/kotlin/com/openai/models/moderations/ModerationTest.kt": { "mode": "100644", @@ -12663,7 +12663,7 @@ }, "openai-java-core/src/test/kotlin/com/openai/models/moderations/ModerationTextInputTest.kt": { "mode": "100644", - "sha256": "115b7af9de33cbadfd9ca8ee3eeb07955f0d4d119931129a31f4d5de2d65022c" + "sha256": "23ff5306f2e0205239da8db604a5f96743ea6f5f22ac626d7dcd5a2a01a9eef7" }, "openai-java-core/src/test/kotlin/com/openai/models/realtime/AudioTranscriptionTest.kt": { "mode": "100644", @@ -14387,7 +14387,7 @@ }, "openai-java-core/src/test/kotlin/com/openai/services/async/ModerationServiceAsyncTest.kt": { "mode": "100644", - "sha256": "b0fca04c4cbf3b63e58d71b1f932a833b9ab8d7c5425e42288c38e4f7e843ab1" + "sha256": "5ef37960af3f4b81b4a772f4fad4ffba8d48c7e8ad2ccccd3d923e2abd2f6031" }, "openai-java-core/src/test/kotlin/com/openai/services/async/ResponseServiceAsyncTest.kt": { "mode": "100644", @@ -14811,7 +14811,7 @@ }, "openai-java-core/src/test/kotlin/com/openai/services/blocking/ModerationServiceTest.kt": { "mode": "100644", - "sha256": "b7f2099fe59b2fa7ef6b7478cb87933ab90904cfa1172b959bbf47090641399c" + "sha256": "7395badf93cd427408b1dc773c8235ffc764ebd2c940d91eb604df3adca16104" }, "openai-java-core/src/test/kotlin/com/openai/services/blocking/ResponseServiceTest.kt": { "mode": "100644",