Skip to content

Commit 3ab0d90

Browse files
committed
docs: add back missing docs
Got accidentally removed by bad find and replace in f5503bd#diff-6581c65f27bffff29bf243d07c1d94ce97e6b93cce1b29d30a304acbf30dfe3a
1 parent b3e4b68 commit 3ab0d90

File tree

4 files changed

+148
-2
lines changed

4 files changed

+148
-2
lines changed

docs/griptape-framework/structures/configs.md

+95
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,101 @@ Griptape exposes a global singleton, [Defaults](../../reference/griptape/configs
1010
To update the default configurations, simply update the fields on the `Defaults` object.
1111
Framework objects will be created with the currently set default configurations, but you can always override at the individual class level.
1212

13+
```python
14+
--8<-- "docs/griptape-framework/structures/src/config_defaults.py"
15+
```
16+
17+
### Drivers Configs
18+
19+
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.
20+
21+
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.
22+
23+
`DriversConfig`s can be used as a Python Context Manager using the `with` statement to temporarily change the default configurations for a block of code.
24+
25+
```python
26+
--8<-- "docs/griptape-framework/structures/src/drivers_config_with.py"
27+
```
28+
29+
#### OpenAI
30+
31+
The [OpenAI Driver config](../../reference/griptape/configs/drivers/openai_drivers_config.md) provides default Drivers for OpenAI's APIs. This is the default config for all Structures.
32+
33+
```python
34+
--8<-- "docs/griptape-framework/structures/src/drivers_config_1.py"
35+
```
36+
37+
#### Azure OpenAI
38+
39+
The [Azure OpenAI Driver config](../../reference/griptape/configs/drivers/azure_openai_drivers_config.md) provides default Drivers for Azure's OpenAI APIs.
40+
41+
```python
42+
--8<-- "docs/griptape-framework/structures/src/drivers_config_2.py"
43+
```
44+
45+
#### Amazon Bedrock
46+
47+
The [Amazon Bedrock Driver config](../../reference/griptape/configs/drivers/amazon_bedrock_drivers_config.md) provides default Drivers for Amazon Bedrock's APIs.
48+
49+
```python
50+
--8<-- "docs/griptape-framework/structures/src/drivers_config_3.py"
51+
```
52+
53+
#### Google
54+
55+
The [Google Driver config](../../reference/griptape/configs/drivers/google_drivers_config.md) provides default Drivers for Google's Gemini APIs.
56+
57+
```python
58+
--8<-- "docs/griptape-framework/structures/src/drivers_config_4.py"
59+
```
60+
61+
#### Anthropic
62+
63+
The [Anthropic Driver config](../../reference/griptape/configs/drivers/anthropic_drivers_config.md) provides default Drivers for Anthropic's APIs.
64+
65+
!!! info
66+
67+
Anthropic does not provide an embeddings API which means you will need to use another service for embeddings.
68+
To override the default embedding driver, see: [Override Default Structure Embedding Driver](../drivers/embedding-drivers.md#override-default-structure-embedding-driver).
69+
70+
```python
71+
--8<-- "docs/griptape-framework/structures/src/drivers_config_5.py"
72+
```
73+
74+
#### Cohere
75+
76+
The [Cohere Driver config](../../reference/griptape/configs/drivers/cohere_drivers_config.md) provides default Drivers for Cohere's APIs.
77+
78+
```python
79+
--8<-- "docs/griptape-framework/structures/src/drivers_config_6.py"
80+
```
81+
82+
#### Custom
83+
84+
You can create your own [DriversConfig](../../reference/griptape/configs/drivers/drivers_config.md) by overriding relevant Drivers.
85+
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.
86+
This approach ensures that you are informed through clear error messages if you attempt to use Structures without proper Driver configurations.
87+
88+
```python
89+
--8<-- "docs/griptape-framework/structures/src/drivers_config_7.py"
90+
```
91+
92+
### Logging Config
93+
94+
Griptape provides a predefined [LoggingConfig](../../reference/griptape/configs/logging/logging_config.md)'s for easily customizing the logging events that the framework emits. In order to customize the logger, the logger can be fetched by using the `Defaults.logging.logger_name`.
95+
96+
```python
97+
--8<-- "docs/griptape-framework/structures/src/logging_config.py"
98+
```
99+
100+
#### Debug Logs
101+
102+
You can enable debug logs to view more granular information such as request/response payloads.
103+
104+
```python
105+
--8<-- "docs/griptape-framework/structures/src/debug_logs.py"
106+
```
107+
13108
### Loading/Saving Configs
14109

15110
You can serialize and deserialize Driver Configs using the [to_json()](../../reference/griptape/mixins/serializable_mixin.md#griptape.mixins.serializable_mixin.SerializableMixin.to_json) and [from_json()](../../reference/griptape/mixins/serializable_mixin.md#griptape.mixins.serializable_mixin.SerializableMixin.from_json) methods.

docs/griptape-framework/structures/task-memory.md

+23
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,29 @@ Let's say we want to query the contents of a very large webpage.
9595

9696
When running this example, we get the following error:
9797

98+
```
99+
[04/26/24 13:20:02] ERROR PromptTask 67e2f907f95d4850ae79f9da67df54c1
100+
Error code: 400 - {'error': {'message': "This model's maximum context length is 8192 tokens. However, your messages resulted in 73874 tokens.
101+
Please reduce the length of the messages.", 'type': 'invalid_request_error', 'param': 'messages', 'code': 'context_length_exceeded'}}
102+
```
103+
104+
This is because the content of the webpage is too large to fit in the LLM's input token limit. We can fix this by storing the content in Task Memory, and then querying it with the `QueryTool`.
105+
Note that we're setting `off_prompt` to `False` on the `QueryTool` so that the _queried_ content can be returned directly to the LLM.
106+
107+
```python
108+
--8<-- "docs/griptape-framework/structures/src/task_memory_5.py"
109+
```
110+
111+
And now we get the expected output.
112+
113+
```
114+
[08/12/24 14:56:29] INFO Subtask 8669ee523bb64550850566011bcd14e2
115+
Response: "Elden Ring" sold 13.4 million copies worldwide by the end of March 2022 and 25 million by June 2024. The downloadable content (DLC)
116+
"Shadow of the Erdtree" sold five million copies within three days of its release.
117+
[08/12/24 14:56:30] INFO PromptTask d3ce58587dc944b0a30a205631b82944
118+
Output: Elden Ring sold 13.4 million copies worldwide by the end of March 2022 and 25 million by June 2024.
119+
```
120+
98121
## Sensitive Data
99122

100123
Because Task Memory splits up the storage and retrieval of data, you can use different models for each step.

docs/griptape-framework/structures/workflows.md

-2
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,6 @@ Imperatively insert parallel tasks between a parent and child:
167167
--8<-- "docs/griptape-framework/structures/logs/workflows_9.txt"
168168
```
169169

170-
output:
171-
172170
### Bitshift Composition
173171

174172
Task relationships can also be set up with the Python bitshift operators `>>` and `<<`. The following statements are all functionally equivalent:

docs/griptape-framework/tools/official-tools/index.md

+30
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ This tool enables LLMs to execute Python code and run shell commands inside a Do
4747

4848
You can specify a local working directory and environment variables during tool initialization:
4949

50+
```python
51+
--8<-- "docs/griptape-framework/tools/official-tools/src/computer_tool_1.py"
52+
```
53+
5054
### Date Time
5155

5256
This tool enables LLMs to get current date and time.
@@ -67,6 +71,24 @@ This tool enables LLMs to get current date and time.
6771

6872
The [EmailTool](../../../reference/griptape/tools/email/tool.md) enables LLMs to send emails.
6973

74+
```python
75+
--8<-- "docs/griptape-framework/tools/official-tools/src/email_tool_1.py"
76+
```
77+
78+
For debugging purposes, you can run a local SMTP server that the LLM can send emails to:
79+
80+
```shell
81+
python -m smtpd -c DebuggingServer -n localhost:1025
82+
```
83+
84+
### Extraction
85+
86+
The [ExractionTool](../../../reference/griptape/tools/extraction/tool.md) enables LLMs to extract structured text from unstructured data.
87+
88+
```python
89+
--8<-- "docs/griptape-framework/tools/official-tools/src/extraction_tool_1.py"
90+
```
91+
7092
### File Manager
7193

7294
This tool enables LLMs to save and load files.
@@ -199,6 +221,14 @@ Here is an example of how it can be used with a local vector store driver:
199221
--8<-- "docs/griptape-framework/tools/official-tools/logs/rag_tool_1.txt"
200222
```
201223

224+
### Query
225+
226+
The [QueryTool](../../../reference/griptape/tools/query/tool.md) enables Agents to query unstructured data for specific information.
227+
228+
```python
229+
--8<-- "docs/griptape-framework/tools/official-tools/src/query_tool_1.py"
230+
```
231+
202232
### Rest Api
203233

204234
This tool enables LLMs to call REST APIs.

0 commit comments

Comments
 (0)