From 33c8a99d5b8b73b9a8f00de5ff7d082bd3855e7e Mon Sep 17 00:00:00 2001 From: Collin Dutter Date: Wed, 9 Oct 2024 13:11:48 -0700 Subject: [PATCH] Format repo --- .github/ISSUE_TEMPLATE/bug_report.md | 8 +- .github/ISSUE_TEMPLATE/feature_request.md | 5 +- CHANGELOG.md | 197 ++++++++++++------ MIGRATION.md | 46 +++- README.md | 12 +- docs/contributing.md | 9 +- docs/examples/amazon-dynamodb-sessions.md | 2 +- docs/examples/multi-agent-workflow.md | 1 - docs/examples/query-webpage-astra-db.md | 1 - .../data-sources/create-data-source.md | 4 +- docs/griptape-cloud/index.md | 4 + .../knowledge-bases/accessing-data.md | 2 +- .../structures/create-structure.md | 4 +- .../structures/structure-config.md | 14 +- docs/griptape-framework/data/artifacts.md | 2 +- docs/griptape-framework/data/chunkers.md | 12 +- docs/griptape-framework/data/index.md | 2 +- docs/griptape-framework/data/loaders.md | 4 +- .../drivers/audio-transcription-drivers.md | 4 +- .../drivers/conversation-memory-drivers.md | 5 +- .../drivers/embedding-drivers.md | 14 +- .../drivers/event-listener-drivers.md | 5 +- .../drivers/image-generation-drivers.md | 10 +- .../drivers/image-query-drivers.md | 6 +- .../drivers/observability-drivers.md | 13 +- .../drivers/prompt-drivers.md | 2 +- .../drivers/ruleset-drivers.md | 2 +- .../griptape-framework/drivers/sql-drivers.md | 11 +- .../drivers/structure-run-drivers.md | 4 +- .../drivers/text-to-speech-drivers.md | 2 +- .../drivers/vector-store-drivers.md | 8 +- .../drivers/web-scraper-drivers.md | 4 +- .../drivers/web-search-drivers.md | 12 +- .../engines/audio-engines.md | 2 +- .../engines/extraction-engines.md | 8 +- .../engines/image-generation-engines.md | 2 +- .../engines/image-query-engines.md | 2 +- .../griptape-framework/engines/rag-engines.md | 5 +- .../engines/summary-engines.md | 2 +- docs/griptape-framework/index.md | 45 ++-- docs/griptape-framework/misc/events.md | 9 +- docs/griptape-framework/misc/tokenizers.md | 10 +- docs/griptape-framework/structures/agents.md | 2 +- docs/griptape-framework/structures/configs.md | 10 +- .../structures/conversation-memory.md | 3 +- .../structures/observability.md | 2 +- .../structures/pipelines.md | 12 +- .../griptape-framework/structures/rulesets.md | 5 +- .../structures/task-memory.md | 27 ++- docs/griptape-framework/structures/tasks.md | 23 +- .../structures/workflows.md | 15 +- docs/griptape-framework/tools/index.md | 9 +- docs/griptape-tools/custom-tools/index.md | 6 +- .../official-tools/aws-iam-tool.md | 1 + .../official-tools/aws-s3-tool.md | 1 + .../official-tools/calculator-tool.md | 1 + .../official-tools/computer-tool.md | 3 +- .../official-tools/date-time-tool.md | 1 + .../official-tools/extraction-tool.md | 1 + .../official-tools/file-manager-tool.md | 1 + .../official-tools/google-calendar-tool.md | 1 - .../official-tools/google-docs-tool.md | 1 + .../official-tools/google-drive-tool.md | 1 + .../official-tools/google-gmail-tool.md | 1 + .../official-tools/prompt-summary-tool.md | 7 +- .../official-tools/query-tool.md | 1 + .../griptape-tools/official-tools/rag-tool.md | 1 + .../official-tools/rest-api-tool.md | 3 +- .../griptape-tools/official-tools/sql-tool.md | 1 + .../official-tools/structure-run-tool.md | 1 + .../variation-image-generation-tool.md | 2 +- .../official-tools/web-scraper-tool.md | 1 + .../official-tools/web-search-tool.md | 1 + docs/index.md | 2 +- 74 files changed, 409 insertions(+), 254 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 9813b6abae..044c53f3b0 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -4,10 +4,9 @@ about: Create a report to help us improve title: '' labels: bug assignees: '' - --- - - [ ] I have read and agree to the [contributing guidelines](https://github.com/griptape-ai/griptape#contributing). +- [ ] I have read and agree to the [contributing guidelines](https://github.com/griptape-ai/griptape#contributing). **Describe the bug** A clear and concise description of what the bug is. @@ -22,8 +21,9 @@ A clear and concise description of what you expected to happen. If applicable, add screenshots to help explain your problem. **Desktop (please complete the following information):** - - OS: [e.g. iOS] - - Version [e.g. 0.5.1] + +- OS: \[e.g. iOS\] +- Version \[e.g. 0.5.1\] **Additional context** Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index a4643237ff..c132bfd355 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -4,13 +4,12 @@ about: Suggest an idea for this project title: '' labels: enhancement assignees: '' - --- - - [ ] I have read and agree to the [contributing guidelines](https://github.com/griptape-ai/griptape#contributing). +- [ ] I have read and agree to the [contributing guidelines](https://github.com/griptape-ai/griptape#contributing). **Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] +A clear and concise description of what the problem is. Ex. I'm always frustrated when \[...\] **Describe the solution you'd like** A clear and concise description of what you want to happen. diff --git a/CHANGELOG.md b/CHANGELOG.md index f894725411..63acda3f6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ # Changelog + All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), @@ -7,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased ## Added + - `Workflow.input_tasks` and `Workflow.output_tasks` to access the input and output tasks of a Workflow. - Ability to pass nested list of `Tasks` to `Structure.tasks` allowing for more complex declarative Structure definitions. - `TavilyWebSearchDriver` to integrate Tavily's web search capabilities. @@ -23,10 +25,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `LocalRulesetDriver` for loading a `Ruleset` from a local `.json` file. - `GriptapeCloudRulesetDriver` for loading a `Ruleset` resource from Griptape Cloud. - Parameter `alias` on `GriptapeCloudConversationMemoryDriver` for fetching a Thread by alias. -- Basic support for OpenAi Structured Output via `OpenAiChatPromptDriver.response_format` parameter. +- Basic support for OpenAi Structured Output via `OpenAiChatPromptDriver.response_format` parameter. - Ability to pass callable to `activity.schema` for dynamic schema generation. ### Changed + - **BREAKING**: Renamed parameters on several classes to `client`: - `bedrock_client` on `AmazonBedrockCohereEmbeddingDriver`. - `bedrock_client` on `AmazonBedrockCohereEmbeddingDriver`. @@ -78,6 +81,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Remove `manifest.yml` requirements for custom tool creation. ### Fixed + - Anthropic native Tool calling. - Empty `ActionsSubtask.thought` being logged. - `RuleMixin` no longer prevents setting `rulesets` _and_ `rules` at the same time. @@ -85,9 +89,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `PromptTask` not checking whether Structure was set before building Prompt Stack. - `BaseTask.full_context` context being empty when not connected to a Structure. -## [0.32.0] - 2024-09-17 +## \[0.32.0\] - 2024-09-17 ### Added + - `BaseArtifact.to_bytes()` method to convert an Artifact's value to bytes. - `BlobArtifact.base64` property for converting a `BlobArtifact`'s value to a base64 string. - `CsvLoader`/`SqlLoader`/`DataframeLoader` `formatter_fn` field for customizing how SQL results are formatted into `TextArtifact`s. @@ -98,8 +103,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Generic type support to `ListArtifact`. - Iteration support to `ListArtifact`. - ### Changed + - **BREAKING**: Removed `CsvRowArtifact`. Use `TextArtifact` instead. - **BREAKING**: Removed `DataframeLoader`. - **BREAKING**: Removed `MediaArtifact`, use `ImageArtifact` or `AudioArtifact` instead. @@ -110,19 +115,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **BREAKING**: Moved `ImageArtifact.prompt` and `ImageArtifact.model` into `ImageArtifact.meta`. - **BREAKING**: `ImageArtifact.format` is now required. - **BREAKING**: Removed the `__all__` declaration from the `griptape.mixins` module. -- Updated `JsonArtifact` value converter to properly handle more types. +- Updated `JsonArtifact` value converter to properly handle more types. - `AudioArtifact` now subclasses `BlobArtifact` instead of `MediaArtifact`. - `ImageArtifact` now subclasses `BlobArtifact` instead of `MediaArtifact`. - Removed `__add__` method from `BaseArtifact`, implemented it where necessary. ### Fixed + - Crash when passing "empty" Artifacts or no Artifacts to `CohereRerankDriver`. -## [0.31.0] - 2024-09-03 +## \[0.31.0\] - 2024-09-03 **Note**: This release includes breaking changes. Please refer to the [Migration Guide](./MIGRATION.md#030x-to-031x) for details. ### Added + - Parameter `meta: dict` on `BaseEvent`. - `AzureOpenAiTextToSpeechDriver`. - Ability to use Event Listeners as Context Managers for temporarily setting the Event Bus listeners. @@ -130,17 +137,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Ability to use Drivers Configs as Context Managers for temporarily setting the default Drivers. ### Changed + - **BREAKING**: Drivers, Loaders, and Engines now raise exceptions rather than returning `ErrorArtifacts`. - **BREAKING**: Parameter `driver` on `BaseConversationMemory` renamed to `conversation_memory_driver`. - **BREAKING**: `BaseConversationMemory.add_to_prompt_stack` now takes a `prompt_driver` parameter. - **BREAKING**: `BaseConversationMemoryDriver.load` now returns `tuple[list[Run], dict]`. This represents the runs and metadata. - **BREAKING**: `BaseConversationMemoryDriver.store` now takes `runs: list[Run]` and `metadata: dict` as input. - **BREAKING**: Parameter `file_path` on `LocalConversationMemoryDriver` renamed to `persist_file` and is now type `Optional[str]`. -- **BREAKING**: Removed the `__all__` declaration from the `griptape.mixins` module. +- **BREAKING**: Removed the `__all__` declaration from the `griptape.mixins` module. - `Defaults.drivers_config.conversation_memory_driver` now defaults to `LocalConversationMemoryDriver` instead of `None`. - `CsvRowArtifact.to_text()` now includes the header. ### Fixed + - Parsing streaming response with some OpenAI compatible services. - Issue in `PromptSummaryEngine` if there are no artifacts during recursive summarization. - Issue in `GooglePromptDriver` using Tools with no schema. @@ -149,22 +158,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Crash when using `CohereRerankDriver` with `CsvRowArtifact`s. - Crash when passing "empty" Artifacts or no Artifacts to `CohereRerankDriver`. - -## [0.30.2] - 2024-08-26 +## \[0.30.2\] - 2024-08-26 ### Fixed -- Ensure thread safety when publishing events by adding a thread lock to batch operations in `BaseEventListenerDriver`. + +- Ensure thread safety when publishing events by adding a thread lock to batch operations in `BaseEventListenerDriver`. - `FileManagerTool` failing to save Artifacts created by `ExtractionTool` with a `CsvExtractionEngine`. -## [0.30.1] - 2024-08-21 +## \[0.30.1\] - 2024-08-21 ### Fixed + - `CsvExtractionEngine` not using provided `Ruleset`s. - Docs examples for Extraction Engines not properly passing in schemas. -## [0.30.0] - 2024-08-20 +## \[0.30.0\] - 2024-08-20 ### Added + - `AstraDbVectorStoreDriver` to support DataStax Astra DB as a vector store. - Ability to set custom schema properties on Tool Activities via `extra_schema_properties`. - Parameter `structure` to `BaseTask`. @@ -178,13 +189,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `QueryTool` for having the LLM query text. - Support for bitshift composition in `BaseTask` for adding parent/child tasks. - `JsonArtifact` for handling de/seralization of values. -- `Chat.logger_level` for setting what the `Chat` utility sets the logger level to. +- `Chat.logger_level` for setting what the `Chat` utility sets the logger level to. - `FuturesExecutorMixin` to DRY up and optimize concurrent code across multiple classes. - `utils.execute_futures_list_dict` for executing a dict of lists of futures. - `GriptapeCloudConversationMemoryDriver` to store conversation history in Griptape Cloud. - `griptape.utils.decorators.lazy_property` for creating lazy properties. ### Changed + - **BREAKING**: Removed all uses of `EventPublisherMixin` in favor of `EventBus`. - **BREAKING**: Removed `EventPublisherMixin`. - **BREAKING**: Removed `Pipeline.prompt_driver` and `Workflow.prompt_driver`. Set this via `griptape.configs.Defaults.drivers.prompt_driver` instead. `Agent.prompt_driver` has not been removed. @@ -196,18 +208,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **BREAKING**: `RagContext.output` was changed to `RagContext.outputs` to support multiple outputs. All relevant RAG modules were adjusted accordingly. - **BREAKING**: Removed before and after response modules from `ResponseRagStage`. - **BREAKING**: Moved ruleset and metadata ingestion from standalone modules to `PromptResponseRagModule`. -- **BREAKING**: Dropped `Client` from all Tool names for better naming consistency. -- **BREAKING**: Dropped `_client` suffix from all Tool packages. -- **BREAKING**: Added `Tool` suffix to all Tool names for better naming consistency. -- **BREAKING**: Removed `TextArtifactStorage.query` and `TextArtifactStorage.summarize`. +- **BREAKING**: Dropped `Client` from all Tool names for better naming consistency. +- **BREAKING**: Dropped `_client` suffix from all Tool packages. +- **BREAKING**: Added `Tool` suffix to all Tool names for better naming consistency. +- **BREAKING**: Removed `TextArtifactStorage.query` and `TextArtifactStorage.summarize`. - **BREAKING**: Removed `TextArtifactStorage.rag_engine`, and `TextArtifactStorage.retrieval_rag_module_name`. - **BREAKING**: Removed `TextArtifactStorage.summary_engine`, `TextArtifactStorage.csv_extraction_engine`, and `TextArtifactStorage.json_extraction_engine`. - **BREAKING**: Removed `TaskMemory.summarize_namespace` and `TaskMemory.query_namespace`. - **BREAKING**: Removed `Structure.rag_engine`. - **BREAKING**: Split `JsonExtractionEngine.template_generator` into `JsonExtractionEngine.system_template_generator` and `JsonExtractionEngine.user_template_generator`. - **BREAKING**: Split `CsvExtractionEngine.template_generator` into `CsvExtractionEngine.system_template_generator` and `CsvExtractionEngine.user_template_generator`. -- **BREAKING**: Changed `JsonExtractionEngine.template_schema` from a `run` argument to a class attribute. -- **BREAKING**: Changed `CsvExtractionEngine.column_names` from a `run` argument to a class attribute. +- **BREAKING**: Changed `JsonExtractionEngine.template_schema` from a `run` argument to a class attribute. +- **BREAKING**: Changed `CsvExtractionEngine.column_names` from a `run` argument to a class attribute. - **BREAKING**: Removed `JsonExtractionTask`, and `CsvExtractionTask` use `ExtractionTask` instead. - **BREAKING**: Removed `TaskMemoryClient`, use `QueryClient`, `ExtractionTool`, or `PromptSummaryTool` instead. - **BREAKING**: `BaseTask.add_parent/child` now take a `BaseTask` instead of `str | BaseTask`. @@ -217,6 +229,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `Chat` now sets the `griptape` logger level to `logging.ERROR`, suppressing all logs except for errors. ### Fixed + - `JsonExtractionEngine` failing to parse json when the LLM outputs more than just the json. - Exception when adding `ErrorArtifact`'s to the Prompt Stack. - Concurrency bug in `BaseVectorStoreDriver.upsert_text_artifacts`. @@ -224,23 +237,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Issue with native Tool calling and streaming with `GooglePromptDriver`. - Description not being used properly in `StructureRunTool`. -## [0.29.2] - 2024-08-16 +## \[0.29.2\] - 2024-08-16 ### Fixed + - `Workflow` threads not being properly cleaned up after completion. - Crash when `ToolAction`s were missing output due to an `ActionsSubtask` exception. -## [0.29.1] - 2024-08-02 +## \[0.29.1\] - 2024-08-02 ### Changed + - Remove `BaseTextArtifact`, revert `CsvRowArtifact` to subclass `TextArtifact`. ### Fixed + - Missing extra for `drivers-text-to-speech-elevenlabs`. -## [0.29.0] - 2024-07-30 +## \[0.29.0\] - 2024-07-30 ### Added + - Native function calling support to `OpenAiChatPromptDriver`, `AzureOpenAiChatPromptDriver`, `AnthropicPromptDriver`, `AmazonBedrockPromptDriver`, `GooglePromptDriver`, `OllamaPromptDriver`, and `CoherePromptDriver`. - `OllamaEmbeddingDriver` for generating embeddings with Ollama. - `GriptapeCloudKnowledgeBaseVectorStoreDriver` to query Griptape Cloud Knowledge Bases. @@ -262,6 +279,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Optional `params` field to `WebSearch`'s `search` schema that the LLM can be steered into using. ### Changed + - **BREAKING**: `BaseVectorStoreDriver.upsert_text_artifacts` optional arguments are now keyword-only arguments. - **BREAKING**: `BaseVectorStoreDriver.upsert_text_artifact` optional arguments are now keyword-only arguments. - **BREAKING**: `BaseVectorStoreDriver.upsert_text` optional arguments are now keyword-only arguments. @@ -289,23 +307,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `TextArtifact` now inherits from `BaseTextArtifact`. ### Fixed + - Parameter `count` for `QdrantVectorStoreDriver.query` now optional as per documentation. - Path issues on Windows with `LocalFileManagerDriver` and `AmazonS3FileManagerDriver`. -## [0.28.2] - 2024-07-12 +## \[0.28.2\] - 2024-07-12 + ### Fixed + - Conversation Memory being incorrectly inserted into the `PromptTask.prompt_stack` when no system content is present. -## [0.28.1] - 2024-07-10 +## \[0.28.1\] - 2024-07-10 ### Fixed + - Sending empty system content in `PromptTask`. - Throttling issues with `DuckDuckGoWebSearchDriver`. -## [0.28.0] - 2024-07-09 +## \[0.28.0\] - 2024-07-09 + ### Added + - `RagEngine` is an abstraction for implementing modular RAG pipelines. - - `RagContext` is a container object for passing around RAG context. + - `RagContext` is a container object for passing around RAG context. - RAG stages: - `QueryRagStage` for parsing and expanding queries. - `RetrievalRagStage` for retrieving content. @@ -346,7 +370,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `ImageMessageContent` for storing image content in a `Message`. - Support for adding `TextArtifact`s, `ImageArtifact`s, and `ListArtifact`s to `PromptStack`. - Support for image inputs to `OpenAiChatPromptDriver`, `AzureOpenAiChatPromptDriver`, `AmazonBedrockPromptDriver`, `AnthropicPromptDriver`, and `GooglePromptDriver`. -- Input/output token usage metrics to all Prompt Drivers. +- Input/output token usage metrics to all Prompt Drivers. - `FinishPromptEvent.input_token_count` and `FinishPromptEvent.output_token_count`. - Support for storing Artifacts as inputs/outputs in Conversation Memory Runs. - `Agent.input` for passing Artifacts as input. @@ -355,6 +379,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `Reference` for supporting artifact citations in loaders and RAG engine modules. ### Changed + - **BREAKING**: Moved/renamed `griptape.utils.PromptStack` to `griptape.common.PromptStack`. - **BREAKING**: Renamed `PromptStack.inputs` to `PromptStack.messages`. - **BREAKING**: Moved `PromptStack.USER_ROLE`, `PromptStack.ASSISTANT_ROLE`, and `PromptStack.SYSTEM_ROLE` to `Message`. @@ -378,28 +403,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Default Prompt Driver model in `GoogleStructureConfig` to `gemini-1.5-pro`. ### Fixed + - `CoherePromptDriver` to properly handle empty history. -- `StructureVisualizer.to_url()` by wrapping task IDs in single quotes. +- `StructureVisualizer.to_url()` by wrapping task IDs in single quotes. -## [0.27.2] - 2024-06-27 +## \[0.27.2\] - 2024-06-27 ### Fixed + - Avoid adding duplicate Tokenizer stop sequences in a `ToolkitTask`. - Fixed token count calculation in `VectorQueryEngine`. -## [0.27.1] - 2024-06-20 +## \[0.27.1\] - 2024-06-20 ### Added + - Support for Claude 3.5 Sonnet in `AnthropicPromptDriver` and `AmazonBedrockPromptDriver`. ### Changed + - Base Tool schema so that `input` is optional when no Tool Activity schema is set. -- Tool Task system prompt for better results with lower-end models. +- Tool Task system prompt for better results with lower-end models. - Default Prompt Driver model to Claude 3.5 Sonnet in `AnthropicStructureConfig` and `AmazonBedrockStructureConfig.` -## [0.27.0] - 2024-06-19 +## \[0.27.0\] - 2024-06-19 ### Added + - `BaseTask.add_child()` to add a child task to a parent task. - `BaseTask.add_children()` to add multiple child tasks to a parent task. - `BaseTask.add_parent()` to add a parent task to a child task. @@ -412,13 +442,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `AmazonSageMakerJumpstartEmbeddingDriver.custom_attributes` for setting custom attributes when invoking an endpoint. - `ToolkitTask.response_stop_sequence` for overriding the default Chain of Thought stop sequence. - `griptape.utils.StructureVisualizer` for visualizing Workflow structures with Mermaid.js -- `BaseTask.parents_outputs` to get the textual output of all parent tasks. +- `BaseTask.parents_outputs` to get the textual output of all parent tasks. - `BaseTask.parents_output_text` to get a concatenated string of all parent tasks' outputs. - `parents_output_text` to Workflow context. - `OllamaPromptModelDriver` for using models with Ollama. - Parameter `output` on `Structure` as a convenience for `output_task.output` ### Changed + - **BREAKING**: `Workflow` no longer modifies task relationships when adding tasks via `tasks` init param, `add_tasks()` or `add_task()`. Previously, adding a task would automatically add the previously added task as its parent. Existing code that relies on this behavior will need to be updated to explicitly add parent/child relationships using the API offered by `BaseTask`. - **BREAKING**: Removed `AmazonBedrockPromptDriver.prompt_model_driver` as it is no longer needed with the `AmazonBedrockPromptDriver` Converse API implementation. - **BREAKING**: Removed `BedrockClaudePromptModelDriver`. @@ -456,6 +487,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Updated template `templates/tasks/tool_task/system.j2`. ### Fixed + - `Workflow.insert_task()` no longer inserts duplicate tasks when given multiple parent tasks. - Performance issue in `OpenAiChatPromptDriver` when extracting unused rate-limiting headers. - Streaming not working when using deprecated `Structure.stream` field. @@ -467,11 +499,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `TextArtifacts` contained in `ListArtifact` returned by `WebSearch.search` to properly formatted stringified JSON. - Structure run args not being set immediately. - Input and output logging in BaseAudioInputTasks and BaseAudioGenerationTasks -- Validation of `max_tokens` < 0 on `BaseChunker` +- Validation of `max_tokens` \< 0 on `BaseChunker` -## [0.26.0] - 2024-06-04 +## \[0.26.0\] - 2024-06-04 ### Added + - `AzureOpenAiStructureConfig` for providing Structures with all Azure OpenAI Driver configuration. - `AzureOpenAiVisionImageQueryDriver` to support queries on images using Azure's OpenAI Vision models. - `AudioLoader` for loading audio content into an `AudioArtifact`. @@ -481,10 +514,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `PusherEventListenerDriver` to enable sending of framework events over a Pusher WebSocket. ### Changed + - **BREAKING**: Updated OpenAI-based image query drivers to remove Vision from the name. - **BREAKING**: `off_prompt` now defaults to `False` on all Tools, making Task Memory something that must be explicitly opted into. -- **BREAKING**: Removed `StructureConfig.global_drivers`. Pass Drivers directly to the Structure Config instead. -- **BREAKING**: Removed `StructureConfig.task_memory` in favor of configuring directly on the Structure. +- **BREAKING**: Removed `StructureConfig.global_drivers`. Pass Drivers directly to the Structure Config instead. +- **BREAKING**: Removed `StructureConfig.task_memory` in favor of configuring directly on the Structure. - **BREAKING**: Updated OpenAI-based image query drivers to remove Vision from the name. - **BREAKING**: `off_prompt` now defaults to `False` on all Tools, making Task Memory something that must be explicitly opted into. - **BREAKING**: `AmazonSageMakerPromptDriver.model` parameter, which gets passed to `SageMakerRuntime.Client.invoke_endpoint` as `EndpointName`, is now renamed to `AmazonSageMakerPromptDriver.endpoint`. @@ -497,27 +531,32 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Error message to be more helpful when importing optional dependencies. ### Fixed + - Extra fields being excluded when using `SerializableMixin.from_dict`. -- Validation of `max_tokens` < 0 on `BaseChunker` +- Validation of `max_tokens` \< 0 on `BaseChunker` -## [0.25.1] - 2024-05-15 +## \[0.25.1\] - 2024-05-15 ### Fixed + - Honor `namespace` in `RedisVectorStoreDriver.query()`. - Correctly set the `meta`, `score`, and `vector` fields of query result returned from `RedisVectorStoreDriver.query()`. - Standardize behavior between omitted and empty actions list when initializing `ActionsSubtask`. ### Added + - Optional event batching on Event Listener Drivers. - `id` field to all events. ### Changed + - Default behavior of Event Listener Drivers to batch events. - Default behavior of OpenAiStructureConfig to utilize `gpt-4o` for prompt_driver. -## [0.25.0] - 2024-05-06 +## \[0.25.0\] - 2024-05-06 ### Added + - `list_files_from_disk` activity to `FileManager` Tool. - Support for Drivers in `EventListener`. - `AmazonSqsEventListenerDriver` for sending events to an Amazon SQS queue. @@ -540,6 +579,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `LocalStructureRunDriver` for running Structures in the same run-time environment as the code that is running the Structure. ### Changed + - **BREAKING**: Secret fields (ex: api_key) removed from serialized Drivers. - **BREAKING**: Remove `FileLoader`. - **BREAKING**: `CsvLoader` no longer accepts `str` file paths as a source. It will now accept the content of the CSV file as a `str` or `bytes` object. @@ -554,16 +594,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Updated `EventListener.handler`'s behavior so that the return value will be passed to the `EventListenerDriver.try_publish_event_payload`'s `event_payload` parameter. ### Fixed + - Type hint for parameter `azure_ad_token_provider` on Azure OpenAI drivers to `Optional[Callable[[], str]]`. - Missing parameters `azure_ad_token` and `azure_ad_token_provider` on the default client for `AzureOpenAiCompletionPromptDriver`. -## [0.24.2] - 2024-04-04 +## \[0.24.2\] - 2024-04-04 - Fixed FileManager.load_files_from_disk schema. -## [0.24.1] - 2024-03-28 +## \[0.24.1\] - 2024-03-28 -### Fixed +### Fixed - Fixed boto3 type-checking stub dependency. @@ -571,14 +612,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Use `schema` instead of `jsonschema` for JSON validation. -## [0.24.0] - 2024-03-27 +## \[0.24.0\] - 2024-03-27 ### Added + - Every subtask in `ToolkitTask` can now execute multiple actions in parallel. - Added `BaseActionSubtaskEvent.subtask_actions`. - Support for `text-embedding-3-small` and `text-embedding-3-large` models. -- `GooglePromptDriver` and `GoogleTokenizer` for use with `gemini-pro`. -- `GoogleEmbeddingDriver` for use with `embedding-001`. +- `GooglePromptDriver` and `GoogleTokenizer` for use with `gemini-pro`. +- `GoogleEmbeddingDriver` for use with `embedding-001`. - `GoogleStructureConfig` for providing Structures with Google Prompt and Embedding Driver configuration. - Support for `claude-3-opus`, `claude-3-sonnet`, and `claude-3-haiku` in `AnthropicPromptDriver`. - Support for `anthropic.claude-3-sonnet-20240229-v1:0` and `anthropic.claude-3-haiku-20240307-v1:0` in `BedrockClaudePromptModelDriver`. @@ -588,14 +630,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `BaseWebScraperDriver` allowing multiple web scraping implementations. - `TrafilaturaWebScraperDriver` for scraping text from web pages using trafilatura. - `MarkdownifyWebScraperDriver` for scraping text from web pages using playwright and converting to markdown using markdownify. -- `VoyageAiEmbeddingDriver` for use with VoyageAi's embedding models. +- `VoyageAiEmbeddingDriver` for use with VoyageAi's embedding models. - `AnthropicStructureConfig` for providing Structures with Anthropic Prompt and VoyageAi Embedding Driver configuration. - `QdrantVectorStoreDriver` to integrate with Qdrant vector databases. ### Fixed + - Improved system prompt in `ToolTask` to support more use cases. ### Changed + - **BREAKING**: `ActionSubtask` was renamed to `ActionsSubtask`. - **BREAKING**: Removed `subtask_action_name`, `subtask_action_path`, and `subtask_action_input` in `BaseActionSubtaskEvent`. - **BREAKING**: `OpenAiVisionImageQueryDriver` field `model` no longer defaults to `gpt-4-vision-preview` and must be specified @@ -607,30 +651,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `OpenAiVisionImageQueryDriver` now has a required field `max_tokens` that defaults to 256 - `GriptapeCloudStructureRunDriver` now outputs a `BaseArtifact` instead of a `TextArtifact` -## [0.23.2] - 2024-03-15 +## \[0.23.2\] - 2024-03-15 ### Fixed + - Deprecation warnings not displaying for `Structure.prompt_driver`, `Structure.embedding_driver`, and `Structure.stream`. - `DummyException` error message not fully displaying. - `StructureConfig.task_memory` not defaulting to using `StructureConfig.global_drivers` by default. -## [0.23.1] - 2024-03-07 +## \[0.23.1\] - 2024-03-07 ### Fixed -- Action Subtask incorrectly raising an exception for actions without an input. -- Incorrect `GriptapeCloudKnowledgeBaseClient`'s API URLs. + +- Action Subtask incorrectly raising an exception for actions without an input. +- Incorrect `GriptapeCloudKnowledgeBaseClient`'s API URLs. - Issue with Tool Task system prompt causing the LLM to generate an invalid action. -## [0.23.0] - 2024-02-26 +## \[0.23.0\] - 2024-02-26 + +### Added -### Added - Image-to-image generation support for OpenAi Dall-E 2 model. - Image tools support loading artifacts from memory. - `AzureMongoDbVectorStoreDriver` for using CosmosDB with MongoDB vCore API. - `vector_path` field on `MongoDbAtlasVectorStoreDriver`. - `LeonardoImageGenerationDriver` supports image to image generation. -- `OpenAiStructureConfig` for providing Structures with all OpenAi Driver configuration. -- `AmazonBedrockStructureConfig` for providing Structures with all Amazon Bedrock Driver configuration. +- `OpenAiStructureConfig` for providing Structures with all OpenAi Driver configuration. +- `AmazonBedrockStructureConfig` for providing Structures with all Amazon Bedrock Driver configuration. - `StructureConfig` for building your own Structure configuration. - `JsonExtractionTask` for convenience over using `ExtractionTask` with a `JsonExtractionEngine`. - `CsvExtractionTask` for convenience over using `ExtractionTask` with a `CsvExtractionEngine`. @@ -638,11 +685,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `ImageQueryTool` allowing an Agent to make queries on images on disk or in Task Memory. - `ImageQueryTask` and `ImageQueryEngine`. -### Fixed +### Fixed + - `BedrockStableDiffusionImageGenerationModelDriver` request parameters for SDXLv1 (`stability.stable-diffusion-xl-v1`). - `BedrockStableDiffusionImageGenerationModelDriver` correctly handles the CONTENT_FILTERED response case. ### Changed + - **BREAKING**: Make `index_name` on `MongoDbAtlasVectorStoreDriver` a required field. - **BREAKING**: Remove `create_index()` from `MarqoVectorStoreDriver`, `OpenSearchVectorStoreDriver`, `PineconeVectorStoreDriver`, `RedisVectorStoreDriver`. - **BREAKING**: `ImageLoader().load()` now accepts image bytes instead of a file path. @@ -657,60 +706,80 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `InpaintingImageGenerationTask.image_generation_engine` now defaults to an `InpaintingImageGenerationEngine` with an Image Generation Driver default of `Structure.config.global_drivers.image_generation_driver`. - `OutpaintingImageGenerationTask.image_generation_engine` now defaults to an `OutpaintingImageGenerationEngine` with an Image Generation Driver default of `Structure.config.global_drivers.image_generation_driver`. -## [0.22.3] - 2024-01-22 +## \[0.22.3\] - 2024-01-22 ### Fixed + - `ToolkitTask`'s user subtask prompt occasionally causing the Task to end prematurely. -## [0.22.2] - 2024-01-18 +## \[0.22.2\] - 2024-01-18 ### Fixed + - `ToolkitTask`'s user subtask prompt occasionally causing a loop with Chain of Thought. ### Security -- Updated stale dependencies [CVE-2023-50447, CVE-2024-22195, and CVE-2023-36464] -## [0.22.1] - 2024-01-12 +- Updated stale dependencies \[CVE-2023-50447, CVE-2024-22195, and CVE-2023-36464\] + +## \[0.22.1\] - 2024-01-12 ### Fixed + - Action Subtasks incorrectly outputting the Task input after failing to follow the ReAct prompt. -## [0.22.0] - 2024-01-11 +## \[0.22.0\] - 2024-01-11 ### Added -- `PromptImageGenerationEngine` for generating images from text prompts. + +- `PromptImageGenerationEngine` for generating images from text prompts. + - `VariationImageGenerationEngine` for generating variations of an input image according to a text prompt. -- `InpaintingImageGenerationEngine` for modifying an input image according to a text prompt within the bounds of a mask defined by a mask image. + +- `InpaintingImageGenerationEngine` for modifying an input image according to a text prompt within the bounds of a mask defined by a mask image. + - `OutpaintingImageGenerationEngine` for modifying an input image according to a text prompt outside the bounds of a mask defined by a mask image. - `PromptImageGenerationClient` for enabling an LLM to use the `PromptImageGenerationEngine`. + - `VariationImageGenerationClient` for enabling an LLM to use the `VariationImageGenerationEngine`. + - `InpaintingImageGenerationClient` for enabling an LLM to use the `InpaintingImageGenerationEngine`. + - `OutpaintingImageGenerationClient` for enabling an LLM to use the `OutpaintingImageGenerationEngine`. - `OpenAiImageGenerationDriver` for use with OpenAI's image generation models. + - `LeonardoImageGenerationDriver` for use with Leonoaro AI's image generation models. + - `AmazonBedrockImageGenerationDriver` for use with Amazon Bedrock's image generation models; requires a Image Generation Model Driver. + - `BedrockTitanImageGenerationModelDriver` for use with Amazon Bedrock's Titan image generation. - `ImageArtifact` for storing image data; used heavily by the image Engines, Tasks, and Drivers. + - `ImageLoader` for loading images files into `ImageArtifact`s. - Support for all Tokenizers in `OpenAiChatPromptDriver`, enabling OpenAI drop-in clients such as Together AI. + - `AmazonSageMakerJumpstartEmbeddingDriver` for using Amazon SageMaker to generate embeddings. Thanks @KaushikIyer16! + - Claude 2.1 support in `AnthropicPromptDriver` and `AmazonBedrockPromptDriver` via `BedrockClaudePromptModelDriver`. + - `CodeExecutionTask` for executing code as a Task without the need for an LLM. -- `BedrockLlamaPromptModelDriver` for using Llama models on Amazon Bedrock. +- `BedrockLlamaPromptModelDriver` for using Llama models on Amazon Bedrock. ### Fixed -- `MongoDbAtlasVectorStore` namespace not being used properly when querying. + +- `MongoDbAtlasVectorStore` namespace not being used properly when querying. - Miscellaneous type errors throughout the codebase. - Remove unused section from `ToolTask` system prompt template. - Structure execution args being cleared after run, preventing inspection of the Structure's `input_task`'s `input`. - Unhandled `SqlClient` exception. Thanks @michal-repo! ### Changed + - **BREAKING**: Rename `input_template` field to `input` in Tasks that take a text input. - **BREAKING**: Rename `BedrockTitanEmbeddingDriver` to `AmazonBedrockTitanEmbeddingDriver`. - **BREAKING**: Rename `AmazonBedrockStableDiffusionImageGenerationModelDriver` to `BedrockStableDiffusionImageGenerationModelDriver`. diff --git a/MIGRATION.md b/MIGRATION.md index 474a2a9f31..5f2729876a 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -1,6 +1,7 @@ # Migration Guide This document provides instructions for migrating your codebase to accommodate breaking changes introduced in new versions of Griptape. + ## 0.32.X to 0.33.X ### Removed `torch` extra from `transformers` dependency @@ -8,11 +9,13 @@ This document provides instructions for migrating your codebase to accommodate b The `torch` extra has been removed from the `transformers` dependency. If you require `torch`, install it separately. #### Before + ```bash pip install griptape[drivers-prompt-huggingface-hub] ``` #### After + ```bash pip install griptape[drivers-prompt-huggingface-hub] pip install torch @@ -36,9 +39,10 @@ audio_media = MediaArtifact( media_type="audio", format="wav" ) -``` +``` #### After + ```python image_artifact = ImageArtifact( b"image_data", @@ -64,6 +68,7 @@ image_artifact = ImageArtifact( ``` #### After + ```python image_artifact = ImageArtifact( b"image_data", @@ -84,6 +89,7 @@ print(type(artifact.value)) # ``` #### After + ```python artifact = TextArtifact("name: John\nage: 30") print(artifact.value) # name: John\nage: 30 @@ -92,11 +98,11 @@ print(type(artifact.value)) # If you require storing a dictionary as an Artifact, you can use `GenericArtifact` instead. -### `CsvLoader`, `DataframeLoader`, and `SqlLoader` return types +### `CsvLoader`, `DataframeLoader`, and `SqlLoader` return types `CsvLoader`, `DataframeLoader`, and `SqlLoader` now return a `list[TextArtifact]` instead of `list[CsvRowArtifact]`. -If you require a dictionary, set a custom `formatter_fn` and then parse the text to a dictionary. +If you require a dictionary, set a custom `formatter_fn` and then parse the text to a dictionary. #### Before @@ -108,6 +114,7 @@ print(type(results[0].value)) # ``` #### After + ```python results = CsvLoader().load(Path("people.csv").read_text()) @@ -123,7 +130,7 @@ dict_results = [json.loads(result.value) for result in results] print(dict_results[0]) # {"name": "John", "age": 30} print(type(dict_results[0])) # ``` - + ### Moved `ImageArtifact.prompt` and `ImageArtifact.model` to `ImageArtifact.meta` `ImageArtifact.prompt` and `ImageArtifact.model` have been moved to `ImageArtifact.meta`. @@ -142,6 +149,7 @@ print(image_artifact.prompt, image_artifact.model) # Generate an image of a cat, ``` #### After + ```python image_artifact = ImageArtifact( b"image_data", @@ -155,6 +163,7 @@ print(image_artifact.meta["prompt"], image_artifact.meta["model"]) # Generate an Renamed `GriptapeCloudKnowledgeBaseVectorStoreDriver` to `GriptapeCloudVectorStoreDriver`. #### Before + ```python from griptape.drivers.griptape_cloud_knowledge_base_vector_store_driver import GriptapeCloudKnowledgeBaseVectorStoreDriver @@ -162,6 +171,7 @@ driver = GriptapeCloudKnowledgeBaseVectorStoreDriver(...) ``` #### After + ```python from griptape.drivers.griptape_cloud_vector_store_driver import GriptapeCloudVectorStoreDriver @@ -173,6 +183,7 @@ driver = GriptapeCloudVectorStoreDriver(...) `OpenAiChatPromptDriver.response_format` is now structured as the `openai` SDK accepts it. #### Before + ```python driver = OpenAiChatPromptDriver( response_format="json_object" @@ -180,6 +191,7 @@ driver = OpenAiChatPromptDriver( ``` #### After + ```python driver = OpenAiChatPromptDriver( response_format={"type": "json_object"} @@ -199,6 +211,7 @@ DataframeLoader().load(df) ``` #### After + ```python # Convert the dataframe to csv bytes and parse it CsvLoader().parse(bytes(df.to_csv(line_terminator='\r\n', index=False), encoding='utf-8')) @@ -209,12 +222,14 @@ CsvLoader().parse(bytes(df.to_csv(line_terminator='\r\n', index=False), encoding ### `TextLoader`, `PdfLoader`, `ImageLoader`, and `AudioLoader` now take a `str | PathLike` instead of `bytes`. #### Before + ```python PdfLoader().load(Path("attention.pdf").read_bytes()) PdfLoader().load_collection([Path("attention.pdf").read_bytes(), Path("CoT.pdf").read_bytes()]) ``` #### After + ```python PdfLoader().load("attention.pdf") PdfLoader().load_collection([Path("attention.pdf"), "CoT.pdf"]) @@ -231,7 +246,7 @@ You can now pass the file path directly to the Loader. PdfLoader().load(load_file("attention.pdf").read_bytes()) PdfLoader().load_collection(list(load_files(["attention.pdf", "CoT.pdf"]).values())) ``` - + ```python PdfLoader().load("attention.pdf") PdfLoader().load_collection(["attention.pdf", "CoT.pdf"]) @@ -253,6 +268,7 @@ vector_store.upsert_text_artifacts( ``` #### After + ```python artifact = PdfLoader().load("attention.pdf") chunks = Chunker().chunk(artifact) @@ -281,9 +297,10 @@ audio_media = MediaArtifact( media_type="audio", format="wav" ) -``` +``` #### After + ```python image_artifact = ImageArtifact( b"image_data", @@ -309,6 +326,7 @@ image_artifact = ImageArtifact( ``` #### After + ```python image_artifact = ImageArtifact( b"image_data", @@ -329,6 +347,7 @@ print(type(artifact.value)) # ``` #### After + ```python artifact = TextArtifact("name: John\nage: 30") print(artifact.value) # name: John\nage: 30 @@ -337,11 +356,11 @@ print(type(artifact.value)) # If you require storing a dictionary as an Artifact, you can use `GenericArtifact` instead. -### `CsvLoader`, `DataframeLoader`, and `SqlLoader` return types +### `CsvLoader`, `DataframeLoader`, and `SqlLoader` return types `CsvLoader`, `DataframeLoader`, and `SqlLoader` now return a `list[TextArtifact]` instead of `list[CsvRowArtifact]`. -If you require a dictionary, set a custom `formatter_fn` and then parse the text to a dictionary. +If you require a dictionary, set a custom `formatter_fn` and then parse the text to a dictionary. #### Before @@ -353,6 +372,7 @@ print(type(results[0].value)) # ``` #### After + ```python results = CsvLoader().load(Path("people.csv").read_text()) @@ -369,7 +389,7 @@ dict_results = [json.loads(result.value) for result in results] print(dict_results[0]) # {"name": "John", "age": 30} print(type(dict_results[0])) # ``` - + ### Moved `ImageArtifact.prompt` and `ImageArtifact.model` to `ImageArtifact.meta` `ImageArtifact.prompt` and `ImageArtifact.model` have been moved to `ImageArtifact.meta`. @@ -388,6 +408,7 @@ print(image_artifact.prompt, image_artifact.model) # Generate an image of a cat, ``` #### After + ```python image_artifact = ImageArtifact( b"image_data", @@ -398,7 +419,6 @@ image_artifact = ImageArtifact( print(image_artifact.meta["prompt"], image_artifact.meta["model"]) # Generate an image of a cat, DALL-E ``` - ## 0.30.X to 0.31.X ### Exceptions Over `ErrorArtifact`s @@ -407,6 +427,7 @@ Drivers, Loaders, and Engines now raise exceptions rather than returning `ErrorA Update any logic that expects `ErrorArtifact` to handle exceptions instead. #### Before + ```python artifacts = WebLoader().load("https://www.griptape.ai") @@ -415,6 +436,7 @@ if isinstance(artifacts, ErrorArtifact): ``` #### After + ```python try: artifacts = WebLoader().load("https://www.griptape.ai") @@ -427,6 +449,7 @@ except Exception as e: `LocalConversationMemoryDriver.file_path` has been renamed to `persist_file` and is now `Optional[str]`. If `persist_file` is not passed as a parameter, nothing will be persisted and no errors will be raised. `LocalConversationMemoryDriver` is now the default driver in the global `Defaults` object. #### Before + ```python local_driver_with_file = LocalConversationMemoryDriver( file_path="my_file.json" @@ -439,6 +462,7 @@ assert local_driver.file_path == "griptape_memory.json" ``` #### After + ```python local_driver_with_file = LocalConversationMemoryDriver( persist_file="my_file.json" @@ -455,6 +479,7 @@ assert local_driver.persist_file is None `BaseConversationMemoryDriver.driver` has been renamed to `conversation_memory_driver`. Method signatures for `.store` and `.load` have been changed. #### Before + ```python memory_driver = LocalConversationMemoryDriver() @@ -468,6 +493,7 @@ memory_driver.store(conversation_memory) ``` #### After + ```python memory_driver = LocalConversationMemoryDriver() diff --git a/README.md b/README.md index 95f6326dd4..854dc281fb 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,6 @@ Griptape is a modular Python framework for building AI-powered applications that securely connect to your enterprise data and APIs. It offers developers the ability to maintain control and flexibility at every step. - ## 🛠️ Core Components ### 🏗️ Structures @@ -68,7 +67,7 @@ Engines wrap Drivers and provide use-case-specific functionality: Please refer to [Griptape Docs](https://docs.griptape.ai/) for: -- Getting started guides. +- Getting started guides. - Core concepts and design overviews. - Examples. - Contribution guidelines. @@ -103,6 +102,7 @@ agent.run("https://griptape.ai", "griptape.txt") ``` And here is the output: + ``` [08/12/24 14:48:15] INFO ToolkitTask c90d263ec69046e8b30323c131ae4ba0 Input: Load https://griptape.ai, summarize it, and store it in a file called griptape.txt. @@ -169,9 +169,9 @@ The important thing to note here is that no matter how big the webpage is it can In the above example, we set [off_prompt](https://docs.griptape.ai/stable/griptape-framework/structures/task-memory.md#off-prompt) to `True`, which means that the LLM can never see the data it manipulates, but can send it to other Tools. -> [!IMPORTANT] +> \[!IMPORTANT\]\ > This example uses Griptape's [ToolkitTask](https://docs.griptape.ai/stable/griptape-framework/structures/tasks/#toolkit-task), which requires a highly capable LLM to function correctly. By default, Griptape uses the [OpenAiChatPromptDriver](https://docs.griptape.ai/stable/griptape-framework/drivers/prompt-drivers/#openai-chat); for another powerful LLM try swapping to the [AnthropicPromptDriver](https://docs.griptape.ai/stable/griptape-framework/drivers/prompt-drivers/#anthropic)! -If you're using a less powerful LLM, consider using the [ToolTask](https://docs.griptape.ai/stable/griptape-framework/structures/tasks/#tool-task) instead, as the `ToolkitTask` might not work properly or at all. +> If you're using a less powerful LLM, consider using the [ToolTask](https://docs.griptape.ai/stable/griptape-framework/structures/tasks/#tool-task) instead, as the `ToolkitTask` might not work properly or at all. [Check out our docs](https://docs.griptape.ai/stable/griptape-framework/drivers/prompt-drivers/) to learn more about how to use Griptape with other LLM providers like Anthropic, Claude, Hugging Face, and Azure. @@ -193,9 +193,9 @@ We welcome and encourage pull requests. To streamline the process, please follow 1. **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. -2. **Branch:** Submit all pull requests to the `dev` branch. This helps us manage changes and integrate them smoothly. +1. **Branch:** Submit all pull requests to the `dev` branch. This helps us manage changes and integrate them smoothly. -3. **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. +1. **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. Run `make test/unit` to execute the test suite locally. diff --git a/docs/contributing.md b/docs/contributing.md index 0342dcd81b..f02a27108f 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -12,20 +12,21 @@ We welcome and encourage pull requests. To streamline the process, please follow 1. **Existing Issues:** Please submit pull requests only for existing issues. If you want to add new documentation or fix a documentation issue 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. -2. **Branch:** Submit all pull requests to the `dev` branch. This helps us manage changes and integrate them smoothly. +1. **Branch:** Submit all pull requests to the `dev` branch. This helps us manage changes and integrate them smoothly. ## Getting Started + Griptape docs are built using [MkDocs](https://squidfunk.github.io/mkdocs-material/getting-started/). Dependencies are managed using [Poetry](https://python-poetry.org/). To contribute to Griptape docs, install the `docs` extra with: -```poetry install --with docs``` +`poetry install --with docs` Then serve the documentation locally with: -```poetry run mkdocs serve``` +`poetry run mkdocs serve` -You should see something similar to the following: +You should see something similar to the following: ``` INFO - Building documentation... diff --git a/docs/examples/amazon-dynamodb-sessions.md b/docs/examples/amazon-dynamodb-sessions.md index d9a6e4bdd4..949af985ee 100644 --- a/docs/examples/amazon-dynamodb-sessions.md +++ b/docs/examples/amazon-dynamodb-sessions.md @@ -2,7 +2,7 @@ Griptape provides [Conversation Memory](../griptape-framework/structures/convers If you provide it with a suitable Driver, the memory of the previous conversation can be preserved between run of a Structure, giving it additional context for how to respond. While we can use the [LocalConversationMemoryDriver](../griptape-framework/drivers/conversation-memory-drivers.md#local) to store the conversation history in a local file, in production use-cases we may want to store in a proper database. -In this example, we will show you how to use the [AmazonDynamoDbConversationMemoryDriver](../griptape-framework/drivers/conversation-memory-drivers.md#amazon-dynamodb) to persist the memory in an [Amazon DynamoDB](https://aws.amazon.com/dynamodb/) table. Please refer to the [Amazon DynamoDB documentation](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/getting-started-step-1.html) for information on setting up DynamoDB. +In this example, we will show you how to use the [AmazonDynamoDbConversationMemoryDriver](../griptape-framework/drivers/conversation-memory-drivers.md#amazon-dynamodb) to persist the memory in an [Amazon DynamoDB](https://aws.amazon.com/dynamodb/) table. Please refer to the [Amazon DynamoDB documentation](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/getting-started-step-1.html) for information on setting up DynamoDB. This code implements the idea of a generic "Session" that represents a Conversation Memory entry. For example, a "Session" could be used to represent an individual user's conversation, or a group conversation thread. diff --git a/docs/examples/multi-agent-workflow.md b/docs/examples/multi-agent-workflow.md index 8763a0a3a4..a2515c24f0 100644 --- a/docs/examples/multi-agent-workflow.md +++ b/docs/examples/multi-agent-workflow.md @@ -3,7 +3,6 @@ In this example we implement a multi-agent Workflow. We have a single "Researche By splitting up our workloads across multiple Structures, we can parallelize the work and leverage the strengths of each Agent. The Researcher can focus on gathering data and insights, while the Writers can focus on crafting engaging narratives. Additionally, this architecture opens us up to using services such as [Griptape Cloud](https://www.griptape.ai/cloud) to have each Agent run completely independently, allowing us to scale our Workflow as needed 🤯. To try out how this would work, you can deploy this example as multiple structures from our [Sample Structures](https://github.com/griptape-ai/griptape-sample-structures/tree/main/griptape-multi-agent-workflows) repo. - ```python --8<-- "docs/examples/src/multi_agent_workflow_1.py" ``` diff --git a/docs/examples/query-webpage-astra-db.md b/docs/examples/query-webpage-astra-db.md index 7e98b63ac7..b96906f87e 100644 --- a/docs/examples/query-webpage-astra-db.md +++ b/docs/examples/query-webpage-astra-db.md @@ -10,7 +10,6 @@ _Note:_ Besides the [Astra DB](../griptape-framework/drivers/vector-store-driver this example requires the `drivers-web-scraper-trafilatura` Griptape extra to be installed as well. - ```python --8<-- "docs/examples/src/query_webpage_astra_db_1.py" ``` diff --git a/docs/griptape-cloud/data-sources/create-data-source.md b/docs/griptape-cloud/data-sources/create-data-source.md index 87a5286a03..a0a45a1735 100644 --- a/docs/griptape-cloud/data-sources/create-data-source.md +++ b/docs/griptape-cloud/data-sources/create-data-source.md @@ -32,6 +32,6 @@ If you do not see a Data Source configuration you'd wish to use, you can submit ## Adding Structure as Transform to Data Source (Experimental) -When creating any Data Source, you can optionally specify a [Structure](../structures/create-structure.md) to run as a transform step of your data ingetstion before loading into the vector store. Ensure the Structure you select to run as a transform is configured to take in a `ListArtifact` as its first positional argument and returns either a `TextArtifact` or `ListArtifact`. +When creating any Data Source, you can optionally specify a [Structure](../structures/create-structure.md) to run as a transform step of your data ingetstion before loading into the vector store. Ensure the Structure you select to run as a transform is configured to take in a `ListArtifact` as its first positional argument and returns either a `TextArtifact` or `ListArtifact`. -Take a look at the [Find and Replace Sample Structure](https://github.com/griptape-ai/griptape-sample-structures/tree/main/griptape-find-replace-transform) for more details on how to implement this for your own Structure. \ No newline at end of file +Take a look at the [Find and Replace Sample Structure](https://github.com/griptape-ai/griptape-sample-structures/tree/main/griptape-find-replace-transform) for more details on how to implement this for your own Structure. diff --git a/docs/griptape-cloud/index.md b/docs/griptape-cloud/index.md index 74556ab621..d70f020bcf 100644 --- a/docs/griptape-cloud/index.md +++ b/docs/griptape-cloud/index.md @@ -3,13 +3,17 @@ [Griptape Cloud](https://cloud.griptape.ai/) provides managed services for your AI app stack. Deploy and scale end-to-end solutions, from LLM-powered data prep and retrieval to AI Agents, Pipelines, and Workflows. ## Build Your Own RAG Pipeline + Connect to your data with our [Data Sources](data-sources/create-data-source.md) and prepare them for retrieval with [Knowledge Bases](knowledge-bases/create-knowledge-base.md). ## Host and Run Your Code + Have Griptape code? Have existing code with another LLM framework? You can host your Python code using [Structures](structures/create-structure.md) whether it uses the Griptape Framework or not. ## Store Configuration for LLM Agents + [Rules and Rulesets](rules/rulesets.md) enable rapid and collabortive iteration for managing LLM behavior. [Threads and Messages](threads/threads.md) allow for persisted and editable conversation memory across any LLM invocation. ## APIs + All of our features can be called via API with a [Griptape Cloud API Key](https://cloud.griptape.ai/configuration/api-keys). See the [API Reference](api/api-reference.md) for detailed information. diff --git a/docs/griptape-cloud/knowledge-bases/accessing-data.md b/docs/griptape-cloud/knowledge-bases/accessing-data.md index 8343933ddc..1890127e61 100644 --- a/docs/griptape-cloud/knowledge-bases/accessing-data.md +++ b/docs/griptape-cloud/knowledge-bases/accessing-data.md @@ -8,7 +8,7 @@ You can explore your data with a natural language question on the `Test` tab of ## From the API -You can enact both `Search` and `Query` via the API by hitting their respective endpoints using a [Griptape Cloud API Key](https://cloud.griptape.ai/configuration/api-keys) and the Knowledge Base ID found on the `Config` tab of your Knowledge Base. +You can enact both `Search` and `Query` via the API by hitting their respective endpoints using a [Griptape Cloud API Key](https://cloud.griptape.ai/configuration/api-keys) and the Knowledge Base ID found on the `Config` tab of your Knowledge Base. The following example commands will send the string `"test question"` and return the results from the Knowledge Base. diff --git a/docs/griptape-cloud/structures/create-structure.md b/docs/griptape-cloud/structures/create-structure.md index df04498914..13b29f8015 100644 --- a/docs/griptape-cloud/structures/create-structure.md +++ b/docs/griptape-cloud/structures/create-structure.md @@ -6,9 +6,9 @@ Structures are a primary component in Griptape for organizing and executing Task 1. [Connect Your GitHub Account in your Griptape Cloud account](https://cloud.griptape.ai/account) 1. Install the [Griptape Cloud GitHub app to your GitHub account or organization](https://github.com/apps/griptape-cloud/installations/new/) - - Be sure to allow the app access to `All Repositories` or select the specific repositories you need + - Be sure to allow the app access to `All Repositories` or select the specific repositories you need 1. Ensure your repository has a Structure Config YAML file - - To learn more see [Structure Config YAML](structure-config.md) + - To learn more see [Structure Config YAML](structure-config.md) You can now [create a Structure in the Griptape Cloud console](https://cloud.griptape.ai/structures/create) by providing your GitHub repository information. diff --git a/docs/griptape-cloud/structures/structure-config.md b/docs/griptape-cloud/structures/structure-config.md index fa920be3c7..1891591a34 100644 --- a/docs/griptape-cloud/structures/structure-config.md +++ b/docs/griptape-cloud/structures/structure-config.md @@ -42,15 +42,15 @@ The specific version of the runtime environment for the Structure. The build-time configuration for the Structure. -* **pre_build_install_script** - The path to your pre_build_install_script, for running during the Structure build prior to dependency installation. This path is relative to the structure configuration file. Or absolute from the repository root if a forward slash is used: `/my-pre-build-install-script.sh`. -* **post_build_install_script** - The path to your post_build_install_script, for running during the Structure build after dependency installation. This path is relative to the structure configuration file. Or absolute from the repository root if a forward slash is used: `/my-post-build-install-script.sh`. -* **requirements_file** - The path to your Structure's requirements.txt file. -* **cache_build_dependencies** - Defines the configuration for caching build dependencies in order to speed up Deployments - * **enabled** - Defines whether the build dependency caching is on or off - * **watched_files** - Defines the particular files that will trigger cache invalidation, resulting in a full rebuild of the Structure and dependencies +- **pre_build_install_script** - The path to your pre_build_install_script, for running during the Structure build prior to dependency installation. This path is relative to the structure configuration file. Or absolute from the repository root if a forward slash is used: `/my-pre-build-install-script.sh`. +- **post_build_install_script** - The path to your post_build_install_script, for running during the Structure build after dependency installation. This path is relative to the structure configuration file. Or absolute from the repository root if a forward slash is used: `/my-post-build-install-script.sh`. +- **requirements_file** - The path to your Structure's requirements.txt file. +- **cache_build_dependencies** - Defines the configuration for caching build dependencies in order to speed up Deployments + - **enabled** - Defines whether the build dependency caching is on or off + - **watched_files** - Defines the particular files that will trigger cache invalidation, resulting in a full rebuild of the Structure and dependencies #### run (REQUIRED) The run-time configuration for the Structure. -* **main_file** - Specifies the path to the entry point file of the Managed Structure. This path is relative to the structure_config.yaml. Or absolute from the repository root if a forward slash is used: `/structure.py`. +- **main_file** - Specifies the path to the entry point file of the Managed Structure. This path is relative to the structure_config.yaml. Or absolute from the repository root if a forward slash is used: `/structure.py`. diff --git a/docs/griptape-framework/data/artifacts.md b/docs/griptape-framework/data/artifacts.md index 2edd1ebec2..a55ac6afea 100644 --- a/docs/griptape-framework/data/artifacts.md +++ b/docs/griptape-framework/data/artifacts.md @@ -1,6 +1,6 @@ --- search: - boost: 2 + boost: 2 --- ## Overview diff --git a/docs/griptape-framework/data/chunkers.md b/docs/griptape-framework/data/chunkers.md index bafbc1c80d..da37ee69ef 100644 --- a/docs/griptape-framework/data/chunkers.md +++ b/docs/griptape-framework/data/chunkers.md @@ -1,17 +1,17 @@ --- search: - boost: 2 + boost: 2 --- ## Overview -Chunkers are used to split arbitrarily long text into chunks of certain token length. -Each chunker has a tokenizer, a max token count, and a list of default separators used to split up text into [TextArtifact](../../reference/griptape/artifacts/text_artifact.md)s. +Chunkers are used to split arbitrarily long text into chunks of certain token length. +Each chunker has a tokenizer, a max token count, and a list of default separators used to split up text into [TextArtifact](../../reference/griptape/artifacts/text_artifact.md)s. Different types of chunkers provide lists of separators for specific text shapes: -* [TextChunker](../../reference/griptape/chunkers/text_chunker.md): works on most texts. -* [PdfChunker](../../reference/griptape/chunkers/pdf_chunker.md): works on text from PDF docs. -* [MarkdownChunker](../../reference/griptape/chunkers/markdown_chunker.md) works on markdown text. +- [TextChunker](../../reference/griptape/chunkers/text_chunker.md): works on most texts. +- [PdfChunker](../../reference/griptape/chunkers/pdf_chunker.md): works on text from PDF docs. +- [MarkdownChunker](../../reference/griptape/chunkers/markdown_chunker.md) works on markdown text. Here is how to use a chunker: diff --git a/docs/griptape-framework/data/index.md b/docs/griptape-framework/data/index.md index 3e43597376..13bbba3c47 100644 --- a/docs/griptape-framework/data/index.md +++ b/docs/griptape-framework/data/index.md @@ -1,9 +1,9 @@ ## Overview + Griptape provides several abstractions for working with data. ![Data Architecture](../../assets/img/data-architecture.png) - [Artifacts](./artifacts.md) are used for passing different types of data, such as text, lists, and blobs, between Griptape components. [Embedding Drivers](../drivers/embedding-drivers.md) are used to generate vector embeddings from text. diff --git a/docs/griptape-framework/data/loaders.md b/docs/griptape-framework/data/loaders.md index a8a8cb7c52..8b1ca9ef10 100644 --- a/docs/griptape-framework/data/loaders.md +++ b/docs/griptape-framework/data/loaders.md @@ -1,6 +1,6 @@ --- search: - boost: 2 + boost: 2 --- ## Overview @@ -9,7 +9,6 @@ Loaders are used to load data from sources and parse it into [Artifact](../../gr Each loader can be used to load a single "source" with [load()](../../reference/griptape/loaders/base_loader.md#griptape.loaders.base_loader.BaseLoader.load) or multiple sources with [load_collection()](../../reference/griptape/loaders/base_loader.md#griptape.loaders.base_loader.BaseLoader.load_collection). - ## File The following Loaders load a file using a [FileManagerDriver](../../reference/griptape/drivers/file_manager/base_file_manager_driver.md) and loads the resulting data into an [Artifact](../../griptape-framework/data/artifacts.md) for the respective file type. @@ -48,7 +47,6 @@ Loads CSV files into [ListArtifact](../../griptape-framework/data/artifacts.md#l Loads images into [ImageArtifact](../../griptape-framework/data/artifacts.md#image)s: - ```python --8<-- "docs/griptape-framework/data/src/loaders_7.py" ``` diff --git a/docs/griptape-framework/drivers/audio-transcription-drivers.md b/docs/griptape-framework/drivers/audio-transcription-drivers.md index 10630cf220..793084e08f 100644 --- a/docs/griptape-framework/drivers/audio-transcription-drivers.md +++ b/docs/griptape-framework/drivers/audio-transcription-drivers.md @@ -1,6 +1,6 @@ --- search: - boost: 2 + boost: 2 --- ## Overview @@ -15,7 +15,7 @@ This capability is essential for enhancing accessibility, improving content disc ### OpenAI -The [OpenAI Audio Transcription Driver](../../reference/griptape/drivers/audio_transcription/openai_audio_transcription_driver.md) utilizes OpenAI's sophisticated `whisper` model to accurately transcribe spoken audio into text. This model supports multiple languages, ensuring precise transcription across a wide range of dialects. +The [OpenAI Audio Transcription Driver](../../reference/griptape/drivers/audio_transcription/openai_audio_transcription_driver.md) utilizes OpenAI's sophisticated `whisper` model to accurately transcribe spoken audio into text. This model supports multiple languages, ensuring precise transcription across a wide range of dialects. ```python --8<-- "docs/griptape-framework/drivers/src/audio_transcription_drivers_1.py" diff --git a/docs/griptape-framework/drivers/conversation-memory-drivers.md b/docs/griptape-framework/drivers/conversation-memory-drivers.md index bb4c1b35a8..4732a7bb73 100644 --- a/docs/griptape-framework/drivers/conversation-memory-drivers.md +++ b/docs/griptape-framework/drivers/conversation-memory-drivers.md @@ -1,6 +1,6 @@ --- search: - boost: 2 + boost: 2 --- ## Overview @@ -35,8 +35,8 @@ The [AmazonDynamoDbConversationMemoryDriver](../../reference/griptape/drivers/me ```python --8<-- "docs/griptape-framework/drivers/src/conversation_memory_drivers_2.py" ``` -Optional parameters `sort_key` and `sort_key_value` can be supplied for tables with a composite primary key. +Optional parameters `sort_key` and `sort_key_value` can be supplied for tables with a composite primary key. ### Redis @@ -48,4 +48,3 @@ The [RedisConversationMemoryDriver](../../reference/griptape/drivers/memory/conv ```python --8<-- "docs/griptape-framework/drivers/src/conversation_memory_drivers_3.py" ``` - diff --git a/docs/griptape-framework/drivers/embedding-drivers.md b/docs/griptape-framework/drivers/embedding-drivers.md index 68f40f09ee..71954e0005 100644 --- a/docs/griptape-framework/drivers/embedding-drivers.md +++ b/docs/griptape-framework/drivers/embedding-drivers.md @@ -1,15 +1,16 @@ --- search: - boost: 2 + boost: 2 --- ## Overview + Embeddings in Griptape are multidimensional representations of text data. Embeddings carry semantic information, which makes them useful for extracting relevant chunks from large bodies of text for search and querying. Griptape provides a way to build Embedding Drivers that are reused in downstream framework components. Every Embedding Driver has two basic methods that can be used to generate embeddings: -* [embed_text_artifact()](../../reference/griptape/drivers/embedding/base_embedding_driver.md#griptape.drivers.embedding.base_embedding_driver.BaseEmbeddingDriver.embed_text_artifact) for [TextArtifact](../../reference/griptape/artifacts/text_artifact.md)s. -* [embed_string()](../../reference/griptape/drivers/embedding/base_embedding_driver.md#griptape.drivers.embedding.base_embedding_driver.BaseEmbeddingDriver.embed_string) for any string. +- [embed_text_artifact()](../../reference/griptape/drivers/embedding/base_embedding_driver.md#griptape.drivers.embedding.base_embedding_driver.BaseEmbeddingDriver.embed_text_artifact) for [TextArtifact](../../reference/griptape/artifacts/text_artifact.md)s. +- [embed_string()](../../reference/griptape/drivers/embedding/base_embedding_driver.md#griptape.drivers.embedding.base_embedding_driver.BaseEmbeddingDriver.embed_string) for any string. You can optionally provide a [Tokenizer](../misc/tokenizers.md) via the [tokenizer](../../reference/griptape/drivers/embedding/base_embedding_driver.md#griptape.drivers.embedding.base_embedding_driver.BaseEmbeddingDriver.tokenizer) field to have the Driver automatically chunk the input text to fit into the token limit. @@ -19,10 +20,10 @@ You can optionally provide a [Tokenizer](../misc/tokenizers.md) via the [tokeniz The [OpenAiEmbeddingDriver](../../reference/griptape/drivers/embedding/openai_embedding_driver.md) uses the [OpenAI Embeddings API](https://platform.openai.com/docs/guides/embeddings). - ```python --8<-- "docs/griptape-framework/drivers/src/embedding_drivers_1.py" ``` + ``` [0.0017853748286142945, 0.006118456833064556, -0.005811543669551611] ``` @@ -54,11 +55,13 @@ The [AmazonBedrockTitanEmbeddingDriver](../../reference/griptape/drivers/embeddi ```python --8<-- "docs/griptape-framework/drivers/src/embedding_drivers_3.py" ``` + ``` [-0.234375, -0.024902344, -0.14941406] ``` ### Google + !!! info This driver requires the `drivers-embedding-google` [extra](../index.md#extras). @@ -67,6 +70,7 @@ The [GoogleEmbeddingDriver](../../reference/griptape/drivers/embedding/google_em ```python --8<-- "docs/griptape-framework/drivers/src/embedding_drivers_4.py" ``` + ``` [0.0588633, 0.0033929371, -0.072810836] ``` @@ -107,6 +111,7 @@ The [AmazonSageMakerJumpstartEmbeddingDriver](../../reference/griptape/drivers/e ``` ### VoyageAI + The [VoyageAiEmbeddingDriver](../../reference/griptape/drivers/embedding/voyageai_embedding_driver.md) uses the [VoyageAI Embeddings API](https://www.voyageai.com/). !!! info @@ -128,6 +133,7 @@ The [CohereEmbeddingDriver](../../reference/griptape/drivers/embedding/cohere_em ``` ### Override Default Structure Embedding Driver + Here is how you can override the Embedding Driver that is used by default in Structures. ```python diff --git a/docs/griptape-framework/drivers/event-listener-drivers.md b/docs/griptape-framework/drivers/event-listener-drivers.md index ab0609c515..a734618b1c 100644 --- a/docs/griptape-framework/drivers/event-listener-drivers.md +++ b/docs/griptape-framework/drivers/event-listener-drivers.md @@ -1,6 +1,6 @@ --- search: - boost: 2 + boost: 2 --- ## Overview @@ -54,7 +54,7 @@ The [GriptapeCloudEventListenerDriver](../../reference/griptape/drivers/event_li ```python --8<-- "docs/griptape-framework/drivers/src/event_listener_drivers_5.py" -``` +``` ### Webhook Event Listener Driver @@ -63,6 +63,7 @@ The [WebhookEventListenerDriver](../../reference/griptape/drivers/event_listener ```python --8<-- "docs/griptape-framework/drivers/src/event_listener_drivers_6.py" ``` + ### Pusher !!! info diff --git a/docs/griptape-framework/drivers/image-generation-drivers.md b/docs/griptape-framework/drivers/image-generation-drivers.md index bcc91aca6b..549fb0c28e 100644 --- a/docs/griptape-framework/drivers/image-generation-drivers.md +++ b/docs/griptape-framework/drivers/image-generation-drivers.md @@ -1,6 +1,6 @@ --- search: - boost: 2 + boost: 2 --- ## Overview @@ -29,7 +29,7 @@ This Model Driver supports negative prompts. When provided (for example, when us --8<-- "docs/griptape-framework/drivers/src/image_generation_drivers_2.py" ``` -#### Titan +#### Titan The [Bedrock Titan Image Generator Model Driver](../../reference/griptape/drivers/image_generation_model/bedrock_titan_image_generation_model_driver.md) provides support for Titan Image Generator models hosted by Amazon Bedrock. This Model Driver supports configurations specific to Titan Image Generator, like quality, seed, and cfg_scale. @@ -78,9 +78,9 @@ The [HuggingFace Pipelines Image Generation Driver](../../reference/griptape/dri This Driver requires a `model` configuration, specifying the model to use for image generation. The value of the `model` configuration must be one of the following: - - A model name from the HuggingFace Model Hub, like `stabilityai/stable-diffusion-3-medium-diffusers` - - A path to the directory containing a model on the filesystem, like `./models/stable-diffusion-3/` - - A path to a file containing a model on the filesystem, like `./models/sd3_medium_incl_clips.safetensors` +- A model name from the HuggingFace Model Hub, like `stabilityai/stable-diffusion-3-medium-diffusers` +- A path to the directory containing a model on the filesystem, like `./models/stable-diffusion-3/` +- A path to a file containing a model on the filesystem, like `./models/sd3_medium_incl_clips.safetensors` The `device` configuration specifies the hardware device used to run inference. Common values include `cuda` (supporting CUDA-enabled GPUs), `cpu` (supported by a device's CPU), and `mps` (supported by Apple silicon GPUs). For more information, see [HuggingFace's documentation](https://huggingface.co/docs/transformers/en/perf_infer_gpu_one) on GPU inference. diff --git a/docs/griptape-framework/drivers/image-query-drivers.md b/docs/griptape-framework/drivers/image-query-drivers.md index b0c5985727..e3dc9032f7 100644 --- a/docs/griptape-framework/drivers/image-query-drivers.md +++ b/docs/griptape-framework/drivers/image-query-drivers.md @@ -1,6 +1,6 @@ --- search: - boost: 2 + boost: 2 --- ## Overview @@ -8,7 +8,7 @@ search: Image Query Drivers are used by [Image Query Engines](../engines/image-query-engines.md) to execute natural language queries on the contents of images. You can specify the provider and model used to query the image by providing the Engine with a particular Image Query Driver. !!! info - All Image Query Drivers default to a `max_tokens` of 256. It is recommended that you set this value to correspond to the desired response length. + All Image Query Drivers default to a `max_tokens` of 256. It is recommended that you set this value to correspond to the desired response length. ## Image Query Drivers @@ -41,7 +41,7 @@ The [OpenAiVisionImageQueryDriver](../../reference/griptape/drivers/image_query/ ``` ### Azure OpenAI - + !!! info In order to use the `gpt-4-vision-preview` model on Azure OpenAI, the `gpt-4` model must be deployed with the version set to `vision-preview`. More information can be found in the [Azure OpenAI documentation](https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/gpt-with-vision). diff --git a/docs/griptape-framework/drivers/observability-drivers.md b/docs/griptape-framework/drivers/observability-drivers.md index 701aca5044..ec7352118c 100644 --- a/docs/griptape-framework/drivers/observability-drivers.md +++ b/docs/griptape-framework/drivers/observability-drivers.md @@ -1,16 +1,15 @@ --- search: - boost: 2 + boost: 2 --- ## Overview Observability Drivers are used by [Observability](../structures/observability.md) to send telemetry (metrics and traces) related to the execution of an LLM application. The telemetry can be used to monitor the application and to diagnose and troubleshoot issues. All Observability Drivers implement the following methods: -* `__enter__()` sets up the Driver. -* `__exit__()` tears down the Driver. -* `observe()` wraps all functions and methods marked with the `@observable` decorator. At a bare minimum, implementations call the wrapped function and return its result (a no-op). This enables the Driver to generate telemetry related to the invocation's call arguments, return values, exceptions, latency, etc. - +- `__enter__()` sets up the Driver. +- `__exit__()` tears down the Driver. +- `observe()` wraps all functions and methods marked with the `@observable` decorator. At a bare minimum, implementations call the wrapped function and return its result (a no-op). This enables the Driver to generate telemetry related to the invocation's call arguments, return values, exceptions, latency, etc. ## Observability Drivers @@ -27,12 +26,10 @@ The Griptape Cloud Observability Driver instruments `@observable` functions and Here is an example of how to use the `GriptapeCloudObservabilityDriver` with the `Observability` context manager to send the telemetry to Griptape Cloud: - ```python --8<-- "docs/griptape-framework/drivers/src/observability_drivers_1.py" ``` - ### OpenTelemetry !!! info @@ -40,7 +37,6 @@ Here is an example of how to use the `GriptapeCloudObservabilityDriver` with the The [OpenTelemetry](https://opentelemetry.io/) Observability Driver instruments `@observable` functions and methods with metrics and traces for use with OpenTelemetry. You must configure a destination for the telemetry by providing a `SpanProcessor` to the Driver. - Here is an example of how to use the `OpenTelemetryObservabilityDriver` with the `Observability` context manager to output the telemetry directly to the console: ```python @@ -48,6 +44,7 @@ Here is an example of how to use the `OpenTelemetryObservabilityDriver` with the ``` Output (only relevant because of use of `ConsoleSpanExporter`): + ``` [06/18/24 06:57:22] INFO PromptTask 2d8ef95bf817480188ae2f74e754308a Input: Name an animal diff --git a/docs/griptape-framework/drivers/prompt-drivers.md b/docs/griptape-framework/drivers/prompt-drivers.md index 54230b9995..131c596cfc 100644 --- a/docs/griptape-framework/drivers/prompt-drivers.md +++ b/docs/griptape-framework/drivers/prompt-drivers.md @@ -1,6 +1,6 @@ --- search: - boost: 2 + boost: 2 --- ## Overview diff --git a/docs/griptape-framework/drivers/ruleset-drivers.md b/docs/griptape-framework/drivers/ruleset-drivers.md index 117f5836bf..4e4f908c47 100644 --- a/docs/griptape-framework/drivers/ruleset-drivers.md +++ b/docs/griptape-framework/drivers/ruleset-drivers.md @@ -5,7 +5,7 @@ search: ## Overview -Ruleset Drivers can be used to load rules in from external sources. +Ruleset Drivers can be used to load rules in from external sources. ## Ruleset Drivers diff --git a/docs/griptape-framework/drivers/sql-drivers.md b/docs/griptape-framework/drivers/sql-drivers.md index c5c15e258a..68c252894e 100644 --- a/docs/griptape-framework/drivers/sql-drivers.md +++ b/docs/griptape-framework/drivers/sql-drivers.md @@ -1,14 +1,15 @@ --- search: - boost: 2 + boost: 2 --- ## Overview + SQL drivers can be used to make SQL queries and load table schemas. They are used by the [SqlLoader](../../reference/griptape/loaders/sql_loader.md) to process data. All loaders implement the following methods: -* `execute_query()` executes a query and returns [RowResult](../../reference/griptape/drivers/sql/base_sql_driver.md#griptape.drivers.sql.base_sql_driver.BaseSqlDriver.RowResult)s. -* `execute_query_row()` executes a query and returns a raw result from SQL. -* `get_table_schema()` returns a table schema. +- `execute_query()` executes a query and returns [RowResult](../../reference/griptape/drivers/sql/base_sql_driver.md#griptape.drivers.sql.base_sql_driver.BaseSqlDriver.RowResult)s. +- `execute_query_row()` executes a query and returns a raw result from SQL. +- `get_table_schema()` returns a table schema. ## SQL Drivers @@ -31,7 +32,7 @@ This is a basic SQL loader based on [SQLAlchemy 2.0](https://docs.sqlalchemy.org !!! info This driver requires the `drivers-sql-amazon-redshift` [extra](../index.md#extras). -This is a SQL driver for interacting with the [Amazon Redshift Data API](https://docs.aws.amazon.com/redshift-data/latest/APIReference/Welcome.html) +This is a SQL driver for interacting with the [Amazon Redshift Data API](https://docs.aws.amazon.com/redshift-data/latest/APIReference/Welcome.html) to execute statements. Here is an example of how to use it for Redshift Serverless: ```python diff --git a/docs/griptape-framework/drivers/structure-run-drivers.md b/docs/griptape-framework/drivers/structure-run-drivers.md index 1f57ff57ef..7ba3aed658 100644 --- a/docs/griptape-framework/drivers/structure-run-drivers.md +++ b/docs/griptape-framework/drivers/structure-run-drivers.md @@ -1,9 +1,10 @@ --- search: - boost: 2 + boost: 2 --- ## Overview + Structure Run Drivers can be used to run Griptape Structures in a variety of runtime environments. When combined with the [Structure Run Task](../../griptape-framework/structures/tasks.md#structure-run-task) or [Structure Run Tool](../../griptape-tools/official-tools/structure-run-tool.md) you can create complex, multi-agent pipelines that span multiple runtime environments. @@ -21,7 +22,6 @@ The [LocalStructureRunDriver](../../reference/griptape/drivers/structure_run/loc The [GriptapeCloudStructureRunDriver](../../reference/griptape/drivers/structure_run/griptape_cloud_structure_run_driver.md) is used to run Griptape Structures in the Griptape Cloud. - ```python --8<-- "docs/griptape-framework/drivers/src/structure_run_drivers_2.py" ``` diff --git a/docs/griptape-framework/drivers/text-to-speech-drivers.md b/docs/griptape-framework/drivers/text-to-speech-drivers.md index a6fb955e6d..4ea1c574f2 100644 --- a/docs/griptape-framework/drivers/text-to-speech-drivers.md +++ b/docs/griptape-framework/drivers/text-to-speech-drivers.md @@ -1,6 +1,6 @@ --- search: - boost: 2 + boost: 2 --- ## Overview diff --git a/docs/griptape-framework/drivers/vector-store-drivers.md b/docs/griptape-framework/drivers/vector-store-drivers.md index 6a76a8cf51..84438c1ed9 100644 --- a/docs/griptape-framework/drivers/vector-store-drivers.md +++ b/docs/griptape-framework/drivers/vector-store-drivers.md @@ -1,6 +1,6 @@ --- search: - boost: 2 + boost: 2 --- ## Overview @@ -79,6 +79,7 @@ Here is an example of how the Driver can be used to load and query information i ``` The format for creating a vector index should look similar to the following: + ```json { "fields": [ @@ -95,6 +96,7 @@ The format for creating a vector index should look similar to the following: ] } ``` + Replace `path_to_vector` with the expected field name where the vector content will be. ### Azure MongoDB @@ -124,6 +126,7 @@ Here is an example of how the Driver can be used to load and query information i ``` The format for creating a vector index should be similar to the following: + ``` FT.CREATE idx:griptape ON hash PREFIX 1 "griptape:" SCHEMA namespace TAG vector VECTOR FLAT 6 TYPE FLOAT32 DIM 1536 DISTANCE_METRIC COSINE ``` @@ -142,6 +145,7 @@ Here is an example of how the Driver can be used to load and query information i ``` The body mappings for creating a vector index should look similar to the following: + ```json { "mappings": { @@ -163,7 +167,7 @@ The [PGVectorVectorStoreDriver](../../reference/griptape/drivers/vector/pgvector Here is an example of how the Driver can be used to load and query information in a Postgres database: -```python +```python --8<-- "docs/griptape-framework/drivers/src/vector_store_drivers_9.py" ``` diff --git a/docs/griptape-framework/drivers/web-scraper-drivers.md b/docs/griptape-framework/drivers/web-scraper-drivers.md index 7bfb7be997..e215d118f3 100644 --- a/docs/griptape-framework/drivers/web-scraper-drivers.md +++ b/docs/griptape-framework/drivers/web-scraper-drivers.md @@ -1,13 +1,13 @@ --- search: - boost: 2 + boost: 2 --- ## Overview Web Scraper Drivers can be used to scrape text from the web. They are used by [WebLoader](../../reference/griptape/loaders/web_loader.md) to provide its functionality. All Web Scraper Drivers implement the following methods: -* `scrape_url()` scrapes text from a website and returns a [TextArtifact](../../reference/griptape/artifacts/text_artifact.md). The format of the scrapped text is determined by the Driver. +- `scrape_url()` scrapes text from a website and returns a [TextArtifact](../../reference/griptape/artifacts/text_artifact.md). The format of the scrapped text is determined by the Driver. ## Web Scraper Drivers diff --git a/docs/griptape-framework/drivers/web-search-drivers.md b/docs/griptape-framework/drivers/web-search-drivers.md index 2c64ceba82..6e950dba03 100644 --- a/docs/griptape-framework/drivers/web-search-drivers.md +++ b/docs/griptape-framework/drivers/web-search-drivers.md @@ -7,13 +7,14 @@ search: Web Search Drivers can be used to search for links from a search query. They are used by [WebSearch](../../reference/griptape/tools/web_search/tool.md) to provide its functionality. All Web Search Drivers implement the following methods: -* `search()` searches the web and returns a [ListArtifact](../../reference/griptape/artifacts/list_artifact.md) that contains JSON-serializable [TextArtifact](../../reference/griptape/artifacts/text_artifact.md)s with the search results. +- `search()` searches the web and returns a [ListArtifact](../../reference/griptape/artifacts/list_artifact.md) that contains JSON-serializable [TextArtifact](../../reference/griptape/artifacts/text_artifact.md)s with the search results. You can use Web Search Drivers with [Structures](../structures/agents.md): ```python --8<-- "docs/griptape-framework/drivers/src/web_search_drivers_5.py" ``` + ``` ToolkitTask 45a53f1024494baab41a1f10a67017b1 Output: Here are some websites with information about AI @@ -35,11 +36,13 @@ ToolkitTask 45a53f1024494baab41a1f10a67017b1 Software](https://clockwise.software/blog/artificial-intelligence -framework/) ``` + Or use them independently: ```python --8<-- "docs/griptape-framework/drivers/src/web_search_drivers_3.py" ``` + ``` {"title": "The Top 16 AI Frameworks and Libraries: A Beginner's Guide", "url": "https://www.datacamp.com/blog/top-ai-frameworks-and-libraries", "description": "PyTorch. Torch is an open-source machine learning library known for its dynamic computational graph and is favored by researchers. The framework is excellent for prototyping and experimentation. Moreover, it's empowered by growing community support, with tools like PyTorch being built on the library."} @@ -48,7 +51,6 @@ Or use them independently: {"title": "The Top 16 AI Frameworks and Libraries | AI Slackers", "url": "https://aislackers.com/the-top-16-ai-frameworks-and-libraries/", "description": "Experiment with different frameworks to find the one that aligns with your needs and goals as a data practitioner. Embrace the world of AI frameworks, and embark on a journey of building smarter software with confidence. Discover the top AI frameworks and libraries like PyTorch, Scikit-Learn, TensorFlow, Keras, LangChain, and more."} ``` - ## Web Search Drivers ### Google @@ -75,6 +77,7 @@ Example of using `DuckDuckGoWebSearchDriver` directly: ``` ### Tavily + !!! info This driver requires the `drivers-web-search-tavily` [extra](../index.md#extras), and a Tavily [api key](https://app.tavily.com). @@ -84,7 +87,8 @@ Example of using `TavilyWebSearchDriver` directly: --8<-- "docs/griptape-framework/drivers/src/web_search_drivers_4.py" ``` -### Exa +### Exa + !!! info This driver requires the `drivers-web-search-exa` [extra](../index.md#extras), and an Exa [api key](https://dashboard.exa.ai/api-keys) @@ -93,4 +97,4 @@ Example of using `ExaWebSearchDriver` directly: ```python --8<-- "docs/griptape-framework/drivers/src/web_search_drivers_6.py" -``` \ No newline at end of file +``` diff --git a/docs/griptape-framework/engines/audio-engines.md b/docs/griptape-framework/engines/audio-engines.md index b5b0b24a6b..2b43925185 100644 --- a/docs/griptape-framework/engines/audio-engines.md +++ b/docs/griptape-framework/engines/audio-engines.md @@ -1,6 +1,6 @@ --- search: - boost: 2 + boost: 2 --- ## Overview diff --git a/docs/griptape-framework/engines/extraction-engines.md b/docs/griptape-framework/engines/extraction-engines.md index c003526911..09b1d5ca16 100644 --- a/docs/griptape-framework/engines/extraction-engines.md +++ b/docs/griptape-framework/engines/extraction-engines.md @@ -1,9 +1,10 @@ --- search: - boost: 2 + boost: 2 --- ## Overview + Extraction Engines in Griptape facilitate the extraction of data from text formats such as CSV and JSON. These engines play a crucial role in the functionality of [Extraction Tasks](../../griptape-framework/structures/tasks.md). As of now, Griptape supports two types of Extraction Engines: the CSV Extraction Engine and the JSON Extraction Engine. @@ -15,6 +16,7 @@ The CSV Extraction Engine extracts tabular content from unstructured text. ```python --8<-- "docs/griptape-framework/engines/src/extraction_engines_1.py" ``` + ``` name,age,location Alice,28,New York @@ -24,12 +26,12 @@ Charlie,40,Texas ## JSON -The JSON Extraction Engine extracts JSON-formatted content from unstructured text. - +The JSON Extraction Engine extracts JSON-formatted content from unstructured text. ```python --8<-- "docs/griptape-framework/engines/src/extraction_engines_2.py" ``` + ``` { "model": "GPT-3.5", diff --git a/docs/griptape-framework/engines/image-generation-engines.md b/docs/griptape-framework/engines/image-generation-engines.md index 6a8f039aa2..fb31254d06 100644 --- a/docs/griptape-framework/engines/image-generation-engines.md +++ b/docs/griptape-framework/engines/image-generation-engines.md @@ -1,6 +1,6 @@ --- search: - boost: 2 + boost: 2 --- ## Overview diff --git a/docs/griptape-framework/engines/image-query-engines.md b/docs/griptape-framework/engines/image-query-engines.md index 3290a20f16..168f6e6010 100644 --- a/docs/griptape-framework/engines/image-query-engines.md +++ b/docs/griptape-framework/engines/image-query-engines.md @@ -1,6 +1,6 @@ --- search: - boost: 2 + boost: 2 --- ## Image Query Engines diff --git a/docs/griptape-framework/engines/rag-engines.md b/docs/griptape-framework/engines/rag-engines.md index 688f46dddb..b603a7633d 100644 --- a/docs/griptape-framework/engines/rag-engines.md +++ b/docs/griptape-framework/engines/rag-engines.md @@ -1,6 +1,6 @@ --- search: - boost: 2 + boost: 2 --- ## RAG Engines @@ -14,7 +14,6 @@ search: `RagEngine`s consist of three _stages_: `QueryRagStage`, `RetrievalRagStage`, and `ResponseRagStage`. These stages are always executed sequentially. Each stage comprises multiple _modules_, which are executed in a customized manner. Due to this unique structure, `RagEngines` are not intended to replace [Workflows](../structures/workflows.md) or [Pipelines](../structures/pipelines.md). - - `QueryRagStage` is used for modifying user queries. - `RetrievalRagStage` is used for retrieving and re-ranking text chunks. - `ResponseRagStage` is used for generating responses. @@ -28,11 +27,13 @@ RAG modules are used to implement concrete actions in the RAG pipeline. `RagEngi - `TranslateQueryRagModule` is for translating the query into another language. #### Retrieval/Rerank Modules + - `TextChunksRerankRagModule` is for re-ranking retrieved results. - `TextLoaderRetrievalRagModule` is for retrieving data with text loaders in real time. - `VectorStoreRetrievalRagModule` is for retrieving text chunks from a vector store. #### Response Modules + - `PromptResponseRagModule` is for generating responses based on retrieved text chunks. - `TextChunksResponseRagModule` is for responding with retrieved text chunks. - `FootnotePromptResponseRagModule` is for responding with automatic footnotes from text chunk references. diff --git a/docs/griptape-framework/engines/summary-engines.md b/docs/griptape-framework/engines/summary-engines.md index 90c72e4dd9..cfd99f3a87 100644 --- a/docs/griptape-framework/engines/summary-engines.md +++ b/docs/griptape-framework/engines/summary-engines.md @@ -1,6 +1,6 @@ --- search: - boost: 2 + boost: 2 --- ## Overview diff --git a/docs/griptape-framework/index.md b/docs/griptape-framework/index.md index 3dd294f0b1..de6206d22c 100644 --- a/docs/griptape-framework/index.md +++ b/docs/griptape-framework/index.md @@ -1,4 +1,4 @@ -The Griptape framework provides developers with the ability to create AI systems that operate across two dimensions: **predictability** and **creativity**. +The Griptape framework provides developers with the ability to create AI systems that operate across two dimensions: **predictability** and **creativity**. For **predictability**, Griptape enforces structures like sequential pipelines, DAG-based workflows, and long-term memory. To facilitate creativity, Griptape safely prompts LLMs with tools and short-term memory connecting them to external APIs and data stores. The framework allows developers to transition between those two dimensions effortlessly based on their use case. @@ -7,14 +7,15 @@ Griptape not only helps developers harness the potential of LLMs but also enforc Griptape’s design philosophy is based on the following tenets: 1. **Modularity and composability**: All framework primitives are useful and usable on their own in addition to being easy to plug into each other. -2. **Technology-agnostic**: Griptape is designed to work with any capable LLM, data store, and backend through the abstraction of drivers. -3. **Keep data off prompt by default**: When working with data through loaders and tools, Griptape aims to keep it off prompt by default, making it easy to work with big data securely and with low latency. -4. **Minimal prompt engineering**: It’s much easier to reason about code written in Python, not natural languages. Griptape aims to default to Python in most cases unless absolutely necessary. +1. **Technology-agnostic**: Griptape is designed to work with any capable LLM, data store, and backend through the abstraction of drivers. +1. **Keep data off prompt by default**: When working with data through loaders and tools, Griptape aims to keep it off prompt by default, making it easy to work with big data securely and with low latency. +1. **Minimal prompt engineering**: It’s much easier to reason about code written in Python, not natural languages. Griptape aims to default to Python in most cases unless absolutely necessary. ## Quick Start ### OpenAI API Key -First, configure an OpenAI client by [getting an API key](https://platform.openai.com/account/api-keys) and adding it to your environment as `OPENAI_API_KEY`. + +First, configure an OpenAI client by [getting an API key](https://platform.openai.com/account/api-keys) and adding it to your environment as `OPENAI_API_KEY`. By default, Griptape uses [OpenAI Completions API](https://platform.openai.com/docs/guides/completion) to execute LLM prompts, but other LLMs can be configured with the use of [Prompt Drivers](./drivers/prompt-drivers.md). ### Using pip @@ -27,13 +28,13 @@ pip install "griptape[all]" -U ### Using Poetry -To get started with Griptape using Poetry first create a new poetry project from the terminal: +To get started with Griptape using Poetry first create a new poetry project from the terminal: ``` poetry new griptape-quickstart ``` -Change your working directory to the new `griptape-quickstart` directory created by Poetry and add the the `griptape` dependency. +Change your working directory to the new `griptape-quickstart` directory created by Poetry and add the the `griptape` dependency. ``` poetry add "griptape[all]" @@ -41,33 +42,38 @@ poetry add "griptape[all]" ### Extras -The `[all]` [extra](https://peps.python.org/pep-0508/#extras) ensures that you have access to the entire range of functionalities that Griptape offers. +The `[all]` [extra](https://peps.python.org/pep-0508/#extras) ensures that you have access to the entire range of functionalities that Griptape offers. This comprehensive installation is recommended for newcomers to get the complete Griptape experience. However, if you wish to optimize the installation size or only require specific functionalities, you have two main options: 1. Core Dependencies: These are the foundational dependencies that enable Griptape to function with most of its default settings. -2. Extras: These are additional, vendor-specific drivers integrated within the Griptape framework. If a particular Driver mandates an extra, it will be explicitly highlighted in the documentation. +1. Extras: These are additional, vendor-specific drivers integrated within the Griptape framework. If a particular Driver mandates an extra, it will be explicitly highlighted in the documentation. To install just the core dependencies: + ``` poetry add griptape ``` To install specific extras (e.g., drivers for [AnthropicPromptDriver](./drivers/prompt-drivers.md#anthropic) and [PineconeVectorStoreDriver](./drivers/vector-store-drivers.md#pinecone)): + ``` poetry add "griptape[drivers-prompt-anthropic,drivers-vector-pinecone]" ``` For a comprehensive list of extras, please refer to the `[tool.poetry.extras]` section of Griptape's [pyproject.toml](https://github.com/griptape-ai/griptape/blob/main/pyproject.toml). -## Build a Simple Agent -With Griptape, you can create *structures*, such as [Agents](./structures/agents.md), [Pipelines](./structures/pipelines.md), and [Workflows](./structures/workflows.md), that are composed of different types of tasks. First, let's build a simple Agent that we can interact with through a chat based interface. +## Build a Simple Agent + +With Griptape, you can create *structures*, such as [Agents](./structures/agents.md), [Pipelines](./structures/pipelines.md), and [Workflows](./structures/workflows.md), that are composed of different types of tasks. First, let's build a simple Agent that we can interact with through a chat based interface. ```python --8<-- "docs/griptape-framework/src/index_1.py" ``` -Run this script in your IDE and you'll be presented with a `Q:` prompt where you can interact with your model. + +Run this script in your IDE and you'll be presented with a `Q:` prompt where you can interact with your model. + ``` Q: Write me a haiku about griptape processing... @@ -82,19 +88,22 @@ Skateboard's trusty, silent guide, In each ride, we're glued. Q: ``` -If you want to skip the chat interface and load an initial prompt, you can do so using the `.run()` method: + +If you want to skip the chat interface and load an initial prompt, you can do so using the `.run()` method: ```python --8<-- "docs/griptape-framework/src/index_2.py" ``` -Agents on their own are fun, but let's add some capabilities to them using Griptape Tools. -### Build a Simple Agent with Tools + +Agents on their own are fun, but let's add some capabilities to them using Griptape Tools. + +### Build a Simple Agent with Tools ```python --8<-- "docs/griptape-framework/src/index_3.py" ``` -Here is the chain of thought from the Agent. Notice where it realizes it can use the tool you just injected to do the calculation.[^1] -[^1]: In some cases a model might be capable of basic arithmetic. For example, gpt-3.5 returns the correct numeric answer but in an odd format. + +Here is the chain of thought from the Agent. Notice where it realizes it can use the tool you just injected to do the calculation.[^1] ``` [07/23/24 10:47:38] INFO ToolkitTask 6a51060d1fb74e57840a91aa319f26dc @@ -200,3 +209,5 @@ Agents are great for getting started, but they are intentionally limited to a si [08/12/24 14:50:42] INFO PromptTask dbbb38f144f445db896dc12854f17ad3 Output: El contenido de https://www.griptape.ai ha sido resumido y almacenado en griptape.txt. ``` + +[^1]: In some cases a model might be capable of basic arithmetic. For example, gpt-3.5 returns the correct numeric answer but in an odd format. diff --git a/docs/griptape-framework/misc/events.md b/docs/griptape-framework/misc/events.md index beb02d66a8..d33514f8a1 100644 --- a/docs/griptape-framework/misc/events.md +++ b/docs/griptape-framework/misc/events.md @@ -1,6 +1,6 @@ --- search: - boost: 2 + boost: 2 --- ## Overview @@ -15,6 +15,7 @@ You can listen to specific event types: ```python --8<-- "docs/griptape-framework/misc/src/events_1.py" ``` + ``` [09/08/23 10:51:16] INFO PromptTask a20c236d1d86480fb14ae976e6cf8983 @@ -84,7 +85,6 @@ The `EventListener` will automatically be added and removed from the [EventBus]( ## Streaming - You can use the [CompletionChunkEvent](../../reference/griptape/events/completion_chunk_event.md) to stream the completion results from Prompt Drivers. ```python @@ -98,7 +98,6 @@ You can also use the [Stream](../../reference/griptape/utils/stream.md) utility --8<-- "docs/griptape-framework/misc/src/events_4.py" ``` - ## Counting Tokens To count tokens, you can use Event Listeners and the [TokenCounter](../../reference/griptape/utils/token_counter.md) util: @@ -132,14 +131,14 @@ To count tokens, you can use Event Listeners and the [TokenCounter](../../refere total tokens: 273 ``` - ## Inspecting Payloads -You can use the [StartPromptEvent](../../reference/griptape/events/start_prompt_event.md) to inspect the Prompt Stack and final prompt string before it is sent to the LLM. +You can use the [StartPromptEvent](../../reference/griptape/events/start_prompt_event.md) to inspect the Prompt Stack and final prompt string before it is sent to the LLM. ```python --8<-- "docs/griptape-framework/misc/src/events_6.py" ``` + ``` ... Prompt Stack Messages: diff --git a/docs/griptape-framework/misc/tokenizers.md b/docs/griptape-framework/misc/tokenizers.md index f820d55a95..3a8f2391a8 100644 --- a/docs/griptape-framework/misc/tokenizers.md +++ b/docs/griptape-framework/misc/tokenizers.md @@ -1,9 +1,9 @@ --- search: - boost: 2 + boost: 2 --- -## Overview +## Overview Tokenizers are used throughout Griptape to calculate the number of [tokens](https://learn.microsoft.com/en-us/semantic-kernel/prompt-engineering/tokens) in a piece of text. They are particularly useful for ensuring that the LLM token limits are not exceeded. @@ -19,6 +19,7 @@ Tokenizers are a low level abstraction that you will rarely interact with direct ``` ### Cohere + ```python --8<-- "docs/griptape-framework/misc/src/tokenizers_2.py" ``` @@ -36,17 +37,20 @@ Tokenizers are a low level abstraction that you will rarely interact with direct ``` ### Hugging Face + ```python --8<-- "docs/griptape-framework/misc/src/tokenizers_5.py" ``` ### Amazon Bedrock + ```python --8<-- "docs/griptape-framework/misc/src/tokenizers_6.py" ``` ### Simple -Not all LLM providers have a public tokenizer API. In this case, you can use the `SimpleTokenizer` to count tokens based on a simple heuristic. + +Not all LLM providers have a public tokenizer API. In this case, you can use the `SimpleTokenizer` to count tokens based on a simple heuristic. ```python --8<-- "docs/griptape-framework/misc/src/tokenizers_7.py" diff --git a/docs/griptape-framework/structures/agents.md b/docs/griptape-framework/structures/agents.md index 1b40fad2b7..a337a476e5 100644 --- a/docs/griptape-framework/structures/agents.md +++ b/docs/griptape-framework/structures/agents.md @@ -1,6 +1,6 @@ --- search: - boost: 2 + boost: 2 --- ## Overview diff --git a/docs/griptape-framework/structures/configs.md b/docs/griptape-framework/structures/configs.md index e192af79d2..ed7327f86b 100644 --- a/docs/griptape-framework/structures/configs.md +++ b/docs/griptape-framework/structures/configs.md @@ -1,13 +1,13 @@ --- search: - boost: 2 + boost: 2 --- ## Overview Griptape exposes a global singleton, [Defaults](../../reference/griptape/configs/defaults_config.md), which can be used to access and modify the default configurations of the framework. -To update the default configurations, simply update the fields on the `Defaults` object. +To update the default configurations, simply update the fields on the `Defaults` object. Framework objects will be created with the currently set default configurations, but you can always override at the individual class level. ```python @@ -16,7 +16,7 @@ Framework objects will be created with the currently set default configurations, ### Drivers Configs -The [DriversConfig](../../reference/griptape/configs/drivers/drivers_config.md) class allows for the customization of Structures within Griptape, enabling specific settings such as Drivers to be defined for Tasks. +The [DriversConfig](../../reference/griptape/configs/drivers/drivers_config.md) class allows for the customization of Structures within Griptape, enabling specific settings such as Drivers to be defined for Tasks. Griptape provides predefined [DriversConfig](../../reference/griptape/configs/drivers/drivers_config.md)'s for widely used services that provide APIs for most Driver types Griptape offers. @@ -43,6 +43,7 @@ The [Azure OpenAI Driver config](../../reference/griptape/configs/drivers/azure_ ``` #### Amazon Bedrock + The [Amazon Bedrock Driver config](../../reference/griptape/configs/drivers/amazon_bedrock_drivers_config.md) provides default Drivers for Amazon Bedrock's APIs. ```python @@ -50,6 +51,7 @@ The [Amazon Bedrock Driver config](../../reference/griptape/configs/drivers/amaz ``` #### Google + The [Google Driver config](../../reference/griptape/configs/drivers/google_drivers_config.md) provides default Drivers for Google's Gemini APIs. ```python @@ -80,7 +82,7 @@ The [Cohere Driver config](../../reference/griptape/configs/drivers/cohere_drive #### Custom You can create your own [DriversConfig](../../reference/griptape/configs/drivers/drivers_config.md) by overriding relevant Drivers. -The [DriversConfig](../../reference/griptape/configs/drivers/drivers_config.md) class includes "Dummy" Drivers for all types, which throw a [DummyError](../../reference/griptape/exceptions/dummy_exception.md) if invoked without being overridden. +The [DriversConfig](../../reference/griptape/configs/drivers/drivers_config.md) class includes "Dummy" Drivers for all types, which throw a [DummyError](../../reference/griptape/exceptions/dummy_exception.md) if invoked without being overridden. This approach ensures that you are informed through clear error messages if you attempt to use Structures without proper Driver configurations. ```python diff --git a/docs/griptape-framework/structures/conversation-memory.md b/docs/griptape-framework/structures/conversation-memory.md index 503a00b140..d8ec211ead 100644 --- a/docs/griptape-framework/structures/conversation-memory.md +++ b/docs/griptape-framework/structures/conversation-memory.md @@ -1,6 +1,6 @@ --- search: - boost: 2 + boost: 2 --- ## Overview @@ -60,4 +60,3 @@ You can choose to offset which runs are summarized with the ```python --8<-- "docs/griptape-framework/structures/src/conversation_memory_5.py" ``` - diff --git a/docs/griptape-framework/structures/observability.md b/docs/griptape-framework/structures/observability.md index 01e1af3365..434059d3a9 100644 --- a/docs/griptape-framework/structures/observability.md +++ b/docs/griptape-framework/structures/observability.md @@ -1,6 +1,6 @@ --- search: - boost: 2 + boost: 2 --- ## Overview diff --git a/docs/griptape-framework/structures/pipelines.md b/docs/griptape-framework/structures/pipelines.md index 7bcfc13487..fd293be308 100644 --- a/docs/griptape-framework/structures/pipelines.md +++ b/docs/griptape-framework/structures/pipelines.md @@ -1,9 +1,10 @@ --- search: - boost: 2 + boost: 2 --- -## Overview +## Overview + A [Pipeline](../../reference/griptape/structures/pipeline.md) is very similar to an [Agent](../../reference/griptape/structures/agent.md), but allows for multiple tasks. You can access the final output of the Pipeline by using the [output](../../reference/griptape/structures/structure.md#griptape.structures.structure.Structure.output) attribute. @@ -12,10 +13,9 @@ You can access the final output of the Pipeline by using the [output](../../refe Pipelines have access to the following [context](../../reference/griptape/structures/pipeline.md#griptape.structures.pipeline.Pipeline.context) variables in addition to the [base context](./tasks.md#context). -* `parent_output`: output from the parent. -* `parent`: parent task. -* `child`: child task. - +- `parent_output`: output from the parent. +- `parent`: parent task. +- `child`: child task. ## Pipeline diff --git a/docs/griptape-framework/structures/rulesets.md b/docs/griptape-framework/structures/rulesets.md index 12f14a96ea..826b9da6e7 100644 --- a/docs/griptape-framework/structures/rulesets.md +++ b/docs/griptape-framework/structures/rulesets.md @@ -1,6 +1,6 @@ --- search: - boost: 2 + boost: 2 --- ## Overview @@ -32,7 +32,6 @@ This is particularly useful when you need the LLM to return well-formed data, su !!! warning `JsonSchemaRule` may break [ToolkitTask](../structures/tasks.md#toolkit) which relies on a specific [output token](https://github.com/griptape-ai/griptape/blob/e6a04c7b88cf9fa5d6bcf4c833ffebfab89a3258/griptape/tasks/toolkit_task.py#L28). - ```python --8<-- "docs/griptape-framework/structures/src/json_schema_rule.py" ``` @@ -102,6 +101,7 @@ You can pass [rules](../../reference/griptape/structures/structure.md#griptape.s ```python --8<-- "docs/griptape-framework/structures/src/rulesets_2.py" ``` + ``` [09/29/23 13:31:41] INFO PromptTask 51c0030b7a854ae5a9bef4595014915c Input: Respond to this question from the user: 'How do I bake a cake?' @@ -143,6 +143,7 @@ You can pass [rules](../../reference/griptape/mixins/rule_mixin.md#griptape.mixi ```python --8<-- "docs/griptape-framework/structures/src/rulesets_4.py" ``` + ``` [09/25/23 16:29:05] INFO PromptTask d1cc2c0b780d4b32b6309ceab11173f4 Input: How are you? diff --git a/docs/griptape-framework/structures/task-memory.md b/docs/griptape-framework/structures/task-memory.md index a3fc04dc5f..07ff7cee32 100644 --- a/docs/griptape-framework/structures/task-memory.md +++ b/docs/griptape-framework/structures/task-memory.md @@ -1,15 +1,15 @@ --- search: - boost: 2 + boost: 2 --- ## Overview Task Memory is a powerful feature of Griptape that allows you to control where the data returned by [Tools](../tools/index.md) is stored. This is useful in the following scenarios: -* **Security requirements**: many organizations don't want data to leave their cloud for regulatory and security reasons. -* **Long textual content**: when textual content returned by Tools can't fit in the token limit, it's often useful to perform actions on it as a separate operation, not through the main LLM. -* **Non-textual content**: Tools can generate images, videos, PDFs, and other non-textual content that can be stored in Task Memory and acted upon later by other Tools. +- **Security requirements**: many organizations don't want data to leave their cloud for regulatory and security reasons. +- **Long textual content**: when textual content returned by Tools can't fit in the token limit, it's often useful to perform actions on it as a separate operation, not through the main LLM. +- **Non-textual content**: Tools can generate images, videos, PDFs, and other non-textual content that can be stored in Task Memory and acted upon later by other Tools. !!! tip Running into issue with Task Memory? Check out the [Task Memory Considerations](#task-memory-considerations) section for some common pitfalls. @@ -68,7 +68,7 @@ Let's explore what happens when `off_prompt` is set to `True`: ...Output truncated for brevity... ``` -When we set `off_prompt` to `True`, the Agent does not function as expected, even generating an error. This is because the Calculator output is being stored in Task Memory but the Agent has no way to access it. +When we set `off_prompt` to `True`, the Agent does not function as expected, even generating an error. This is because the Calculator output is being stored in Task Memory but the Agent has no way to access it. To fix this, we need a [Tool that can read from Task Memory](#tools-that-can-read-from-task-memory) such as the `PromptSummaryTool`. This is an example of [not providing a Task Memory compatible Tool](#not-providing-a-task-memory-compatible-tool). @@ -77,7 +77,7 @@ This is an example of [not providing a Task Memory compatible Tool](#not-providi The [PromptSummaryTool](../../griptape-tools/official-tools/prompt-summary-tool.md) is a Tool that allows an Agent to summarize the Artifacts in Task Memory. It has the following methods: Let's add `PromptSummaryTool` to the Agent and run the same task. -Note that on the `PromptSummaryTool` we've set `off_prompt` to `False` so that the results of the query can be returned directly to the LLM. +Note that on the `PromptSummaryTool` we've set `off_prompt` to `False` so that the results of the query can be returned directly to the LLM. If we had kept it as `True`, the results would have been stored back Task Memory which would've put us back to square one. See [Task Memory Looping](#task-memory-looping) for more information on this scenario. ```python @@ -137,6 +137,7 @@ Let's say we want to query the contents of a very large webpage. ``` When running this example, we get the following error: + ``` [04/26/24 13:20:02] ERROR ToolkitTask 67e2f907f95d4850ae79f9da67df54c1 Error code: 400 - {'error': {'message': "This model's maximum context length is 8192 tokens. However, your messages resulted in 73874 tokens. @@ -151,6 +152,7 @@ Note that we're setting `off_prompt` to `False` on the `QueryTool` so that the _ ``` And now we get the expected output: + ``` [08/12/24 14:56:18] INFO ToolkitTask d3ce58587dc944b0a30a205631b82944 Input: According to this page https://en.wikipedia.org/wiki/Elden_Ring, how many copies of Elden Ring have been sold? @@ -201,7 +203,7 @@ Because Task Memory splits up the storage and retrieval of data, you can use dif Here is an example where we use GPT-4 to orchestrate the Tools and store the data in Task Memory, and Anthropic's Claude 3 Haiku model to query the raw content. In this example, GPT-4 _never_ sees the contents of the page, only that it was stored in Task Memory. Even the query results generated by the Haiku model are stored in Task Memory so that the `FileManagerTool` can save the results to disk without GPT-4 ever seeing them. -```python +```python --8<-- "docs/griptape-framework/structures/src/task_memory_6.py" ``` @@ -282,12 +284,14 @@ Today, these include: Task Memory is a powerful feature of Griptape, but with great power comes great responsibility. Here are some things to keep in mind when using Task Memory: -### Tool Return Types -Griptape will only store Artifacts in Task Memory that have been explicitly defined in the `artifact_storages` parameter of the `TaskMemory` object. +### Tool Return Types + +Griptape will only store Artifacts in Task Memory that have been explicitly defined in the `artifact_storages` parameter of the `TaskMemory` object. If you try to store an Artifact that is not defined in `artifact_storages`, Griptape will raise an error. The exception to this is `InfoArtifact`s and `ErrorArtifact`s. Griptape will never store these Artifacts store in Task Memory. -By default, Griptape will store `TextArtifact`'s, `BlobArtifact`'s in Task Memory. Additionally, Griptape will also store the elements of `ListArtifact`'s as long as they are of a supported Artifact type. +By default, Griptape will store `TextArtifact`'s, `BlobArtifact`'s in Task Memory. Additionally, Griptape will also store the elements of `ListArtifact`'s as long as they are of a supported Artifact type. ### Not Providing a Task Memory Compatible Tool + When using Task Memory, make sure that you have at least one Tool that can read from Task Memory. If you don't, the data stored in Task Memory will be inaccessible to the Agent and it may hallucinate Tool Activities. ```python @@ -295,6 +299,7 @@ When using Task Memory, make sure that you have at least one Tool that can read ``` ### Task Memory Looping + An improper configuration of Tools can lead to the LLM using the Tools in a loop. For example, if you have a Tool that stores data in Task Memory and another Tool that queries that data from Task Memory ([Tools That Can Read From Task Memory](#tools-that-can-read-from-task-memory)), make sure that the query Tool does not store the data back in Task Memory. This can create a loop where the same data is stored and queried over and over again. @@ -303,9 +308,9 @@ This can create a loop where the same data is stored and queried over and over a ``` ### Task Memory May Not Be Necessary + Task Memory may not be necessary for all use cases. If the data returned by a Tool is not sensitive, not too large, and does not need to be acted upon by another Tool, you can leave the default of `off_prompt` to `False` and return the data directly to the LLM. ```python --8<-- "docs/griptape-framework/structures/src/task_memory_9.py" ``` - diff --git a/docs/griptape-framework/structures/tasks.md b/docs/griptape-framework/structures/tasks.md index f91937ec0a..7472010205 100644 --- a/docs/griptape-framework/structures/tasks.md +++ b/docs/griptape-framework/structures/tasks.md @@ -1,22 +1,23 @@ --- search: - boost: 2 + boost: 2 --- ## Overview A [Task](../../reference/griptape/tasks/index.md) is a purpose-built abstraction for the Large Language Model (LLM). Griptape offers various types of Tasks, each suitable for specific use cases. - ## Context -Tasks that take input have a field [input](../../reference/griptape/tasks/base_text_input_task.md#griptape.tasks.base_text_input_task.BaseTextInputTask.input) which lets you define the Task objective. + +Tasks that take input have a field [input](../../reference/griptape/tasks/base_text_input_task.md#griptape.tasks.base_text_input_task.BaseTextInputTask.input) which lets you define the Task objective. Within the [input](../../reference/griptape/tasks/base_text_input_task.md#griptape.tasks.base_text_input_task.BaseTextInputTask.input), you can access the following [context](../../reference/griptape/structures/structure.md#griptape.structures.structure.Structure.context) variables: -* `args`: an array of arguments passed to the `.run()` method. -* `structure`: the structure that the task belongs to. -* user defined context variables +- `args`: an array of arguments passed to the `.run()` method. +- `structure`: the structure that the task belongs to. +- user defined context variables Additional [context](../../reference/griptape/structures/structure.md#griptape.structures.structure.Structure.context) variables may be added based on the Structure running the task. + ```python --8<-- "docs/griptape-framework/structures/src/tasks_1.py" ``` @@ -160,7 +161,7 @@ This Task takes in one or more Tools which the LLM will decide to use through Ch ## Tool Task -Another way to use [Griptape Tools](../../griptape-framework/tools/index.md), is with a [Tool Task](../../reference/griptape/tasks/tool_task.md). +Another way to use [Griptape Tools](../../griptape-framework/tools/index.md), is with a [Tool Task](../../reference/griptape/tasks/tool_task.md). This Task takes in a single Tool which the LLM will use without Chain of Thought (CoT) reasoning. Because this Task does not use CoT, it is better suited for less capable models. ```python @@ -192,12 +193,12 @@ This Task takes in a single Tool which the LLM will use without Chain of Thought To extract information from text, use an [ExtractionTask](../../reference/griptape/tasks/extraction_task.md). This Task takes an [Extraction Engine](../../griptape-framework/engines/extraction-engines.md), and a set of arguments specific to the Engine. - ### CSV Extraction ```python --8<-- "docs/griptape-framework/structures/src/tasks_6.py" ``` + ``` [12/19/23 10:33:11] INFO ExtractionTask e87fb457edf8423ab8a78583badd7a11 Input: @@ -217,6 +218,7 @@ This Task takes an [Extraction Engine](../../griptape-framework/engines/extracti ```python --8<-- "docs/griptape-framework/structures/src/tasks_7.py" ``` + ``` [12/19/23 10:37:41] INFO ExtractionTask 3315cc77f94943a2a2dceccfe44f6a67 Input: @@ -284,7 +286,7 @@ This task takes a [RAG Engine](../../griptape-framework/engines/rag-engines.md), To execute an arbitrary Python function, use the [CodeExecutionTask](../../reference/griptape/tasks/code_execution_task.md). This task takes a python function, and authors can elect to return a custom artifact. -```python +```python --8<-- "docs/griptape-framework/structures/src/tasks_10.py" ``` @@ -349,6 +351,7 @@ This Task accepts two inputs: a query (represented by either a string or a [Text ``` ## Structure Run Task + The [Structure Run Task](../../reference/griptape/tasks/structure_run_task.md) runs another Structure with a given input. This Task is useful for orchestrating multiple specialized Structures in a single run. Note that the input to the Task is a tuple of arguments that will be passed to the Structure. @@ -364,7 +367,7 @@ This Task enables Structures to synthesize speech from text using [Text to Speec --8<-- "docs/griptape-framework/structures/src/tasks_17.py" ``` -## Audio Transcription Task +## Audio Transcription Task This Task enables Structures to transcribe speech from text using [Audio Transcription Engines](../../reference/griptape/engines/audio/audio_transcription_engine.md) and [Audio Transcription Drivers](../../reference/griptape/drivers/audio_transcription/index.md). diff --git a/docs/griptape-framework/structures/workflows.md b/docs/griptape-framework/structures/workflows.md index 9161268ae8..85a4cec688 100644 --- a/docs/griptape-framework/structures/workflows.md +++ b/docs/griptape-framework/structures/workflows.md @@ -1,9 +1,9 @@ --- search: - boost: 2 + boost: 2 --- -## Overview +## Overview A [Workflow](../../reference/griptape/structures/workflow.md) is a non-sequential DAG that can be used for complex concurrent scenarios with tasks having multiple inputs. @@ -13,12 +13,13 @@ You can access the final output of the Workflow by using the [output](../../refe Workflows have access to the following [context](../../reference/griptape/structures/workflow.md#griptape.structures.workflow.Workflow.context) variables in addition to the [base context](./tasks.md#context): -* `parent_outputs`: dictionary containing mapping of parent IDs to their outputs. -* `parents_output_text`: string containing the concatenated outputs of all parent tasks. -* `parents`: parent tasks referenceable by IDs. -* `children`: child tasks referenceable by IDs. +- `parent_outputs`: dictionary containing mapping of parent IDs to their outputs. +- `parents_output_text`: string containing the concatenated outputs of all parent tasks. +- `parents`: parent tasks referenceable by IDs. +- `children`: child tasks referenceable by IDs. ## Workflow + Let's build a simple workflow. Let's say, we want to write a story in a fantasy world with some unique characters. We could setup a workflow that generates a world based on some keywords. Then we pass the world description to any number of child tasks that create characters. Finally, the last task pulls in information from all parent tasks and writes up a short story. ```python @@ -31,6 +32,7 @@ Note that we use the `StructureVisualizer` to get a visual representation of the !!! Info Output edited for brevity + ``` [09/08/23 10:26:21] INFO PromptTask world Input: Create a fictional world based on the following key words fantasy, ocean, tidal lock @@ -181,6 +183,7 @@ Imperatively insert parallel tasks between a parent and child: ``` output: + ``` [06/18/24 09:52:21] INFO PromptTask animal Input: Name an animal diff --git a/docs/griptape-framework/tools/index.md b/docs/griptape-framework/tools/index.md index f2adc0c973..4f7d06408d 100644 --- a/docs/griptape-framework/tools/index.md +++ b/docs/griptape-framework/tools/index.md @@ -1,18 +1,19 @@ --- search: - boost: 2 + boost: 2 --- ## Overview One of the most powerful features of Griptape is the ability to use tools that can interact with the outside world. -Many of our [Prompt Drivers](../drivers/prompt-drivers.md) leverage the native function calling built into the LLMs. -For LLMs that don't support this, Griptape provides its own implementation using the [ReAct](https://arxiv.org/abs/2210.03629) technique. +Many of our [Prompt Drivers](../drivers/prompt-drivers.md) leverage the native function calling built into the LLMs. +For LLMs that don't support this, Griptape provides its own implementation using the [ReAct](https://arxiv.org/abs/2210.03629) technique. You can switch between the two strategies by setting `use_native_tools` to `True` (LLM-native tool calling) or `False` (Griptape tool calling) on your [Prompt Driver](../drivers/prompt-drivers.md). ## Tools -Here is an example of a Pipeline using Tools: + +Here is an example of a Pipeline using Tools: ```python --8<-- "docs/griptape-framework/tools/src/index_1.py" diff --git a/docs/griptape-tools/custom-tools/index.md b/docs/griptape-tools/custom-tools/index.md index 3715b7be62..f2ea484ff8 100644 --- a/docs/griptape-tools/custom-tools/index.md +++ b/docs/griptape-tools/custom-tools/index.md @@ -3,7 +3,7 @@ Building your own tools is easy with Griptape! Tools are nothing more than Python classes that inherit from [BaseTool](../../reference/griptape/tools/base_tool.md). -Each method in the class is decorated with an [activity](../../reference/griptape/utils/decorators.md#griptape.utils.decorators.activity) decorator which informs the LLM how and when it should use that Tool Activity. +Each method in the class is decorated with an [activity](../../reference/griptape/utils/decorators.md#griptape.utils.decorators.activity) decorator which informs the LLM how and when it should use that Tool Activity. ## Random Number Generator Tool @@ -20,7 +20,7 @@ Check out other [Griptape Tools](https://github.com/griptape-ai/griptape/tree/ma Each Tool can also have its own dependencies. You can specify them in a `requirements.txt` file in the tool directory and Griptape will install them during Tool execution. To start, create a directory for your Tool inside your project. The directory must have the following structure: -* `tool.py` file with a tool Python class. -* `requirements.txt` file with tool Python dependencies. +- `tool.py` file with a tool Python class. +- `requirements.txt` file with tool Python dependencies. That's it! Import and use your Tool in your project as you would with any other Griptape Tool. diff --git a/docs/griptape-tools/official-tools/aws-iam-tool.md b/docs/griptape-tools/official-tools/aws-iam-tool.md index 8be54afb5c..3524c36b76 100644 --- a/docs/griptape-tools/official-tools/aws-iam-tool.md +++ b/docs/griptape-tools/official-tools/aws-iam-tool.md @@ -5,6 +5,7 @@ This tool enables LLMs to make AWS IAM API requests. ```python --8<-- "docs/griptape-tools/official-tools/src/aws_iam_tool_1.py" ``` + ``` [08/12/24 14:56:59] INFO ToolkitTask 12345abcd67890efghijk1112131415 Input: List all my IAM users diff --git a/docs/griptape-tools/official-tools/aws-s3-tool.md b/docs/griptape-tools/official-tools/aws-s3-tool.md index c6a972d766..9e44dda100 100644 --- a/docs/griptape-tools/official-tools/aws-s3-tool.md +++ b/docs/griptape-tools/official-tools/aws-s3-tool.md @@ -5,6 +5,7 @@ This tool enables LLMs to make AWS S3 API requests. ```python --8<-- "docs/griptape-tools/official-tools/src/aws_s3_tool_1.py" ``` + ``` [08/12/24 14:51:36] INFO ToolkitTask bfc329ebc7d34497b429ab0d18ff7e7b Input: List all my S3 buckets. diff --git a/docs/griptape-tools/official-tools/calculator-tool.md b/docs/griptape-tools/official-tools/calculator-tool.md index afe17a3648..d8ba618b73 100644 --- a/docs/griptape-tools/official-tools/calculator-tool.md +++ b/docs/griptape-tools/official-tools/calculator-tool.md @@ -5,6 +5,7 @@ This tool enables LLMs to make simple calculations. ```python --8<-- "docs/griptape-tools/official-tools/src/calculator_tool_1.py" ``` + ``` [09/08/23 14:23:51] INFO Task bbc6002a5e5b4655bb52b6a550a1b2a5 Input: What is 10 raised to the power of 5? diff --git a/docs/griptape-tools/official-tools/computer-tool.md b/docs/griptape-tools/official-tools/computer-tool.md index f21d4bda9a..67d0f260c0 100644 --- a/docs/griptape-tools/official-tools/computer-tool.md +++ b/docs/griptape-tools/official-tools/computer-tool.md @@ -7,6 +7,7 @@ You can specify a local working directory and environment variables during tool ```python --8<-- "docs/griptape-tools/official-tools/src/computer_tool_1.py" ``` + ``` ❮ poetry run python src/docs/task-memory.py [08/12/24 15:13:56] INFO ToolkitTask 203ee958d1934811afe0bb86fb246e86 @@ -44,4 +45,4 @@ You can specify a local working directory and environment variables during tool file2.txt [08/12/24 15:14:00] INFO ToolkitTask 203ee958d1934811afe0bb86fb246e86 Output: file1.txt, file2.txt -``` +``` diff --git a/docs/griptape-tools/official-tools/date-time-tool.md b/docs/griptape-tools/official-tools/date-time-tool.md index bdc5ccbf42..2e1946d700 100644 --- a/docs/griptape-tools/official-tools/date-time-tool.md +++ b/docs/griptape-tools/official-tools/date-time-tool.md @@ -5,6 +5,7 @@ This tool enables LLMs to get current date and time. ```python --8<-- "docs/griptape-tools/official-tools/src/date_time_tool_1.py" ``` + ``` [09/11/23 15:26:02] INFO Task d0bf49dacd8849e695494578a333f6cc Input: {'description': 'What is the current date diff --git a/docs/griptape-tools/official-tools/extraction-tool.md b/docs/griptape-tools/official-tools/extraction-tool.md index 5b0486ffde..157a7161d8 100644 --- a/docs/griptape-tools/official-tools/extraction-tool.md +++ b/docs/griptape-tools/official-tools/extraction-tool.md @@ -3,6 +3,7 @@ The [ExractionTool](../../reference/griptape/tools/extraction/tool.md) enables L ```python --8<-- "docs/griptape-tools/official-tools/src/extraction_tool_1.py" ``` + ``` [08/12/24 15:58:03] INFO ToolkitTask 43b3d209a83c470d8371b7ef4af175b4 Input: Load https://griptape.ai and extract key info diff --git a/docs/griptape-tools/official-tools/file-manager-tool.md b/docs/griptape-tools/official-tools/file-manager-tool.md index 2c27c86ea2..19215cdfdf 100644 --- a/docs/griptape-tools/official-tools/file-manager-tool.md +++ b/docs/griptape-tools/official-tools/file-manager-tool.md @@ -5,6 +5,7 @@ This tool enables LLMs to save and load files. ```python --8<-- "docs/griptape-tools/official-tools/src/file_manager_tool_1.py" ``` + ``` [09/12/23 12:07:56] INFO Task 16a1ce1847284ae3805485bad7d99116 Input: Can you get me the sample1.txt file? diff --git a/docs/griptape-tools/official-tools/google-calendar-tool.md b/docs/griptape-tools/official-tools/google-calendar-tool.md index e0b5d9cdc0..313a97777f 100644 --- a/docs/griptape-tools/official-tools/google-calendar-tool.md +++ b/docs/griptape-tools/official-tools/google-calendar-tool.md @@ -2,7 +2,6 @@ The [GoogleCalendarTool](../../reference/griptape/tools/google_calendar/tool.md) tool allows you to interact with Google Calendar. - ```python --8<-- "docs/griptape-tools/official-tools/src/google_calendar_tool_1.py" ``` diff --git a/docs/griptape-tools/official-tools/google-docs-tool.md b/docs/griptape-tools/official-tools/google-docs-tool.md index 1f02196b99..bc3e4e8148 100644 --- a/docs/griptape-tools/official-tools/google-docs-tool.md +++ b/docs/griptape-tools/official-tools/google-docs-tool.md @@ -5,6 +5,7 @@ The [GoogleDocsTool](../../reference/griptape/tools/google_docs/tool.md) tool pr ```python --8<-- "docs/griptape-tools/official-tools/src/google_docs_tool_1.py" ``` + ``` [10/05/23 12:56:19] INFO ToolkitTask 90721b7478a74618a63d852d35be3b18 Input: Create doc with name 'test_creation' in diff --git a/docs/griptape-tools/official-tools/google-drive-tool.md b/docs/griptape-tools/official-tools/google-drive-tool.md index 18e10ec08b..5d11ddd92c 100644 --- a/docs/griptape-tools/official-tools/google-drive-tool.md +++ b/docs/griptape-tools/official-tools/google-drive-tool.md @@ -5,6 +5,7 @@ The [GoogleDriveTool](../../reference/griptape/tools/google_drive/tool.md) tool ```python --8<-- "docs/griptape-tools/official-tools/src/google_drive_tool_1.py" ``` + ``` [10/05/23 10:49:14] INFO ToolkitTask 2ae3bb7e828744f3a2631c29c6fce001 Input: Save the content 'Hi this is Tony' in a file diff --git a/docs/griptape-tools/official-tools/google-gmail-tool.md b/docs/griptape-tools/official-tools/google-gmail-tool.md index 1a9e6ea478..dd66856b64 100644 --- a/docs/griptape-tools/official-tools/google-gmail-tool.md +++ b/docs/griptape-tools/official-tools/google-gmail-tool.md @@ -5,6 +5,7 @@ The [GoogleGmailTool](../../reference/griptape/tools/google_gmail/tool.md) tool ```python --8<-- "docs/griptape-tools/official-tools/src/google_gmail_tool_1.py" ``` + ``` [10/05/23 13:24:05] INFO ToolkitTask 1f190f823d584053bfe9942f41b6cb2d Input: Create a draft email in Gmail to diff --git a/docs/griptape-tools/official-tools/prompt-summary-tool.md b/docs/griptape-tools/official-tools/prompt-summary-tool.md index 7afecf57bd..23c35c3677 100644 --- a/docs/griptape-tools/official-tools/prompt-summary-tool.md +++ b/docs/griptape-tools/official-tools/prompt-summary-tool.md @@ -1,9 +1,10 @@ -The [PromptSummaryTool](../../reference/griptape/tools/prompt_summary/tool.md) enables LLMs summarize text data. +The [PromptSummaryTool](../../reference/griptape/tools/prompt_summary/tool.md) enables LLMs summarize text data. ```python --8<-- "docs/griptape-tools/official-tools/src/prompt_summary_tool_1.py" ``` -``` + +```` [08/12/24 15:54:46] INFO ToolkitTask 8be73eb542c44418ba880399044c017a Input: How can I build Neovim from source for MacOS according to this https://github.com/neovim/neovim/blob/master/BUILD.md [08/12/24 15:54:47] INFO Subtask cd362a149e1d400997be93c1342d1663 @@ -102,4 +103,4 @@ The [PromptSummaryTool](../../reference/griptape/tools/prompt_summary/tool.md) e By following these steps, you should be able to build and install Neovim from source on macOS. For more detailed instructions and troubleshooting tips, refer to the [BUILD.md](https://github.com/neovim/neovim/blob/master/BUILD.md) file in the Neovim repository. -``` +```` diff --git a/docs/griptape-tools/official-tools/query-tool.md b/docs/griptape-tools/official-tools/query-tool.md index 4a4f2bf33e..8b1b0a50ed 100644 --- a/docs/griptape-tools/official-tools/query-tool.md +++ b/docs/griptape-tools/official-tools/query-tool.md @@ -3,6 +3,7 @@ The [QueryTool](../../reference/griptape/tools/query/tool.md) enables Agents to ```python --8<-- "docs/griptape-tools/official-tools/src/query_tool_1.py" ``` + ``` [08/12/24 15:49:23] INFO ToolkitTask a88abda2e5324bdf81a3e2b99c26b9df Input: Tell me about the architecture as described here: https://neovim.io/doc/user/vim_diff.html diff --git a/docs/griptape-tools/official-tools/rag-tool.md b/docs/griptape-tools/official-tools/rag-tool.md index 71613beab0..f96f9c7fe6 100644 --- a/docs/griptape-tools/official-tools/rag-tool.md +++ b/docs/griptape-tools/official-tools/rag-tool.md @@ -7,6 +7,7 @@ Here is an example of how it can be used with a local vector store driver: ```python --8<-- "docs/griptape-tools/official-tools/src/rag_tool_1.py" ``` + ``` [07/11/24 13:30:43] INFO ToolkitTask a6d057d5c71d4e9cb6863a2adb64b76c Input: what is Griptape? diff --git a/docs/griptape-tools/official-tools/rest-api-tool.md b/docs/griptape-tools/official-tools/rest-api-tool.md index 345f0589b0..b122fa51b9 100644 --- a/docs/griptape-tools/official-tools/rest-api-tool.md +++ b/docs/griptape-tools/official-tools/rest-api-tool.md @@ -2,9 +2,10 @@ This tool enables LLMs to call REST APIs. -The [RestApiTool](../../reference/griptape/tools/rest_api/tool.md) tool uses the following parameters: +The [RestApiTool](../../reference/griptape/tools/rest_api/tool.md) tool uses the following parameters: ### Example + The following example is built using [https://jsonplaceholder.typicode.com/guide/](https://jsonplaceholder.typicode.com/guide/). ```python diff --git a/docs/griptape-tools/official-tools/sql-tool.md b/docs/griptape-tools/official-tools/sql-tool.md index ed8aae2a0f..a0b023038b 100644 --- a/docs/griptape-tools/official-tools/sql-tool.md +++ b/docs/griptape-tools/official-tools/sql-tool.md @@ -5,6 +5,7 @@ This tool enables LLMs to execute SQL statements via [SQLAlchemy](https://www.sq ```python --8<-- "docs/griptape-tools/official-tools/src/sql_tool_1.py" ``` + ``` [08/12/24 14:59:31] INFO ToolkitTask e302f7315d1a4f939e0125103ff4f09f Input: SELECT * FROM people; diff --git a/docs/griptape-tools/official-tools/structure-run-tool.md b/docs/griptape-tools/official-tools/structure-run-tool.md index 7b73e5b52d..37366b586e 100644 --- a/docs/griptape-tools/official-tools/structure-run-tool.md +++ b/docs/griptape-tools/official-tools/structure-run-tool.md @@ -6,6 +6,7 @@ It requires you to provide a [Structure Run Driver](../../griptape-framework/dri ```python --8<-- "docs/griptape-tools/official-tools/src/structure_run_tool_1.py" ``` + ``` [05/02/24 13:50:03] INFO ToolkitTask 4e9458375bda4fbcadb77a94624ed64c Input: what is modular RAG? diff --git a/docs/griptape-tools/official-tools/variation-image-generation-tool.md b/docs/griptape-tools/official-tools/variation-image-generation-tool.md index bcc8c3f61b..523dcf9f04 100644 --- a/docs/griptape-tools/official-tools/variation-image-generation-tool.md +++ b/docs/griptape-tools/official-tools/variation-image-generation-tool.md @@ -1,6 +1,6 @@ # Variation Image Generation Engine Tool -This Tool allows LLMs to generate variations of an input image from a text prompt. The input image can be provided either by its file path or by its [Task Memory](../../griptape-framework/structures/task-memory.md) reference. +This Tool allows LLMs to generate variations of an input image from a text prompt. The input image can be provided either by its file path or by its [Task Memory](../../griptape-framework/structures/task-memory.md) reference. ## Referencing an Image by File Path diff --git a/docs/griptape-tools/official-tools/web-scraper-tool.md b/docs/griptape-tools/official-tools/web-scraper-tool.md index 26b83f6e30..7001494ff5 100644 --- a/docs/griptape-tools/official-tools/web-scraper-tool.md +++ b/docs/griptape-tools/official-tools/web-scraper-tool.md @@ -5,6 +5,7 @@ This tool enables LLMs to scrape web pages for full text, summaries, authors, ti ```python --8<-- "docs/griptape-tools/official-tools/src/web_scraper_tool_1.py" ``` + ``` [08/12/24 15:32:08] INFO ToolkitTask b14a4305365f4b17a4dcf235f84397e2 Input: Based on https://www.griptape.ai/, tell me what griptape is diff --git a/docs/griptape-tools/official-tools/web-search-tool.md b/docs/griptape-tools/official-tools/web-search-tool.md index 3f31fd4fdb..86632a557f 100644 --- a/docs/griptape-tools/official-tools/web-search-tool.md +++ b/docs/griptape-tools/official-tools/web-search-tool.md @@ -5,6 +5,7 @@ This tool enables LLMs to search the web. ```python --8<-- "docs/griptape-tools/official-tools/src/web_search_tool_1.py" ``` + ``` [09/08/23 15:37:25] INFO Task 2cf557f7f7cd4a20a7fa2f0c46af2f71 Input: Tell me how photosynthesis works diff --git a/docs/index.md b/docs/index.md index 2c6ee5d50b..9f6128f35d 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,6 +1,6 @@ # Griptape Docs -Welcome to Griptape Docs! This documentation is organized into the following sections: +Welcome to Griptape Docs! This documentation is organized into the following sections: ## Griptape Topic Guides