Remove deprecated TranscriptionMessage, ThoughtTranscriptionMessage, and TranscriptionUpdateFrame
This commit is contained in:
@@ -462,137 +462,6 @@ class LLMContextAssistantTimestampFrame(DataFrame):
|
|||||||
timestamp: str
|
timestamp: str
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class TranscriptionMessage:
|
|
||||||
"""A message in a conversation transcript.
|
|
||||||
|
|
||||||
A message in a conversation transcript containing the role and content.
|
|
||||||
Messages are in standard format with roles normalized to user/assistant.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
role: The role of the message sender (user or assistant).
|
|
||||||
content: The message content/text.
|
|
||||||
user_id: Optional identifier for the user.
|
|
||||||
timestamp: Optional timestamp when the message was created.
|
|
||||||
|
|
||||||
.. deprecated:: 0.0.99
|
|
||||||
`TranscriptionMessage` is deprecated and will be removed in a future version.
|
|
||||||
Use `LLMUserAggregator`'s and `LLMAssistantAggregator`'s new events instead.
|
|
||||||
"""
|
|
||||||
|
|
||||||
role: Literal["user", "assistant"]
|
|
||||||
content: str
|
|
||||||
user_id: Optional[str] = None
|
|
||||||
timestamp: Optional[str] = None
|
|
||||||
|
|
||||||
def __post_init__(self):
|
|
||||||
import warnings
|
|
||||||
|
|
||||||
with warnings.catch_warnings():
|
|
||||||
warnings.simplefilter("always")
|
|
||||||
warnings.warn(
|
|
||||||
"TranscriptionMessage is deprecated and will be removed in a future version. "
|
|
||||||
"Use `LLMUserAggregator`'s and `LLMAssistantAggregator`'s new events instead.",
|
|
||||||
DeprecationWarning,
|
|
||||||
stacklevel=2,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class ThoughtTranscriptionMessage:
|
|
||||||
"""An LLM thought message in a conversation transcript.
|
|
||||||
|
|
||||||
.. deprecated:: 0.0.99
|
|
||||||
`ThoughtTranscriptionMessage` is deprecated and will be removed in a future version.
|
|
||||||
Use `LLMAssistantAggregator`'s new events instead.
|
|
||||||
"""
|
|
||||||
|
|
||||||
role: Literal["assistant"] = field(default="assistant", init=False)
|
|
||||||
content: str
|
|
||||||
timestamp: Optional[str] = None
|
|
||||||
|
|
||||||
def __post_init__(self):
|
|
||||||
import warnings
|
|
||||||
|
|
||||||
with warnings.catch_warnings():
|
|
||||||
warnings.simplefilter("always")
|
|
||||||
warnings.warn(
|
|
||||||
"ThoughtTranscriptionMessage is deprecated and will be removed in a future version. "
|
|
||||||
"Use `LLMAssistantAggregator`'s new events instead.",
|
|
||||||
DeprecationWarning,
|
|
||||||
stacklevel=2,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class TranscriptionUpdateFrame(DataFrame):
|
|
||||||
"""Frame containing new messages added to conversation transcript.
|
|
||||||
|
|
||||||
A frame containing new messages added to the conversation transcript.
|
|
||||||
This frame is emitted when new messages are added to the conversation history,
|
|
||||||
containing only the newly added messages rather than the full transcript.
|
|
||||||
Messages have normalized roles (user/assistant) regardless of the LLM service used.
|
|
||||||
Messages are always in the OpenAI standard message format, which supports both:
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
Simple format::
|
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"role": "user",
|
|
||||||
"content": "Hi, how are you?"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"role": "assistant",
|
|
||||||
"content": "Great! And you?"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
Content list format::
|
|
||||||
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"role": "user",
|
|
||||||
"content": [{"type": "text", "text": "Hi, how are you?"}]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"role": "assistant",
|
|
||||||
"content": [{"type": "text", "text": "Great! And you?"}]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
OpenAI supports both formats. Anthropic and Google messages are converted to the
|
|
||||||
content list format.
|
|
||||||
|
|
||||||
Parameters:
|
|
||||||
messages: List of new transcript messages that were added.
|
|
||||||
|
|
||||||
.. deprecated:: 0.0.99
|
|
||||||
`TranscriptionUpdateFrame` is deprecated and will be removed in a future version.
|
|
||||||
Use `LLMUserAggregator`'s and `LLMAssistantAggregator`'s new events instead.
|
|
||||||
"""
|
|
||||||
|
|
||||||
messages: List[TranscriptionMessage | ThoughtTranscriptionMessage]
|
|
||||||
|
|
||||||
def __post_init__(self):
|
|
||||||
super().__post_init__()
|
|
||||||
|
|
||||||
import warnings
|
|
||||||
|
|
||||||
with warnings.catch_warnings():
|
|
||||||
warnings.simplefilter("always")
|
|
||||||
warnings.warn(
|
|
||||||
"TranscriptionUpdateFrame is deprecated and will be removed in a future version. "
|
|
||||||
"Use `LLMUserAggregator`'s and `LLMAssistantAggregator`'s new events instead.",
|
|
||||||
DeprecationWarning,
|
|
||||||
stacklevel=2,
|
|
||||||
)
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
pts = format_pts(self.pts)
|
|
||||||
return f"{self.name}(pts: {pts}, messages: {len(self.messages)})"
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class LLMContextFrame(Frame):
|
class LLMContextFrame(Frame):
|
||||||
"""Frame containing a universal LLM context.
|
"""Frame containing a universal LLM context.
|
||||||
|
|||||||
Reference in New Issue
Block a user