Base Service Classes
Reference documentation for Pipecat’s base service classes
Overview
Pipecat services inherit from base classes that define common functionality, parameters, and methods shared across similar service types.
BaseTransport
Base class for transport implementations that handle audio/video I/O streams.
Constructor Parameters
Name identifier for the input stream
Name identifier for the output stream
Event loop to use for async operations. Defaults to the current running loop.
Methods
Returns the input frame processor. Must be implemented by subclasses.
Returns the output frame processor. Must be implemented by subclasses.
Decorator to register an event handler for the specified event.
Adds an event handler function for the specified event.
TransportParams
Configuration parameters for transport audio/video capabilities.
Parameters
Video Output Configuration
Enable camera output
Whether camera output is live streaming
Camera output width in pixels
Camera output height in pixels
Camera output bitrate in bits/second
Camera output framerate
Camera output color format
Audio Output Configuration
Enable audio output
Whether audio output is live streaming
Audio output sample rate in Hz
Number of audio output channels
Audio output bitrate in bits/second
Audio mixer for output processing
Audio Input Configuration
Enable audio input
Audio input sample rate in Hz
Number of audio input channels
Audio filter for input processing
VAD Configuration
Enable Voice Activity Detection
When the VAD is enabled, determines whether to pass through audio frames. This is required in order to pass through audio if you’re using an STT service and have the VAD enabled.
Voice Activity Detection analyzer. You can set this to either
SileroVADAnalyzer()
or WebRTCVADAnalyzer()
.
STTService
Base class for Speech-to-Text services.
Constructor Parameters
Whether to pass through audio frames
Methods
Sets the STT model.
Sets the recognition language.
LLMService
Base class for LLM services.
Methods
Registers a function handler. Use None
as function_name to handle all functions.
Removes a registered function handler.
Checks if a function handler is registered.
Requests an image from a user.
TTSService
Base class for Text-to-Speech services.
Constructor Parameters
Output audio sample rate in Hz
Text filter for preprocessing
Methods
Sets the TTS model.
Sets the voice identifier.
Converts text to speech immediately.
Text Filters
Base class for text preprocessing filters used by TTS services.
MarkdownTextFilter
Removes Markdown formatting from text while preserving structure and readability.
Constructor Parameters
Enable/disable text filtering
Remove code blocks from the text
Remove Markdown tables from the text
Usage Example
ImageGenService
Base class for Image Generation services.
Methods
Core image generation method to be implemented by services.
VisionService
Base class for Vision services.
Methods
Core vision processing method to be implemented by services.