#!/usr/bin/env python3
import json
from benchmark import chat, MODELS
OPTS={"num_ctx":8192,"temperature":0,"top_p":1,"num_predict":1024}
TASKS={
"hebrew_to_english": """Translate the following Hebrew into natural, precise English. Preserve every time, causal relationship, and the distinction between service recovery and incident resolution. Return only the translation.\n\nלמרות שהשרת חזר לפעול בשעה 14:10, הצוות לא הכריז על סיום האירוע, מפני שתור המשימות המשיך לגדול. רק לאחר שבוטלה הגדרת המטמון השגויה בשעה 14:37 חזר זמן התגובה לרמה הרגילה.""",
"english_to_hebrew": """Translate into natural modern Hebrew suitable for a technical incident report. Preserve the cautious wording and return only the translation.\n\nThe rollout was paused after monitoring suggested— but did not yet prove— that the new query planner was responsible for the elevated error rate. No customer data was lost.""",
"incident_summary": """Read the incident notes and produce exactly four bullet points: Impact, Timeline, Root cause, and Follow-up. Each bullet must be at most 22 words. Distinguish observed facts from unresolved uncertainty.\n\nAt 09:12 UTC, checkout latency rose from a median of 180 ms to 2.8 seconds for customers in Australia and New Zealand. Requests elsewhere remained normal. The on-call engineer disabled the recommendation widget at 09:19, but this had no measurable effect. At 09:27 the team shifted traffic away from the Sydney read replica, and latency recovered by 09:31. Logs showed the replica repeatedly cancelling queries while applying a schema migration. The migration had completed successfully on the primary and other replicas. Engineers suspect a storage latency spike on the Sydney host made the migration overlap with peak traffic, but the provider has not confirmed the underlying storage event. No orders were lost, although 7.4% of checkout attempts in the affected region timed out. The team will add replica-lag-aware routing, rehearse regional failover, and wait for the provider's storage report before assigning a definitive infrastructure root cause.""",
"source_synthesis": """Using only the two reports below, write a neutral summary of at most 90 words. State what they agree on, their central disagreement, and what evidence would resolve it. Do not choose a winner.\n\nReport A: The trial reduced average handling time by 18%. Supervisors attribute the improvement to the assistant's suggested replies. The analysis compares the four trial weeks with the preceding four weeks.\n\nReport B: Handling time fell during the trial, but incoming tickets were 12% shorter and two experienced agents returned from leave. It argues the current comparison cannot isolate the assistant's effect. Both reports use the same help-desk export and agree customer satisfaction did not materially change."""
}
allres=[]
for model in MODELS:
 print('RUN',model,flush=True); r={'model':model,'tasks':{}}
 for name,prompt in TASKS.items():
  print(' ',name,flush=True);r['tasks'][name]=chat(model,[{'role':'user','content':prompt}],options=OPTS)
 allres.append(r);open('language-results.json','w').write(json.dumps(allres,indent=2,ensure_ascii=False))
print('WROTE language-results.json')
