Brand Ingestion

This commit is contained in:
sriram
2026-09-07 17:52:45 +05:30
parent 75dd3eb3ce
commit 2749bee1a3
11 changed files with 5069 additions and 10 deletions

View File

@@ -316,6 +316,37 @@ BRAND_SYNC_INTERVAL_SECONDS = int(os.getenv("BRAND_SYNC_INTERVAL_SECONDS", "300"
# See app/services/active_brands.py.
ACTIVE_BRANDS = os.getenv("ACTIVE_BRANDS", "")
# ---------------------------------------------------------------------------
# Brand discovery (brand name -> the 11-stage pipeline)
# ---------------------------------------------------------------------------
# Discovery turns a brand NAME into rows the ordinary catalog pipeline ingests.
# See app/services/brand_discovery.py. Every value below has a working default,
# so the feature needs no configuration to run.
#
# Open Food Facts is the primary source and the language model is the
# supplement, not the reverse: OFF returns real products carrying a real GTIN,
# while the default OLLAMA_MODEL_NAME (qwen2.5:1.5b) invents plausible ones that
# nothing downstream can catch. Turning BRAND_DISCOVERY_USE_OFF off leaves the
# result resting on the model alone.
BRAND_DISCOVERY_USE_OFF = _bool("BRAND_DISCOVERY_USE_OFF", "true")
BRAND_DISCOVERY_USE_LLM = _bool("BRAND_DISCOVERY_USE_LLM", "true")
# Products per discovery run. One CSV row per product; pack-size explosion
# happens later in stage 4, so this is well inside the 2000-row per-file cap.
BRAND_DISCOVERY_MAX_PRODUCTS = int(os.getenv("BRAND_DISCOVERY_MAX_PRODUCTS", "200"))
# Pack sizes kept per product when only the language model offers any. Stage 6
# runs an image search per exploded row, so this multiplies the slowest part of
# the run; 3 keeps a large brand inside a sane wall-clock.
BRAND_DISCOVERY_MAX_SIZES = int(os.getenv("BRAND_DISCOVERY_MAX_SIZES", "3"))
# Wall-clock ceiling on the LLM half of a run, checked between prompts. Open
# Food Facts runs first and is never subject to it, so a run that hits this
# still returns the evidence-backed products.
BRAND_DISCOVERY_DEADLINE_SECONDS = float(
os.getenv("BRAND_DISCOVERY_DEADLINE_SECONDS", "300")
)
# ---------------------------------------------------------------------------
# S3 / DigitalOcean Spaces (product image storage) - optional
# ---------------------------------------------------------------------------