Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong JsonPropertyNames in OpenAI.SDK/ObjectModels/ResponseModels/CreateModerationResponse.cs #214

Closed
scolmarg opened this issue Mar 31, 2023 · 2 comments · Fixed by #210
Assignees
Labels
bug Something isn't working
Milestone

Comments

@scolmarg
Copy link

scolmarg commented Mar 31, 2023

Describe the bug
The corresponding JsonPropertyNames "self-harm", "sexual/minors", "hate/threatening" and "violence/graphic" within CreateModerationResponse.cs are mapped incorrectly. All eight occurrences within the file are missing their special characters ("-", "/"). This prevents SDK clients from correct decision making based on community guidelines and general terms and services when relying on moderation responses.

Result
Moderation requests with immanent violations currently result in incorrect scores and categories on four out of seven possible properties. The corresponding values either always return "false" or "0.0".

Expected behavior
The received moderation values from the openai-API should be correctly mapped and propagated to the SDK.

Screenshots
image
image
image

Desktop

  • OS: [Windows]
  • Language [C#]
  • Version [6.7.2]

Additional
I further recommend adjusting "Violencegraphic" to its UpperCamelCase version "ViolenceGraphic".
I further recommend replacing the float result types with either decimal or double, as of the already given double precision values originating from the openai-API.

Thank you! Keep up the good work.

@AbdelAzizMohamedMousa
Copy link

Thank you for bringing this to our attention. It appears to be a bug in the OpenAI.SDK/ObjectModels/ResponseModels/CreateModerationResponse.cs file where the special characters ("-", "/") are missing from the JsonPropertyNames for the "self-harm", "sexual/minors", "hate/threatening", and "violence/graphic" properties.

To fix this issue, you can manually edit the CreateModerationResponse.cs file to add the missing special characters to the JsonPropertyNames. For example:
`[JsonPropertyName("self-harm")]
public float SelfHarm { get; set; }

[JsonPropertyName("sexual/minors")]
public float SexualMinors { get; set; }

[JsonPropertyName("hate/threatening")]
public float HateThreatening { get; set; }

[JsonPropertyName("violence/graphic")]
public float ViolenceGraphic { get; set; }
`

Alternatively, you can wait for a patch or update from OpenAI that addresses this issue.

In the meantime, you may want to implement additional checks and validations in your code to ensure that the correct properties and values are being used for moderation responses.

@kayhantolga kayhantolga modified the milestones: 8.4.4, 6.8.4 Apr 15, 2023
@kayhantolga kayhantolga added the bug Something isn't working label Apr 15, 2023
@kayhantolga kayhantolga self-assigned this Apr 15, 2023
@kayhantolga
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants