Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add pts to llm full response end frame #583

Merged
merged 6 commits into from
Oct 15, 2024

Conversation

aconchillo
Copy link
Contributor

No description provided.

while True:
try:
(word, timestamp) = await self._words_queue.get()
if word == "LLMFullResponseEndFrame" and timestamp == 0:
await self.push_frame(LLMFullResponseEndFrame())
frame = LLMFullResponseEndFrame()
frame.pts = last_pts
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before this frame would be added after all the audio and since it didn't have a pts it would just be processed after the audio is spoken which should coincide with the text timestamps. But to make it more accurate we make sure it has a pts and its processed just after the text.

@@ -210,7 +210,6 @@ def _get_websocket(self):
async def _handle_interruption(self, frame: StartInterruptionFrame, direction: FrameDirection):
await super()._handle_interruption(frame, direction)
await self.stop_all_metrics()
await self.push_frame(LLMFullResponseEndFrame())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I already mentioned it in the commit messages but this is not needed. The context aggregator interruption already handle interruption properly. We don't want to pollute the code with push_frame() otherwise it will become very hard to maintain.

# audio and video as well.
if isinstance(frame, TextFrame):
await self.push_frame(frame)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we already have _sink_frame_handler() so this function is not really needed.

@aconchillo aconchillo force-pushed the aleix/add-pts-to-llm-full-response-end-frame branch from 22c4752 to e6b3ca3 Compare October 15, 2024 16:03
@aconchillo aconchillo force-pushed the aleix/add-pts-to-llm-full-response-end-frame branch from e6b3ca3 to 7bbaf4d Compare October 15, 2024 17:25
@aconchillo aconchillo merged commit 0c250c0 into main Oct 15, 2024
3 checks passed
@aconchillo aconchillo deleted the aleix/add-pts-to-llm-full-response-end-frame branch October 23, 2024 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants