Skip to main content
Internal Service β€” This is not an HTTP endpoint. It’s called by the create-boosted-page orchestrator.

Purpose

Uses Gemini to generate unique, SEO-optimized content for the boosted page based on the scraped AI site content.

Function Signature

async def generate_boosted_content(
    business_id: str,
    product_id: Optional[str],
    boosted_id: str,
    scrape_result: dict,
    existing_posts: list
) -> dict

Returns

{
    "status": "success",
    "title": "Complete Guide to Payment Processing",
    "slug": "complete-guide-payment-processing",
    "content": "...",  # Markdown content
    "meta_description": "...",
    "keywords": ["payment", "processing", "guide"]
}

Content Generation

The LLM is prompted to:
  1. Analyze the scraped content to understand the business
  2. Identify a topic not covered by existing posts
  3. Generate comprehensive, helpful content
  4. Optimize for AI search engines

Deduplication

Existing post titles/slugs are passed to prevent generating duplicate content:
existing_posts = [
    {"title": "Payment Gateway Guide", "slug": "payment-gateway-guide"},
    {"title": "Security Best Practices", "slug": "security-best-practices"}
]
The LLM is instructed to create content on a DIFFERENT topic.

Code Location

src/app/apis/cron/create_boosted_page/children/step_3_generate_content.py