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

Simplify the static flows API #65

Merged
merged 7 commits into from
Dec 18, 2024
Merged

Simplify the static flows API #65

merged 7 commits into from
Dec 18, 2024

Conversation

markbackman
Copy link
Contributor

Added

  • New initial_system_message field in FlowConfig, which allows setting a
    global system message for static flows.

Changed

  • Simplified FlowManager initialization by removing the need for manual context
    setup in static flows.
  • Updated static examples to use the updated API.

Copy link

vercel bot commented Dec 17, 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 18, 2024 3:56am

logger.warning("Initial messages ignored for static flow configuration")

# Set initial system message if present
if hasattr(self, "initial_system_message"):

Choose a reason for hiding this comment

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

I think this could be:

if self.initial_system_message:

We should always have things (i.e. fields) defined, because this is kind of hiding what fields are defined or not depending on something else.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense!

@@ -155,6 +97,7 @@ def __init__(
if flow_config:
self.nodes = flow_config["nodes"]
self.initial_node = flow_config["initial_node"]
self.initial_system_message = flow_config.get("initial_system_message", [])
self.transition_callback = self._handle_static_transition
logger.debug("Initialized in static mode")
else:

Choose a reason for hiding this comment

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

in this else block we would have:

self.initial_system_message = None

@aconchillo
Copy link

LGTM! Just made a small comment easy to fix.

@markbackman markbackman merged commit 06b0109 into main Dec 18, 2024
2 checks passed
@markbackman markbackman deleted the mb/simplify-static-flows branch December 18, 2024 03:56
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