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

Improve Error Messaging in Product Creation with AI for 'finish_reason' parameter in API Responses #13259

Open
Tracked by #13103
pmusolino opened this issue Jul 5, 2024 · 3 comments
Assignees
Labels
feature: add/edit products Related to adding or editing products. type: enhancement A request for an enhancement. type: task An internally driven task.

Comments

@pmusolino
Copy link
Member

pmusolino commented Jul 5, 2024

During the development of new prompts (context: pe5sF9-2UY) and experiments with the GPT-4 API, it has come to my attention that the 'finish_reason' parameter can sometimes return the value "length," indicating that the AI had more to say but was cut off due to token limitations. This scenario leads to incomplete responses, which can cause confusion for users due to the generic nature of the error message currently being displayed.

The purpose of this issue is to enhance the user experience by providing clearer, more informative error messages when the 'finish_reason' parameter indicates an incomplete output or other errors. By doing so, we aim to give users a better understanding of why their response was truncated and what actions they can take to remedy the situation.

Delving deeper, the parameter finish_reason can yield these responses:

  • stop: API returned complete message, or a message terminated by one of the stop sequences provided via the stop parameter
  • length: Incomplete model output due to max_tokens parameter or token limit
  • function_call: The model decided to call a function
  • content_filter: Omitted content due to a flag from our content filters
  • null: API response still in progress or incomplete

Android issue: woocommerce/woocommerce-android#11930

@pmusolino pmusolino added type: enhancement A request for an enhancement. type: task An internally driven task. feature: add/edit products Related to adding or editing products. labels Jul 5, 2024
@pmusolino pmusolino self-assigned this Jul 5, 2024
@dangermattic
Copy link
Collaborator

Thanks for reporting! 👍

@selanthiraiyan
Copy link
Contributor

The purpose of this issue is to enhance the user experience by providing clearer, more informative error messages when the 'finish_reason' parameter indicates an incomplete output or other errors. By doing so, we aim to give users a better understanding of why their response was truncated and what actions they can take to remedy the situation.

@pmusolino I don't understand how custom error messages will help the user remedy the situation. Could you explain a bit about what kind of error messages you have in mind?

@pmusolino
Copy link
Member Author

@selanthiraiyan Instead of a generic or something like "Error: response truncated" message, which doesn't offer much insight into the problem or how to solve it, we can inform the user about the specific issue and suggest steps to fix it.

Here an example of custom error messages For finish_reason "length":

  • Custom message: "The response was cut off because it reached the token limit. To get a complete answer, try shortening your prompt if possible."

This message tells the user exactly why they saw the error and offers a possible solution: shortening the prompt. I don't expect to happen often given the new 4K limit, but something to keep in mind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: add/edit products Related to adding or editing products. type: enhancement A request for an enhancement. type: task An internally driven task.
Projects
None yet
Development

No branches or pull requests

3 participants