Tools
__all__ = ['BaseTool', 'BaseAwsClient', 'AwsIamClient', 'AwsS3Client', 'BaseGoogleClient', 'GoogleGmailClient', 'GoogleDocsClient', 'GoogleCalendarClient', 'GoogleDriveClient', 'Calculator', 'WebSearch', 'WebScraper', 'SqlClient', 'EmailClient', 'RestApiClient', 'FileManager', 'VectorStoreClient', 'DateTime', 'TaskMemoryClient', 'Computer', 'ProxycurlClient', 'OpenWeatherClient']
module-attribute
AwsIamClient
Bases: BaseAwsClient
Source code in griptape/griptape/tools/aws_iam_client/tool.py
iam_client: boto3.client = field(default=Factory(lambda : self.session.client('iam'), takes_self=True), kw_only=True)
class-attribute
instance-attribute
get_user_policy(params)
Source code in griptape/griptape/tools/aws_iam_client/tool.py
list_mfa_devices(_)
Source code in griptape/griptape/tools/aws_iam_client/tool.py
list_user_policies(params)
Source code in griptape/griptape/tools/aws_iam_client/tool.py
list_users(_)
Source code in griptape/griptape/tools/aws_iam_client/tool.py
AwsS3Client
Bases: BaseAwsClient
Source code in griptape/griptape/tools/aws_s3_client/tool.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 |
|
s3_client: boto3.client = field(default=Factory(lambda : self.session.client('s3'), takes_self=True), kw_only=True)
class-attribute
instance-attribute
download_objects(params)
Source code in griptape/griptape/tools/aws_s3_client/tool.py
get_bucket_acl(params)
Source code in griptape/griptape/tools/aws_s3_client/tool.py
get_bucket_policy(params)
Source code in griptape/griptape/tools/aws_s3_client/tool.py
get_object_acl(params)
Source code in griptape/griptape/tools/aws_s3_client/tool.py
list_objects(params)
Source code in griptape/griptape/tools/aws_s3_client/tool.py
list_s3_buckets(_)
Source code in griptape/griptape/tools/aws_s3_client/tool.py
upload_content_to_s3(params)
Source code in griptape/griptape/tools/aws_s3_client/tool.py
upload_memory_artifacts_to_s3(params)
Source code in griptape/griptape/tools/aws_s3_client/tool.py
BaseAwsClient
Bases: BaseTool
, ABC
Source code in griptape/griptape/tools/base_aws_client.py
session: boto3.Session = field(kw_only=True)
class-attribute
instance-attribute
get_current_aws_identity(params)
Source code in griptape/griptape/tools/base_aws_client.py
BaseGoogleClient
Bases: BaseTool
, ABC
Source code in griptape/griptape/tools/base_google_client.py
DRIVE_AUTH_SCOPES = ['https://www.googleapis.com/auth/drive']
class-attribute
instance-attribute
DRIVE_FILE_SCOPES = ['https://www.googleapis.com/auth/drive.file']
class-attribute
instance-attribute
service_account_credentials: dict = field(kw_only=True)
class-attribute
instance-attribute
BaseTool
Bases: ActivityMixin
, ABC
Abstract class for all tools to inherit from for.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
Tool name. |
input_memory |
Optional[list[TaskMemory]]
|
TaskMemory available in tool activities. Gets automatically set if None. |
output_memory |
Optional[dict[str, list[TaskMemory]]]
|
TaskMemory that activities write to be default. Gets automatically set if None. |
install_dependencies_on_init |
bool
|
Determines whether dependencies from the tool requirements.txt file are installed in init. |
dependencies_install_directory |
Optional[str]
|
Custom dependency install directory. |
verbose |
bool
|
Determines whether tool operations (such as dependency installation) should be verbose. |
off_prompt |
bool
|
Determines whether tool activity output goes to the output memory. |
Source code in griptape/griptape/tools/base_tool.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
|
MANIFEST_FILE = 'manifest.yml'
class-attribute
instance-attribute
REQUIREMENTS_FILE = 'requirements.txt'
class-attribute
instance-attribute
abs_dir_path
property
abs_file_path
property
class_name
property
dependencies_install_directory: Optional[str] = field(default=None, kw_only=True)
class-attribute
instance-attribute
input_memory: Optional[list[TaskMemory]] = field(default=None, kw_only=True)
class-attribute
instance-attribute
install_dependencies_on_init: bool = field(default=True, kw_only=True)
class-attribute
instance-attribute
manifest: dict
property
manifest_path: str
property
name: str = field(default=Factory(lambda : self.class_name, takes_self=True), kw_only=True)
class-attribute
instance-attribute
off_prompt: bool = field(default=True, kw_only=True)
class-attribute
instance-attribute
output_memory: Optional[dict[str, list[TaskMemory]]] = field(default=None, kw_only=True)
class-attribute
instance-attribute
requirements_path: str
property
verbose: bool = field(default=False, kw_only=True)
class-attribute
instance-attribute
__attrs_post_init__()
after_run(activity, subtask, value)
Source code in griptape/griptape/tools/base_tool.py
before_run(activity, value)
execute(activity, subtask)
Source code in griptape/griptape/tools/base_tool.py
find_input_memory(memory_name)
install_dependencies(env=None)
Source code in griptape/griptape/tools/base_tool.py
run(activity, subtask, value)
Source code in griptape/griptape/tools/base_tool.py
schema()
Source code in griptape/griptape/tools/base_tool.py
tool_dir()
validate()
Source code in griptape/griptape/tools/base_tool.py
validate_output_memory(_, output_memory)
Source code in griptape/griptape/tools/base_tool.py
Calculator
Bases: BaseTool
Source code in griptape/griptape/tools/calculator/tool.py
calculate(params)
Source code in griptape/griptape/tools/calculator/tool.py
Computer
Bases: BaseTool
Source code in griptape/griptape/tools/computer/tool.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
|
__tempdir: Optional[tempfile.TemporaryDirectory] = field(default=None, kw_only=True)
class-attribute
instance-attribute
container_workdir: str = field(default='/griptape', kw_only=True)
class-attribute
instance-attribute
docker_client: DockerClient = field(default=Factory(lambda : self.default_docker_client(), takes_self=True), kw_only=True)
class-attribute
instance-attribute
dockerfile_path: str = field(default=Factory(lambda : f'{os.path.join(self.tool_dir(), 'resources/Dockerfile')}', takes_self=True), kw_only=True)
class-attribute
instance-attribute
env_vars: dict = field(factory=dict, kw_only=True)
class-attribute
instance-attribute
local_workdir: Optional[str] = field(default=None, kw_only=True)
class-attribute
instance-attribute
requirements_txt_path: str = field(default=Factory(lambda : f'{os.path.join(self.tool_dir(), 'resources/requirements.txt')}', takes_self=True), kw_only=True)
class-attribute
instance-attribute
__attrs_post_init__()
Source code in griptape/griptape/tools/computer/tool.py
__del__()
build_image(tool)
Source code in griptape/griptape/tools/computer/tool.py
container_name(tool)
default_docker_client()
dependencies()
execute_code(params)
Source code in griptape/griptape/tools/computer/tool.py
execute_code_in_container(filename, code)
Source code in griptape/griptape/tools/computer/tool.py
execute_command(params)
Source code in griptape/griptape/tools/computer/tool.py
execute_command_in_container(command)
Source code in griptape/griptape/tools/computer/tool.py
image_name(tool)
install_dependencies(env=None)
remove_existing_container(name)
Source code in griptape/griptape/tools/computer/tool.py
validate_docker_client(_, docker_client)
DateTime
Bases: BaseTool
Source code in griptape/griptape/tools/date_time/tool.py
get_current_datetime(_)
Source code in griptape/griptape/tools/date_time/tool.py
get_relative_datetime(params)
Source code in griptape/griptape/tools/date_time/tool.py
EmailClient
Bases: BaseTool
Tool for working with email
Attributes:
Name | Type | Description |
---|---|---|
username |
Optional[str]
|
Username/email address used to send email via the SMTP protocol and retrieve email via the IMAP protocol. Example: bender@futurama.com |
password |
Optional[str]
|
Password used to send email via the SMTP protocol and retrieve email via the IMAP protocol. If using gmail, this would be an App Password. |
email_max_retrieve_count |
Optional[int]
|
Used to limit the number of messages retrieved during any given activities. |
smtp_host |
Optional[str]
|
Hostname or url of the SMTP server. Example: smtp.gmail.com |
smtp_port |
Optional[int]
|
Port of the SMTP server. Example: 465 |
smtp_use_ssl |
bool
|
Whether to use SSL when sending email via the SMTP protocol. |
smtp_user |
Optional[str]
|
Username/email address used to send email via the SMTP protocol. Overrides username for SMTP only. |
smtp_password |
Optional[str]
|
Password to send email via the SMTP protocol. Overrides password for SMTP only. |
imap_url |
Optional[str]
|
Hostname or url of the IMAP server. Example: imap.gmail.com |
imap_user |
Optional[str]
|
Username/email address used to retrieve email via the IMAP protocol. Overrides username for IMAP only. |
imap_password |
Optional[str]
|
Password to retrieve email via the IMAP protocol. Overrides password for IMAP only. |
mailboxes |
Optional[dict[str, str]]
|
Descriptions of mailboxes available for retrieving email via the IMAP protocol. Example: {'INBOX': 'default mailbox for incoming email', 'SENT': 'default mailbox for sent email'} |
email_loader |
EmailLoader
|
Used to retrieve email. |
Source code in griptape/griptape/tools/email_client/tool.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
|
email_loader: EmailLoader = field(default=Factory(lambda : EmailLoader(imap_url=self.imap_url, username=self.imap_user, password=self.imap_password), takes_self=True), kw_only=True)
class-attribute
instance-attribute
email_max_retrieve_count: Optional[int] = field(default=None, kw_only=True)
class-attribute
instance-attribute
imap_password: Optional[str] = field(default=Factory(lambda : self.password, takes_self=True), kw_only=True)
class-attribute
instance-attribute
imap_url: Optional[str] = field(default=None, kw_only=True)
class-attribute
instance-attribute
imap_user: Optional[str] = field(default=Factory(lambda : self.username, takes_self=True), kw_only=True)
class-attribute
instance-attribute
mailboxes: Optional[dict[str, str]] = field(default=None, kw_only=True)
class-attribute
instance-attribute
password: Optional[str] = field(default=None, kw_only=True)
class-attribute
instance-attribute
smtp_host: Optional[str] = field(default=None, kw_only=True)
class-attribute
instance-attribute
smtp_password: Optional[str] = field(default=Factory(lambda : self.password, takes_self=True), kw_only=True)
class-attribute
instance-attribute
smtp_port: Optional[int] = field(default=None, kw_only=True)
class-attribute
instance-attribute
smtp_use_ssl: bool = field(default=True, kw_only=True)
class-attribute
instance-attribute
smtp_user: Optional[str] = field(default=Factory(lambda : self.username, takes_self=True), kw_only=True)
class-attribute
instance-attribute
username: Optional[str] = field(default=None, kw_only=True)
class-attribute
instance-attribute
retrieve(params)
Source code in griptape/griptape/tools/email_client/tool.py
send(params)
Source code in griptape/griptape/tools/email_client/tool.py
FileManager
Bases: BaseTool
FileManager is a tool that can be used to load and save files.
Attributes:
Name | Type | Description |
---|---|---|
workdir |
str
|
The absolute directory to load files from and save files to. |
loaders |
dict[str, BaseLoader]
|
Dictionary of file extensions and matching loaders to use when loading files in load_files_from_disk. |
default_loader |
BaseLoader
|
The loader to use when loading files in load_files_from_disk without any matching loader in |
save_file_encoding |
Optional[str]
|
The encoding to use when saving files to disk. |
Source code in griptape/griptape/tools/file_manager/tool.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
|
default_loader: BaseLoader = field(default=Factory(lambda : FileLoader()))
class-attribute
instance-attribute
loaders: dict[str, BaseLoader] = field(default=Factory(lambda : {'pdf': PdfLoader(), 'csv': CsvLoader(), 'txt': TextLoader(), 'html': TextLoader(), 'json': TextLoader(), 'yaml': TextLoader(), 'xml': TextLoader()}), kw_only=True)
class-attribute
instance-attribute
save_file_encoding: Optional[str] = field(default=None, kw_only=True)
class-attribute
instance-attribute
workdir: str = field(default=os.getcwd(), kw_only=True)
class-attribute
instance-attribute
load_files_from_disk(params)
Source code in griptape/griptape/tools/file_manager/tool.py
save_content_to_file(params)
Source code in griptape/griptape/tools/file_manager/tool.py
save_memory_artifacts_to_disk(params)
Source code in griptape/griptape/tools/file_manager/tool.py
GoogleCalendarClient
Bases: BaseGoogleClient
Source code in griptape/griptape/tools/google_cal/tool.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
|
CREATE_EVENT_SCOPES = ['https://www.googleapis.com/auth/calendar']
class-attribute
instance-attribute
GET_UPCOMING_EVENTS_SCOPES = ['https://www.googleapis.com/auth/calendar']
class-attribute
instance-attribute
owner_email: str = field(kw_only=True)
class-attribute
instance-attribute
create_event(params)
Source code in griptape/griptape/tools/google_cal/tool.py
get_upcoming_events(params)
Source code in griptape/griptape/tools/google_cal/tool.py
GoogleDocsClient
Bases: BaseGoogleClient
Source code in griptape/griptape/tools/google_docs/tool.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
|
DEFAULT_FOLDER_PATH = 'root'
class-attribute
instance-attribute
DOCS_SCOPES = ['https://www.googleapis.com/auth/documents']
class-attribute
instance-attribute
owner_email: str = field(kw_only=True)
class-attribute
instance-attribute
append_text_to_google_doc(params)
Source code in griptape/griptape/tools/google_docs/tool.py
prepend_text_to_google_doc(params)
Source code in griptape/griptape/tools/google_docs/tool.py
save_content_to_google_doc(params)
Source code in griptape/griptape/tools/google_docs/tool.py
save_memory_artifacts_to_google_docs(params)
Source code in griptape/griptape/tools/google_docs/tool.py
GoogleDriveClient
Bases: BaseGoogleClient