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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use factory in example #772

Merged
merged 1 commit into from
May 6, 2024
Merged
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
40 changes: 23 additions & 17 deletions docs/griptape-framework/drivers/structure-run-drivers.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,39 @@ from griptape.rules import Rule
from griptape.structures import Agent, Pipeline
from griptape.tasks import StructureRunTask

joke_teller = Agent(
rules=[
Rule(
value="You are very funny.",
)
],
)

joke_rewriter = Agent(
rules=[
Rule(
value="You are the editor of a joke book. But you only speak in riddles",
)
],
)
def build_joke_teller():
joke_teller = Agent(
rules=[
Rule(
value="You are very funny.",
)
],
)

return joke_teller

def build_joke_rewriter():
joke_rewriter = Agent(
rules=[
Rule(
value="You are the editor of a joke book. But you only speak in riddles",
)
],
)

return joke_rewriter

joke_coordinator = Pipeline(
tasks=[
StructureRunTask(
driver=LocalStructureRunDriver(
structure_factory_fn=lambda: joke_teller,
structure_factory_fn=build_joke_teller,
),
),
StructureRunTask(
("Rewrite this joke: {{ parent_output }}",),
driver=LocalStructureRunDriver(
structure_factory_fn=lambda: joke_rewriter,
structure_factory_fn=build_joke_rewriter,
),
),
]
Expand Down
Loading