SDK Examples
Interactive examples demonstrating PromptKit SDK features.
Overview
Section titled “Overview”All examples use the Pipeline architecture - audio, TTS, VAD, and other features flow through Pipeline middleware rather than SDK-specific methods.
Available Examples
Section titled “Available Examples”Demonstrates streaming text-to-speech through the Pipeline.
- Streaming LLM responses
- TTS middleware converting text to audio
- Real-time audio generation during streaming
Demonstrates voice conversation through the Pipeline.
- VAD (Voice Activity Detection)
- Turn detection
- TTS responses
- Full voice conversation flow
Basic streaming example showing real-time LLM responses.
Working with images, audio, and other media types.
Automatic image resizing and optimization for vision models.
WithAutoResize()for simple size limitsWithImagePreprocessing()for full control- Quality optimization for API costs and latency
Realtime video/image streaming for duplex sessions.
SendFrame()for webcam-like scenariosWithStreamingVideo()for frame rate limiting- Simulated frame capture example
Function calling and tool integration.
Dynamic variable substitution in prompts.
Voice Activity Detection examples.
Human-in-the-loop workflows.
Simple getting started example.
Running Examples
Section titled “Running Examples”All examples follow the pattern:
cd <example-name>export OPENAI_API_KEY=your-key # or appropriate provider keygo run .Examples with the _interactive.go suffix are designed to be run interactively and demonstrate features visually.
Architecture Note
Section titled “Architecture Note”Pipeline-First Design:
These examples demonstrate the correct architecture where TTS, VAD, and audio processing happen through Pipeline middleware, not via SDK convenience methods.
✅ Correct: Configure Pipeline → Everything flows through middleware❌ Old way: SDK methods bypass PipelineBenefits:
- Consistent interface for all processing
- Middleware composability
- Testable with mocks
- Observable via hooks
- Lower latency (streaming audio generation)
For integration tests and lower-level Pipeline usage, see tests/integration/.