-
Notifications
You must be signed in to change notification settings - Fork 0
Add support for multi-modal moderation inputs and category applied input types #1
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
Changes from 1 commit
5e4d057
f7dfff5
8f72ca9
da9bd98
75270b8
2a6c324
c516fed
31d8449
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OpenAI\Enums\Moderations; | ||
|
||
enum CategoryAppliedInputType: string | ||
{ | ||
case Text = 'text'; | ||
case Image = 'image'; | ||
case Audio = 'audio'; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
<?php | ||
|
||
use OpenAI\Enums\Moderations\Category; | ||
use OpenAI\Enums\Moderations\CategoryAppliedInputType; | ||
use OpenAI\Responses\Meta\MetaInformation; | ||
use OpenAI\Responses\Moderations\CreateResponse; | ||
use OpenAI\Responses\Moderations\CreateResponseCategory; | ||
|
@@ -47,12 +48,16 @@ | |
test('create omni', closure: function () { | ||
$client = mockClient('POST', 'moderations', [ | ||
'model' => 'omni-moderation-latest', | ||
'input' => 'I want to kill them.', | ||
'input' => [ | ||
['type' => 'text', 'text' => '.. I want to kill...'], | ||
], | ||
], Response::from(moderationOmniResource(), metaHeaders())); | ||
|
||
$result = $client->moderations()->create([ | ||
'model' => 'omni-moderation-latest', | ||
'input' => 'I want to kill them.', | ||
'input' => [ | ||
['type' => 'text', 'text' => '.. I want to kill...'], | ||
], | ||
]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should probably support both right? We need to support the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @iBotPeaches Yes, It support both. Should I revert this changes and create new unit test ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just want to make sure both work. You changed both of them to the multi-modal approach. We should probably have:
|
||
|
||
expect($result) | ||
|
@@ -77,6 +82,10 @@ | |
->violated->toBe(true) | ||
->score->toBe(0.9223177433013916); | ||
|
||
expect($result->results[0]->categoryAppliedInputTypes) | ||
->toHaveCount(13) | ||
->each->toBe([CategoryAppliedInputType::Text->value]); | ||
|
||
expect($result->meta()) | ||
->toBeInstanceOf(MetaInformation::class); | ||
}); |
Uh oh!
There was an error while loading. Please reload this page.