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

Added fields for moderation #662

Merged
merged 2 commits into from
Feb 26, 2024

Conversation

raphoester
Copy link
Contributor

Describe the change
I converted the ResultCategoriesScores struct into a map[string]float32.
This change has been discussed in issue #633 .

Provide OpenAI documentation link
https://platform.openai.com/docs/guides/moderation/overview

Describe your solution
I just converted the struct into a map to allow more categories to be accessible without the need of changing the code everytime

Tests
I simply adapted the existing tests to the new data structure with more test cases

Issue: #633

Copy link

codecov bot commented Feb 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.44%. Comparing base (69e3bbb) to head (2e361b2).
Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #662   +/-   ##
=======================================
  Coverage   98.44%   98.44%           
=======================================
  Files          24       24           
  Lines        1347     1347           
=======================================
  Hits         1326     1326           
  Misses         15       15           
  Partials        6        6           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sashabaranov
Copy link
Owner

Thank you for the PR!

moderation.go Outdated Show resolved Hide resolved
@raphoester raphoester changed the title [BREAKING_CHANGES] converted ResultCategoryScores struct to map Added fields for moderation Feb 23, 2024
@sashabaranov sashabaranov merged commit f220443 into sashabaranov:master Feb 26, 2024
3 checks passed
mheck136 added a commit to mheck136/go-openai that referenced this pull request Feb 28, 2024
PR sashabaranov#662 has broken the json decoding of moderation responses by changing the
type of score values from float32 to bool. This commit fixes that problem.
grulex pushed a commit to grulex/go-openai that referenced this pull request Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants