Add deprecation directives, add indexing, only autodoc members

This commit is contained in:
Mark Backman
2025-07-02 13:57:57 -07:00
parent e19c5464fe
commit abee0f853c
17 changed files with 132 additions and 44 deletions

View File

@@ -86,6 +86,13 @@ We follow Google-style docstrings with these specific conventions:
- Use section headers like "Supported features:" or "Behavior:" before lists - Use section headers like "Supported features:" or "Behavior:" before lists
- For complex nested information, consider using paragraph format instead - For complex nested information, consider using paragraph format instead
**Deprecations:**
- Use `warnings.warn()` in code for runtime deprecation warnings
- Add `.. deprecated::` directive in docstrings for documentation visibility
- Include version information and describe current status
- Describe parameters in present tense, use directive to indicate deprecation status
#### Examples: #### Examples:
```python ```python
@@ -103,14 +110,24 @@ class MyService(BaseService):
- Feature three for advanced use cases - Feature three for advanced use cases
""" """
def __init__(self, param1: str, param2: bool = True, **kwargs): def __init__(self, param1: str, old_param: str = None, **kwargs):
"""Initialize the service. """Initialize the service.
Args: Args:
param1: Description of param1. param1: Description of param1.
param2: Description of param2. Defaults to True. old_param: Controls legacy behavior.
.. deprecated:: 1.2.0
This parameter no longer has any effect and will be removed in version 2.0.
**kwargs: Additional arguments passed to parent. **kwargs: Additional arguments passed to parent.
""" """
if old_param is not None:
import warnings
warnings.warn(
"Parameter 'old_param' is deprecated and will be removed in version 2.0.",
DeprecationWarning,
)
super().__init__(**kwargs) super().__init__(**kwargs)
@property @property
@@ -133,21 +150,6 @@ class MyService(BaseService):
""" """
pass pass
# Dataclass
@dataclass
class ConfigParams:
"""Configuration parameters for the service.
Parameters:
host: The host address.
port: The port number. Defaults to 8080.
timeout: Connection timeout in seconds.
"""
host: str
port: int = 8080
timeout: float = 30.0
# Dataclass with code examples # Dataclass with code examples
@dataclass @dataclass
class MessageFrame: class MessageFrame:
@@ -155,21 +157,13 @@ class MessageFrame:
Supports both simple and content list message formats. Supports both simple and content list message formats.
Examples: Example::
Simple format::
[ [
{"role": "user", "content": "Hello"}, {"role": "user", "content": "Hello"},
{"role": "assistant", "content": "Hi there!"} {"role": "assistant", "content": "Hi there!"}
] ]
Content list format::
[
{"role": "user", "content": [{"type": "text", "text": "Hello"}]},
{"role": "assistant", "content": [{"type": "text", "text": "Hi there!"}]}
]
Parameters: Parameters:
messages: List of messages in OpenAI format. messages: List of messages in OpenAI format.
""" """

View File

@@ -38,9 +38,8 @@ napoleon_include_init_with_doc = True
autodoc_default_options = { autodoc_default_options = {
"members": True, "members": True,
"member-order": "bysource", "member-order": "bysource",
"undoc-members": True, "undoc-members": False,
"exclude-members": "__weakref__,model_config", "exclude-members": "__weakref__,model_config",
"no-index": True,
"show-inheritance": True, "show-inheritance": True,
} }

View File

@@ -76,6 +76,10 @@ class PipelineParams(BaseModel):
heartbeats_period_secs: Period between heartbeats in seconds. heartbeats_period_secs: Period between heartbeats in seconds.
interruption_strategies: Strategies for bot interruption behavior. interruption_strategies: Strategies for bot interruption behavior.
observers: [deprecated] Use `observers` arg in `PipelineTask` class. observers: [deprecated] Use `observers` arg in `PipelineTask` class.
.. deprecated:: 0.0.58
Use the `observers` argument in the `PipelineTask` class instead.
report_only_initial_ttfb: Whether to report only initial time to first byte. report_only_initial_ttfb: Whether to report only initial time to first byte.
send_initial_empty_metrics: Whether to send initial empty metrics. send_initial_empty_metrics: Whether to send initial empty metrics.
start_metadata: Additional metadata for pipeline start. start_metadata: Additional metadata for pipeline start.

