Skip to content

SDK Examples

Interactive examples demonstrating PromptKit SDK features.

All examples use the Pipeline architecture - audio, TTS, VAD, and other features flow through Pipeline middleware rather than SDK-specific methods.

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 limits
  • WithImagePreprocessing() for full control
  • Quality optimization for API costs and latency

Realtime video/image streaming for duplex sessions.

  • SendFrame() for webcam-like scenarios
  • WithStreamingVideo() 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.

All examples follow the pattern:

Terminal window
cd <example-name>
export OPENAI_API_KEY=your-key # or appropriate provider key
go run .

Examples with the _interactive.go suffix are designed to be run interactively and demonstrate features visually.

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 Pipeline

Benefits:

  • 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/.