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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pip install .
## Example

```python
from control_flow import ai_flow, ai_task, run_agent, instructions
from control_flow import ai_flow, ai_task, run_ai_task, instructions
from pydantic import BaseModel


Expand Down Expand Up @@ -61,7 +61,7 @@ def demo():
name = get_user_name()

# define an AI task inline
interests = run_agent("ask user for three interests", cast=list[str], user_access=True)
interests = run_ai_task("ask user for three interests", cast=list[str], user_access=True)

# set instructions for just the next task
with instructions("no more than 8 lines"):
Expand Down
8 changes: 4 additions & 4 deletions examples/documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import control_flow
from control_flow import ai_flow, ai_task
from marvin.beta.assistants import Assistant, Thread
from marvin.tools.filesystem import ls, read, read_lines, write
from marvin.tools.filesystem import read, write

ROOT = Path(control_flow.__file__).parents[2]

Expand All @@ -23,7 +23,7 @@ def glob(pattern: str) -> list[str]:
You are an expert technical writer who writes wonderful documentation for
open-source tools and believes that documentation is a product unto itself.
""",
tools=[read, read_lines, ls, write, glob],
tools=[read, write, glob],
)


Expand All @@ -35,7 +35,7 @@ def examine_source_code(source_dir: Path, extensions: list[str]):
"""


@ai_task
@ai_task(model="gpt-3.5-turbo")
def read_docs(docs_dir: Path):
"""
Read all documentation in the docs dir and subdirectories, if any.
Expand All @@ -52,7 +52,7 @@ def write_docs(docs_dir: Path, instructions: str = None):
@ai_flow(assistant=assistant)
def docs_flow(instructions: str):
examine_source_code(ROOT / "src", extensions=[".py"])
read_docs(ROOT / "docs")
# read_docs(ROOT / "docs")
write_docs(ROOT / "docs", instructions=instructions)


Expand Down
4 changes: 2 additions & 2 deletions examples/readme_example.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from control_flow import ai_flow, ai_task, instructions, run_agent
from control_flow import ai_flow, ai_task, instructions, run_ai_task
from pydantic import BaseModel


Expand Down Expand Up @@ -26,7 +26,7 @@ def demo():
name = get_user_name()

# define an AI task inline
interests = run_agent(
interests = run_ai_task(
"ask user for three interests",
cast=list[str],
user_access=True,
Expand Down
4 changes: 3 additions & 1 deletion src/control_flow/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from .settings import settings

from .agent import ai_task, Agent, run_agent
from .agent import ai_task, Agent, run_ai_task
from .flow import ai_flow
from .instructions import instructions

from marvin.beta.assistants import Assistant
Loading
Loading