This directory contains various example configurations demonstrating different features and use cases of DialogChain.
- Basic Examples
- File Processing
- Messaging & Integration
- Advanced Examples
- Tutorial Examples
- Running Examples
A simple timer that logs "Hello, World!" every 5 seconds.
Features:
- Basic timer configuration
- Simple message templating
- Logging output
Usage:
python -m dialogchain run --config examples/basic_timer.yamlBasic timer example with structured JSON output.
Features:
- Structured JSON output
- Dynamic timestamp inclusion
- Configurable interval
Minimal "Hello World" example demonstrating the simplest possible DialogChain configuration.
Watches a file for changes and processes its contents.
Features:
- File system monitoring
- Content extraction
- Line and word counting
Dependencies:
- File system access to the monitored file
Monitors a file and publishes changes to an MQTT topic.
Features:
- File system integration
- MQTT publishing
- Content transformation
Dependencies:
- MQTT broker
- File system access
Processes JSON files with multiple transformation steps.
Features:
- JSON parsing
- Multi-step transformations
- Conditional processing
Implements MQTT publisher and subscriber functionality.
Features:
- MQTT publishing and subscribing
- Topic-based routing
- Message transformation
Dependencies:
- MQTT broker
Sets up an HTTP endpoint for receiving and processing requests.
Features:
- HTTP server
- Request/response handling
- URL routing
Demonstrates gRPC service integration.
Features:
- gRPC server
- Protocol Buffers
- Service definitions
Dependencies:
- gRPC tools
- Protocol buffer definitions
Combines multiple routes and processors for a complete workflow.
Features:
- Multiple routes
- Complex transformations
- Error handling
Generates and processes structured sensor data.
Features:
- Structured data generation
- Conditional processing
- Data enrichment
Video processing pipeline example.
Features:
- Video capture
- Frame processing
- Real-time analysis
Dependencies:
- OpenCV
- Camera access
IoT device communication patterns.
Features:
- Device management
- Data collection
- Command handling
Contains basic examples for getting started:
basic_usage_dsl.yaml: Basic DSL usagefile_watcher.yaml: Simple file watchinghttp_handler.yaml: Basic HTTP handlingtimer_to_log.yaml: Timer to log example
Example for processing email invoices.
Features:
- Email parsing
- Attachment handling
- Data extraction
Example for processing web-based invoices.
Features:
- Web scraping
- Form handling
- Data extraction
- Python 3.8+
- DialogChain installed (
pip install -e .from project root) - Additional dependencies as specified in each example
# Run a specific example
python -m dialogchain run --config examples/example_name.yaml
# Run with verbose output
python -m dialogchain run --config examples/example_name.yaml -vFor examples requiring additional services:
# Start required services
docker-compose -f docker-compose.test.yml up -d
# Run the example
python -m dialogchain run --config examples/example_name.yaml-
Missing Dependencies
- Install required Python packages:
pip install -r requirements.txt - For MQTT examples, ensure an MQTT broker is running
- For camera examples, ensure camera access is properly configured
- Install required Python packages:
-
Permission Issues
- Ensure read/write permissions for file operations
- Check service account permissions for cloud integrations
-
Debugging
- Use
-vflag for verbose output - Check log files in the configured log directory
- Verify network connectivity for remote services
- Use
When adding new examples:
- Follow the existing naming conventions
- Include clear comments in configuration files
- Document any external dependencies
- Update this documentation
- Add tests when applicable