10up / classifai

Supercharge WordPress Content Workflows and Engagement with Artificial Intelligence.
https://classifaiplugin.com
GNU General Public License v2.0
573 stars 53 forks source link

fix/759: Add background processing for Embeddings Classification #779

Closed Sidsector9 closed 2 months ago

Sidsector9 commented 3 months ago

Description of the Change

This PR implements Action Scheduler to perform Embeddings Classification with 20 terms per job. (The count is opinionated, open to change it).

Closes #759

How to test the Change

  1. Visit /wp-admin/tools.php?page=classifai&tab=language_processing
  2. Click save.
  3. Observe the notice "OpenAI Embeddings: Classification is in progress in the background."
  4. Wait until message updates to "OpenAI Embeddings: Classification completed."
  5. Verify the embeddings generated in the wp_termmeta table.

Changelog Entry

Added - classifai_openai_embeddings_max_terms filter hook to change the number of terms to process during Embeddings classification per job. Changed - Embeddings classification now uses background processing to improve performance.

Credits

Props @dkotter @Sidsector9

Checklist:

Sidsector9 commented 2 months ago

@dkotter sorry for the delay, I couldn't find time to pick this up. I'll work on Azure and revert soon for review.