-
Notifications
You must be signed in to change notification settings - Fork 65
Add support for Moderations API endpoint #35
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
Add support for Moderations API endpoint #35
Conversation
Signed-off-by: Yoriyasu Yano <430092+yorinasub17@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ This pull request was sent to the PullRequest network.
@yorinasub17 you can click here to see the review status or cancel the code review job.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PullRequest Breakdown
Reviewable lines of change
+ 112
- 0
66% Go
34% Go (tests)
Type of change
Feature - These changes are adding a new feature or improvement to existing code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pull request, which adds support for the OpenAI moderations endpoint, looks good to me. It is clean, organized, well document, and relatively straightforward. I don't notice any major issues with the approach.
Reviewed with ❤️ by PullRequest
type ModerationRequest struct { | ||
// Input is the input text that should be classified. Required. | ||
Input string `json:"input"` | ||
// Model is the content moderation model to use. If not specified, will default to OpenAI API defaults, which is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup this is being satisfied at the OpenAI API level as mentioned in the comment. See related API docs on openai.com: https://platform.openai.com/docs/api-reference/moderations/create
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding support for this @yorinasub17 . This looks fairly straightforward to me and should be good to go.
This adds support for calling the Moderations API endpoint which is a part of the OpenAI API.
Manual test
main.go contents
go.mod contents
Run output:
Unit test results
go test -v .