Deprecate dict-based *UpdateSettingsFrame(settings={...}) code path in STT, TTS, and LLM services.

The dataclass-based API (`*UpdateSettingsFrame(update=*Settings(...))`) is the preferred path since 0.0.103. The dict path still works but now emits a `DeprecationWarning`.
This commit is contained in:
Paul Kompfner
2026-02-17 15:07:45 -05:00
parent 1cec8d119d
commit 1cad4210ce
4 changed files with 29 additions and 1 deletions

View File

@@ -2117,7 +2117,11 @@ class ServiceUpdateSettingsFrame(ControlFrame):
``update`` object. When both are provided, ``update`` takes precedence.
Parameters:
settings: Dictionary of setting name to value mappings (legacy).
settings: Dictionary of setting name to value mappings.
.. deprecated:: 0.0.103
Use ``update`` with a typed settings object instead.
update: :class:`~pipecat.services.settings.ServiceSettings` object
describing the delta to apply.
"""

View File

@@ -354,6 +354,14 @@ class LLMService(UserTurnCompletionLLMServiceMixin, AIService):
await self._update_settings(frame.update)
elif frame.settings:
# Backward-compatible path: convert legacy dict to settings object.
with warnings.catch_warnings():
warnings.simplefilter("always")
warnings.warn(
"Passing a dict via LLMUpdateSettingsFrame(settings={...}) is deprecated "
"since 0.0.103, use LLMUpdateSettingsFrame(update=LLMSettings(...)) instead.",
DeprecationWarning,
stacklevel=2,
)
update = type(self._settings).from_mapping(frame.settings)
await self._update_settings(update)
elif isinstance(frame, LLMContextSummaryRequestFrame):

View File

@@ -336,6 +336,14 @@ class STTService(AIService):
await self._update_settings(frame.update)
elif frame.settings:
# Backward-compatible path: convert legacy dict to settings object.
with warnings.catch_warnings():
warnings.simplefilter("always")
warnings.warn(
"Passing a dict via STTUpdateSettingsFrame(settings={...}) is deprecated "
"since 0.0.103, use STTUpdateSettingsFrame(update=STTSettings(...)) instead.",
DeprecationWarning,
stacklevel=2,
)
update = type(self._settings).from_mapping(frame.settings)
await self._update_settings(update)
elif isinstance(frame, STTMuteFrame):

View File

@@ -546,6 +546,14 @@ class TTSService(AIService):
await self._update_settings(frame.update)
elif frame.settings:
# Backward-compatible path: convert legacy dict to settings object.
with warnings.catch_warnings():
warnings.simplefilter("always")
warnings.warn(
"Passing a dict via TTSUpdateSettingsFrame(settings={...}) is deprecated "
"since 0.0.103, use TTSUpdateSettingsFrame(update=TTSSettings(...)) instead.",
DeprecationWarning,
stacklevel=2,
)
update = type(self._settings).from_mapping(frame.settings)
await self._update_settings(update)
elif isinstance(frame, BotStoppedSpeakingFrame):