feat(ingest): Allow semantic ingest to accept feedback
This commit is contained in:
parent
3360388f00
commit
06e877ec1d
1 changed files with 10 additions and 3 deletions
|
|
@ -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).
|
# Unset = omit the flag entirely (correct for plain instruct models such as qwen2.5).
|
||||||
THINK = os.environ.get("INGEST_THINK")
|
THINK = os.environ.get("INGEST_THINK")
|
||||||
TODAY = datetime.date.today().isoformat()
|
TODAY = datetime.date.today().isoformat()
|
||||||
|
FEEDBACK = os.environ.get("INGEST_FEEDBACK", "").strip()
|
||||||
|
|
||||||
|
|
||||||
def die(stage, reason):
|
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)"
|
existing_conc = ", ".join(sorted(existing_concepts)) or "(none yet)"
|
||||||
prompt = SYSTEM_PROMPT.format(existing_entities=existing_ents, existing_concepts=existing_conc)
|
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 = {
|
payload = {
|
||||||
"model": MODEL,
|
"model": MODEL,
|
||||||
"messages": [
|
"messages": [
|
||||||
{"role": "system", "content": prompt},
|
{"role": "system", "content": prompt},
|
||||||
{"role": "user", "content":
|
{"role": "user", "content": user_content },
|
||||||
"Source path: " + raw_rel + "\n\n--- SOURCE START ---\n"
|
|
||||||
+ source_text + "\n--- SOURCE END ---\n\nReturn the JSON now."},
|
|
||||||
],
|
],
|
||||||
"format": SCHEMA,
|
"format": SCHEMA,
|
||||||
"stream": False,
|
"stream": False,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue