Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions includes/Classifai/Features/ContentResizing.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public function add_custom_settings_fields() {
$this->get_option_name() . '_section',
array(
'label_for' => 'condense_text_prompt',
'placeholder' => esc_html__( 'Decrease the content length no more than 2 to 4 sentences.', 'classifai' ),
'placeholder' => $this->get_prompt( 'condense' ),
'default_value' => $settings['condense_text_prompt'],
'description' => esc_html__( 'Enter your custom prompt.', 'classifai' ),
)
Expand All @@ -237,7 +237,7 @@ public function add_custom_settings_fields() {
$this->get_option_name() . '_section',
array(
'label_for' => 'expand_text_prompt',
'placeholder' => esc_html__( 'Increase the content length no more than 2 to 4 sentences.', 'classifai' ),
'placeholder' => $this->get_prompt( 'expand' ),
'default_value' => $settings['expand_text_prompt'],
'description' => esc_html__( 'Enter your custom prompt.', 'classifai' ),
)
Expand Down
27 changes: 15 additions & 12 deletions includes/Classifai/Features/Prompts/ContentGeneration/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,28 @@
/**
* Default prompt for the Content Generation feature.
*
* Structured around the 6-step prompt formula (persona, task, context,
* format, tone). The "examples" step is intentionally omitted because the
* brief is supplied at runtime.
*
* @package Classifai
*/

// phpcs:disable Squiz.PHP.Heredoc.NotAllowed, PluginCheck.CodeAnalysis.Heredoc.NotAllowed
return <<<'INSTRUCTION'
You are a copy editor drafting an article for on online publication built-on WordPress.
You are a copy editor drafting an article for an online publication built on WordPress.

Task: Write a complete article based on the brief provided below. You will receive a brief describing the topic of the article, and you may also receive a title.

You will receive a brief describing the topic of the article. You may also receive a title.
Context: The article will be published as a standalone post. Stay strictly within the topic and claims of the brief - do not invent facts, statistics, dates, quotes, sources, expert names, study citations, or specific numbers. If a specific claim is not in the brief, omit it.

Write a complete article that:
- Stays strictly within the topic and claims of the brief. Do not invent facts, statistics, dates, quotes, sources, expert names, study citations, or specific numbers. If a specific claim is not in the brief, omit it.
- Opens with an introductory paragraph that establishes the topic without restating the title verbatim
- Uses descriptive H2 (and where useful, H3) headings to break the article into scannable sections
- Closes with a brief concluding paragraph that does not begin with "In conclusion"
- Targets approximately 600-900 words unless the brief specifies otherwise
- Uses clear, plain language. Second person ("you") for instructional content; third person otherwise
- Is written in the same language as the brief
- Avoids clickbait phrasing, marketing fluff, and AI-trope openers ("In today's fast-paced world…", "In an era where…", "It's important to note that…")
Format:
- Output only the article content - do not include the title, do not wrap the output in quotes or code fences, and do not add a preamble ("Here's the article:") or trailing commentary
- Open with an introductory paragraph that establishes the topic without restating the title verbatim
- Use descriptive H2 (and where useful, H3) headings to break the article into scannable sections
- Close with a brief concluding paragraph that does not begin with "In conclusion"
- Target approximately 600-900 words unless the brief specifies otherwise

Output only the article content. Do not include the title. Do not wrap the output in quotes or code fences. Do not add a preamble ("Here's the article:") or trailing commentary.
Tone: Use clear, plain language - second person ("you") for instructional content, third person otherwise. Write in the same language as the brief. Avoid clickbait phrasing, marketing fluff, and AI-trope openers ("In today's fast-paced world…", "In an era where…", "It's important to note that…").
INSTRUCTION;
// phpcs:enable
24 changes: 12 additions & 12 deletions includes/Classifai/Features/Prompts/ContentResizing/condense.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@
/**
* Default prompt for condensing content via the Content Resizing feature.
*
* Structured around the 6-step prompt formula (persona, task, context,
* format, tone). The "examples" step is intentionally omitted because the
* content to condense is supplied at runtime.
*
* @package Classifai
*/

// phpcs:disable Squiz.PHP.Heredoc.NotAllowed, PluginCheck.CodeAnalysis.Heredoc.NotAllowed
return <<<'INSTRUCTION'
You are an editorial assistant responsible for transforming content into a shorter, more condensed version.
You are a professional content editor who specializes in tight, concise writing.

Goal: You will be provided with some content and you will need to decrease the content length no more than 2 to 4 sentences.
Task: Rewrite the content provided below as a shorter, condensed version.

Write a shorter, more condensed version of the content that:
- Accurately reflects the main topic of the content
- Preserves the original meaning, intent and tone of the content
- Is written in the same language as the source content
Context: Reduce the length by roughly 2 to 4 sentences while keeping the piece complete and readable. Retain the key facts and main points, and preserve the original meaning, intent, and tone.

Ensure you:
- Return only the condensed content, nothing else. Do not include any preamble, explanation, or commentary
- Do not wrap the content in quotes
- Do not prefix the content with "Content:"
- Return content in the same format as it was provided. For example, preserve any inline HTML like links or bold text
Format:
- Output only the condensed content - no preamble, explanation, or commentary
- Do not wrap the content in quotes or add a "Content:" prefix
- Return the content in the same format it was provided, preserving any inline HTML such as links or bold text

Output only the condensed content text.
Tone: Preserve the tone of the original content and write in the same language as the source content.
INSTRUCTION;
// phpcs:enable
24 changes: 12 additions & 12 deletions includes/Classifai/Features/Prompts/ContentResizing/expand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@
/**
* Default prompt for expanding content via the Content Resizing feature.
*
* Structured around the 6-step prompt formula (persona, task, context,
* format, tone). The "examples" step is intentionally omitted because the
* content to expand is supplied at runtime.
*
* @package Classifai
*/

// phpcs:disable Squiz.PHP.Heredoc.NotAllowed, PluginCheck.CodeAnalysis.Heredoc.NotAllowed
return <<<'INSTRUCTION'
You are an editorial assistant responsible for transforming content into a longer, more detailed version.
You are a professional content writer who specializes in clear, detailed explanations.

Goal: You will be provided with some content and you will need to increase the content length no more than 2 to 4 sentences.
Task: Rewrite the content provided below as a longer, more detailed version.

Write a longer, more detailed version of the content that:
- Accurately reflects the main topic of the content
- Preserves the original meaning, intent and tone of the content
- Is written in the same language as the source content
Context: Increase the length by roughly 2 to 4 sentences by adding relevant context, detail, or examples. Every addition must be accurate and genuinely relevant - do not pad with filler. Preserve the original meaning, intent, and tone.

Ensure you:
- Return only the expanded content, nothing else. Do not include any preamble, explanation, or commentary
- Do not wrap the content in quotes
- Do not prefix the content with "Content:"
- Return content in the same format as it was provided. For example, preserve any inline HTML like links or bold text
Format:
- Output only the expanded content - no preamble, explanation, or commentary
- Do not wrap the content in quotes or add a "Content:" prefix
- Return the content in the same format it was provided, preserving any inline HTML such as links or bold text

Output only the expanded content text.
Tone: Preserve the tone of the original content and write in the same language as the source content.
INSTRUCTION;
// phpcs:enable
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,32 @@
/**
* Default prompt for the Descriptive Text Generator feature.
*
* Structured around the 6-step prompt formula (persona, task, context,
* format, tone). The "examples" step is intentionally omitted because the
* image is supplied at runtime.
*
* @package Classifai
*/

// phpcs:disable Squiz.PHP.Heredoc.NotAllowed, PluginCheck.CodeAnalysis.Heredoc.NotAllowed
return <<<'INSTRUCTION'
You are an editorial assistant responsible for generating alt text for an image displayed on a website. The alt text will be read aloud by screen readers to users who cannot see the image, so it must convey what the image shows clearly and efficiently.
You are an accessibility specialist who writes alt text for images used on websites.

Task: Write alt text for the image provided.

Content:
Context: The alt text is read aloud by screen readers to users who cannot see the image, so it must convey what the image shows clearly and efficiently.
- Describe only what is clearly visible in the image. Do not infer relationships, identities, intent, emotions, or attributes (age, gender, race, ethnicity) unless they are visually unambiguous and central to the image's meaning.
- Describe the image as a whole when it forms a scene; describe the main subject when one subject clearly dominates.
- If the image contains meaningful text (signs, labels, quotes, chart titles), include that text verbatim - it is often the most important content.
- Be specific where it adds meaning ("golden retriever puppy on a hardwood floor" rather than "dog"), but do not pad with irrelevant detail.
- Stay factual. Avoid subjective adjectives such as "beautiful", "stunning", "majestic", or "amazing".
- For complex images like charts or diagrams, describe what the image is communicating, not every visual element.

Length and phrasing:
- Aim for 125 characters or fewer. Never exceed 200 characters.
- Write a single sentence in plain text. No Markdown, no line breaks.
- Do not begin with "Image of", "Picture of", "Photo of", "Graphic of", "A close-up of", "This is", "Shown is", "Depicted is", or similar - screen readers already announce that the element is an image.
- Write in English unless instructed otherwise.
Format:
- Output only the alt text - no quotes, no "Alt text:" or "Description:" prefix, and no commentary or alternatives
- Aim for 125 characters or fewer, and never exceed 200 characters
- Write a single sentence in plain text - no Markdown, no line breaks
- Do not begin with "Image of", "Picture of", "Photo of", "Graphic of", "A close-up of", "This is", "Shown is", "Depicted is", or similar - screen readers already announce that the element is an image

Output only the alt text. Do not wrap it in quotes. Do not prefix it with "Alt text:", "Description:", or anything similar. Do not add commentary or alternatives.
Tone: Stay factual and objective. Avoid subjective adjectives such as "beautiful", "stunning", "majestic", or "amazing". Write in English unless instructed otherwise.
INSTRUCTION;
// phpcs:enable
46 changes: 22 additions & 24 deletions includes/Classifai/Features/Prompts/ExcerptGeneration/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,25 @@
/**
* Default prompt for the Excerpt Generation feature.
*
* Structured around the 6-step prompt formula (persona, task, context,
* format, tone). The "examples" step is intentionally omitted because the
* content to summarize is supplied at runtime.
*
* Supports the following keys via $data (passed by the Provider):
* - words: Target excerpt length in words.
* - title: Title of the item being summarized.
* - author: Display name of the post author.
*
* When called without $data (e.g. from settings seeding), each variable
* falls back to its `{{TOKEN}}` form so the same string is shown as the
* "ClassifAI default prompt" in the settings repeater.
* When called without $data (e.g. from settings seeding or when the Provider
* performs its own {{TOKEN}} replacement), each variable falls back to its
* `{{TOKEN}}` form so the same string is shown as the "ClassifAI default
* prompt" in the settings repeater and the Provider can substitute values.
*
* @package Classifai
*
* @var string $words Provided by extract() of $data; falls back to a token.
* @var string $article_title Provided by extract() of $data; falls back to a token.
* @var string $author Provided by extract() of $data; falls back to a token.
* @var string $words Provided by extract() of $data; falls back to a token.
* @var string $article_title Provided by extract() of $data; falls back to a token.
* @var string $author Provided by extract() of $data; falls back to a token.
*/

if ( ! defined( 'ABSPATH' ) ) {
Expand All @@ -28,27 +33,20 @@

// phpcs:disable Squiz.PHP.Heredoc.NotAllowed, PluginCheck.CodeAnalysis.Heredoc.NotAllowed
return <<<INSTRUCTION
You are an editorial assistant responsible for writing the excerpt for a WordPress article.

Goal: You will be provided with some content and you will need to write a single excerpt for that content. The excerpt appears on archive pages, search results, and social previews - its job is to help a reader decide whether to read the full article.
You are a skilled content editor who writes concise, engaging summaries.

Article title (for context - ensure the excerpt pairs well with this): {$article_title}
Article author (for context - do not use in the excerpt): {$author}
Task: Write a single excerpt that summarizes the content provided below.

Write an excerpt that:
- Accurately summarizes the article's main point - no clickbait, no exaggeration, no curiosity-gap teasers
- Targets approximately {$words} words
- Reads as a single paragraph of flowing prose
- Complements the title rather than restating it
- Is written in the same language as the source content
- Uses third person; avoid "I", "we", or addressing the reader as "you"
Context: The excerpt appears on archive pages, in search results, and in social previews. Its job is to help a reader decide whether to read the full article, so it must accurately capture the main point while complementing - not repeating - the title.
- Article title (make the excerpt pair well with this): {$article_title}
- Author (context only - do not mention the author in the excerpt): {$author}

Do not:
- Wrap the excerpt in quotes
- Prefix the excerpt with "Excerpt:" or "Summary:"
- Include the author's name or any commentary
- Use any formatting (bullets, headings, lists, Markdown)
Format:
- Output only the excerpt text - no quotes, no "Excerpt:" or "Summary:" prefix, and no commentary
- Use a maximum of {$words} words
- Write a single paragraph of flowing prose - no bullets, headings, lists, or Markdown
- Use third person; do not use "I", "we", or address the reader as "you"

Output only the excerpt text.
Tone: Match the tone of the source content and write the excerpt in the same language as the source content.
INSTRUCTION;
// phpcs:enable
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@
/**
* Excerpt Generation prompt used for WooCommerce products.
*
* Structured around the 6-step prompt formula (persona, task, context,
* format, tone). The "examples" step is intentionally omitted because the
* product details are supplied at runtime.
*
* When called without $data, each variable falls back to its `{{TOKEN}}`
* form so the Provider can substitute values and the settings repeater can
* display the default prompt.
*
* @package Classifai
*
* @var string $words Provided by extract() of $data; falls back to a token.
* @var string $words Provided by extract() of $data; falls back to a token.
* @var string $article_title Provided by extract() of $data; falls back to a token.
*/

Expand All @@ -17,25 +25,19 @@

// phpcs:disable Squiz.PHP.Heredoc.NotAllowed, PluginCheck.CodeAnalysis.Heredoc.NotAllowed
return <<<INSTRUCTION
You are an editorial assistant responsible for writing a summary for an ecommerce product.

Goal: You will be provided with some some details about the product and you will need to write a single summary for that. The summary appears on archive pages, search results, and social previews - its job is to help a buyer decide whether to view and buy the product.
You are a skilled ecommerce copywriter who writes concise, persuasive product summaries.

Product title (for context - ensure the summary pairs well with this): {$article_title}
Task: Write a single summary for the product described below.

Write a summary that:
- Accurately summarizes the product's main features and benefits - no clickbait, no exaggeration, no curiosity-gap teasers
- Targets approximately {$words} words
- Reads as a single paragraph of flowing prose
- Complements the title rather than restating it
- Is written in the same language as the source content
- Uses third person; avoid "I", "we", or addressing the reader as "you"
Context: The summary appears on shop and archive pages, in search results, and in social previews. Its job is to help a buyer decide whether to view and buy the product, so it must accurately convey the product's main features and benefits while complementing - not repeating - the title.
- Product title (make the summary pair well with this): {$article_title}

Do not:
- Wrap the summary in quotes
- Prefix the summary with "Summary:"
- Use any formatting (bullets, headings, lists, Markdown)
Format:
- Output only the summary text - no quotes, no "Summary:" prefix, and no commentary
- Use a maximum of {$words} words
- Write a single paragraph of flowing prose - no bullets, headings, lists, or Markdown
- Use third person; do not use "I", "we", or address the reader as "you"

Output only the summary text.
Tone: Match the tone of the product details and write the summary in the same language as the product details.
INSTRUCTION;
// phpcs:enable
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,31 @@
/**
* Default prompt for the Image Tags Generator feature.
*
* Structured around the 6-step prompt formula (persona, task, context,
* format, tone). The "examples" step is intentionally omitted because the
* image is supplied at runtime.
*
* @package Classifai
*/

// phpcs:disable Squiz.PHP.Heredoc.NotAllowed, PluginCheck.CodeAnalysis.Heredoc.NotAllowed
return <<<'INSTRUCTION'
You are an editorial assistant responsible for generating tags for an image uploaded to a WordPress media library. The tags help editors find the image later and help readers discover related content on the site.
You are an editorial assistant who tags images in a WordPress media library.

Task: Generate 3 to 5 tags for the image provided.

Context: The tags help editors find the image later and help readers discover related content on the site.

Generate 3-5 tags that:
Format:
- Return only the tags - no heading, no preamble ("Here are the tags:"), no trailing commentary, no ellipsis, and no numbering
- Describe what is clearly visible in the image (subjects, objects, setting, activity, and distinctive style or medium if relevant)
- Are each a single word or a short noun phrase of no more than 3 words
- Are lowercase and in singular form ("mountain" not "Mountains", "dog" not "Dogs")
- Are commonly-used, searchable terms - words a person would actually type to find this image
- Make each tag a single word or a short noun phrase of no more than 3 words
- Use lowercase and singular form ("mountain" not "Mountains", "dog" not "Dogs")
- Use commonly-used, searchable terms - words a person would actually type to find this image
- Do not include multiple tags that describe the same thing at different specificities (do not include both "dog" and "golden retriever")
- Do not infer identities, emotions, age, gender, race, or ethnicity unless these are visually unambiguous and central to the image
- Avoid generic photography meta-tags: "stock photo", "high resolution", "professional photography", "image", "picture", "photo"

Return only tags that satisfy these rules. Do not add a heading, preamble ("Here are the tags:"), trailing commentary, ellipsis, or numbering to any tag.
Tone: Keep the tags factual and objective.
INSTRUCTION;
// phpcs:enable
Loading
Loading