Created
April 20, 2023 21:56
-
-
Save kyleroche/fa3715caf27d404fc9638828a002d575 to your computer and use it in GitHub Desktop.
Getting Started with Griptape
This file contains hidden or 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
from decouple import config | |
from griptape.tools import WebScraper, Calculator | |
from griptape.flow import utils | |
from griptape.flow.memory import PipelineMemory | |
from griptape.flow.steps import PromptStep, ToolkitStep | |
from griptape.flow.structures import Pipeline | |
from griptape.flow.utils import ToolLoader | |
scraper = WebScraper( | |
openai_api_key=config("OPENAI_API_KEY") | |
) | |
calculator = Calculator() | |
pipeline = Pipeline( | |
memory=PipelineMemory(), | |
tool_loader=ToolLoader( | |
tools=[calculator, scraper] | |
) | |
) | |
pipeline.add_steps( | |
ToolkitStep( | |
tool_names=[calculator.name, scraper.name] | |
), | |
PromptStep( | |
"Say the following like a pirate: {{ input }}" | |
) | |
) | |
pipeline.run("Give me a summary of https://en.wikipedia.org/wiki/Large_language_model") | |
print(utils.Conversation(pipeline.memory).to_string()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment