Package: griptape
griptapeGriptapeis a modular Python framework for building AI-powered applications that connect securely to your enterprise data and APIs. It offers developers the ability to maintain control and flexibility at every step.Build AI Apps: Easily compose apps in Python with modular structures and ready-made tools. Use built-in drivers to connect to whichever LLMs and data stores you choose.Control Data Access: Connect securely to data sources with granular access controls, ensuring LLMs stay focused on the information that matters.Scale With Your Workload: Easily deploy and run apps in the cloud, where your data lives. Process data ahead of time or vectorize it on the fly.Using Griptape, you can securely integrate with your internal data stores and APIs. You get to control what data goes into the prompt, and what the LLM is allowed to do with it.DocumentationPlease refer toGriptape Docsfor:Getting started guides.Core concepts and design overviews.Examples.Contribution guidelines.Please check outGriptape Trade Schoolfor free online courses.Quick StartFirst, installgriptape:pip install griptape[all] -USecond, configure an OpenAI client bygetting an API keyand adding it to your environment asOPENAI_API_KEY. By default, Griptape usesOpenAI Chat Completions APIto execute LLM prompts.With Griptape, you can createstructures, such asAgents,Pipelines, andWorkflows, that are composed of different types of tasks. Let's build a simple creative agent that dynamically uses three tools and moves the data around in short-term memory.fromgriptape.structuresimportAgentfromgriptape.toolsimportWebScraper,FileManager,TaskMemoryClientagent=Agent(input_template="Load {{ args[0] }}, summarize it, and store it in a file called {{ args[1] }}.",tools=[WebScraper(),FileManager(),TaskMemoryClient(off_prompt=True)])agent.run("https://griptape.ai","griptape.txt")And here is the output:[11/02/23 15:28:24] INFO     ToolkitTask 72b89a905be84245a0563b206795ac73       
                             Input: Load https://griptape.ai, summarize it, and 
                             store it in a file called griptape.txt.            
[11/02/23 15:28:37] INFO     Subtask f2cd3cfecaeb4001a0d3eccad32c2d07           
                             Thought: First, I need to use the WebScraper action to
                             load the content of the webpage.                   
                                                                                
                             Action: {"name": "WebScraper", "path":            
                             "get_content", "input": {"values": {"url":         
                             "https://griptape.ai"}}}                           
                    INFO     Subtask f2cd3cfecaeb4001a0d3eccad32c2d07           
                             Response: Output of "WebScraper.get_content" was   
                             stored in memory with memory_name "TaskMemory" and 
                             artifact_namespace                                 
                             "c497d83c1d134db694b9994596016320"                 
[11/02/23 15:28:50] INFO     Subtask 0096dac0f0524636be197e06a37f8aa0           
                             Thought: Now that the webpage content is stored in 
                             memory, I need to use the TaskMemoryClient action  
                             to summarize the content.                          
                             Action: {"name": "TaskMemoryClient", "path":   
                             "summarize", "input": {"values": {"memory_name":   
                             "TaskMemory", "artifact_namespace":                
                             "c497d83c1d134db694b9994596016320"}}}              
[11/02/23 15:29:06] INFO     Subtask 0096dac0f0524636be197e06a37f8aa0           
                             Response: Output of "TaskMemoryClient.summarize"
                             was stored in memory with memory_name "TaskMemory" 
                             and artifact_namespace                             
                             "77584322d33d40e992da9767d02a9018"                 
[11/02/23 15:29:25] INFO     Subtask 7cc3d96500ce4efdac085c07c7370822           
                             Thought: Now that the summary is stored in memory, 
                             I need to use the FileManager action to save the      
                             summary to a file named griptape.txt.              
                             Action: {"name": "FileManager", "path":           
                             "save_memory_artifacts_to_disk", "input":          
                             {"values": {"dir_name": ".", "file_name":          
                             "griptape.txt", "memory_name": "TaskMemory",       
                             "artifact_namespace":                              
                             "77584322d33d40e992da9767d02a9018"}}}              
                    INFO     Subtask 7cc3d96500ce4efdac085c07c7370822           
                             Response: saved successfully                       
[11/02/23 15:29:30] INFO     ToolkitTask 72b89a905be84245a0563b206795ac73       
                             Output: The summary of the webpage                 
                             https://griptape.ai has been successfully stored in
                             a file named griptape.txt.During the run, the Griptape Agent loaded a webpage with aTool, stored its full content inTool Memory, queried it to answer the original question, and finally saved the answer to a file.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 full content of the page never goes back to the LLM. Additionally, no data from the subsequent subtasks were returned back to the prompt either. So, how does it work?All tools have theoff_promptproperty enabled be default. Disabling it (off_prompt=False) will force the framework to return all tool outputs directly to the LLM prompt.TaskMemoryClientrequires the user to set this property explicitly for usability reasons. In the above example, we setoff_prompttoTrue, which means that the LLM can never see the data it manipulates, but can send it to other tools.Check out our docsto learn more about how to use Griptape with other LLM providers like Anthropic, Claude, Hugging Face, and Azure.VersioningGriptape 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.ContributingThank you for considering contributing to Griptape! Before you start, please read the following guidelines.Submitting IssuesIf you have identified a bug, want to propose a new feature, or have a question, please submit an issue through our publicissue tracker. Before submitting a new issue, please check the existing issues to ensure it hasn't been reported or discussed before.New Griptape ToolsGriptape's extensibility allows anyone to develop and distribute tools independently. With rare exceptions for tools providing broadly applicable functionality, new Griptape tools should be managed as their own projects and not submitted to the core framework. Pull requests for new tools (unless addressing anexisting issue) will be closed.TheGriptape Tool Templateprovides the recommended structure, step-by-step instructions, basic automation, and usage examples for new tools. In the Template, selectUse this templatethenCreate a new repositoryto begin a new tool project.Submitting Pull RequestsWe welcome and encourage pull requests. To streamline the process, please follow these guidelines:Existing Issues:Please submit pull requests only for existing issues. If you want to work on new functionality or fix a bug that hasn't been addressed yet, please first submit an issue. This allows the Griptape team to internally process the request and provide a public response.Branch:Submit all pull requests to thedevbranch. This helps us manage changes and integrate them smoothly.Unit Tests:Ensure that your pull request passes all existing unit tests. Additionally, if you are introducing new code, please include new unit tests to validate its functionality.Documentation:Every pull request must include a corresponding pull request in thedocs repositoryor explicitly explain why a documentation update is not required. Documentation is crucial for maintaining a comprehensive and user-friendly project.Code Style:Griptape usesBlackto enforce style guidelines. You can ensure that your code is formatted accordingly and will pass formatting checks usingpre-commit. SeeToolsfor information on how to configure this and other dev tools.ToolsInstall dev dependencies with Poetry:poetryinstall--withdevConfigure pre-commit to ensure that your code is formatted correctly and passes all checks:poetryrunpre-commitinstallLicenseGriptape is available under the Apache 2.0 License.