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

Non Linear Flow Examples #50

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

albertviilik
Copy link

@albertviilik albertviilik commented Nov 27, 2024

An example of a flow, that is non-linear.

graph TD
    start["Start"] -->|User chooses Good Cop| good_cop["Good Cop"]
    start -->|User chooses Bad Cop| bad_cop["Bad Cop"]

    good_cop -->|Finish conversation| end_conversation["End Conversation"]
    good_cop -->|Switch to Bad Cop| bad_cop

    bad_cop -->|Finish conversation| end_conversation
    bad_cop -->|Switch to Good Cop| good_cop

    end_conversation["End Conversation"]
Loading
Screenshot 2024-11-27 at 21 40 09

An example of a flow, that is non-linear and allows transitioning back and forth between two states.
Copy link

vercel bot commented Nov 27, 2024

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

Name Status Preview Updated (UTC)
pipecat-flows ✅ Ready (Inspect) Visit Preview Nov 27, 2024 11:13pm

@albertviilik
Copy link
Author

Apologies for the "make belief" (🍪 theft investigation) rather than "real world use case" prompts/example. I tried to come up with something simple and game like to illustrate the principle. I love how this functions like a finite state machine, where you can define the nodes (states) and the transitions (functions) between them.

A non-linear example with 3 states that a conversation can transition between.
@albertviilik
Copy link
Author

emotion-fsm

@albertviilik albertviilik changed the title Create good_bad_cop.json Non Linear Flow Examples Nov 27, 2024
@markbackman
Copy link
Contributor

This is great! Thanks for trying out the editor. @albertviilik have you tried running this with the Flows python package? If so, how does it work?

@albertviilik
Copy link
Author

Yes. I have, I love it!

It's very nice. For example, if you run the emotional_states.json it really shows how the state transitions work. You say you're sad, it goes to sad. Ask to switch to happy, it goes there. Ask to end or go to neutral, it does that. And it shows in the logs that that transition has happened.

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