Implement Prompt_Builder and Prompt_Builder_With_WP_Error
#13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #9
Supersedes #12
PromptBuilderinPrompt_Builder, allowing to use "snake_case" method names instead of "camelCase" method names, as per WordPress Coding Standards.Prompt_Builder_With_WP_ErrorextendsPrompt_Builderand catches any exceptions thrown in the originalPromptBuilder, turning them intoWP_Errorreturn values from the terminate methods.WP_Errorobjects, to maintain the fluent interface. As soon as an exception is caught in a chain of method calls, all subsequent calls become no-ops, and only the terminate method will return theWP_Error.AI_Clientis included to streamline instantiation of the prompt builder classes. While it is somewhat equivalent toAiClientfrom the underlying PHP AI Client SDK, there is no need for parity at this point, as most methods onAiClientare for more advanced use-cases. We can consider separately which other things we would want to include in the WordPress version of the class.Developers are free to choose either class, depending on their preferences. There are no differences in their feature set, the only difference is the exception vs
WP_Errorpiece.