View File

@@ -70,7 +70,12 @@ class AudioBufferProcessor(FrameProcessor):
sample_rate: Desired output sample rate. If None, uses source rate. sample_rate: Desired output sample rate. If None, uses source rate.
num_channels: Number of channels (1 for mono, 2 for stereo). Defaults to 1. num_channels: Number of channels (1 for mono, 2 for stereo). Defaults to 1.
buffer_size: Size of buffer before triggering events. 0 for no buffering. buffer_size: Size of buffer before triggering events. 0 for no buffering.
user_continuous_stream: Deprecated parameter for backwards compatibility. user_continuous_stream: Controls whether user audio is treated as a continuous
stream for buffering purposes.
.. deprecated:: 0.0.72
This parameter no longer has any effect and will be removed in a future version.
enable_turn_audio: Whether turn audio event handlers should be triggered. enable_turn_audio: Whether turn audio event handlers should be triggered.
**kwargs: Additional arguments passed to parent class. **kwargs: Additional arguments passed to parent class.
""" """

View File

@@ -343,7 +343,12 @@ class AWSPollyTTSService(TTSService):
class PollyTTSService(AWSPollyTTSService): class PollyTTSService(AWSPollyTTSService):
"""Deprecated alias for AWSPollyTTSService.""" """Deprecated alias for AWSPollyTTSService.
.. deprecated:: 0.0.67
`PollyTTSService` is deprecated, use `AWSPollyTTSService` instead.
"""
def __init__(self, **kwargs): def __init__(self, **kwargs):
"""Initialize the deprecated PollyTTSService. """Initialize the deprecated PollyTTSService.

View File

@@ -151,7 +151,7 @@ class CurrentContent:
class Params(BaseModel): class Params(BaseModel):
"""Configuration parameters for AWS Nova Sonic. """Configuration parameters for AWS Nova Sonic.
Attributes: Parameters:
input_sample_rate: Audio input sample rate in Hz. input_sample_rate: Audio input sample rate in Hz.
input_sample_size: Audio input sample size in bits. input_sample_size: Audio input sample size in bits.
input_channel_count: Number of input audio channels. input_channel_count: Number of input audio channels.

View File

@@ -98,7 +98,10 @@ class CartesiaTTSService(AudioContextWordTTSService):
Parameters: Parameters:
language: Language to use for synthesis. language: Language to use for synthesis.
speed: Voice speed control (string or float). speed: Voice speed control (string or float).
emotion: List of emotion controls (deprecated). emotion: List of emotion controls.
.. deprecated:: 0.0.68
The `emotion` parameter is deprecated and will be removed in a future version.
""" """
language: Optional[Language] = Language.EN language: Optional[Language] = Language.EN
@@ -414,7 +417,10 @@ class CartesiaHttpTTSService(TTSService):
Parameters: Parameters:
language: Language to use for synthesis. language: Language to use for synthesis.
speed: Voice speed control (string or float). speed: Voice speed control (string or float).
emotion: List of emotion controls (deprecated). emotion: List of emotion controls.
.. deprecated:: 0.0.68
The `emotion` parameter is deprecated and will be removed in a future version.
""" """
language: Optional[Language] = Language.EN language: Optional[Language] = Language.EN

View File

@@ -65,7 +65,11 @@ class DeepgramSTTService(STTService):
Args: Args:
api_key: Deepgram API key for authentication. api_key: Deepgram API key for authentication.
url: Deprecated. Use base_url instead. url: Custom Deepgram API base URL.
.. deprecated:: 0.0.64
Parameter `url` is deprecated, use `base_url` instead.
base_url: Custom Deepgram API base URL. base_url: Custom Deepgram API base URL.
sample_rate: Audio sample rate. If None, uses default or live_options value. sample_rate: Audio sample rate. If None, uses default or live_options value.
live_options: Deepgram LiveOptions for detailed configuration. live_options: Deepgram LiveOptions for detailed configuration.

View File

