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

Improve LLM completion timing for edge and node functions #75

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

markbackman
Copy link
Contributor

Issue: #67.

This fix comes in two parts:

This PR resolves a timing/race condition issue that resulted in variable and unpredictable timing for how LLM completions occur. This change makes both node and edge function calls predictable in that:

  • Edge function calls (which transition to a new node) result in an LLM completion after both the function call result and the next nodes messages are added to the context. This ensures that the LLM responds only once and with the necessary task and context.
  • Node function calls (which happen within the existing node) result in an LLM completion once the function call result is added to the context (default Pipecat behavior).

⚠️ This change is breaking in that you need to pass the context_aggregator to the FlowManager at initialization. The benefit for this is warranted though as it results in LLM completions creating a natural and controllable conversation.

For reviewing, the code change is only in the manager.py. All of the other files are changes to align with the FlowManager updates.

Copy link

vercel bot commented Jan 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
pipecat-flows ✅ Ready (Inspect) Visit Preview Jan 14, 2025 0:43am

@markbackman
Copy link
Contributor Author

Tests are failing because a newer version of Pipecat is required... I'll wait until the 0.0.53 release before merging this due to the dependency.

@markbackman markbackman requested a review from filipi87 January 15, 2025 23:34
Copy link

@filipi87 filipi87 left a comment

Choose a reason for hiding this comment

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

LGTM!

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