import os MODEL="grok-4.20-0309-non-reasoning"; BASE="https://api.x.ai/v1"; KEY=os.environ["XAI_API_KEY"] csv=open(os.path.join(os.path.dirname(__file__),"invoices.csv")).read() SYSTEM=("You are a UK bookkeeping assistant. Goal: Prepare accurate credit-control summaries for a UK small business. " "You help a small UK firm chase unpaid invoices. UK standard VAT rate is 20%.") TASK=(f"Today is 2026-10-14. All invoices below are unpaid. Data:\n{csv}\n" "1) For each invoice compute VAT at 20% and gross total (GBP, 2dp). 2) List which invoices are overdue (due date before today). " "3) Give the total gross amount overdue. 4) Draft a short, polite UK-English chaser email to the customer with the oldest overdue invoice.")