Implement "The Reflex Layer" for low-reasoning tasks
This commit is contained in:
29
tasks.py
29
tasks.py
@@ -266,31 +266,22 @@ def hermes_local(prompt, model=None, caller_tag=None, toolsets=None):
|
||||
return None
|
||||
return result.get("response")
|
||||
|
||||
PII_SCRUBBER_SYSTEM_PROMPT = (
|
||||
"You are a PII (Personally Identifiable Information) redaction middleware.\n"
|
||||
"Your ONLY task is to identify and replace PII with generic placeholders.\n"
|
||||
"Replace names with [NAME], email addresses with [EMAIL], phone numbers with [PHONE], and physical addresses with [ADDRESS].\n"
|
||||
"Do not change any other part of the text. Do not add any commentary.\n"
|
||||
"If no PII is found, return the input text exactly as it is."
|
||||
)
|
||||
|
||||
|
||||
@huey.task()
|
||||
def pii_scrubber(text):
|
||||
"""Redact PII from text using gemma2:2b."""
|
||||
result = run_hermes_local(
|
||||
prompt=text,
|
||||
def run_reflex_task(prompt, caller_tag):
|
||||
"""Force a task to run on the cheapest local model (The Reflex Layer).
|
||||
|
||||
Use this for non-reasoning tasks like formatting, categorization,
|
||||
and simple status checks to save expensive context for coding.
|
||||
"""
|
||||
return run_hermes_local(
|
||||
prompt=prompt,
|
||||
model="gemma2:2b",
|
||||
caller_tag="pii-scrubber",
|
||||
system_prompt=PII_SCRUBBER_SYSTEM_PROMPT,
|
||||
caller_tag=f"reflex-{caller_tag}",
|
||||
disable_all_tools=True,
|
||||
skip_context_files=True,
|
||||
skip_memory=True,
|
||||
max_iterations=1,
|
||||
)
|
||||
if not result:
|
||||
return text
|
||||
return result.get("response", text)
|
||||
|
||||
|
||||
|
||||
ARCHIVE_EPHEMERAL_SYSTEM_PROMPT = (
|
||||
|
||||
Reference in New Issue
Block a user