-
Notifications
You must be signed in to change notification settings - Fork 354
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
oop again
- Loading branch information
Showing
4 changed files
with
88 additions
and
15 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
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,5 @@ | ||
import marvin | ||
|
||
poem = marvin.run("Write a short poem about artificial intelligence") | ||
|
||
print(poem) |
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,26 @@ | ||
"""Warning: this example will run untrusted shell commands. | ||
Use with caution. | ||
""" | ||
|
||
import platform | ||
import subprocess | ||
|
||
from pydantic import IPv4Address | ||
|
||
import marvin | ||
|
||
|
||
def run_shell_command(command: list[str]) -> str: | ||
"""e.g. ['ls', '-l'] or ['git', '--no-pager', 'diff', '--cached']""" | ||
return subprocess.check_output(command).decode() | ||
|
||
|
||
task = marvin.Task( | ||
instructions="find the current ip address", | ||
result_type=IPv4Address, | ||
tools=[run_shell_command], | ||
context={"os": platform.system()}, | ||
) | ||
|
||
task.run() |
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