| English | Korean | Chinese | Japanese |
LLM API-Powered Event Detection
Flexible AI API Integration
Surveillance Logic VMS supports two approaches to AI-powered event detection:
· Response APIs (Traditional LLM Integration): Send video frames to LLM servers such as OpenAI, Anthropic, and Google Gemini for image analysis and event detection. The VMS evaluates the returned responses and uses the results to trigger event logs and notifications.
· Decision APIs (Optimized Integration): Support the Typesafe JEV API and OpenAI Decision API, enabling AI models to return structured decision results directly. This approach reduces unnecessary response processing and can provide faster, more cost-effective event detection.
Users can select the API integration that best fits their AI service provider and application requirements.
How It Works
The VMS periodically sends video frames to the configured AI service for analysis. Depending on the selected API, the AI service returns either a traditional LLM response or a structured decision result.
The VMS evaluates the returned data using configurable expressions and automatically determines whether to record an event or send a notification.
This flexible architecture allows users to build real-time AI surveillance applications without requiring manual video monitoring.
Use Cases
· Traffic Monitoring: Detect car accidents and alert emergency services.
· Wildfire Detection: Identify early signs of wildfires.
· Security Breaches: Detect unauthorized access or suspicious activities.
· Industrial Safety: Identify hazardous situations and unsafe working conditions.
· Custom Event Detection: Define application-specific detection rules using AI-generated results.

Evaluation Guide
The VMS provides an expression-based evaluation environment for processing AI responses and controlling event logs and notifications. The same evaluation mechanism can be used with both traditional LLM APIs and Decision APIs.
Response Variables from AI
The following read-only variables store the results from the AI model:
· res: Depends on the request. It can be a Boolean value (true or false), an integer, or a floating-point value.
· res0, res1, ... res9: Integer or floating-point values.
· idx_max, idx_min: Index of the item with the highest or lowest value among res0 through res9. This variable is used in the System 1 Choice scenario.
· confidence: A floating-point value representing the confidence level of the decision. Used in the System 1 Choice and Score scenarios.
· str : Text string.
These variables can be used in expressions to define custom event detection conditions.
Control Variables
The following variables are set by the user to control event logging and notifications:
· record_event: indicates whether to record an event (true or false).
· notification: indicates whether to send a notification (true or false).
// Log event if the sum of res0 and res1 is greater than one.
record_event := res0 + res1 > 1;
// Log event if the variable res0 is greater than 0.5 and
// the variable res1 is less than 0.5.
record_event := res0 > 0.5 and res1 < 0.5;
// Log event if the string variable str is not empty.
record_event := str != '';
// Send notification if both res0 and res1 exceed five.
notification := res0 > 5 and res1 > 5;
// Send notification if the string variable str contains 'apple'.
notification := 'apple' in str;
Miscellaneous Variables(Persistent Variables)
The following variables can be used to store miscellaneous information: count and time_notification are set by the user and persist between evaluations.
All persistent variables are initialized to zero (0) by default.
· count: An integer used to count events or other occurrences (set by the user).
if (res == true)
count += 1; // If res is true, increment count.
else
count := 0; // Otherwise, reset count.
// If count exceeds three, send a notification.
notification := count > 3;
· time_now: the current timestamp (set by the VMS).
· time_notification: the timestamp of the last notification (set by the user).
// If more than 10 seconds have elapsed since the last
// notification and count exceeds three, send a notification
// and reset time_notification.
if (time_now - time_notification > 10 and count > 3) {
notification := true;
time_notification := time_now;
} else {
notification := false; // Otherwise, do not send a notification.
}
For more information about the syntax of the evaluation program, please refer to:
C++ Mathematical Expression Library
Revolutionizing CCTV: AI-Powered Event Detection with ChatGPT


