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

Support multiple assistants when working on a task #10

Merged
merged 4 commits into from
Apr 8, 2024
Merged

Support multiple assistants when working on a task #10

merged 4 commits into from
Apr 8, 2024

Conversation

jlowin
Copy link
Member

@jlowin jlowin commented Apr 8, 2024

from control_flow import Assistant, run_ai_task
from control_flow.flow import ai_flow

# define assistants

a = Assistant(name="a")
b = Assistant(name="b")
c = Assistant(name="c")


# define tools

GUESTBOOK = []


def sign(name):
    """sign your name in the guestbook"""
    GUESTBOOK.append(name)


def view_guestbook():
    """view the guestbook"""
    return GUESTBOOK


# define flow


@ai_flow
def guestbook_flow():
    run_ai_task(
        """
        When it is your turn, add your name to the list using the `sign` tool. All assistants must
        sign their names for the task to be complete. You can read the sign to
        see if that has happened yet. You can not sign for another assistant.
        """,
        assistants=[a, b, c],
        tools=[sign, view_guestbook],
    )


# run test


def test():
    guestbook_flow()
    assert GUESTBOOK == ["a", "b", "c"]

image

@jlowin jlowin merged commit 8a392bd into main Apr 8, 2024
1 of 2 checks passed
@jlowin jlowin deleted the multi branch April 8, 2024 01:20
@jlowin jlowin mentioned this pull request Apr 8, 2024
3 tasks
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