From 4abdc88286899db3e83bf25d38fd8acd9feb73dd Mon Sep 17 00:00:00 2001 From: Piotr Oleszczyk Date: Sat, 28 Feb 2026 21:49:26 +0100 Subject: [PATCH] fix(backend): request minified JSON from Gemini to avoid token truncation Pretty-printed JSON wastes 2-3x tokens on indentation/newlines. Minified output fits more data (e.g. long INCI lists) within the 8192 output token limit. Co-Authored-By: Claude Sonnet 4.6 --- backend/innercontext/api/products.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/innercontext/api/products.py b/backend/innercontext/api/products.py index 9630ae2..f4834c6 100644 --- a/backend/innercontext/api/products.py +++ b/backend/innercontext/api/products.py @@ -227,7 +227,7 @@ Given raw text (product page copy, ingredient list, label scan, etc.), \ extract structured product data and return it as a single JSON object. RULES: -- Return ONLY raw JSON — no markdown code fences, no explanation, no preamble. +- Return ONLY raw JSON — no markdown code fences, no explanation, no preamble, no indentation or extra whitespace (minified). - Omit any field you cannot confidently determine from the text. Do not guess. - All enum values must exactly match the allowed strings listed below. - For INCI lists: return each ingredient as a separate string in the array, \