Fix docstrings for 0.0.93 release, fix classmethod placement in RequestHandler

This commit is contained in:
Mark Backman
2025-11-05 15:27:16 -05:00
parent 11b101e8a6
commit e2f6ce1078
7 changed files with 59 additions and 61 deletions

View File

@@ -11,36 +11,34 @@ including conversation history management and role-specific message processing.
.. deprecated:: 0.0.91 .. deprecated:: 0.0.91
AWS Nova Sonic no longer uses types from this module under the hood. 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. Using the new patterns should allow you to not need types from this module.
BEFORE: BEFORE::
```
# Setup
context = OpenAILLMContext(messages, tools)
context_aggregator = llm.create_context_aggregator(context)
# Context frame type # Setup
frame: OpenAILLMContextFrame context = OpenAILLMContext(messages, tools)
context_aggregator = llm.create_context_aggregator(context)
# Context type # Context frame type
context: AWSNovaSonicLLMContext frame: OpenAILLMContextFrame
# or
context: OpenAILLMContext
```
AFTER: # Context type
``` context: AWSNovaSonicLLMContext
# Setup # or
context = LLMContext(messages, tools) context: OpenAILLMContext
context_aggregator = LLMContextAggregatorPair(context)
# Context frame type AFTER::
frame: LLMContextFrame
# Context type # Setup
context: LLMContext context = LLMContext(messages, tools)
``` context_aggregator = LLMContextAggregatorPair(context)
# Context frame type
frame: LLMContextFrame
# Context type
context: LLMContext
""" """
import warnings import warnings

View File

@@ -1163,7 +1163,8 @@ class AWSNovaSonicLLMService(LLMService):
"""Create context aggregator pair for managing conversation context. """Create context aggregator pair for managing conversation context.
NOTE: this method exists only for backward compatibility. New code NOTE: this method exists only for backward compatibility. New code
should instead do: should instead do::
context = LLMContext(...) context = LLMContext(...)
context_aggregator = LLMContextAggregatorPair(context) context_aggregator = LLMContextAggregatorPair(context)

View File

@@ -1742,7 +1742,8 @@ class GeminiLiveLLMService(LLMService):
Constructor keyword arguments for both the user and assistant aggregators can be provided. Constructor keyword arguments for both the user and assistant aggregators can be provided.
NOTE: this method exists only for backward compatibility. New code NOTE: this method exists only for backward compatibility. New code
should instead do: should instead do::
context = LLMContext(...) context = LLMContext(...)
context_aggregator = LLMContextAggregatorPair(context) context_aggregator = LLMContextAggregatorPair(context)

View File

@@ -8,42 +8,40 @@
.. deprecated:: 0.0.92 .. deprecated:: 0.0.92
OpenAI Realtime no longer uses types from this module under the hood. 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. Using the new patterns should allow you to not need types from this module.
BEFORE: BEFORE::
```
# Setup
context = OpenAILLMContext(messages, tools)
context_aggregator = llm.create_context_aggregator(context)
# Context aggregator type # Setup
context_aggregator: OpenAIContextAggregatorPair context = OpenAILLMContext(messages, tools)
context_aggregator = llm.create_context_aggregator(context)
# Context frame type # Context aggregator type
frame: OpenAILLMContextFrame context_aggregator: OpenAIContextAggregatorPair
# Context type # Context frame type
context: OpenAIRealtimeLLMContext frame: OpenAILLMContextFrame
# or
context: OpenAILLMContext
```
AFTER: # Context type
``` context: OpenAIRealtimeLLMContext
# Setup # or
context = LLMContext(messages, tools) context: OpenAILLMContext
context_aggregator = LLMContextAggregatorPair(context)
# Context aggregator type AFTER::
context_aggregator: LLMContextAggregatorPair
# Context frame type # Setup
frame: LLMContextFrame context = LLMContext(messages, tools)
context_aggregator = LLMContextAggregatorPair(context)
# Context type # Context aggregator type
context: LLMContext context_aggregator: LLMContextAggregatorPair
```
# Context frame type
frame: LLMContextFrame
# Context type
context: LLMContext
""" """
import warnings import warnings

View File

@@ -12,7 +12,7 @@
It now works more like most LLM services in Pipecat, relying on updates to 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. 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 import warnings

View File

@@ -845,7 +845,8 @@ class OpenAIRealtimeLLMService(LLMService):
"""Create an instance of OpenAIContextAggregatorPair from an OpenAILLMContext. """Create an instance of OpenAIContextAggregatorPair from an OpenAILLMContext.
NOTE: this method exists only for backward compatibility. New code NOTE: this method exists only for backward compatibility. New code
should instead do: should instead do::
context = LLMContext(...) context = LLMContext(...)
context_aggregator = LLMContextAggregatorPair(context) context_aggregator = LLMContextAggregatorPair(context)

View File

@@ -39,13 +39,12 @@ class SmallWebRTCRequest:
restart_pc: Optional[bool] = None restart_pc: Optional[bool] = None
request_data: Optional[Any] = None request_data: Optional[Any] = None
@classmethod
@classmethod def from_dict(cls, data: dict):
def from_dict(cls, data: dict): """Accept both snake_case and camelCase for the request_data field."""
"""Accept both snake_case and camelCase for the request_data field.""" if "requestData" in data and "request_data" not in data:
if "requestData" in data and "request_data" not in data: data["request_data"] = data.pop("requestData")
data["request_data"] = data.pop("requestData") return cls(**data)
return cls(**data)
@dataclass @dataclass