Skip to main content

Purpose

Generates visibility tracking prompts for products. These prompts are used by the daily cron to check if products are being recommended by AI platforms.

Architecture

Pipeline Flow

This endpoint is the second step in a 3-step product pipeline:
1. discover-products
   └── Extract products from content
   └── Return entity_ids

2. generate-product-prompts (this endpoint)
   └── Takes entity_ids from step 1
   └── Generates 10 prompts per product
   └── Saves to entity_prompts_tracker

3. generate-product-llms-txt
   └── Takes entity_ids from step 1
   └── Generates /llms/{slug}.txt files

How Prompts Are Used

These prompts are later used by the daily cron job:
  1. Sample prompts - Cron samples 10 prompts per day
  2. Check visibility - Query 8 AI platforms with each prompt
  3. Store results - Update entity_prompts_tracker with pass/fail per platform
  4. Calculate score - Aggregate into visibility score

Code Location

src/app/apis/cron/generate_product_prompts/routes.py
src/app/shared/products/discover.py  # generate_prompts_for_product()
src/app/shared/prompts/service.py    # Underlying prompt generation