Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
jlowin committed May 8, 2024
1 parent 66bbcb1 commit 0b10f4a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,26 @@ pip install .
## Example

```python
from control_flow import ai_flow, ai_task, instructions, Task
from control_flow import Agent, Task, ai_flow, ai_task, instructions
from pydantic import BaseModel


class Name(BaseModel):
first_name: str
last_name: str


@ai_task(user_access=True)
def get_user_name() -> Name:
pass

@ai_task

@ai_task(agents=[Agent(name="poetry-bot", instructions="loves limericks")])
def write_poem_about_user(name: Name, interests: list[str]) -> str:
"""write a poem based on the provided `name` and `interests`"""
pass


@ai_flow()
def demo():
# set instructions that will be used for multiple tasks
Expand All @@ -72,9 +76,7 @@ def demo():

# define an AI task imperatively
interests = Task(
"ask user for three interests",
result_type=list[str],
user_access=True
"ask user for three interests", result_type=list[str], user_access=True
)
interests.run_until_complete()

Expand All @@ -84,6 +86,7 @@ def demo():

return poem


if __name__ == "__main__":
demo()
```
Expand Down
2 changes: 1 addition & 1 deletion src/control_flow/core/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def get_flow() -> Flow:
"""
flow: Flow | None = ctx.get("flow")
if not flow:
raise ValueError("No flow found in context")
return Flow()
return flow


Expand Down

0 comments on commit 0b10f4a

Please sign in to comment.