50, // Target expansion percentage 'max_tokens' => 5000 // Higher token limit for longer content )); } /** * Get the refinement instruction * * @return string */ protected function get_refinement_instruction() { $percent = $this->get_config_value('expansion_percent', 50); return "Expand this article significantly ({$percent}% more content). Add detailed explanations and deeper analysis."; } /** * Build the user prompt * * @param string $original_content * @param string $research_context * @param AIGH_Pipeline_Context $context * @return string */ protected function build_user_prompt($original_content, $research_context, $context) { $prompt = "Here is the original article:\n\n{$original_content}\n\n"; if (!empty($research_context)) { $prompt .= "\n{$research_context}\n\n"; $prompt .= "IMPORTANT: Use the specific data, statistics, and examples from the research above to improve the article.\n\n"; } $prompt .= "Refinement Task: " . $this->get_refinement_instruction(); if (!empty($research_context)) { $prompt .= " ADD NEW SECTIONS based on the research findings."; } $prompt .= "\n\n"; $prompt .= "Expansion Guidelines:\n"; $prompt .= "- Add new subsections where appropriate\n"; $prompt .= "- Expand existing points with more detail\n"; $prompt .= "- Include additional examples\n"; $prompt .= "- Add transitional paragraphs for better flow\n"; $prompt .= "- Ensure the expansion feels natural, not padded\n\n"; $prompt .= $this->get_standard_requirements(!empty($research_context)); return $prompt; } /** * Get configuration schema * * @return array */ public function get_config_schema() { return array_merge(parent::get_config_schema(), array( 'expansion_percent' => array( 'type' => 'number', 'label' => 'Expansion Percentage', 'description' => 'Target percentage to expand the content', 'min' => 25, 'max' => 100, 'default' => 50 ) )); } }