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

Purpose

Generates 10 visibility prompts for each discovered product. These are product-specific search queries that potential customers might use. Runs in GROUP 3a (starts immediately when GROUP 2b completes, runs in parallel with GROUP 3b).

Function Signature

async def run_product_prompts(
    url: str,
    org_slug: str,
    discovered_products: list,
    pages: list
) -> Optional[StepResult]

Parameters

ParameterTypeDescription
urlstrThe business website URL
org_slugstrThe Clerk organization slug
discovered_productslistProducts from GROUP 2b
pageslistPre-scraped pages from GROUP 1a

Returns

{
  "name": "product_prompts",
  "status": "success",
  "data": {
    "products_processed": 3,
    "total_prompts": 30
  }
}

Prompt Count

Entity TypePrompts
Business50 (10 Exa + 40 Gemini)
Each Product10
Example: A business with 3 products gets 50 + 30 = 80 total prompts.

Execution Flow

Product-Specific Prompts

Uses Gemini with product context:
prompt = f"""
Generate 10 search queries for this specific product: {product_name}

The product is offered by {business_name} at {product_url}.

Requirements:
- Queries should be specific to this product
- Include feature-specific queries
- Include comparison queries with alternatives
- Do NOT include the product name or business name
"""

Database Storage

Prompts are linked to the product entity:
INSERT INTO entity_prompts_tracker (
  entity_id,  -- Product entity ID, not business
  prompt
) VALUES (
  'product-uuid-...',
  'Best tool for X feature'
);

Code Location

src/app/apis/onboarding/generate_all/tasks/prompts.py
Contains both:
  • run_business_prompts() - GROUP 2a
  • run_product_prompts() - GROUP 3

Skipped Scenarios

Product prompts are skipped if:
  1. No products were discovered in GROUP 2b
  2. Product discovery failed
  3. Products don’t have valid entity IDs
{
  "name": "product_prompts",
  "status": "skipped",
  "data": {
    "products_processed": 0,
    "total_prompts": 0
  }
}