Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .castiron.stats.yml
Original file line number Diff line number Diff line change
@@ -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
95 changes: 7 additions & 88 deletions api_reference/openapi.transformed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9620,15 +9620,15 @@ 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
client = OpenAI()

moderation = client.moderations.create(
model="omni-moderation-latest",
input="I want to kill them.",
input="...text to classify goes here...",
)
print(moderation)
javascript: |
Expand All @@ -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);
Expand All @@ -9656,88 +9656,7 @@ paths:
apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY")
);

ClientResult<ModerationResult> 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<ModerationResult> moderation = client.ClassifyText("...text to classify goes here...");
- title: Image and text
request:
curl: |
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand All @@ -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..."))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
10 changes: 5 additions & 5 deletions scripts/castiron/generated-files.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -12655,15 +12655,15 @@
},
"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",
"sha256": "bd3bd78f25fd88efe1f0bdcd8373b4f480143880912161a0e908c5cbe395bcd9"
},
"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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
Loading