diff --git a/src/pipecat/processors/frameworks/rtvi.py b/src/pipecat/processors/frameworks/rtvi.py index ca7995cb5..4e5ed442b 100644 --- a/src/pipecat/processors/frameworks/rtvi.py +++ b/src/pipecat/processors/frameworks/rtvi.py @@ -131,6 +131,7 @@ class RTVITranscriptionMessageData(BaseModel): text: str user_id: str timestamp: str + final: bool class RTVITranscriptionMessage(BaseModel): @@ -139,12 +140,6 @@ class RTVITranscriptionMessage(BaseModel): data: RTVITranscriptionMessageData -class RTVIInterimTranscriptionMessage(BaseModel): - label: Literal["rtvi"] = "rtvi" - type: Literal["user-interim-transcription"] = "user-interim-transcription" - data: RTVITranscriptionMessageData - - class RTVIUserStartedSpeakingMessage(BaseModel): label: Literal["rtvi"] = "rtvi" type: Literal["user-started-speaking"] = "user-started-speaking" @@ -318,11 +313,15 @@ class RTVIProcessor(FrameProcessor): data=RTVITranscriptionMessageData( text=frame.text, user_id=frame.user_id, - timestamp=frame.timestamp)) + timestamp=frame.timestamp, + final=True)) elif isinstance(frame, InterimTranscriptionFrame): - message = RTVIInterimTranscriptionMessage( + message = RTVITranscriptionMessage( data=RTVITranscriptionMessageData( - text=frame.text, user_id=frame.user_id, timestamp=frame.timestamp)) + text=frame.text, + user_id=frame.user_id, + timestamp=frame.timestamp, + final=False)) if message: frame = TransportMessageFrame(message=message.model_dump(exclude_none=True))