30, // Target reduction percentage 'max_tokens' => 3000 // Lower token limit for shorter content )); } /** * Get the refinement instruction * * @return string */ protected function get_refinement_instruction() { $percent = $this->get_config_value('reduction_percent', 30); return "Condense this article (reduce by {$percent}%). Remove redundancy, keep only the most important points."; } /** * 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"; // Note: Research context is typically not used for making content shorter // but we include the option for consistency if (!empty($research_context)) { $prompt .= "\n{$research_context}\n\n"; } $prompt .= "Refinement Task: " . $this->get_refinement_instruction(); $prompt .= "\n\n"; $prompt .= "Condensation Guidelines:\n"; $prompt .= "- Remove redundant phrases and sentences\n"; $prompt .= "- Combine similar points\n"; $prompt .= "- Keep the most impactful statistics and examples\n"; $prompt .= "- Maintain the core message and structure\n"; $prompt .= "- Ensure smooth transitions remain\n"; $prompt .= "- Preserve the introduction hook and conclusion call-to-action\n\n"; $prompt .= $this->get_standard_requirements(false); return $prompt; } /** * Get configuration schema * * @return array */ public function get_config_schema() { return array_merge(parent::get_config_schema(), array( 'reduction_percent' => array( 'type' => 'number', 'label' => 'Reduction Percentage', 'description' => 'Target percentage to reduce the content', 'min' => 10, 'max' => 50, 'default' => 30 ) )); } }