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

Purpose

Generates 40 visibility prompts using Gemini 3 Flash. These prompts are search queries that potential customers might use to find businesses like this one. Runs in GROUP 2a (parallel with other tasks after scrape completes).
The total is 50 business prompts: 10 come from GROUP 1c (Exa, pre-tested) + 40 from this service.

Function Signature

async def run_business_prompts(
    url: str,
    org_slug: str,
    prompt_count: int,
    pages: list
) -> StepResult

Parameters

ParameterTypeDescription
urlstrThe website URL
org_slugstrThe Clerk organization slug
prompt_countintNumber of prompts to generate (typically 40)
pageslistPre-scraped pages from GROUP 1a

Returns

{
  "name": "business_prompts",
  "status": "success",
  "data": {
    "prompts_generated": 40,
    "prompts_saved": 40
  }
}

Prompt Generation

Uses Gemini 3 Flash to analyze the scraped content and generate diverse prompts:
prompt = f"""
Analyze this website content and generate {count} search queries that 
potential customers might type into AI assistants (ChatGPT, Claude, 
Perplexity) when looking for this type of product/service.

Requirements:
- Natural questions a real person would ask
- Mix of: discovery queries, comparison queries, recommendation queries
- Do NOT include the business name
- Each query should be unique and specific
"""

Prompt Categories

CategoryExample
Discovery”What tools help with X?”
Comparison”Best alternatives to Y”
Recommendation”Which service should I use for Z?”
Problem-solving”How do I solve X problem?”
Feature-specific”Software with X feature”

Database Storage

Prompts are saved to entity_prompts_tracker:
INSERT INTO entity_prompts_tracker (
  entity_id,
  prompt
) VALUES (
  'uuid-...',
  'What payment gateway supports instant transfers?'
);
These prompts are NOT pre-tested. They get tested by the daily visibility cron job.

Code Location

src/app/shared/prompts/
β”œβ”€β”€ __init__.py
β”œβ”€β”€ service.py              # generate_prompts function
└── templates/
    └── onboarding/
        └── prompt_generation.py  # Gemini prompt template

Error Handling

{
  "name": "business_prompts",
  "status": "error",
  "error": "Gemini API timeout"
}
If prompt generation fails, the error is logged but onboarding continues. Prompts can be regenerated later.