DEV Community

shashank ms
shashank ms

Posted on

Introduction to LLMs for Utilities and Telecommunications Professionals

We are going to build an outage triage agent that turns raw customer reports into structured dispatch tickets. This helps utilities and telecom operators cut response time by automating the first line of classification. I will walk through the exact Python I run in production against Oxlo.ai.

What you'll need

Step 1: Configure the Oxlo.ai client

I start by instantiating the OpenAI-compatible client pointing at Oxlo.ai. This client is a drop-in replacement, so the rest of the code looks like any standard OpenAI example.

from openai import OpenAI

client = OpenAI(base_url="https://api.oxlo.ai/v1", api_key="YOUR_OXLO_API_KEY")

Step 2: Define the triage system prompt

The system prompt is the only instructions the agent receives. I keep it strict: JSON output only, a closed set of enums for service type and severity, and clear escalation rules based on safety.

SYSTEM_PROMPT = """You are an outage triage agent for a combined utility and telecommunications company. Your job is to read unstructured customer reports and extract structured fields.

Return a JSON object with exactly these keys:
- location: the street address or neighborhood mentioned
- service_type: one of [power, water, gas, internet, mobile]
- severity: one of [low, medium, high, critical] based on safety implications and number of customers likely affected
- summary: a one-sentence description of the issue
- crew_type: one of [electric_line, water_main, gas_leak, network_ops, customer_support]

Rules:
- If the report mentions sparks, fire, gas smell, or injury, severity is critical.
- If the report mentions an entire building or neighborhood, severity is at least high.
- If only one residence mentions a billing question, severity is low and crew_type is customer_support.
- Do not add extra keys. Do not wrap the JSON in markdown code fences."""

Step 3: Build the report parser

I wrap the API call in a small function. I use JSON mode so the model returns valid machine-readable output, and I keep temperature low to avoid creative hallucinations on safety-critical classifications.

import json

def triage_report(raw_report: str) -> dict:
    response = client.chat.completions.create(
        model="llama-3.3-70b",
        messages=[
            {"role": "system", "content": SYSTEM_PROMPT},
            {"role": "user", "content": raw_report},
        ],
        response_format={"type": "json_object"},
        temperature=0.1,
    )
    return json.loads(response.choices[0].message.content)

Step 4: Add escalation logic

LLMs should not make dispatch decisions alone. I add a thin Python layer that maps the model's severity label to internal business rules. Critical outages notify a manager immediately, while low severity hits the standard queue.

def apply_business_rules(triage: dict) -> dict:
    ticket = triage.copy()
    severity = ticket.get("severity", "low")

    if severity == "critical":
        ticket["dispatch_urgency"] = "immediate"
        ticket["notify_manager"] = True
    elif severity == "high":
        ticket["dispatch_urgency"] = "within_1_hour"
        ticket["notify_manager"] = True
    else:
        ticket["dispatch_urgency"] = "standard_queue"
        ticket["notify_manager"] = False

    return ticket

Run it

I can now feed the agent a raw SMS-style report and print the final ticket.

if __name__ == "__main__":
    raw_report = (
        "Burning smell from the transformer on Oak St. "
        "Whole block lost power and I see flames."
    )

    triage = triage_report(raw_report)
    ticket = apply_business_rules(triage)

    print(json.dumps(ticket, indent=2))

When I run the script, the output looks like this:

{
  "location": "Oak St",
  "service_type": "power",
  "severity": "critical",
  "summary": "Transformer fire causing block-wide power outage",
  "crew_type": "electric_line",
  "dispatch_urgency": "immediate",
  "notify_manager": true
}

Next steps

Expose the triage_report function as a FastAPI endpoint and wire it to your SMS or IVR webhook so field crews receive tickets in real time. If you later need deeper reasoning for complex multi-outage narratives, swap in a model like DeepSeek R1 671B or Kimi K2.6 on Oxlo.ai. Because Oxlo.ai charges a flat rate per request rather than per token, your costs stay predictable even when customer reports grow into long, threaded conversations.

Top comments (0)