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
CYS - AI Improvements #42800
CYS - AI Improvements #42800
Conversation
… will return the responses in JSON format.
…n the ProductUpdater class.
…ble quotes from the response.
…ion for the woocommerce-blocks/testimonials-3-columns pattern.
…dpoint callback in case execution is interrupted so images don't have to be fetched from Pexels again.
…loaded and uploaded to the media library.
@@ -245,7 +245,7 @@ private function fetch_and_validate_ai_responses( $ai_connection, $token, $forma | |||
$success = false; | |||
while ( $ai_request_retries < 5 && ! $success ) { | |||
$ai_request_retries ++; | |||
$ai_responses = $ai_connection->fetch_ai_responses( $token, $formatted_prompts, 60 ); | |||
$ai_responses = $ai_connection->fetch_ai_responses( $token, $formatted_prompts, 60, 'json_object' ); |
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.
Enabling JSON Mode: https://platform.openai.com/docs/guides/text-generation/json-mode
Test Results SummaryCommit SHA: d1c7034
To view the full API test report, click here. To view the full E2E test report, click here. To view all test reports, visit the WooCommerce Test Reports Dashboard. |
Apart from reviewing the code changes, please make sure to review the testing instructions as well. You can follow this guide to find out what good testing instructions should look like: |
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.
Great job!
It was very interesting to see these prompt updates and they seem to be working great!
🙌
Submission Review Guidelines:
Changes proposed in this Pull Request:
On this PR, a series of changes are made to improve AI content generation and image management, including:
JSON Mode Enabled
Improvements for images assigned to products
Reduce the size of the images uploaded to the media library for products. While the
/wpcom/v2/external-media/list/pexels
endpoint provides a series of predefined image sizes for usage, none of them were ideal for our use-case when it comes to products, with the images accessible viaURL
(and['thumbnails']['large']
) being too big and the images accessible via['thumbnails']['medium']
and['thumbnails']['small']
being too low quality. Initially, we were relying on the highest quality possible, which would work as expected most of the time. Still, on occasion, when the returned image was too big, it could trigger memory exhaustion errors on servers with limited resources, such as JN, which we have been using for testing. This change ensures that images still have a good resolution while at the same time ensuring that they have a reasonable size for downloading and uploading to the media library without any problems.Similarly to what was already implemented on
ai/patterns
endpoint, created a transient to store images fetched from Pexels and make them accessible whenever a request toai/product
is made but for some reason interrupted due to unavailability of AI or equivalent, avoiding making additional requests to Pexels and AI to generate a search term and fetch images that were already successfully fetched for that execution in particular. This change should improve performance and also reduce costs with AI.Updated Prompts
How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
/wp-admin/tools.php?page=woocommerce-admin-test-helper
and enablecustomize-store
feature flag:latest_ai_demo.mov
Changelog entry
Significance
Type
Message
Enhancement - Improve the AI content generation experience within the CYS onboarding flow.
Comment