LLM tools runtime framework.
Project description
Griptape
Griptape is a Python framework that enables developers to write tools for generative AI middleware once and use it anywhere.
Griptape has three core components:
- Tools: call external APIs, access databases, and run arbitrary code or CLI commands.
- Executors: run your tools safely in any environment: local, containerized, or serverless in the cloud.
- Adapters: convert tools into underlying middleware abstractions, such as ChatGPT Plugins, LangChain tools, and Fixie.ai agents.
Getting Started
Griptape separates the core framework from tools into two Python packages: griptape_core
and griptape_tools
. Explore Griptape tools in the griptape-tools repo
First, install those packages:
pip install griptape_core
pip install griptape_tools
Next, initialize an executor and some tools:
from griptape.adapters import LangchainToolAdapter, ChatgptPluginAdapter
from griptape.executors import LocalExecutor
from griptape.tools import (
Calculator, GoogleSearch
)
tool_executor = LocalExecutor()
google_search = GoogleSearch(
api_search_key="<search key>",
api_search_id="<search ID>"
)
calculator = Calculator()
You can execute tool actions directly:
tool_executor.execute(calculator.calculate, "42**42".encode())
Convert tool actions into LangChain tools:
agent = initialize_agent(
[
LangchainToolAdapter(executor=tool_executor).generate(google_search.search),
LangchainToolAdapter(executor=tool_executor).generate(calculator.calculate)
],
OpenAI(temperature=0.5, model_name="text-davinci-003"),
agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
verbose=True
)
agent.run("What is 42^42?")
Or generate and run a ChatGPT Plugin:
app = ChatgptPluginAdapter(
host="localhost:8000",
path_prefix="/search-tool/",
executor=tool_executor
).generate_api(google_search)
# run with `uvicorn app:app --reload`
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_core-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e45d100a307d7d2d5db1d4cb31684c45b16ceaba9947d836237b6dc81c49c73 |
|
MD5 | 3b0f2a6c4e27a4ac83e7b00376767b92 |
|
BLAKE2b-256 | d85d0a28aa8c43d75e08c13cf8b18c836c87a0b8f4ad95a84cade1d1f51c329e |