diff --git a/src/pipecat/services/aws/nova_sonic/context.py b/src/pipecat/services/aws/nova_sonic/context.py index c9aab439f..fd863c6c5 100644 --- a/src/pipecat/services/aws/nova_sonic/context.py +++ b/src/pipecat/services/aws/nova_sonic/context.py @@ -11,36 +11,34 @@ including conversation history management and role-specific message processing. .. deprecated:: 0.0.91 AWS Nova Sonic no longer uses types from this module under the hood. - It now uses `LLMContext` and `LLMContextAggregatorPair`. + It now uses ``LLMContext`` and ``LLMContextAggregatorPair``. Using the new patterns should allow you to not need types from this module. - BEFORE: - ``` - # Setup - context = OpenAILLMContext(messages, tools) - context_aggregator = llm.create_context_aggregator(context) + BEFORE:: - # Context frame type - frame: OpenAILLMContextFrame + # Setup + context = OpenAILLMContext(messages, tools) + context_aggregator = llm.create_context_aggregator(context) - # Context type - context: AWSNovaSonicLLMContext - # or - context: OpenAILLMContext - ``` + # Context frame type + frame: OpenAILLMContextFrame - AFTER: - ``` - # Setup - context = LLMContext(messages, tools) - context_aggregator = LLMContextAggregatorPair(context) + # Context type + context: AWSNovaSonicLLMContext + # or + context: OpenAILLMContext - # Context frame type - frame: LLMContextFrame + AFTER:: - # Context type - context: LLMContext - ``` + # Setup + context = LLMContext(messages, tools) + context_aggregator = LLMContextAggregatorPair(context) + + # Context frame type + frame: LLMContextFrame + + # Context type + context: LLMContext """ import warnings diff --git a/src/pipecat/services/aws/nova_sonic/llm.py b/src/pipecat/services/aws/nova_sonic/llm.py index 5df3bbd21..4ad9d05ea 100644 --- a/src/pipecat/services/aws/nova_sonic/llm.py +++ b/src/pipecat/services/aws/nova_sonic/llm.py @@ -1163,7 +1163,8 @@ class AWSNovaSonicLLMService(LLMService): """Create context aggregator pair for managing conversation context. NOTE: this method exists only for backward compatibility. New code - should instead do: + should instead do:: + context = LLMContext(...) context_aggregator = LLMContextAggregatorPair(context) diff --git a/src/pipecat/services/google/gemini_live/llm.py b/src/pipecat/services/google/gemini_live/llm.py index 70beed86c..ce63a19db 100644 --- a/src/pipecat/services/google/gemini_live/llm.py +++ b/src/pipecat/services/google/gemini_live/llm.py @@ -1742,7 +1742,8 @@ class GeminiLiveLLMService(LLMService): Constructor keyword arguments for both the user and assistant aggregators can be provided. NOTE: this method exists only for backward compatibility. New code - should instead do: + should instead do:: + context = LLMContext(...) context_aggregator = LLMContextAggregatorPair(context) diff --git a/src/pipecat/services/openai/realtime/context.py b/src/pipecat/services/openai/realtime/context.py index 91c6e74d5..3cb40eca5 100644 --- a/src/pipecat/services/openai/realtime/context.py +++ b/src/pipecat/services/openai/realtime/context.py @@ -8,42 +8,40 @@ .. deprecated:: 0.0.92 OpenAI Realtime no longer uses types from this module under the hood. - It now uses `LLMContext` and `LLMContextAggregatorPair`. + It now uses ``LLMContext`` and ``LLMContextAggregatorPair``. Using the new patterns should allow you to not need types from this module. - BEFORE: - ``` - # Setup - context = OpenAILLMContext(messages, tools) - context_aggregator = llm.create_context_aggregator(context) + BEFORE:: - # Context aggregator type - context_aggregator: OpenAIContextAggregatorPair + # Setup + context = OpenAILLMContext(messages, tools) + context_aggregator = llm.create_context_aggregator(context) - # Context frame type - frame: OpenAILLMContextFrame + # Context aggregator type + context_aggregator: OpenAIContextAggregatorPair - # Context type - context: OpenAIRealtimeLLMContext - # or - context: OpenAILLMContext - ``` + # Context frame type + frame: OpenAILLMContextFrame - AFTER: - ``` - # Setup - context = LLMContext(messages, tools) - context_aggregator = LLMContextAggregatorPair(context) + # Context type + context: OpenAIRealtimeLLMContext + # or + context: OpenAILLMContext - # Context aggregator type - context_aggregator: LLMContextAggregatorPair + AFTER:: - # Context frame type - frame: LLMContextFrame + # Setup + context = LLMContext(messages, tools) + context_aggregator = LLMContextAggregatorPair(context) - # Context type - context: LLMContext - ``` + # Context aggregator type + context_aggregator: LLMContextAggregatorPair + + # Context frame type + frame: LLMContextFrame + + # Context type + context: LLMContext """ import warnings diff --git a/src/pipecat/services/openai/realtime/frames.py b/src/pipecat/services/openai/realtime/frames.py index 39cfd9757..023b518b2 100644 --- a/src/pipecat/services/openai/realtime/frames.py +++ b/src/pipecat/services/openai/realtime/frames.py @@ -12,7 +12,7 @@ It now works more like most LLM services in Pipecat, relying on updates to its context, pushed by context aggregators, to update its internal state. - Listen for `LLMContextFrame`s for context updates. + Listen for ``LLMContextFrame`` s for context updates. """ import warnings diff --git a/src/pipecat/services/openai/realtime/llm.py b/src/pipecat/services/openai/realtime/llm.py index 012604eb8..00a0322a8 100644 --- a/src/pipecat/services/openai/realtime/llm.py +++ b/src/pipecat/services/openai/realtime/llm.py @@ -845,7 +845,8 @@ class OpenAIRealtimeLLMService(LLMService): """Create an instance of OpenAIContextAggregatorPair from an OpenAILLMContext. NOTE: this method exists only for backward compatibility. New code - should instead do: + should instead do:: + context = LLMContext(...) context_aggregator = LLMContextAggregatorPair(context) diff --git a/src/pipecat/transports/smallwebrtc/request_handler.py b/src/pipecat/transports/smallwebrtc/request_handler.py index adbca920e..d6ab3841d 100644 --- a/src/pipecat/transports/smallwebrtc/request_handler.py +++ b/src/pipecat/transports/smallwebrtc/request_handler.py @@ -39,13 +39,12 @@ class SmallWebRTCRequest: restart_pc: Optional[bool] = None request_data: Optional[Any] = None - -@classmethod -def from_dict(cls, data: dict): - """Accept both snake_case and camelCase for the request_data field.""" - if "requestData" in data and "request_data" not in data: - data["request_data"] = data.pop("requestData") - return cls(**data) + @classmethod + def from_dict(cls, data: dict): + """Accept both snake_case and camelCase for the request_data field.""" + if "requestData" in data and "request_data" not in data: + data["request_data"] = data.pop("requestData") + return cls(**data) @dataclass