-
Notifications
You must be signed in to change notification settings - Fork 52
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
Update all Azure APIs to their latest public version #559
Conversation
I tested this a bit when I put the issue together and one thing I noticed that we'll need to address in this PR is that the error's returned from the API have changed from v3.0 to v3.2. Can compare the v3.0 error responses to the v3.2 error responses to see that. If helpful, here's the code I had added locally to handle this: if ( 200 !== wp_remote_retrieve_response_code( $request ) ) {
if ( isset( $body->error ) ) {
$rtn = new WP_Error( $body->error->code ?? 'error', $body->error->message ?? esc_html__( 'An error occurred.', 'classifai' ), $body );
} elseif ( isset( $body->message ) ) {
$rtn = new WP_Error( $body->error ?? 'error', $body->message, $body );
} else {
$rtn = new WP_Error( 'error', esc_html__( 'An error occurred.', 'classifai' ), $body );
}
} else {
$rtn = $body;
} |
Your code was mostly fine @dkotter. In the code for the second
Thank you |
Overall this looks good to me but I do think we need to figure out how to handle the lower confidence scores, as mentioned here. That will need to be resolved as part of this PR before we can merge this in. |
@dkotter assuming the TLDR from @kmgalanakis is that with the v3.2 API in order to see similar results the threshold needs to drop from 70% to 50/55%, then I think the suggestion from @kmgalanakis to display a dismissable admin notice when we see a threshold still at the default 70% and IBM Watson NLU active that we recommend dropping the value(s) to 55%. So something like:
If the IBM Watson NLU feature is not activated and the thresholds are at 70%, then let's change those defaults to 55%. Otherwise new installs will receive the new default of 55%. |
@dkotter any thoughts on the potential handling as noted in my comment above? |
I think this all sounds fine. We can call this out in the changelog and in the release as well as add an admin notice to hopefully make this clear to all existing users. |
@jeffpaul @dkotter I've updated the default thresholds value and added admin notice which will only run when the IBM Watson is active/configured. please check it and let me know your feedback. Thank you |
…e're changing here. Move admin notice into our Notifications class
…. This sends an ajax request that we listen for and store some data in user meta, which we then use to not show the notice again
I've gotten this PR ready for review. I think it would be a great addition to the v3 release as the v3.2 version of the AI Vision API brings support for quite a few new languages which I know has come up as a request. I know one of the things we were concerned with was lower confidence scores. In testing, I do see that for Descriptive Text. As an example, I tested on v3.0 with an image of a dog and got a response of But for Image Tagging, I'm not seeing a decrease in the confidence scores. Results seem better but the actual scores seem to be the same, so I've left that threshold alone. |
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.
Code LGTM and PR tests well. Thanks all for the great work here.
Description of the Change
In this MR, I'm updating the Azure APIs version. More specifically I'm updating the Azure AI Vision Image Analyze endpoint version and Thumbnail Generate version to v3.2. I'm also handling the way the API error responses are handed since those changed in v3.2
Closes #553
How to test the Change
Changelog Entry
Credits
Props @kmgalanakis
Checklist: