examples/

directory
v1.1.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2026 License: Apache-2.0

README ΒΆ

SDK Examples

Interactive examples demonstrating PromptKit SDK features.

Overview

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

Available Examples

πŸŽ™οΈ streaming-tts

Demonstrates streaming text-to-speech through the Pipeline.

  • Streaming LLM responses
  • TTS middleware converting text to audio
  • Real-time audio generation during streaming
πŸ—£οΈ voice-chat

Demonstrates voice conversation through the Pipeline.

  • VAD (Voice Activity Detection)
  • Turn detection
  • TTS responses
  • Full voice conversation flow
πŸ”„ streaming

Basic streaming example showing real-time LLM responses.

🎨 multimodal

Working with images, audio, and other media types.

πŸ–ΌοΈ image-preprocessing

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

Realtime video/image streaming for duplex sessions.

  • SendFrame() for webcam-like scenarios
  • WithStreamingVideo() for frame rate limiting
  • Simulated frame capture example
πŸ› οΈ tools

Function calling and tool integration.

πŸ“Š variables

Dynamic variable substitution in prompts.

πŸ” vad-demo

Voice Activity Detection examples.

πŸ‘€ hitl

Human-in-the-loop workflows.

πŸ‘‹ hello

Simple getting started example.

Running Examples

All examples follow the pattern:

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.

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

Directories ΒΆ

Path Synopsis
Package main demonstrates audio analysis capabilities with the PromptKit SDK.
Package main demonstrates audio analysis capabilities with the PromptKit SDK.
Package main demonstrates the simplest PromptKit SDK usage.
Package main demonstrates the simplest PromptKit SDK usage.
Package main demonstrates Human-in-the-Loop (HITL) tool approval with the PromptKit SDK.
Package main demonstrates Human-in-the-Loop (HITL) tool approval with the PromptKit SDK.
Package main demonstrates image preprocessing capabilities with the PromptKit SDK.
Package main demonstrates image preprocessing capabilities with the PromptKit SDK.
Package main demonstrates multimodal capabilities with the PromptKit SDK.
Package main demonstrates multimodal capabilities with the PromptKit SDK.
Package main demonstrates OpenAI Realtime API streaming with text mode.
Package main demonstrates OpenAI Realtime API streaming with text mode.
Package main demonstrates realtime video/image streaming with the PromptKit SDK.
Package main demonstrates realtime video/image streaming with the PromptKit SDK.
Package main demonstrates session recording and replay.
Package main demonstrates session recording and replay.
Package main demonstrates streaming responses with the PromptKit SDK.
Package main demonstrates streaming responses with the PromptKit SDK.
Package main demonstrates tool handling with the PromptKit SDK.
Package main demonstrates tool handling with the PromptKit SDK.
Package main demonstrates Voice Activity Detection (VAD) in PromptKit.
Package main demonstrates Voice Activity Detection (VAD) in PromptKit.
Package main demonstrates the Variable Providers feature in the PromptKit SDK.
Package main demonstrates the Variable Providers feature in the PromptKit SDK.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL