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: ad1a1341-4ead-4bab-a79b-e66f7fe5b5ef
openapi_spec_hash: 64820aedcf0a6d3776224cb1f9460be6
openapi_transformed_spec_hash: 3ee2167e4445ca49fde24cff2244f5c3
generation_id: 1ec90ff0-46f6-46e7-9b41-e4d26f449d4a
openapi_spec_hash: 56dec1d7f0146f0334e214d4c389da55
openapi_transformed_spec_hash: 58406901d14d2ff99a923c64274ed949
config_hash: 22678292630564aa7033f38fece5b88e
codegen_sha: a7099862397f70f7d948b92cad367fd3b25468b1
codegen_hash: c790646e7fe521f62f65fb0ca73023294b53448f910e492fcc81a17399782c06
public_codegen_sha: 9b9488d034bbbbc1c37dbb7fd012b575cca558ba
codegen_sha: a84f02d05cb0a05a1675d51f1ede962c3e1b6da7
codegen_hash: 508e64dd6f387285e9f3ebfe1e60057f7d5c216f10fbd378ccd4c0628f69417c
public_codegen_sha: 4f35fe8c63cb8d9deb93cd3ac6055e601efc8076
95 changes: 7 additions & 88 deletions api_reference/openapi.transformed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9617,15 +9617,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 @@ -9636,7 +9636,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 @@ -9653,88 +9653,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 @@ -43752,13 +43671,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 @@ -107246,7 +107165,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
2 changes: 1 addition & 1 deletion scripts/castiron/generated-files.json
Original file line number Diff line number Diff line change
Expand Up @@ -1367,7 +1367,7 @@
},
"tests/api-resources/moderations.test.ts": {
"mode": "100644",
"sha256": "572834ddb67a64ccd69b6cf3736b432cb085fe138ee01521aff3c511d9db312a"
"sha256": "9fdad0e0bbc9e20f61ab13de0c1239755a41e633a6c8a5f29515b484a954ecba"
},
"tests/api-resources/realtime/calls.test.ts": {
"mode": "100644",
Expand Down
4 changes: 2 additions & 2 deletions tests/api-resources/moderations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const client = new OpenAI({

describe('resource moderations', () => {
test('create: only required params', async () => {
const responsePromise = client.moderations.create({ input: 'I want to kill them.' });
const responsePromise = client.moderations.create({ input: '...text to classify goes here...' });
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
Expand All @@ -22,7 +22,7 @@ describe('resource moderations', () => {

test('create: required and optional params', async () => {
await client.moderations.create({
input: 'I want to kill them.',
input: '...text to classify goes here...',
model: 'omni-moderation-2024-09-26',
});
});
Expand Down
Loading