Customization Guide
Prompt Management
Export Current Prompts
# Export all prompts to YAML
netintel-ocr config export-prompts prompts.yaml
# Export specific category
netintel-ocr config export-prompts network-prompts.yaml --category network
Import Custom Prompts
# Import modified prompts
netintel-ocr config import-prompts custom-prompts.yaml
# Validate prompts
netintel-ocr config validate-prompts custom-prompts.yaml
Prompt Structure
network_detection:
description: "Detect network diagrams in images"
prompt: |
Analyze this image for network architecture elements:
- Routers, switches, firewalls
- Network zones and segments
- Connection types and protocols
Return confidence score 0-1.
component_extraction:
description: "Extract network components"
prompt: |
Identify all network components:
{
"components": [...],
"connections": [...],
"zones": [...]
}
Key Tuning Parameters
1. Detection Confidence Threshold
# Default: 0.7
netintel-ocr process file document.pdf --confidence-threshold 0.9
# Lower for more detection (may include false positives)
netintel-ocr process file document.pdf --confidence-threshold 0.5
2. Model Temperature
# In prompts.yaml
network_extraction:
temperature: 0.3 # Lower = more deterministic
max_tokens: 4096
top_p: 0.9
3. Context Window Size
# Surrounding text for context extraction
netintel-ocr --context-before 1000 --context-after 1000 document.pdf
# Disable context for speed
netintel-ocr process file document.pdf --no-context
# Fast extraction (less accurate)
netintel-ocr process file document.pdf --fast-extraction
# Comprehensive extraction (slower)
netintel-ocr process file document.pdf --comprehensive
# Multi-pass extraction
netintel-ocr --multi-pass 3 document.pdf
5. Output Verbosity
# Minimal output
netintel-ocr process file document.pdf --output minimal
# Include all metadata
netintel-ocr process file document.pdf --output detailed
# Custom fields
netintel-ocr db query --fields "components,security,recommendations" document.pdf
6. Mermaid Syntax Preferences
# In config.yaml
mermaid:
direction: TB # Top-Bottom (or LR, RL, BT)
theme: default
node_shape: rectangle # Or circle, diamond, hexagon
include_labels: true
simplify_connections: false
Model Selection Tips
Vision Models Comparison
| Model |
Speed |
Accuracy |
Memory |
Best For |
| qwen2.5vl:7b |
Fast |
High |
8GB |
General use |
| llava:13b |
Medium |
Very High |
16GB |
Complex diagrams |
| minicpm-v |
Very Fast |
Medium |
4GB |
Quick processing |
| cogvlm |
Slow |
Highest |
32GB |
Critical accuracy |
Selecting Models by Document Type
# Technical specifications
netintel-ocr --model Nanonets-OCR-s:latest \
--network-model cogvlm:latest \
technical-spec.pdf
# Marketing materials (simpler diagrams)
netintel-ocr --model minicpm-v:latest \
--network-model minicpm-v:latest \
marketing-doc.pdf
# Security documentation
netintel-ocr --model qwen2.5vl:7b \
--security-focus \
security-guide.pdf
Custom Processing Pipelines
Define Custom Pipeline
# custom_pipeline.py
from netintel_ocr import Pipeline
pipeline = Pipeline()
pipeline.add_step("ocr", model="Nanonets-OCR-s:latest")
pipeline.add_step("detect", confidence=0.8)
pipeline.add_step("extract", strategy="comprehensive")
pipeline.add_step("validate", fix_errors=True)
pipeline.add_step("context", window=2000)
Use Custom Pipeline
netintel-ocr config set pipeline custom_pipeline.py document.pdf
Advanced Prompt Engineering
component_extraction:
prompt: |
Extract network components with these specific details:
1. Component type (router/switch/firewall/server/endpoint)
2. Component name/label
3. IP addresses or network ranges
4. Security zone assignment
5. Criticality level (high/medium/low)
For each connection include:
- Source and destination components
- Protocol/port information
- Direction (unidirectional/bidirectional)
- Bandwidth or capacity if shown
Security Analysis Focus
security_analysis:
prompt: |
Analyze security aspects:
- Identify trust boundaries and security zones
- Detect exposed services and entry points
- Map data flows crossing zone boundaries
- Identify potential attack vectors
- Suggest security improvements
Priority: Accuracy over speed
Batch Processing
# Process multiple files efficiently
netintel-ocr process batch \
--max-parallel 4 \
--cache-models \
*.pdf
GPU Acceleration
# Enable GPU
export CUDA_VISIBLE_DEVICES=0
netintel-ocr process file document.pdf --gpu
# Multi-GPU
export CUDA_VISIBLE_DEVICES=0,1
netintel-ocr --gpu --parallel-pages 2 document.pdf
Caching
# Enable result caching
netintel-ocr config set cache.dir /tmp/netintel-cache document.pdf
# Clear cache
netintel-ocr system clear-cache
Validation Rules
Custom Validation
validation_rules:
network:
- rule: "All components must have unique IDs"
- rule: "Connections must reference existing components"
- rule: "Security zones must be properly labeled"
mermaid:
- rule: "No orphaned nodes"
- rule: "Valid Mermaid syntax"
- rule: "Consistent node naming"
Apply Validation
netintel-ocr config set validation.rules custom-rules.yaml document.pdf
Additional Resources
- Full Documentation: https://visionml.net/docs
- PyPI Package: https://pypi.org/project/netintel-ocr/
- Example Prompts: https://github.com/VisionMLNet/NetIntelOCR/tree/main/prompts
Next Steps