@@ -153,7 +153,12 @@ class GladiaInputParams(BaseModel):
custom_metadata: Additional metadata to include with requests custom_metadata: Additional metadata to include with requests
endpointing: Silence duration in seconds to mark end of speech endpointing: Silence duration in seconds to mark end of speech
maximum_duration_without_endpointing: Maximum utterance duration without silence maximum_duration_without_endpointing: Maximum utterance duration without silence
language: DEPRECATED - Use language_config instead language: Language code for transcription
.. deprecated:: 0.0.62
The 'language' parameter is deprecated and will be removed in a future version.
Use 'language_config' instead.
language_config: Detailed language configuration language_config: Detailed language configuration
pre_processing: Audio pre-processing options pre_processing: Audio pre-processing options
realtime_processing: Real-time processing features realtime_processing: Real-time processing features

View File

@@ -189,6 +189,9 @@ class GladiaSTTService(STTService):
Provides automatic reconnection, audio buffering, and comprehensive error handling. Provides automatic reconnection, audio buffering, and comprehensive error handling.
For complete API documentation, see: https://docs.gladia.io/api-reference/v2/live/init For complete API documentation, see: https://docs.gladia.io/api-reference/v2/live/init
.. deprecated:: 0.0.62
Use :class:`~pipecat.services.gladia.config.GladiaInputParams` directly instead.
""" """
# Maintain backward compatibility # Maintain backward compatibility

View File

@@ -362,7 +362,7 @@ class GoogleSTTService(STTService):
with streaming support. Handles audio transcription and optional voice activity detection. with streaming support. Handles audio transcription and optional voice activity detection.
Implements automatic stream reconnection to handle Google's 4-minute streaming limit. Implements automatic stream reconnection to handle Google's 4-minute streaming limit.
Attributes: Parameters:
InputParams: Configuration parameters for the STT service. InputParams: Configuration parameters for the STT service.
STREAMING_LIMIT: Google Cloud's streaming limit in milliseconds (4 minutes). STREAMING_LIMIT: Google Cloud's streaming limit in milliseconds (4 minutes).

View File

@@ -273,6 +273,10 @@ class LLMService(AIService):
parameter. parameter.
start_callback: Legacy callback function (deprecated). Put initialization start_callback: Legacy callback function (deprecated). Put initialization
code at the top of your handler instead. code at the top of your handler instead.
.. deprecated:: 0.0.59
The `start_callback` parameter is deprecated and will be removed in a future version.
cancel_on_interruption: Whether to cancel this function call when an cancel_on_interruption: Whether to cancel this function call when an
interruption occurs. Defaults to True. interruption occurs. Defaults to True.
""" """

View File

@@ -660,7 +660,8 @@ class RivaSegmentedSTTService(SegmentedSTTService):
class ParakeetSTTService(RivaSTTService): class ParakeetSTTService(RivaSTTService):
"""Deprecated speech-to-text service using NVIDIA Parakeet models. """Deprecated speech-to-text service using NVIDIA Parakeet models.
This class is deprecated. Use RivaSTTService instead for equivalent functionality .. deprecated:: 0.0.66
This class is deprecated. Use `RivaSTTService` instead for equivalent functionality
with Parakeet models by specifying the appropriate model_function_map. with Parakeet models by specifying the appropriate model_function_map.
""" """

View File

@@ -188,6 +188,7 @@ class RivaTTSService(TTSService):
class FastPitchTTSService(RivaTTSService): class FastPitchTTSService(RivaTTSService):
"""Deprecated FastPitch TTS service. """Deprecated FastPitch TTS service.
.. deprecated:: 0.0.66
This class is deprecated. Use RivaTTSService instead for new implementations. This class is deprecated. Use RivaTTSService instead for new implementations.
Provides backward compatibility for existing FastPitch TTS integrations. Provides backward compatibility for existing FastPitch TTS integrations.
""" """

View File

@@ -94,6 +94,10 @@ class TTSService(AIService):
text_aggregator: Custom text aggregator for processing incoming text. text_aggregator: Custom text aggregator for processing incoming text.
text_filters: Sequence of text filters to apply after aggregation. text_filters: Sequence of text filters to apply after aggregation.
text_filter: Single text filter (deprecated, use text_filters). text_filter: Single text filter (deprecated, use text_filters).
.. deprecated:: 0.0.59
Use `text_filters` instead, which allows multiple filters.
transport_destination: Destination for generated audio frames. transport_destination: Destination for generated audio frames.
**kwargs: Additional arguments passed to the parent AIService. **kwargs: Additional arguments passed to the parent AIService.
""" """

