Metadata-Version: 2.1
Name: griptape
Version: 0.8.0
Summary: Modular Python framework for LLM workflows, tools, memory, and data.
Home-page: https://github.com/griptape-ai/griptape
License: Apache 2.0
Author: Griptape
Author-email: hello@griptape.ai
Requires-Python: >=3.9,<4.0
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: attrs (>=22)
Requires-Dist: boto3 (>=1.26.123,<2.0.0)
Requires-Dist: cohere (>=4)
Requires-Dist: docker (>=6)
Requires-Dist: fastapi (>=0.80)
Requires-Dist: graphlib
Requires-Dist: huggingface-hub (>=0.13)
Requires-Dist: jinja2 (>=3.1)
Requires-Dist: jsonschema (>=4)
Requires-Dist: llama_index (>=0.6.0,<0.7.0)
Requires-Dist: marshmallow (>=3)
Requires-Dist: marshmallow-enum (>=1.5)
Requires-Dist: openai (>=0.27)
Requires-Dist: python-decouple (>=3)
Requires-Dist: python-dotenv (>=0.21)
Requires-Dist: pyyaml (>=6)
Requires-Dist: rich (>=13)
Requires-Dist: schema (>=0.7)
Requires-Dist: stopit
Requires-Dist: stringcase (>=1)
Requires-Dist: tiktoken (>=0.3)
Requires-Dist: transformers (>=4)
Requires-Dist: uvicorn (>=0.20)
Project-URL: Repository, https://github.com/griptape-ai/griptape
Description-Content-Type: text/markdown

# griptape

[![PyPI Version](https://img.shields.io/pypi/v/griptape.svg)](https://pypi.python.org/pypi/griptape)
[![Tests](https://github.com/griptape-ai/griptape/actions/workflows/tests.yml/badge.svg)](https://github.com/griptape-ai/griptape/actions/workflows/tests.yml)
[![Docs](https://readthedocs.org/projects/griptape/badge/)](https://griptape.readthedocs.io/)
[![Griptape Discord](https://dcbadge.vercel.app/api/server/gnWRz88eym?compact=true&style=flat)](https://discord.gg/gnWRz88eym)

**griptape** is a modular Python framework for LLM workflows, tools, memory, and data that enables developers to:

1. 🤖 Build **AI agents**, sequential **LLM pipelines** and sprawling **DAG workflows** for complex use cases.
2. ⛓️ Augment LLMs with **chain of thought** capabilities.
3. 🧰️ Integrate other services and functionality into LLMs as [tools](https://github.com/griptape-ai/griptape-tools) (e.g., calculators, web scrapers, spreadsheet editors, and API connectors); run tools in any environment (local, containerized, cloud, etc.); and wrap tools with off prompt data storage that prevents LLMs from accessing your data directly.
4. 💾 Add **memory** to AI pipelines for context preservation and summarization.

## Documentation

Please refer to [Griptape Docs](https://griptape.readthedocs.io) 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](https://beta.openai.com/account/api-keys) and adding it to your environment as `OPENAI_API_KEY`. griptape uses [OpenAI Completions API](https://platform.openai.com/docs/guides/completion) to execute LLM prompts and to work with [LlamaIndex](https://gpt-index.readthedocs.io/en/latest/index.html) data structures.

With **griptape**, you can create *structures*, such as `Agents`, `Pipelines`, and `Workflows`, that are composed of different types of tasks. You can also define structures as JSON objects and load them into **griptape** dynamically. Let's define a simple two-task pipeline that uses tools and ramps:

```python
from griptape.memory import Memory
from griptape.ramps import TextStorageRamp, BlobStorageRamp
from griptape.structures import Pipeline
from griptape.tasks import ToolkitTask, PromptTask
from griptape.tools import WebScraper, TextProcessor, FileManager

# Ramps enable LLMs to store and manipulate data without ever looking at it directly.
text_storage = TextStorageRamp()
blob_storage = BlobStorageRamp()

# Connect a web scraper to load web pages.
web_scraper = WebScraper(
    ramps={
        "get_content": [text_storage]
    }
)

# TextProcessor enables LLMs to summarize and query text.
text_processor = TextProcessor(
    ramps={
        "summarize": [text_storage],
        "query": [text_storage]
    }
)

# File manager can load and store files locally.
file_manager = FileManager(
    ramps={
        "load": [blob_storage],
        "save": [text_storage, blob_storage]
    }
)

# Pipelines represent sequences of tasks.
pipeline = Pipeline(
    memory=Memory()
)

pipeline.add_tasks(
    # Load up the first argument from `pipeline.run`.
    ToolkitTask(
        "{{ args[0] }}",
        tools=[web_scraper, text_processor, file_manager]
    ),
    # Augment `input` from the previous task.
    PromptTask(
        "Say the following in spanish: {{ input }}"
    )
)

result = pipeline.run("Load https://griptape.readthedocs.io, summarize it, and store it in griptape.txt")

print(result.output.to_text())
```

Boom! Our first LLM pipeline with two sequential tasks generated the following exchange:

```
Q: Load https://griptape.readthedocs.io, summarize it, and store it in griptape.txt
A: El contenido de https://griptape.readthedocs.io ha sido resumido y almacenado en griptape.txt.
```

## Versioning

**griptape** is in early 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.

