feat: add opik instrumentation to image and content pipeline

- Add optional $trace_context parameter to PRAutoBlogger_Image_Prompt_Builder
- Wrap LLM call in image_prompt_rewrite span when trace context available
- Pass trace context through from image pipeline
- Add $eval_mode parameter to content generator generate() method
- Define PRAUTOBLOGGER_EVAL_MODE constant to suppress side effects
- Add generate_eval() convenience method
- Register WP-CLI hook in main orchestrator
- Bump version to 0.13.0
This commit is contained in:
peptiderepo
2026-04-24 04:25:31 +00:00
parent 50ae7ca530
commit 575d0b97b9
4 changed files with 27 additions and 6 deletions

View File

@@ -29,7 +29,10 @@ class PRAutoBlogger_Content_Generator {
* @param PRAutoBlogger_Article_Idea $idea The scored idea to generate content for.
* @return string Generated HTML content.
*/
public function generate( PRAutoBlogger_Article_Idea $idea ): string {
public function generate( PRAutoBlogger_Article_Idea $idea, bool $eval_mode = false ): string {
// In eval mode, suppress publishing and image generation side effects.
define( 'PRAUTOBLOGGER_EVAL_MODE', $eval_mode );
$mode = get_option( 'prautoblogger_writing_pipeline', 'multi_step' );
$request = new PRAutoBlogger_Content_Request(
@@ -285,4 +288,14 @@ class PRAutoBlogger_Content_Generator {
return $response['content'];
}
/**
* Generate content in eval mode (no publishing, no image generation).
*
* @param PRAutoBlogger_Article_Idea $idea The scored idea to generate content for.
* @return string Generated HTML content.
*/
public function generate_eval( PRAutoBlogger_Article_Idea $idea ): string {
return $this->generate( $idea, true );
}
}