From f078b8b867ce2d9d3146d759d6ed342449933cfd Mon Sep 17 00:00:00 2001 From: Mark Backman Date: Fri, 3 Apr 2026 09:55:27 -0400 Subject: [PATCH] Fix Sphinx docstring RST formatting warnings Replace Markdown code blocks with RST syntax in genesys.py, fix deprecated directive transitions in nvidia and summarization modules, remove stray bullet prefix in whisper arg docs, restructure code block in turn completion mixin, and add deepgram mock to Sphinx conf. --- docs/api/conf.py | 2 ++ src/pipecat/serializers/genesys.py | 15 ++++++--------- src/pipecat/services/google/tts.py | 3 +-- src/pipecat/services/nvidia/stt.py | 4 +++- src/pipecat/services/nvidia/tts.py | 4 +++- src/pipecat/services/whisper/base_stt.py | 2 +- src/pipecat/turns/user_turn_completion_mixin.py | 9 +++++---- .../utils/context/llm_context_summarization.py | 4 +++- 8 files changed, 24 insertions(+), 19 deletions(-) diff --git a/docs/api/conf.py b/docs/api/conf.py index d366776a8..cb2153c73 100644 --- a/docs/api/conf.py +++ b/docs/api/conf.py @@ -97,6 +97,8 @@ autodoc_mock_imports = [ "fastapi.middleware", "fastapi.responses", "uvicorn", + # Deepgram dependencies + "deepgram", ] # HTML output settings diff --git a/src/pipecat/serializers/genesys.py b/src/pipecat/serializers/genesys.py index 4e0c11504..ceb7724be 100644 --- a/src/pipecat/serializers/genesys.py +++ b/src/pipecat/serializers/genesys.py @@ -95,8 +95,8 @@ class GenesysAudioHookSerializer(FrameSerializer): - Text WebSocket frames for JSON control messages - Binary WebSocket frames for audio data - Example usage: - ```python + Example usage:: + serializer = GenesysAudioHookSerializer( params=GenesysAudioHookSerializer.InputParams( channel=AudioHookChannel.EXTERNAL, @@ -122,7 +122,6 @@ class GenesysAudioHookSerializer(FrameSerializer): # Set output variables to return to Architect serializer.set_output_variables({"intent": "billing", "resolved": True}) - ``` Attributes: PROTOCOL_VERSION: The AudioHook protocol version (currently "2"). @@ -246,8 +245,8 @@ class GenesysAudioHookSerializer(FrameSerializer): Args: variables: Dictionary of custom variables to send to Genesys. - Example: - ```python + Example:: + # During the conversation, collect data and set it serializer.set_output_variables({ "intent": "billing_inquiry", @@ -255,7 +254,6 @@ class GenesysAudioHookSerializer(FrameSerializer): "summary": "Customer asked about their bill", "transfer_to": "billing_queue" }) - ``` """ self._output_variables = variables logger.debug(f"Output variables set: {variables}") @@ -413,8 +411,8 @@ class GenesysAudioHookSerializer(FrameSerializer): Returns: Dictionary of the closed response message. - Example: - ```python + Example:: + # Pass custom data back to Genesys serializer.create_closed_response( output_variables={ @@ -423,7 +421,6 @@ class GenesysAudioHookSerializer(FrameSerializer): "summary": "Customer asked about their bill" } ) - ``` """ parameters: Optional[Dict[str, Any]] = None diff --git a/src/pipecat/services/google/tts.py b/src/pipecat/services/google/tts.py index 5b919d30e..81ede9ef8 100644 --- a/src/pipecat/services/google/tts.py +++ b/src/pipecat/services/google/tts.py @@ -520,8 +520,7 @@ class GoogleTTSSettings(TTSSettings): speaking_rate: float | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) -#: .. deprecated:: 0.0.105 -#: Use ``GoogleTTSService.Settings`` instead. +#: *Deprecated since 0.0.105:* Use ``GoogleTTSService.Settings`` instead. GoogleStreamTTSSettings = GoogleTTSSettings diff --git a/src/pipecat/services/nvidia/stt.py b/src/pipecat/services/nvidia/stt.py index 50a654191..e8ef3dc08 100644 --- a/src/pipecat/services/nvidia/stt.py +++ b/src/pipecat/services/nvidia/stt.py @@ -269,7 +269,9 @@ class NvidiaSTTService(STTService): .. deprecated:: 0.0.104 Model cannot be changed after initialization for NVIDIA Riva streaming STT. - Set model and function id in the constructor instead, e.g.:: + Set model and function id in the constructor instead. + + Example:: NvidiaSTTService( api_key=..., diff --git a/src/pipecat/services/nvidia/tts.py b/src/pipecat/services/nvidia/tts.py index 5e7a20a3c..c42acc02e 100644 --- a/src/pipecat/services/nvidia/tts.py +++ b/src/pipecat/services/nvidia/tts.py @@ -163,7 +163,9 @@ class NvidiaTTSService(TTSService): .. deprecated:: 0.0.104 Model cannot be changed after initialization for NVIDIA Riva TTS. - Set model and function id in the constructor instead, e.g.:: + Set model and function id in the constructor instead. + + Example:: NvidiaTTSService( api_key=..., diff --git a/src/pipecat/services/whisper/base_stt.py b/src/pipecat/services/whisper/base_stt.py index 33d19b0aa..a891253ce 100644 --- a/src/pipecat/services/whisper/base_stt.py +++ b/src/pipecat/services/whisper/base_stt.py @@ -168,7 +168,7 @@ class BaseWhisperSTTService(SegmentedSTTService): include_prob_metrics: If True, enables probability metrics in API response. Each service implements this differently (see child classes). Defaults to False. - push_empty_transcripts: - If true, allow empty `TranscriptionFrame` frames to be + push_empty_transcripts: If true, allow empty `TranscriptionFrame` frames to be pushed downstream instead of discarding them. This is intended for situations where VAD fires even though the user did not speak. In these cases, it is useful to know that nothing was transcribed so that the agent can resume diff --git a/src/pipecat/turns/user_turn_completion_mixin.py b/src/pipecat/turns/user_turn_completion_mixin.py index fc421e411..d527407b9 100644 --- a/src/pipecat/turns/user_turn_completion_mixin.py +++ b/src/pipecat/turns/user_turn_completion_mixin.py @@ -191,9 +191,7 @@ class UserTurnCompletionLLMServiceMixin: When incomplete timeouts expire, the mixin automatically prompts the LLM with a contextual follow-up message to re-engage the user. - Usage: - The LLM service controls when to use turn completion by calling - _push_turn_text instead of push_frame: + Usage example:: # With turn completion: if self._filter_incomplete_user_turns: @@ -201,7 +199,10 @@ class UserTurnCompletionLLMServiceMixin: else: await self.push_frame(LLMTextFrame(chunk.text)) - The mixin requires that the base class has a `push_frame` method compatible + The LLM service controls when to use turn completion by calling + ``_push_turn_text`` instead of ``push_frame``. + + The mixin requires that the base class has a ``push_frame`` method compatible with FrameProcessor's signature. """ diff --git a/src/pipecat/utils/context/llm_context_summarization.py b/src/pipecat/utils/context/llm_context_summarization.py index 259d0bae5..8cfcb4a1f 100644 --- a/src/pipecat/utils/context/llm_context_summarization.py +++ b/src/pipecat/utils/context/llm_context_summarization.py @@ -168,7 +168,9 @@ class LLMContextSummarizationConfig: .. deprecated:: 0.0.104 Use :class:`LLMAutoContextSummarizationConfig` with a nested - :class:`LLMContextSummaryConfig` instead:: + :class:`LLMContextSummaryConfig` instead. + + Example:: LLMAutoContextSummarizationConfig( max_context_tokens=8000,