Skip to content
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

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

Merged
merged 15 commits into from
Jul 12, 2024

Conversation

Sidsector9
Copy link
Member

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:

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

@Sidsector9 Sidsector9 requested review from dkotter, jeffpaul and a team as code owners June 17, 2024 18:39
@Sidsector9 Sidsector9 self-assigned this Jun 17, 2024
@github-actions github-actions bot added this to the 3.1.0 milestone Jun 17, 2024
@github-actions github-actions bot added the needs:code-review This requires code review. label Jun 17, 2024
Copy link
Collaborator

@dkotter dkotter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few comments but overall this looks really good and seems to work well.

One other thing we'll need to do before this is ready to merge is bring these same changes over to the Azure OpenAI Embeddings Provider, as right now we only added this to the OpenAI Embeddings Provider

composer.json Outdated Show resolved Hide resolved
classifai.php Outdated Show resolved Hide resolved
includes/Classifai/Providers/OpenAI/Embeddings.php Outdated Show resolved Hide resolved
@Sidsector9 Sidsector9 requested a review from dkotter June 28, 2024 14:38
Copy link
Collaborator

@dkotter dkotter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good and tests well but still need to account for this piece:

bring these same changes over to the Azure OpenAI Embeddings Provider

@Sidsector9 Let me know if you'd like me to tackle that

@Sidsector9
Copy link
Member Author

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

@Sidsector9 Sidsector9 requested a review from dkotter July 8, 2024 15:48
@dkotter dkotter merged commit 0198c28 into develop Jul 12, 2024
12 of 14 checks passed
@dkotter dkotter deleted the fix/759 branch July 12, 2024 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs:code-review This requires code review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Need a more performant way to bulk generate embeddings for terms
2 participants