Reply by industrial_ai_dev_rachel
Yeah you got the flow right. For the LLM hosting we actually use both - Azure OpenAI for most queries because it has better data residency guarantees and HIPAA compliance (we're in pharma), but we also have a local Llama model running on a GPU server for offline capability. The local model isn't as good at understanding complex queries but it works fine for basic stuff. Here's a rough example of how we structure the LLM prompt:
system_prompt = """You are an industrial SCADA assistant. You can help operators query process data.
Available functions:
- get_tag_value(tag_name, timestamp): Get a specific tag value at a time
- get_tag_history(tag_name, start_time, end_time): Get historical data range
- get_active_alarms(plant_area): Get current alarms for an area
- get_alarm_history(start_time, end_time, severity): Get past alarms
IMPORTANT:
- Only query tags the user has permission to access
- Always specify time ranges, don't query more than 7 days at once
- Tag names must match exactly: "FT-101" not "flow transmitter 101"
The trick is constraining the LLM enough that it can't do anything dangerous while still being useful. We spent a lot of time building a good tag name lookup system because operators say things like "the main feed pump" but the actual tag is "P-3301_SPEED_PV".