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
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

View File

@@ -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)

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -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