diff --git a/handlers/remote_handlers.py b/handlers/remote_handlers.py index 2f10e18..90c08aa 100644 --- a/handlers/remote_handlers.py +++ b/handlers/remote_handlers.py @@ -20,17 +20,31 @@ def __init__(self) -> None: self.system_prompt = load_prompt_template("remote_general.txt") async def handle(self, prompt: str, category: str = "LOCAL_GENERAL") -> str: - # Set max_tokens based on category + # Category-specific token budgets max_tokens = { "LOCAL_GENERAL": 80, - "LOCAL_SENTIMENT": 20, + "LOCAL_SENTIMENT": 60, # label + one-sentence reason "LOCAL_NER": 200, "API_LONG_CONTEXT": 200, }.get(category, 80) + # Preserve schema constraints for structured-output categories + if category == "LOCAL_NER": + # Must keep JSON list format intact — remote_general.txt is unstructured prose + system_prompt = load_prompt_template("ner.txt") + elif category == "LOCAL_SENTIMENT": + system_prompt = ( + "Classify the sentiment of the text as Positive, Negative, or Neutral. " + "Then provide exactly one sentence explaining your reasoning. " + "Format: