From 06e877ec1ddc99ce59155c673538146f0f69810b Mon Sep 17 00:00:00 2001 From: Matteo Cherubini Date: Tue, 30 Jun 2026 10:31:37 +0200 Subject: [PATCH] feat(ingest): Allow semantic ingest to accept feedback --- skills/ingest/scripts/ingest-semantic.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/skills/ingest/scripts/ingest-semantic.py b/skills/ingest/scripts/ingest-semantic.py index f73612e..a7b527a 100755 --- a/skills/ingest/scripts/ingest-semantic.py +++ b/skills/ingest/scripts/ingest-semantic.py @@ -32,6 +32,7 @@ TIMEOUT = int(os.environ.get("INGEST_TIMEOUT", "600")) # Unset = omit the flag entirely (correct for plain instruct models such as qwen2.5). THINK = os.environ.get("INGEST_THINK") TODAY = datetime.date.today().isoformat() +FEEDBACK = os.environ.get("INGEST_FEEDBACK", "").strip() def die(stage, reason): @@ -217,13 +218,19 @@ def call_model(max_retries=2, base_delay=2.0): existing_conc = ", ".join(sorted(existing_concepts)) or "(none yet)" prompt = SYSTEM_PROMPT.format(existing_entities=existing_ents, existing_concepts=existing_conc) + user_content = ( + ("REVISION REQUESTED BY THE MAINTAINER (address this explicitly):\n" + + FEEDBACK + "\n\n") if FEEDBACK else "" + ) + ( + "Source path: " + raw_rel + "\n\n--- SOURCE START ---\n" + + source_text + "\n--- SOURCE END ---\n\nReturn the JSON now." + ) + payload = { "model": MODEL, "messages": [ {"role": "system", "content": prompt}, - {"role": "user", "content": - "Source path: " + raw_rel + "\n\n--- SOURCE START ---\n" - + source_text + "\n--- SOURCE END ---\n\nReturn the JSON now."}, + {"role": "user", "content": user_content }, ], "format": SCHEMA, "stream": False,