Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork667
Open
Description
When using using the Azure OpenAI API, if content filtering is kicked off an error is returnedUndefined array key "content" as there is no content parameter in the array within CreateResponseMessage.php
/** * @param array{role: string, content: ?string, function_call: ?array{name: string, arguments: string}} $attributes */publicstaticfunctionfrom(array$attributes):self {returnnewself($attributes['role'],$attributes['content'],isset($attributes['function_call']) ? CreateResponseFunctionCall::from($attributes['function_call']) :null, ); }
The choices array looks something like this,
"choices": [ {"index":0,"finish_reason":"content_filter","message": {"role":"assistant" },"content_filter_results": {"hate": {"filtered":false,"severity":"safe" },"self_harm": {"filtered":false,"severity":"safe" },"sexual": {"filtered":true,"severity":"medium" },"violence": {"filtered":false,"severity":"safe" } } } ],
That example above has the "sexual" filter triggered, hence why there is no content back from the assistant.
It would be great if this lib handled the content filtering issues (e.g. threw an exception with a message etc)