-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #613 from PrefectHQ/app-as-tool-doc
set app description as tool __doc__ if used as tool
- Loading branch information
Showing
4 changed files
with
43 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from marvin import AIApplication | ||
|
||
|
||
def get_foo(): | ||
"""A function that returns the value of foo.""" | ||
return 42 | ||
|
||
|
||
worker = AIApplication( | ||
name="worker", | ||
description="A simple worker application.", | ||
plan_enabled=False, | ||
state_enabled=False, | ||
tools=[get_foo], | ||
) | ||
|
||
router = AIApplication( | ||
name="router", | ||
description="routes user requests to the appropriate worker", | ||
plan_enabled=False, | ||
state_enabled=False, | ||
tools=[worker], | ||
) | ||
|
||
message = router("what is the value of foo?") | ||
|
||
assert "42" in message.content, "The answer should be 42." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters