Skip to content

Commit 44a925a

Browse files
kumarsjrkumarsjryogeshmpandey
authored
GenAI enablement handling and doc update (open-edge-platform#1501)
Co-authored-by: kumarsjr <shashank.kumar1@intel.com> Co-authored-by: Yogesh Pandey <yogesh.pandey@intel.com>
1 parent 699d65f commit 44a925a

File tree

2 files changed

+43
-17
lines changed

2 files changed

+43
-17
lines changed

metro-ai-suite/smart-nvr/docs/user-guide/get-started.md

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -118,36 +118,29 @@ source setup.sh stop
118118

119119
To enable Smart NVR's GenAI capabilities for intelligent event descriptions:
120120

121-
#### 1. Update Frigate Configuration
122-
123-
Modify `resources/frigate-config/config.yml`:
124-
125-
```yaml
126-
genai:
127-
enabled: true
128-
```
129-
130-
#### 2. Ensure VLM Service Availability
121+
#### 1. Ensure VLM Service Availability
131122

132123
Verify the VLM microservice is running and accessible at the configured endpoint.
133124

134-
#### 3. Set Environment Variable
135-
125+
#### 2. Set Environment Variable
136126
```bash
137127
export NVR_GENAI=true
138128
export VLM_SERVING_IP=<vlm-serving-device-ip>
139129
export VLM_SERVING_PORT=<vlm-serving-port>
140130
```
141131

142-
#### 4. Run the application
132+
#### 3. Run the application
143133

144134
Re-run the application after [configuring](./get-started.md#step-2-configure-environment) the rest of environment variables. Ensure that the environment value `export NVR_GENAI=true` is set.
145135

146136
> **⚠️ Important Notes**:
147137
>
148-
> - This feature is experimental and may be unstable due to underlying Frigate GenAI implementation
149-
> - Requires VLM microservice to be running
150-
> - Disabled by default for system stability
138+
> - This feature is experimental and may be unstable due to underlying Frigate GenAI implementation.
139+
> - Requires VLM microservice to be running.
140+
> - Disabled by default for system stability.
141+
> - SmartNVR uses either Frigate or Scenescape for GenAI capabilities. GenAI in both cannot be enabled at the same time. If Scenescape is enabled, its capabilities are prioritized over Frigate, with Frigate used in "dumb" mode.
142+
> - If NVR_SCENESCAPE=true. then NVR_GENAI must be set to false. Else, error is thrown.
143+
151144

152145
## Running Tests and Generating Coverage Report
153146

metro-ai-suite/smart-nvr/setup.sh

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,26 @@ configure_scenescape_setup() {
107107
fi
108108
}
109109

110+
configure_genai_setup() {
111+
print_info "Configuring GenAI setup based on NVR_GENAI setting"
112+
113+
if [ "${NVR_GENAI}" = "True" ] || [ "${NVR_GENAI}" = "true" ]; then
114+
print_info "NVR_GENAI is enabled - configuring GenAI mode"
115+
116+
if [ -f "./resources/frigate-config/config.yml" ]; then
117+
sed -i '/^\s*genai:/!b;n;s/enabled: false/enabled: true/' "./resources/frigate-config/config.yml"
118+
# Enable Detect - required for GenAI
119+
sed -i '/^\s*detect:/!b;n;s/enabled: false/enabled: true/' "./resources/frigate-config/config.yml"
120+
print_success "GenAI and Detection enabled in Frigate configuration"
121+
else
122+
print_error "Frigate config file not found at ./resources/frigate-config/config.yml"
123+
return 1
124+
fi
125+
else
126+
print_info "NVR_GENAI is disabled"
127+
fi
128+
}
129+
110130
# Function to validate required environment variables
111131
validate_environment() {
112132
# Check for NVR_GENAI flag
@@ -119,7 +139,15 @@ validate_environment() {
119139
print_error "NVR_SCENESCAPE environment variable is required"
120140
print_info "Please set it to 'true' or 'false' to enable/disable NVR SceneScape features"
121141
return 1
122-
fi
142+
fi
143+
144+
# Check for incompatible configuration
145+
if ([ "${NVR_SCENESCAPE}" = "True" ] || [ "${NVR_SCENESCAPE}" = "true" ]) && ([ "${NVR_GENAI}" = "True" ] || [ "${NVR_GENAI}" = "true" ]); then
146+
print_error "NVR_GENAI cannot be enabled when NVR_SCENESCAPE is enabled"
147+
print_info "Please set NVR_GENAI to 'false' if using SceneScape, or disable NVR_SCENESCAPE"
148+
return 1
149+
fi
150+
123151
# Check for VSS IP and port
124152
if [ -z "${VSS_SUMMARY_IP}" ]; then
125153
print_error "VSS_SUMMARY_IP environment variable is required"
@@ -201,6 +229,11 @@ start_services() {
201229
return 1
202230
fi
203231

232+
# Configure GenAI setup
233+
if ! configure_genai_setup; then
234+
return 1
235+
fi
236+
204237
print_info "Starting Docker Compose services..."
205238
# Run the Docker Compose stack with all services
206239
docker compose -f docker/compose.yaml up -d

0 commit comments

Comments
 (0)