classifai icon indicating copy to clipboard operation
classifai copied to clipboard

Add Azure Language Services provider

Open psorensen opened this issue 1 year ago • 7 comments

Description of the Change

This PR adds Azure Language Services as a provider and adds it to the Excerpt Generation feature.

Closes #159

How to test the Change

Testing Steps:

  1. Create new Azure resource for Language Services
  2. Enter Credentials into the Excerpt Generation feature screen
  3. Confirm valid credentials allow feature to be enabled
  4. Test 'Generate Excerpt' tag for allowed post types.

Changelog Entry

Added - Azure Language Services provider with Excerpt Generation.

Credits

Props @psorensen @cadic @jeffpaul @Sidsector9 @dkotter

Checklist:

  • [x] I agree to follow this project's Code of Conduct.
  • [ ] I have updated the documentation accordingly.
  • [ ] I have added tests to cover my change.
  • [x] All new and existing tests pass.

psorensen avatar Aug 01 '24 18:08 psorensen

@psorensen thanks for the PR! Could you please fill out the PR template with description, changelog, and credits information so that we can properly review and merge this?

github-actions[bot] avatar Aug 01 '24 18:08 github-actions[bot]

@dkotter How should I handle the VIP flag for wp_remote_get usage? Should I conditionally use it if defined, or ignore this rule?

psorensen avatar Aug 05 '24 20:08 psorensen

@dkotter How should I handle the VIP flag for wp_remote_get usage? Should I conditionally use it if defined, or ignore this rule?

So we've not been consistent with this so far in the codebase. We've basically done both, where we use vip_safe_wp_remote_get if it exists (see here) and otherwise use wp_remote_get and in other places we just use wp_remote_get and add an ignore statement.

Personally I'd prefer we go with the first approach, as this is technically a VIP approved plugin so it's nice to match their standards. We have had issues though a few times with timeouts, as some of these services take a bit to return. vip_safe_wp_remote_get only allows you to set a timeout of 3 seconds so if we need higher than that here, we'll want to stick with wp_remote_get only

dkotter avatar Aug 05 '24 21:08 dkotter

sounds good @dkotter - I've included a helper function to facilitate a refactor of all the existing usage of wp_remote_get

psorensen avatar Aug 06 '24 01:08 psorensen

@psorensen is this still WIP or can this formally go through review/merge?

jeffpaul avatar Aug 13 '24 02:08 jeffpaul

@jeffpaul Good to review - removed the WIP from the title

psorensen avatar Aug 13 '24 02:08 psorensen

@dkotter @Sidsector9 back to you for review

jeffpaul avatar Oct 09 '25 13:10 jeffpaul