-
Notifications
You must be signed in to change notification settings - Fork 112
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
Product Creation with AI: update prompt to generate 3 options #13258
Product Creation with AI: update prompt to generate 3 options #13258
Conversation
…ue to an unexpectedly low `max_tokens` limit. Updated the code to explicitly set `max_tokens` to 4000, ensuring full-length responses for detailed prompts.
📲 You can test the changes from this Pull Request in WooCommerce iOS by scanning the QR code below to install the corresponding build.
|
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.
The product generation works as described. The code changes look good to me. 🎉
I left a comment about the newly added requirement to generate three options for the short description field. I am preapproving the PR as this can worked in a separate PR.
return ["name": "The name of the product, written in the language with ISO code ```\(language)```", | ||
"description": "Product description of around 100 words long in a ```\(tone)``` tone, " | ||
return ["names": "An array of strings, containing three different names of the product, written in the language with ISO code ```\(language)```", | ||
"descriptions": "An array of strings, each containing three different product descriptions of around 100 words long each in a ```\(tone)``` tone, " | ||
+ "written in the language with ISO code ```\(language)```", | ||
"short_description": "Product's short description, written in the language with ISO code ```\(language)```", |
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.
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.
I logged a subtask here. I will work on this.
@@ -125,7 +125,7 @@ public extension Product { | |||
tags: [ProductTag]) { | |||
self.init(siteID: siteID, | |||
productID: 0, | |||
name: aiProduct.name, | |||
name: aiProduct.names.first ?? "", |
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.
Not a blocker, and we can add it in a future PR:
I think we should add another helper method to init a Product
with a custom selected name, description and shortDescription. We can use the new custom init
method to pass the user selected/typed name, description and shortDescription.
Closes: #13108
Description
This PR addresses issue #13108, which is part of the "Product Creation with AI: v2 - Milestone 1" (#13103). The goal is to refine the product creation prompt to yield three options for both the product name and description while ensuring compatibility with the existing product creation flow.
Changes include:
AIProduct
model to work with the previous and new flow, to store multiple name and description options.In the course of this update, I led to the decision to avoid duplicating the
AIProduct
model and related code as originally planned in the issue. Instead, I updated the existingAIProduct
model to contain arrays for names and descriptions. This approach simplifies the transition and future code maintenance, and it will require just removing 3 lines of legacy code (marked withTODO
) in the future.Additionally, while working on the new prompt, I encountered token limitations in the ChatGPT responses, where the
finish_reason
was set tolength
. This indicated that the responses were being cut off due to themax_tokens
limit. To resolve this, I have manually set themax_tokens
parameter to4000
, which aligns with the capabilities of GPT-4o and ensures complete responses. This change will require a corresponding update on the Android client to accommodate the larger token count. More context here pe5sF9-2UYTesting
productCreationAIv2M1
feature flag, and make sure the previous AI flow works as before.RELEASE-NOTES.txt
if necessary.