Skip to content

Add support for dynamic flows #54

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

Merged
merged 2 commits into from
Dec 3, 2024
Merged

Add support for dynamic flows #54

merged 2 commits into from
Dec 3, 2024

Conversation

markbackman
Copy link
Contributor

@markbackman markbackman commented Nov 30, 2024

This PR extends the FlowManager to support dynamic flows in addition to static flows.

From the README:

  • Static Flows: When your conversation structure is known upfront and follows predefined paths. Perfect for customer service scripts, intake forms, or guided experiences.
  • Dynamic Flows: When conversation paths need to be determined at runtime based on user input, external data, or business logic. Ideal for personalized experiences or complex decision trees.

For static flows, simplified function registration. All functions are now registered to the LLMs automatically at runtime.

Also, added tests for the new functionality.

This change also simplifies the API:

Static flows:

  • Define the flow_config as a JSON blob using compliant LLM formats
  • Create the FlowManager instance: flow_manager = FlowManager(task, llm, tts, flow_config=flow_config)
  • Optionally, initialize the FlowManager with initial messages: await flow_manager.initialize(messages)

Dynamic flows:

  • Define your transition callback, which is responsible for transitioning node to node
  • Create the FlowManager instance: flow_manager = FlowManager(task, llm, tts, transition_callback=handle_insurance_transition)
  • Optionally, initialize the FlowManager with initial messages: await flow_manager.initialize(messages)

Copy link

vercel bot commented Nov 30, 2024

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

Name Status Preview Updated (UTC)
pipecat-flows ✅ Ready (Inspect) Visit Preview Dec 3, 2024 2:32am

@markbackman markbackman merged commit f376607 into main Dec 3, 2024
1 of 2 checks passed
@markbackman markbackman deleted the mb/dynamic branch December 3, 2024 02:51
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.

1 participant