View File

@@ -29,13 +29,53 @@ class TransportParams(BaseModel):
Parameters: Parameters:
camera_in_enabled: Enable camera input (deprecated, use video_in_enabled). camera_in_enabled: Enable camera input (deprecated, use video_in_enabled).
.. deprecated:: 0.0.66
The `camera_in_enabled` parameter is deprecated, use
`video_in_enabled` instead.
camera_out_enabled: Enable camera output (deprecated, use video_out_enabled). camera_out_enabled: Enable camera output (deprecated, use video_out_enabled).
.. deprecated:: 0.0.66
The `camera_out_enabled` parameter is deprecated, use
`video_out_enabled` instead.
camera_out_is_live: Enable real-time camera output (deprecated). camera_out_is_live: Enable real-time camera output (deprecated).
.. deprecated:: 0.0.66
The `camera_out_is_live` parameter is deprecated, use
`video_out_is_live` instead.
camera_out_width: Camera output width in pixels (deprecated). camera_out_width: Camera output width in pixels (deprecated).
.. deprecated:: 0.0.66
The `camera_out_width` parameter is deprecated, use
`video_out_width` instead.
camera_out_height: Camera output height in pixels (deprecated). camera_out_height: Camera output height in pixels (deprecated).
.. deprecated:: 0.0.66
The `camera_out_height` parameter is deprecated, use
`video_out_height` instead.
camera_out_bitrate: Camera output bitrate in bits per second (deprecated). camera_out_bitrate: Camera output bitrate in bits per second (deprecated).
.. deprecated:: 0.0.66
The `camera_out_bitrate` parameter is deprecated, use
`video_out_bitrate` instead.
camera_out_framerate: Camera output frame rate in FPS (deprecated). camera_out_framerate: Camera output frame rate in FPS (deprecated).
.. deprecated:: 0.0.66
The `camera_out_framerate` parameter is deprecated, use
`video_out_framerate` instead.
camera_out_color_format: Camera output color format string (deprecated). camera_out_color_format: Camera output color format string (deprecated).
.. deprecated:: 0.0.66
The `camera_out_color_format` parameter is deprecated, use
`video_out_color_format` instead.
audio_out_enabled: Enable audio output streaming. audio_out_enabled: Enable audio output streaming.
audio_out_sample_rate: Output audio sample rate in Hz. audio_out_sample_rate: Output audio sample rate in Hz.
audio_out_channels: Number of output audio channels. audio_out_channels: Number of output audio channels.
@@ -59,7 +99,17 @@ class TransportParams(BaseModel):
video_out_color_format: Video output color format string. video_out_color_format: Video output color format string.
video_out_destinations: List of video output destination identifiers. video_out_destinations: List of video output destination identifiers.
vad_enabled: Enable Voice Activity Detection (deprecated). vad_enabled: Enable Voice Activity Detection (deprecated).
.. deprecated:: 0.0.66
The `vad_enabled` parameter is deprecated, use `audio_in_enabled`
and `TransportParams.vad_analyzer` instead.
vad_audio_passthrough: Enable VAD audio passthrough (deprecated). vad_audio_passthrough: Enable VAD audio passthrough (deprecated).
.. deprecated:: 0.0.66
The `vad_audio_passthrough` parameter is deprecated, use `audio_in_passthrough`
instead.
vad_analyzer: Voice Activity Detection analyzer instance. vad_analyzer: Voice Activity Detection analyzer instance.
turn_analyzer: Turn-taking analyzer instance for conversation management. turn_analyzer: Turn-taking analyzer instance for conversation management.
""" """

View File

@@ -1977,6 +1977,9 @@ class DailyTransport(BaseTransport):
async def send_dtmf(self, settings): async def send_dtmf(self, settings):
"""Send DTMF tones during a call (deprecated). """Send DTMF tones during a call (deprecated).
.. deprecated:: 0.0.69
Push an `OutputDTMFFrame` or an `OutputDTMFUrgentFrame` instead.
Args: Args:
settings: DTMF settings including tones and target session. settings: DTMF settings including tones and target session.
""" """