Modular Python framework for LLM workflows, tools, memory, and data.
Project description
griptape
Griptape offers developers the ability to build AI systems that operate across two dimensions: predictability and creativity.
For predictability, software structures like sequential pipelines and directed acyclic graphs (DAGs) are enforced. Creativity, on the other hand, is facilitated by safely prompting LLMs with tools that connect to external APIs and data sources. Developers can move between these two dimensions according to their use case.
Documentation
Please refer to Griptape Docs for:
- Getting started guides.
- Core concepts and design overviews.
- Examples.
- Contribution guidelines.
Quick Start
First, install griptape and griptape-tools:
pip install griptape griptape-tools -U
Second, configure an OpenAI client by getting an API key and adding it to your environment as OPENAI_API_KEY
. By default, Griptape uses OpenAI Completions API to execute LLM prompts.
With Griptape, you can create structures, such as Agents
, Pipelines
, and Workflows
, that are composed of different types of tasks. Let's build a simple creative agent that dynamically uses two tools with shared short-term memory.
from griptape.structures import Agent
from griptape.tools import WebScraper
agent = Agent(
tools=[WebScraper()]
)
agent.run(
"based on https://www.griptape.ai/, tell me what Griptape is"
)
And here is the output:
Q: based on https://www.griptape.ai/, tell me what Griptape is
A: Griptape is an opinionated Python framework that enables developers to fully harness the potential of LLMs while enforcing strict trust boundaries, schema validation, and activity-level permissions. It offers developers the ability to build AI systems that operate across two dimensions: predictability and creativity. Griptape can be used to create conversational and autonomous agents.
During the run, the Griptape agent loaded a webpage, stored its full content in the short-term memory, and finally queried it to answer the original question. The important thing to note here is that no matter how big the webpage is it can never blow up the prompt token limit because the content never goes to memory instead of the main prompt.
Using a Different LLM
By default, Griptape uses OpenAI's gpt-4
to drive the core agent logic. Other framework components responsible for summarization, querying, and text extraction use gpt-3.5-turbo
. All of them are customizable and if you don't have access to gpt-4
, you can change the quick start example like this:
from griptape.drivers import OpenAiPromptDriver
from griptape.structures import Agent
from griptape.tools import WebScraper
agent = Agent(
prompt_driver=OpenAiPromptDriver(
model="gpt-3.5-turbo"
),
tools=[WebScraper()]
)
agent.run(
"based on https://www.griptape.ai/, tell me what Griptape is"
)
Check out our docs to learn how to use Griptape with other LLM providers like Anthropic, Claude, Hugging Face, and Azure.
Versioning
Griptape is in constant development and its APIs and documentation are subject to change. Until we stabilize the API and release version 1.0.0, we will use minor versions (i.e., x.Y.z) to introduce features and breaking features, and patch versions (i.e., x.y.Z) for bug fixes.
Contributing
Contributions in the form of bug reports, feature ideas, or pull requests are super welcome! Take a look at the current issues and if you'd like to help please submit a pull request with some tests.
License
Griptape is available under the Apache 2.0 License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for griptape-0.14.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c56f55d2b1d4f0fc18556ade60ff47eeae8be493ebf355033b513ca99b2c3aa |
|
MD5 | 81c7e0a0fc49b637c3cee504102fe2c0 |
|
BLAKE2b-256 | d64a7ce0c15e2e96cd81b795403678bfef06aca66649aef8a7e6135b556926e2 |