drivers
__all__ = ['AmazonBedrockCohereEmbeddingDriver', 'AmazonBedrockImageGenerationDriver', 'AmazonBedrockPromptDriver', 'AmazonBedrockRerankDriver', 'AmazonBedrockTitanEmbeddingDriver', 'AmazonDynamoDbConversationMemoryDriver', 'AmazonOpenSearchVectorStoreDriver', 'AmazonRedshiftSqlDriver', 'AmazonS3FileManagerDriver', 'AmazonSageMakerJumpstartEmbeddingDriver', 'AmazonSageMakerJumpstartPromptDriver', 'AmazonSqsEventListenerDriver', 'AnthropicPromptDriver', 'AstraDbVectorStoreDriver', 'AwsIotCoreEventListenerDriver', 'AzureMongoDbVectorStoreDriver', 'AzureOpenAiChatPromptDriver', 'AzureOpenAiEmbeddingDriver', 'AzureOpenAiImageGenerationDriver', 'AzureOpenAiTextToSpeechDriver', 'BaseAssistantDriver', 'BaseAudioTranscriptionDriver', 'BaseConversationMemoryDriver', 'BaseDiffusionImageGenerationPipelineDriver', 'BaseEmbeddingDriver', 'BaseEventListenerDriver', 'BaseFileManagerDriver', 'BaseImageGenerationDriver', 'BaseImageGenerationModelDriver', 'BaseMultiModelImageGenerationDriver', 'BaseObservabilityDriver', 'BasePromptDriver', 'BaseRerankDriver', 'BaseRulesetDriver', 'BaseSqlDriver', 'BaseStructureRunDriver', 'BaseTextToSpeechDriver', 'BaseVectorStoreDriver', 'BaseWebScraperDriver', 'BaseWebSearchDriver', 'BedrockStableDiffusionImageGenerationModelDriver', 'BedrockTitanImageGenerationModelDriver', 'CohereEmbeddingDriver', 'CoherePromptDriver', 'CohereRerankDriver', 'DatadogObservabilityDriver', 'DuckDuckGoWebSearchDriver', 'DummyAudioTranscriptionDriver', 'DummyEmbeddingDriver', 'DummyImageGenerationDriver', 'DummyPromptDriver', 'DummyTextToSpeechDriver', 'DummyVectorStoreDriver', 'ElevenLabsTextToSpeechDriver', 'ExaWebSearchDriver', 'GoogleEmbeddingDriver', 'GooglePromptDriver', 'GoogleWebSearchDriver', 'GriptapeCloudAssistantDriver', 'GriptapeCloudConversationMemoryDriver', 'GriptapeCloudEventListenerDriver', 'GriptapeCloudFileManagerDriver', 'GriptapeCloudObservabilityDriver', 'GriptapeCloudPromptDriver', 'GriptapeCloudRulesetDriver', 'GriptapeCloudStructureRunDriver', 'GriptapeCloudVectorStoreDriver', 'GrokPromptDriver', 'HuggingFaceHubEmbeddingDriver', 'HuggingFaceHubPromptDriver', 'HuggingFacePipelineImageGenerationDriver', 'HuggingFacePipelinePromptDriver', 'LeonardoImageGenerationDriver', 'LocalConversationMemoryDriver', 'LocalFileManagerDriver', 'LocalRerankDriver', 'LocalRulesetDriver', 'LocalStructureRunDriver', 'LocalVectorStoreDriver', 'MarkdownifyWebScraperDriver', 'MarqoVectorStoreDriver', 'MongoDbAtlasVectorStoreDriver', 'NoOpObservabilityDriver', 'OllamaEmbeddingDriver', 'OllamaPromptDriver', 'OpenAiAssistantDriver', 'OpenAiAudioTranscriptionDriver', 'OpenAiChatPromptDriver', 'OpenAiEmbeddingDriver', 'OpenAiImageGenerationDriver', 'OpenAiTextToSpeechDriver', 'OpenSearchVectorStoreDriver', 'OpenTelemetryObservabilityDriver', 'PerplexityPromptDriver', 'PerplexityWebSearchDriver', 'PgAiKnowledgeBaseVectorStoreDriver', 'PgVectorVectorStoreDriver', 'PineconeVectorStoreDriver', 'ProxyWebScraperDriver', 'PusherEventListenerDriver', 'QdrantVectorStoreDriver', 'RedisConversationMemoryDriver', 'RedisVectorStoreDriver', 'SnowflakeSqlDriver', 'SqlDriver', 'StableDiffusion3ControlNetImageGenerationPipelineDriver', 'StableDiffusion3ImageGenerationPipelineDriver', 'StableDiffusion3Img2ImgImageGenerationPipelineDriver', 'StableDiffusion3ControlNetImageGenerationPipelineDriver', 'BaseImageGenerationDriver', 'BaseMultiModelImageGenerationDriver', 'OpenAiImageGenerationDriver', 'LeonardoImageGenerationDriver', 'AmazonBedrockImageGenerationDriver', 'AzureOpenAiImageGenerationDriver', 'DummyImageGenerationDriver', 'HuggingFacePipelineImageGenerationDriver', 'GriptapeCloudImageGenerationDriver', 'BaseWebScraperDriver', 'TrafilaturaWebScraperDriver', 'MarkdownifyWebScraperDriver', 'ProxyWebScraperDriver', 'BaseWebSearchDriver', 'GoogleWebSearchDriver', 'DuckDuckGoWebSearchDriver', 'ExaWebSearchDriver', 'TavilyWebSearchDriver', 'TrafilaturaWebScraperDriver', 'VoyageAiEmbeddingDriver', 'TwelveLabsEmbeddingDriver', 'WebhookEventListenerDriver']
module-attribute
AmazonBedrockCohereEmbeddingDriver
Bases: BaseEmbeddingDriver
Amazon Bedrock Cohere Embedding Driver.
Attributes:
| Name | Type | Description |
|---|---|---|
model |
str
|
Embedding model name. Defaults to DEFAULT_MODEL. |
input_type |
str
|
Defaults to |
session |
Session
|
Optionally provide custom |
tokenizer |
BaseTokenizer
|
Optionally provide custom |
client |
BedrockRuntimeClient
|
Optionally provide custom |
Source code in griptape/drivers/embedding/amazon_bedrock_cohere_embedding_driver.py
DEFAULT_MODEL = 'cohere.embed-english-v3'
class-attribute
instance-attribute
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
input_type = field(default='search_query', kw_only=True)
class-attribute
instance-attribute
model = field(default=DEFAULT_MODEL, kw_only=True)
class-attribute
instance-attribute
session = field(default=Factory(lambda: import_optional_dependency('boto3').Session()), kw_only=True)
class-attribute
instance-attribute
tokenizer = field(default=Factory(lambda self: AmazonBedrockTokenizer(model=self.model), takes_self=True), kw_only=True)
class-attribute
instance-attribute
client()
try_embed_chunk(chunk, **kwargs)
Source code in griptape/drivers/embedding/amazon_bedrock_cohere_embedding_driver.py
AmazonBedrockImageGenerationDriver
Bases: BaseMultiModelImageGenerationDriver
Driver for image generation models provided by Amazon Bedrock.
Attributes:
| Name | Type | Description |
|---|---|---|
model |
str
|
Bedrock model ID. |
session |
Session
|
boto3 session. |
client |
BedrockRuntimeClient
|
Bedrock runtime client. |
image_width |
int
|
Width of output images. Defaults to 512 and must be a multiple of 64. |
image_height |
int
|
Height of output images. Defaults to 512 and must be a multiple of 64. |
seed |
int | None
|
Optionally provide a consistent seed to generation requests, increasing consistency in output. |
Source code in griptape/drivers/image_generation/amazon_bedrock_image_generation_driver.py
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 | |
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
image_height = field(default=512, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
image_width = field(default=512, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
seed = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
session = field(default=Factory(lambda: import_optional_dependency('boto3').Session()), kw_only=True)
class-attribute
instance-attribute
_make_request(request)
Source code in griptape/drivers/image_generation/amazon_bedrock_image_generation_driver.py
client()
try_image_inpainting(prompts, image, mask, negative_prompts=None)
Source code in griptape/drivers/image_generation/amazon_bedrock_image_generation_driver.py
try_image_outpainting(prompts, image, mask, negative_prompts=None)
Source code in griptape/drivers/image_generation/amazon_bedrock_image_generation_driver.py
try_image_variation(prompts, image, negative_prompts=None)
Source code in griptape/drivers/image_generation/amazon_bedrock_image_generation_driver.py
try_text_to_image(prompts, negative_prompts=None)
Source code in griptape/drivers/image_generation/amazon_bedrock_image_generation_driver.py
AmazonBedrockPromptDriver
Bases: BasePromptDriver
Source code in griptape/drivers/prompt/amazon_bedrock_prompt_driver.py
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 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | |
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
additional_model_request_fields = field(default=Factory(dict), kw_only=True)
class-attribute
instance-attribute
session = field(default=Factory(lambda: import_optional_dependency('boto3').Session()), kw_only=True)
class-attribute
instance-attribute
structured_output_strategy = field(default='tool', kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
tokenizer = field(default=Factory(lambda self: AmazonBedrockTokenizer(model=self.model), takes_self=True), kw_only=True)
class-attribute
instance-attribute
tool_choice = field(default=Factory(lambda: {'auto': {}}), kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
use_native_tools = field(default=True, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
__to_bedrock_message_content(content)
Source code in griptape/drivers/prompt/amazon_bedrock_prompt_driver.py
__to_bedrock_messages(messages)
Source code in griptape/drivers/prompt/amazon_bedrock_prompt_driver.py
__to_bedrock_role(message)
__to_bedrock_tool_use_content(artifact)
Source code in griptape/drivers/prompt/amazon_bedrock_prompt_driver.py
__to_bedrock_tools(tools)
Source code in griptape/drivers/prompt/amazon_bedrock_prompt_driver.py
__to_prompt_stack_delta_message_content(event)
Source code in griptape/drivers/prompt/amazon_bedrock_prompt_driver.py
__to_prompt_stack_message_content(content)
Source code in griptape/drivers/prompt/amazon_bedrock_prompt_driver.py
_base_params(prompt_stack)
Source code in griptape/drivers/prompt/amazon_bedrock_prompt_driver.py
client()
try_run(prompt_stack)
Source code in griptape/drivers/prompt/amazon_bedrock_prompt_driver.py
try_stream(prompt_stack)
Source code in griptape/drivers/prompt/amazon_bedrock_prompt_driver.py
validate_structured_output_strategy(_, value)
Source code in griptape/drivers/prompt/amazon_bedrock_prompt_driver.py
AmazonBedrockRerankDriver
Bases: BaseRerankDriver
Amazon Bedrock Rerank Driver for executing cross-encoder text scoring calculations serverlessly.
Attributes:
| Name | Type | Description |
|---|---|---|
model |
str
|
The specific model identifier ARN (e.g., 'cohere.rerank-v3-5:0'). |
top_n |
int | None
|
Optional maximum threshold number of sorted results to return. |
session |
Session
|
An authenticated boto3.Session connection profile container. |
Source code in griptape/drivers/rerank/amazon_bedrock_rerank_driver.py
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
model = field(default='cohere.rerank-v3-5:0', metadata={'serializable': True})
class-attribute
instance-attribute
model_arn
property
session = field(default=Factory(lambda: import_optional_dependency('boto3').Session()))
class-attribute
instance-attribute
top_n = field(default=None, metadata={'serializable': True})
class-attribute
instance-attribute
_post_process(response, artifacts)
staticmethod
client()
run(query, artifacts)
Source code in griptape/drivers/rerank/amazon_bedrock_rerank_driver.py
AmazonBedrockTitanEmbeddingDriver
Bases: BaseEmbeddingDriver
Amazon Bedrock Titan Embedding Driver.
Attributes:
| Name | Type | Description |
|---|---|---|
model |
str
|
Embedding model name. Defaults to DEFAULT_MODEL. |
tokenizer |
BaseTokenizer
|
Optionally provide custom |
session |
Session
|
Optionally provide custom |
client |
BedrockRuntimeClient
|
Optionally provide custom |
Source code in griptape/drivers/embedding/amazon_bedrock_titan_embedding_driver.py
DEFAULT_MODEL = 'amazon.titan-embed-text-v1'
class-attribute
instance-attribute
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
model = field(default=DEFAULT_MODEL, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
session = field(default=Factory(lambda: import_optional_dependency('boto3').Session()), kw_only=True)
class-attribute
instance-attribute
tokenizer = field(default=Factory(lambda self: AmazonBedrockTokenizer(model=self.model), takes_self=True), kw_only=True)
class-attribute
instance-attribute
_invoke_model(payload)
Source code in griptape/drivers/embedding/amazon_bedrock_titan_embedding_driver.py
client()
try_embed_artifact(artifact, **kwargs)
Source code in griptape/drivers/embedding/amazon_bedrock_titan_embedding_driver.py
AmazonDynamoDbConversationMemoryDriver
Bases: BaseConversationMemoryDriver
Source code in griptape/drivers/memory/conversation/amazon_dynamodb_conversation_memory_driver.py
_table = field(default=None, kw_only=True, alias='table', metadata={'serializable': False})
class-attribute
instance-attribute
partition_key = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
partition_key_value = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
session = field(default=Factory(lambda: import_optional_dependency('boto3').Session()), kw_only=True)
class-attribute
instance-attribute
sort_key = field(default=None, metadata={'serializable': True})
class-attribute
instance-attribute
sort_key_value = field(default=None, metadata={'serializable': True})
class-attribute
instance-attribute
table_name = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
value_attribute_key = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
_get_key()
Source code in griptape/drivers/memory/conversation/amazon_dynamodb_conversation_memory_driver.py
load()
Source code in griptape/drivers/memory/conversation/amazon_dynamodb_conversation_memory_driver.py
store(runs, metadata)
Source code in griptape/drivers/memory/conversation/amazon_dynamodb_conversation_memory_driver.py
AmazonOpenSearchVectorStoreDriver
Bases: OpenSearchVectorStoreDriver
A Vector Store Driver for Amazon OpenSearch.
Attributes:
| Name | Type | Description |
|---|---|---|
session |
Session
|
The boto3 session to use. |
service |
str
|
Service name for AWS Signature v4. Values can be 'es' or 'aoss' for for OpenSearch Serverless. Defaults to 'es'. |
http_auth |
str | tuple[str, str]
|
The HTTP authentication credentials to use. Defaults to using credentials in the boto3 session. |
client |
OpenSearch
|
An optional OpenSearch client to use. Defaults to a new client using the host, port, http_auth, use_ssl, and verify_certs attributes. |
Source code in griptape/drivers/vector/amazon_opensearch_vector_store_driver.py
http_auth = field(default=Factory(lambda self: import_optional_dependency('opensearchpy').AWSV4SignerAuth(self.session.get_credentials(), self.session.region_name, self.service), takes_self=True))
class-attribute
instance-attribute
service = field(default='es', kw_only=True)
class-attribute
instance-attribute
session = field(default=Factory(lambda: import_optional_dependency('boto3').Session()), kw_only=True)
class-attribute
instance-attribute
upsert_vector(vector, *, vector_id=None, namespace=None, meta=None, **kwargs)
Inserts or updates a vector in OpenSearch.
If a vector with the given vector ID already exists, it is updated; otherwise, a new vector is inserted. Metadata associated with the vector can also be provided.
Source code in griptape/drivers/vector/amazon_opensearch_vector_store_driver.py
AmazonRedshiftSqlDriver
Bases: BaseSqlDriver
Source code in griptape/drivers/sql/amazon_redshift_sql_driver.py
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 | |
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
cluster_identifier = field(default=None, kw_only=True)
class-attribute
instance-attribute
database = field(kw_only=True)
class-attribute
instance-attribute
database_credentials_secret_arn = field(default=None, kw_only=True)
class-attribute
instance-attribute
db_user = field(default=None, kw_only=True)
class-attribute
instance-attribute
session = field(kw_only=True)
class-attribute
instance-attribute
wait_for_query_completion_sec = field(default=0.3, kw_only=True)
class-attribute
instance-attribute
workgroup_name = field(default=None, kw_only=True)
class-attribute
instance-attribute
_post_process(meta, records)
classmethod
Source code in griptape/drivers/sql/amazon_redshift_sql_driver.py
_process_cells_from_rows_and_columns(columns, rows)
classmethod
_process_columns_from_column_metadata(meta)
classmethod
_process_rows_from_records(records)
classmethod
client()
execute_query(query)
execute_query_raw(query)
Source code in griptape/drivers/sql/amazon_redshift_sql_driver.py
get_table_schema(table_name, schema=None)
Source code in griptape/drivers/sql/amazon_redshift_sql_driver.py
validate_params(_, workgroup_name)
Source code in griptape/drivers/sql/amazon_redshift_sql_driver.py
AmazonS3FileManagerDriver
Bases: BaseFileManagerDriver
AmazonS3FileManagerDriver can be used to list, load, and save files in an Amazon S3 bucket.
Attributes:
| Name | Type | Description |
|---|---|---|
session |
Session
|
The boto3 session to use for S3 operations. |
bucket |
str
|
The name of the S3 bucket. |
workdir |
str
|
The absolute working directory (must start with "/"). List, load, and save operations will be performed relative to this directory. |
client |
S3Client
|
The S3 client to use for S3 operations. |
Source code in griptape/drivers/file_manager/amazon_s3_file_manager_driver.py
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 | |
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
_workdir = field(default='/', kw_only=True, alias='workdir')
class-attribute
instance-attribute
bucket = field(kw_only=True)
class-attribute
instance-attribute
session = field(default=Factory(lambda: import_optional_dependency('boto3').Session()), kw_only=True)
class-attribute
instance-attribute
workdir
property
writable
_is_a_directory(full_key)
Source code in griptape/drivers/file_manager/amazon_s3_file_manager_driver.py
_list_files_and_dirs(full_key, **kwargs)
Source code in griptape/drivers/file_manager/amazon_s3_file_manager_driver.py
_normpath(path)
Source code in griptape/drivers/file_manager/amazon_s3_file_manager_driver.py
_to_dir_full_key(path)
Source code in griptape/drivers/file_manager/amazon_s3_file_manager_driver.py
_to_full_key(path)
Source code in griptape/drivers/file_manager/amazon_s3_file_manager_driver.py
client()
try_list_files(path)
Source code in griptape/drivers/file_manager/amazon_s3_file_manager_driver.py
try_load_file(path)
Source code in griptape/drivers/file_manager/amazon_s3_file_manager_driver.py
try_save_file(path, value)
Source code in griptape/drivers/file_manager/amazon_s3_file_manager_driver.py
AmazonSageMakerJumpstartEmbeddingDriver
Bases: BaseEmbeddingDriver
Source code in griptape/drivers/embedding/amazon_sagemaker_jumpstart_embedding_driver.py
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
custom_attributes = field(default='accept_eula=true', kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
endpoint = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
inference_component_name = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
session = field(default=Factory(lambda: import_optional_dependency('boto3').Session()), kw_only=True)
class-attribute
instance-attribute
client()
try_embed_chunk(chunk, **kwargs)
Source code in griptape/drivers/embedding/amazon_sagemaker_jumpstart_embedding_driver.py
AmazonSageMakerJumpstartPromptDriver
Bases: BasePromptDriver
Source code in griptape/drivers/prompt/amazon_sagemaker_jumpstart_prompt_driver.py
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 | |
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
custom_attributes = field(default='accept_eula=true', kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
endpoint = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
inference_component_name = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
max_tokens = field(default=250, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
session = field(default=Factory(lambda: import_optional_dependency('boto3').Session()), kw_only=True)
class-attribute
instance-attribute
stream = field(default=False, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
structured_output_strategy = field(default='rule', kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
tokenizer = field(default=Factory(lambda self: HuggingFaceTokenizer(model=self.model, max_output_tokens=self.max_tokens), takes_self=True), kw_only=True)
class-attribute
instance-attribute
__prompt_stack_to_tokens(prompt_stack)
Source code in griptape/drivers/prompt/amazon_sagemaker_jumpstart_prompt_driver.py
_base_params(prompt_stack)
Source code in griptape/drivers/prompt/amazon_sagemaker_jumpstart_prompt_driver.py
_prompt_stack_to_messages(prompt_stack)
Source code in griptape/drivers/prompt/amazon_sagemaker_jumpstart_prompt_driver.py
client()
prompt_stack_to_string(prompt_stack)
try_run(prompt_stack)
Source code in griptape/drivers/prompt/amazon_sagemaker_jumpstart_prompt_driver.py
try_stream(prompt_stack)
validate_stream(_, stream)
validate_structured_output_strategy(_, value)
Source code in griptape/drivers/prompt/amazon_sagemaker_jumpstart_prompt_driver.py
AmazonSqsEventListenerDriver
Bases: BaseEventListenerDriver
Source code in griptape/drivers/event_listener/amazon_sqs_event_listener_driver.py
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
queue_url = field(kw_only=True)
class-attribute
instance-attribute
session = field(default=Factory(lambda: import_optional_dependency('boto3').Session()), kw_only=True)
class-attribute
instance-attribute
client()
try_publish_event_payload(event_payload)
try_publish_event_payload_batch(event_payload_batch)
Source code in griptape/drivers/event_listener/amazon_sqs_event_listener_driver.py
AnthropicPromptDriver
Bases: BasePromptDriver
Anthropic Prompt Driver.
Attributes:
| Name | Type | Description |
|---|---|---|
api_key |
str | None
|
Anthropic API key. |
model |
str
|
Anthropic model name. |
client |
Client
|
Custom |
Source code in griptape/drivers/prompt/anthropic_prompt_driver.py
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 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | |
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
api_key = field(kw_only=True, default=None, metadata={'serializable': False})
class-attribute
instance-attribute
max_tokens = field(default=1000, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
model = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
structured_output_strategy = field(default='tool', kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
supports_temperature
property
supports_top_k
property
supports_top_p
property
tokenizer = field(default=Factory(lambda self: AnthropicTokenizer(model=self.model), takes_self=True), kw_only=True)
class-attribute
instance-attribute
tool_choice = field(default=Factory(lambda: {'type': 'auto'}), kw_only=True, metadata={'serializable': False})
class-attribute
instance-attribute
top_k = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
top_p = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
use_native_tools = field(default=True, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
__to_anthropic_content(message)
Source code in griptape/drivers/prompt/anthropic_prompt_driver.py
__to_anthropic_message_content(content)
Source code in griptape/drivers/prompt/anthropic_prompt_driver.py
__to_anthropic_messages(messages)
__to_anthropic_role(message)
__to_anthropic_tool_result_content(artifact)
Source code in griptape/drivers/prompt/anthropic_prompt_driver.py
__to_anthropic_tools(tools)
Source code in griptape/drivers/prompt/anthropic_prompt_driver.py
__to_prompt_stack_delta_message_content(event)
Source code in griptape/drivers/prompt/anthropic_prompt_driver.py
__to_prompt_stack_message_content(content)
Source code in griptape/drivers/prompt/anthropic_prompt_driver.py
_base_params(prompt_stack)
Source code in griptape/drivers/prompt/anthropic_prompt_driver.py
client()
try_run(prompt_stack)
Source code in griptape/drivers/prompt/anthropic_prompt_driver.py
try_stream(prompt_stack)
Source code in griptape/drivers/prompt/anthropic_prompt_driver.py
validate_structured_output_strategy(_, value)
Source code in griptape/drivers/prompt/anthropic_prompt_driver.py
AstraDbVectorStoreDriver
Bases: BaseVectorStoreDriver
A Vector Store Driver for Astra DB.
Attributes:
| Name | Type | Description |
|---|---|---|
embedding_driver |
BaseEmbeddingDriver
|
a |
api_endpoint |
str
|
the "API Endpoint" for the Astra DB instance. |
token |
str | TokenProvider | None
|
a Database Token ("AstraCS:...") secret to access Astra DB. An instance of |
collection_name |
str
|
the name of the collection on Astra DB. The collection must have been created beforehand, and support vectors with a vector dimension matching the embeddings being used by this driver. |
environment |
str | None
|
the environment ("prod", "hcd", ...) hosting the target Data API.
It can be omitted for production Astra DB targets. See |
astra_db_namespace |
str | None
|
optional specification of the namespace (in the Astra database) for the data. Note: not to be confused with the "namespace" mentioned elsewhere, which is a grouping within this vector store. |
caller_name |
str
|
the name of the caller for the Astra DB client. Defaults to "griptape". |
client |
DataAPIClient
|
an instance of |
collection |
Collection
|
an instance of |
Source code in griptape/drivers/vector/astradb_vector_store_driver.py
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 | |
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
_collection = field(default=None, kw_only=True, alias='collection', metadata={'serializable': False})
class-attribute
instance-attribute
api_endpoint = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
astra_db_namespace = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
caller_name = field(default='griptape', kw_only=True, metadata={'serializable': False})
class-attribute
instance-attribute
collection_name = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
environment = field(kw_only=True, default=None, metadata={'serializable': True})
class-attribute
instance-attribute
token = field(kw_only=True, default=None, metadata={'serializable': False})
class-attribute
instance-attribute
client()
Source code in griptape/drivers/vector/astradb_vector_store_driver.py
collection()
Source code in griptape/drivers/vector/astradb_vector_store_driver.py
delete_vector(vector_id)
Delete a vector from Astra DB store.
The method succeeds regardless of whether a vector with the provided ID was actually stored or not in the first place.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vector_id
|
str
|
ID of the vector to delete. |
required |
Source code in griptape/drivers/vector/astradb_vector_store_driver.py
load_entries(*, namespace=None)
Load entries from the Astra DB store.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
namespace
|
str | None
|
a namespace, within the vector store, to constrain the search. |
None
|
Returns:
| Type | Description |
|---|---|
list[Entry]
|
A list of vector ( |
Source code in griptape/drivers/vector/astradb_vector_store_driver.py
load_entry(vector_id, *, namespace=None)
Load a single vector entry from the Astra DB store given its ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vector_id
|
str
|
the ID of the required vector. |
required |
namespace
|
str | None
|
a namespace, within the vector store, to constrain the search. |
None
|
Returns:
| Type | Description |
|---|---|
Entry | None
|
The vector entry (a |
Source code in griptape/drivers/vector/astradb_vector_store_driver.py
query_vector(vector, *, count=None, namespace=None, include_vectors=False, **kwargs)
Run a similarity search on the Astra DB store, based on a vector list.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vector
|
list[float]
|
the vector to be queried. |
required |
count
|
int | None
|
the maximum number of results to return. If omitted, defaults will apply. |
None
|
namespace
|
str | None
|
the namespace to filter results by. |
None
|
include_vectors
|
bool
|
whether to include vector data in the results. |
False
|
kwargs
|
Any
|
additional keyword arguments. Currently only the free-form dict |
{}
|
Returns:
| Type | Description |
|---|---|
list[Entry]
|
A list of vector ( |
list[Entry]
|
with their |
Source code in griptape/drivers/vector/astradb_vector_store_driver.py
upsert_vector(vector, *, vector_id=None, namespace=None, meta=None, **kwargs)
Write a vector to the Astra DB store.
In case the provided ID exists already, an overwrite will take place.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vector
|
list[float]
|
the vector to be upserted. |
required |
vector_id
|
str | None
|
the ID for the vector to store. If omitted, a server-provided new ID will be employed. |
None
|
namespace
|
str | None
|
a namespace (a grouping within the vector store) to assign the vector to. |
None
|
meta
|
dict | None
|
a metadata dictionary associated to the vector. |
None
|
kwargs
|
Any
|
additional keyword arguments. Currently none is used: if they are passed, they will be ignored with a warning. |
{}
|
Returns:
| Type | Description |
|---|---|
str
|
the ID of the written vector (str). |
Source code in griptape/drivers/vector/astradb_vector_store_driver.py
AwsIotCoreEventListenerDriver
Bases: BaseEventListenerDriver
Source code in griptape/drivers/event_listener/aws_iot_core_event_listener_driver.py
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
iot_endpoint = field(kw_only=True)
class-attribute
instance-attribute
session = field(default=Factory(lambda: import_optional_dependency('boto3').Session()), kw_only=True)
class-attribute
instance-attribute
topic = field(kw_only=True)
class-attribute
instance-attribute
client()
try_publish_event_payload(event_payload)
try_publish_event_payload_batch(event_payload_batch)
AzureMongoDbVectorStoreDriver
Bases: MongoDbAtlasVectorStoreDriver
A Vector Store Driver for CosmosDB with MongoDB vCore API.
Source code in griptape/drivers/vector/azure_mongodb_vector_store_driver.py
query_vector(vector, *, count=None, namespace=None, include_vectors=False, offset=None, **kwargs)
Queries the MongoDB collection for documents that match the provided vector list.
Results can be customized based on parameters like count, namespace, inclusion of vectors, offset, and index.
Source code in griptape/drivers/vector/azure_mongodb_vector_store_driver.py
AzureOpenAiChatPromptDriver
Bases: OpenAiChatPromptDriver
Azure OpenAi Chat Prompt Driver.
Attributes:
| Name | Type | Description |
|---|---|---|
azure_deployment |
str
|
An optional Azure OpenAi deployment id. Defaults to the model name. |
azure_endpoint |
str
|
An Azure OpenAi endpoint. |
azure_ad_token |
str | None
|
An optional Azure Active Directory token. |
azure_ad_token_provider |
Callable[[], str] | None
|
An optional Azure Active Directory token provider. |
api_version |
str
|
An Azure OpenAi API version. |
client |
AzureOpenAI
|
An |
Source code in griptape/drivers/prompt/azure_openai_chat_prompt_driver.py
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
api_version = field(default='2024-10-21', kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
azure_ad_token = field(kw_only=True, default=None, metadata={'serializable': False})
class-attribute
instance-attribute
azure_ad_token_provider = field(kw_only=True, default=None, metadata={'serializable': False})
class-attribute
instance-attribute
azure_deployment = field(kw_only=True, default=Factory(lambda self: self.model, takes_self=True), metadata={'serializable': True})
class-attribute
instance-attribute
azure_endpoint = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
_base_params(prompt_stack)
Source code in griptape/drivers/prompt/azure_openai_chat_prompt_driver.py
client()
Source code in griptape/drivers/prompt/azure_openai_chat_prompt_driver.py
AzureOpenAiEmbeddingDriver
Bases: OpenAiEmbeddingDriver
Azure OpenAi Embedding Driver.
Attributes:
| Name | Type | Description |
|---|---|---|
azure_deployment |
str
|
An optional Azure OpenAi deployment id. Defaults to the model name. |
azure_endpoint |
str
|
An Azure OpenAi endpoint. |
azure_ad_token |
str | None
|
An optional Azure Active Directory token. |
azure_ad_token_provider |
Callable[[], str] | None
|
An optional Azure Active Directory token provider. |
api_version |
str
|
An Azure OpenAi API version. |
tokenizer |
OpenAiTokenizer
|
An |
client |
AzureOpenAI
|
An |
Source code in griptape/drivers/embedding/azure_openai_embedding_driver.py
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
api_version = field(default='2024-10-21', kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
azure_ad_token = field(kw_only=True, default=None, metadata={'serializable': False})
class-attribute
instance-attribute
azure_ad_token_provider = field(kw_only=True, default=None, metadata={'serializable': False})
class-attribute
instance-attribute
azure_deployment = field(kw_only=True, default=Factory(lambda self: self.model, takes_self=True), metadata={'serializable': True})
class-attribute
instance-attribute
azure_endpoint = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
tokenizer = field(default=Factory(lambda self: OpenAiTokenizer(model=self.model), takes_self=True), kw_only=True)
class-attribute
instance-attribute
client()
Source code in griptape/drivers/embedding/azure_openai_embedding_driver.py
AzureOpenAiImageGenerationDriver
Bases: OpenAiImageGenerationDriver
Driver for Azure-hosted OpenAI image generation API.
Attributes:
| Name | Type | Description |
|---|---|---|
azure_deployment |
str
|
An optional Azure OpenAi deployment id. Defaults to the model name. |
azure_endpoint |
str
|
An Azure OpenAi endpoint. |
azure_ad_token |
str | None
|
An optional Azure Active Directory token. |
azure_ad_token_provider |
Callable[[], str] | None
|
An optional Azure Active Directory token provider. |
api_version |
str
|
An Azure OpenAi API version. |
client |
AzureOpenAI
|
An |
Source code in griptape/drivers/image_generation/azure_openai_image_generation_driver.py
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
api_version = field(default='2024-02-01', kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
azure_ad_token = field(kw_only=True, default=None, metadata={'serializable': False})
class-attribute
instance-attribute
azure_ad_token_provider = field(kw_only=True, default=None, metadata={'serializable': False})
class-attribute
instance-attribute
azure_deployment = field(kw_only=True, default=Factory(lambda self: self.model, takes_self=True), metadata={'serializable': True})
class-attribute
instance-attribute
azure_endpoint = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
client()
Source code in griptape/drivers/image_generation/azure_openai_image_generation_driver.py
AzureOpenAiTextToSpeechDriver
Bases: OpenAiTextToSpeechDriver
Azure OpenAi Text to Speech Driver.
Attributes:
| Name | Type | Description |
|---|---|---|
azure_deployment |
str
|
An optional Azure OpenAi deployment id. Defaults to the model name. |
azure_endpoint |
str
|
An Azure OpenAi endpoint. |
azure_ad_token |
str | None
|
An optional Azure Active Directory token. |
azure_ad_token_provider |
Callable[[], str] | None
|
An optional Azure Active Directory token provider. |
api_version |
str
|
An Azure OpenAi API version. |
client |
AzureOpenAI
|
An |
Source code in griptape/drivers/text_to_speech/azure_openai_text_to_speech_driver.py
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
api_version = field(default='2024-07-01-preview', kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
azure_ad_token = field(kw_only=True, default=None, metadata={'serializable': False})
class-attribute
instance-attribute
azure_ad_token_provider = field(kw_only=True, default=None, metadata={'serializable': False})
class-attribute
instance-attribute
azure_deployment = field(kw_only=True, default=Factory(lambda self: self.model, takes_self=True), metadata={'serializable': True})
class-attribute
instance-attribute
azure_endpoint = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
model = field(default='tts', kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
client()
Source code in griptape/drivers/text_to_speech/azure_openai_text_to_speech_driver.py
BaseAssistantDriver
Bases: ABC
Base class for AssistantDrivers.
Source code in griptape/drivers/assistant/base_assistant_driver.py
run(*args)
BaseAudioTranscriptionDriver
Bases: SerializableMixin, ExponentialBackoffMixin, ABC
Source code in griptape/drivers/audio_transcription/base_audio_transcription_driver.py
model = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
after_run()
before_run()
run(audio, prompts=None)
Source code in griptape/drivers/audio_transcription/base_audio_transcription_driver.py
BaseConversationMemoryDriver
Bases: SerializableMixin, ABC
Source code in griptape/drivers/memory/conversation/base_conversation_memory_driver.py
_from_params_dict(params_dict)
Source code in griptape/drivers/memory/conversation/base_conversation_memory_driver.py
_to_params_dict(runs, metadata)
load()
abstractmethod
BaseDiffusionImageGenerationPipelineDriver
Bases: ABC
Source code in griptape/drivers/image_generation_pipeline/base_image_generation_pipeline_driver.py
output_image_dimensions
abstractmethod
property
make_additional_params(negative_prompts, device)
abstractmethod
make_image_param(image)
abstractmethod
BaseEmbeddingDriver
Bases: SerializableMixin, ExponentialBackoffMixin, ABC
Base Embedding Driver.
Attributes:
| Name | Type | Description |
|---|---|---|
model |
str
|
The name of the model to use. |
tokenizer |
BaseTokenizer | None
|
An instance of |
Source code in griptape/drivers/embedding/base_embedding_driver.py
chunker = field(init=False)
class-attribute
instance-attribute
model = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
tokenizer = field(default=None, kw_only=True)
class-attribute
instance-attribute
__attrs_post_init__()
_embed_long_string(string, *, vector_operation=None)
Embeds a string that is too long to embed in one go.
Adapted from: https://github.com/openai/openai-cookbook/blob/683e5f5a71bc7a1b0e5b7a35e087f53cc55fceea/examples/Embedding_long_inputs.ipynb
Source code in griptape/drivers/embedding/base_embedding_driver.py
embed(value, *, vector_operation=None)
Source code in griptape/drivers/embedding/base_embedding_driver.py
embed_string(string, *, vector_operation=None)
Source code in griptape/drivers/embedding/base_embedding_driver.py
embed_text_artifact(artifact, *, vector_operation=None)
Source code in griptape/drivers/embedding/base_embedding_driver.py
try_embed_artifact(artifact, *, vector_operation=None)
Source code in griptape/drivers/embedding/base_embedding_driver.py
try_embed_chunk(chunk, *, vector_operation=None)
abstractmethod
BaseEventListenerDriver
Bases: FuturesExecutorMixin, ExponentialBackoffMixin, ABC
Source code in griptape/drivers/event_listener/base_event_listener_driver.py
_batch = field(default=Factory(list), kw_only=True)
class-attribute
instance-attribute
batch
property
batch_size = field(default=10, kw_only=True)
class-attribute
instance-attribute
batched = field(default=True, kw_only=True)
class-attribute
instance-attribute
_safe_publish_event_payload(event_payload)
Source code in griptape/drivers/event_listener/base_event_listener_driver.py
_safe_publish_event_payload_batch(event_payload_batch)
Source code in griptape/drivers/event_listener/base_event_listener_driver.py
flush_events()
Source code in griptape/drivers/event_listener/base_event_listener_driver.py
publish_event(event)
Source code in griptape/drivers/event_listener/base_event_listener_driver.py
try_publish_event_payload(event_payload)
abstractmethod
BaseFileManagerDriver
Bases: ABC
BaseFileManagerDriver can be used to list, load, and save files.
Attributes:
| Name | Type | Description |
|---|---|---|
default_loader |
The default loader to use for loading file contents into artifacts. |
|
loaders |
Dictionary of file extension specific loaders to use for loading file contents into artifacts. |
Source code in griptape/drivers/file_manager/base_file_manager_driver.py
_workdir = field(kw_only=True, alias='workdir')
class-attribute
instance-attribute
encoding = field(default=None, kw_only=True)
class-attribute
instance-attribute
workdir
abstractmethod
property
writable
list_files(path)
load_artifact(path)
load_file(path)
Source code in griptape/drivers/file_manager/base_file_manager_driver.py
save_artifact(path, artifact)
Source code in griptape/drivers/file_manager/base_file_manager_driver.py
save_file(path, value)
Source code in griptape/drivers/file_manager/base_file_manager_driver.py
try_list_files(path)
abstractmethod
try_load_file(path)
abstractmethod
BaseImageGenerationDriver
Bases: SerializableMixin, ExponentialBackoffMixin, ABC
Source code in griptape/drivers/image_generation/base_image_generation_driver.py
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 | |
model = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
after_run()
before_run(prompts, negative_prompts=None)
run_image_inpainting(prompts, image, mask, negative_prompts=None)
Source code in griptape/drivers/image_generation/base_image_generation_driver.py
run_image_outpainting(prompts, image, mask, negative_prompts=None)
Source code in griptape/drivers/image_generation/base_image_generation_driver.py
run_image_variation(prompts, image, negative_prompts=None)
Source code in griptape/drivers/image_generation/base_image_generation_driver.py
run_text_to_image(prompts, negative_prompts=None)
Source code in griptape/drivers/image_generation/base_image_generation_driver.py
try_image_inpainting(prompts, image, mask, negative_prompts=None)
abstractmethod
try_image_outpainting(prompts, image, mask, negative_prompts=None)
abstractmethod
try_image_variation(prompts, image, negative_prompts=None)
abstractmethod
BaseImageGenerationModelDriver
Bases: SerializableMixin, ABC
Source code in griptape/drivers/image_generation_model/base_image_generation_model_driver.py
get_generated_image(response)
abstractmethod
image_inpainting_request_parameters(prompts, image, mask, negative_prompts=None, seed=None)
abstractmethod
Source code in griptape/drivers/image_generation_model/base_image_generation_model_driver.py
image_outpainting_request_parameters(prompts, image, mask, negative_prompts=None, seed=None)
abstractmethod
Source code in griptape/drivers/image_generation_model/base_image_generation_model_driver.py
image_variation_request_parameters(prompts, image, negative_prompts=None, seed=None)
abstractmethod
Source code in griptape/drivers/image_generation_model/base_image_generation_model_driver.py
text_to_image_request_parameters(prompts, image_width, image_height, negative_prompts=None, seed=None)
abstractmethod
Source code in griptape/drivers/image_generation_model/base_image_generation_model_driver.py
BaseMultiModelImageGenerationDriver
Bases: BaseImageGenerationDriver, ABC
Image Generation Driver for platforms like Amazon Bedrock that host many LLM models.
Instances of this Image Generation Driver require a Image Generation Model Driver which is used to structure the image generation request in the format required by the model and to process the output.
Attributes:
| Name | Type | Description |
|---|---|---|
image_generation_model_driver |
BaseImageGenerationModelDriver
|
Image Model Driver to use. |
Source code in griptape/drivers/image_generation/base_multi_model_image_generation_driver.py
image_generation_model_driver = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
BaseObservabilityDriver
Bases: ABC
Source code in griptape/drivers/observability/base_observability_driver.py
__enter__()
__exit__(exc_type, exc_value, exc_traceback)
get_span_id()
abstractmethod
BasePromptDriver
Bases: SerializableMixin, ExponentialBackoffMixin, ABC
Base class for the Prompt Drivers.
Attributes:
| Name | Type | Description |
|---|---|---|
temperature |
float
|
The temperature to use for the completion. |
max_tokens |
int | None
|
The maximum number of tokens to generate. If not specified, the value will be automatically generated based by the tokenizer. |
prompt_stack_to_string |
str
|
A function that converts a |
ignored_exception_types |
tuple[type[Exception], ...]
|
A tuple of exception types to ignore. |
model |
str
|
The model name. |
tokenizer |
BaseTokenizer
|
An instance of |
stream |
bool
|
Whether to stream the completion or not. |
use_native_tools |
bool
|
Whether to use LLM's native function calling capabilities. Must be supported by the model. |
extra_params |
dict
|
Extra parameters to pass to the model. |
Source code in griptape/drivers/prompt/base_prompt_driver.py
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 | |
extra_params = field(factory=dict, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
ignored_exception_types = field(default=Factory(lambda: (ImportError, ValueError)))
class-attribute
instance-attribute
max_tokens = field(default=None, metadata={'serializable': True})
class-attribute
instance-attribute
model = field(metadata={'serializable': True})
class-attribute
instance-attribute
stream = field(default=False, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
structured_output_strategy = field(default='rule', kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
temperature = field(default=0.1, metadata={'serializable': True})
class-attribute
instance-attribute
tokenizer
instance-attribute
use_native_tools = field(default=False, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
__build_message(delta_contents, usage)
Source code in griptape/drivers/prompt/base_prompt_driver.py
__process_run(prompt_stack)
__process_stream(prompt_stack)
Source code in griptape/drivers/prompt/base_prompt_driver.py
_init_structured_output(prompt_stack)
Source code in griptape/drivers/prompt/base_prompt_driver.py
after_run(result)
Source code in griptape/drivers/prompt/base_prompt_driver.py
before_run(prompt_stack)
prompt_stack_to_string(prompt_stack)
Converts a Prompt Stack to a string for token counting or model prompt_input.
This base implementation is only a rough approximation, and should be overridden by subclasses with model-specific tokens.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prompt_stack
|
PromptStack
|
The Prompt Stack to convert to a string. |
required |
Returns:
| Type | Description |
|---|---|
str
|
A single string representation of the Prompt Stack. |
Source code in griptape/drivers/prompt/base_prompt_driver.py
run(prompt_input)
Source code in griptape/drivers/prompt/base_prompt_driver.py
try_run(prompt_stack)
abstractmethod
BaseRerankDriver
Bases: ABC
Source code in griptape/drivers/rerank/base_rerank_driver.py
BaseRulesetDriver
Bases: SerializableMixin, ABC
Base class for ruleset drivers.
Attributes:
| Name | Type | Description |
|---|---|---|
raise_not_found |
bool
|
Whether to raise an error if the ruleset is not found. Defaults to True. |
Source code in griptape/drivers/ruleset/base_ruleset_driver.py
raise_not_found = field(default=True, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
_from_ruleset_dict(params_dict)
Source code in griptape/drivers/ruleset/base_ruleset_driver.py
_get_rule(value, meta)
Source code in griptape/drivers/ruleset/base_ruleset_driver.py
BaseSqlDriver
Bases: ABC
Source code in griptape/drivers/sql/base_sql_driver.py
RowResult
dataclass
execute_query(query)
abstractmethod
execute_query_raw(query)
abstractmethod
BaseStructureRunDriver
Bases: ABC
Base class for Structure Run Drivers.
Attributes:
| Name | Type | Description |
|---|---|---|
env |
dict[str, str]
|
Environment variables to set before running the Structure. |
Source code in griptape/drivers/structure_run/base_structure_run_driver.py
env = field(default=Factory(dict), kw_only=True)
class-attribute
instance-attribute
run(*args)
BaseTextToSpeechDriver
Bases: SerializableMixin, ExponentialBackoffMixin, ABC
Source code in griptape/drivers/text_to_speech/base_text_to_speech_driver.py
model = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
after_run()
before_run(prompts)
run_text_to_audio(prompts)
Source code in griptape/drivers/text_to_speech/base_text_to_speech_driver.py
BaseVectorStoreDriver
Bases: SerializableMixin, FuturesExecutorMixin, ABC
Source code in griptape/drivers/vector/base_vector_store_driver.py
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 225 226 | |
DEFAULT_QUERY_COUNT = 5
class-attribute
instance-attribute
embedding_driver = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
Entry
Bases: SerializableMixin
Source code in griptape/drivers/vector/base_vector_store_driver.py
id = field(metadata={'serializable': True})
class-attribute
instance-attribute
meta = field(default=None, metadata={'serializable': True})
class-attribute
instance-attribute
namespace = field(default=None, metadata={'serializable': True})
class-attribute
instance-attribute
score = field(default=None, metadata={'serializable': True})
class-attribute
instance-attribute
vector = field(default=None, metadata={'serializable': True})
class-attribute
instance-attribute
_get_default_vector_id(value)
delete_vector(vector_id)
abstractmethod
does_entry_exist(vector_id, *, namespace=None)
load_artifacts(*, namespace=None)
Source code in griptape/drivers/vector/base_vector_store_driver.py
load_entries(*, namespace=None)
abstractmethod
load_entry(vector_id, *, namespace=None)
abstractmethod
query(query, *, count=None, namespace=None, include_vectors=False, **kwargs)
Source code in griptape/drivers/vector/base_vector_store_driver.py
query_vector(vector, *, count=None, namespace=None, include_vectors=False, **kwargs)
Source code in griptape/drivers/vector/base_vector_store_driver.py
upsert(value, *, namespace=None, meta=None, vector_id=None, **kwargs)
Source code in griptape/drivers/vector/base_vector_store_driver.py
upsert_collection(artifacts, *, meta=None, **kwargs)
Source code in griptape/drivers/vector/base_vector_store_driver.py
upsert_text(string, *, namespace=None, meta=None, vector_id=None, **kwargs)
Source code in griptape/drivers/vector/base_vector_store_driver.py
upsert_text_artifact(artifact, *, namespace=None, meta=None, vector_id=None, **kwargs)
Source code in griptape/drivers/vector/base_vector_store_driver.py
upsert_text_artifacts(artifacts, *, meta=None, **kwargs)
Source code in griptape/drivers/vector/base_vector_store_driver.py
upsert_vector(vector, *, vector_id=None, namespace=None, meta=None, **kwargs)
abstractmethod
BaseWebScraperDriver
Bases: ABC
Source code in griptape/drivers/web_scraper/base_web_scraper_driver.py
extract_page(page)
abstractmethod
fetch_url(url)
abstractmethod
BaseWebSearchDriver
Bases: ABC
Source code in griptape/drivers/web_search/base_web_search_driver.py
BedrockStableDiffusionImageGenerationModelDriver
Bases: BaseImageGenerationModelDriver
Image generation model driver for Stable Diffusion models on Amazon Bedrock.
For more information on all supported parameters, see the Stable Diffusion documentation: https://platform.stability.ai/docs/api-reference#tag/v1generation
Attributes:
| Name | Type | Description |
|---|---|---|
cfg_scale |
int
|
Specifies how strictly image generation follows the provided prompt. Defaults to 7. |
mask_source |
int
|
Specifies mask image configuration for image-to-image generations. Defaults to "MASK_IMAGE_BLACK". |
style_preset |
str | None
|
If provided, specifies a specific image generation style preset. |
clip_guidance_preset |
str | None
|
If provided, requests a specific clip guidance preset to be used in the diffusion process. |
sampler |
str | None
|
If provided, requests a specific sampler to be used in the diffusion process. |
steps |
int | None
|
If provided, specifies the number of diffusion steps to use in the image generation. |
start_schedule |
float | None
|
If provided, specifies the start_schedule parameter used to determine the influence of the input image in image-to-image generation. |
Source code in griptape/drivers/image_generation_model/bedrock_stable_diffusion_image_generation_model_driver.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 | |
cfg_scale = field(default=7, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
clip_guidance_preset = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
sampler = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
start_schedule = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
steps = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
style_preset = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
_request_parameters(prompts, width=None, height=None, image=None, mask=None, negative_prompts=None, seed=None, mask_source=None)
Source code in griptape/drivers/image_generation_model/bedrock_stable_diffusion_image_generation_model_driver.py
get_generated_image(response)
Source code in griptape/drivers/image_generation_model/bedrock_stable_diffusion_image_generation_model_driver.py
image_inpainting_request_parameters(prompts, image, mask, negative_prompts=None, seed=None)
Source code in griptape/drivers/image_generation_model/bedrock_stable_diffusion_image_generation_model_driver.py
image_outpainting_request_parameters(prompts, image, mask, negative_prompts=None, seed=None)
Source code in griptape/drivers/image_generation_model/bedrock_stable_diffusion_image_generation_model_driver.py
image_variation_request_parameters(prompts, image, negative_prompts=None, seed=None)
Source code in griptape/drivers/image_generation_model/bedrock_stable_diffusion_image_generation_model_driver.py
text_to_image_request_parameters(prompts, image_width, image_height, negative_prompts=None, seed=None)
Source code in griptape/drivers/image_generation_model/bedrock_stable_diffusion_image_generation_model_driver.py
BedrockTitanImageGenerationModelDriver
Bases: BaseImageGenerationModelDriver
Image Generation Model Driver for Amazon Bedrock Titan Image Generator.
Attributes:
| Name | Type | Description |
|---|---|---|
quality |
str
|
The quality of the generated image, defaults to standard. |
cfg_scale |
int
|
Specifies how strictly image generation follows the provided prompt. Defaults to 7, (1.0 to 10.0]. |
outpainting_mode |
str
|
Specifies the outpainting mode, defaults to PRECISE. |
Source code in griptape/drivers/image_generation_model/bedrock_titan_image_generation_model_driver.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 | |
cfg_scale = field(default=7, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
outpainting_mode = field(default='PRECISE', kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
quality = field(default='standard', kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
_add_common_params(request, width, height, seed=None)
Source code in griptape/drivers/image_generation_model/bedrock_titan_image_generation_model_driver.py
get_generated_image(response)
image_inpainting_request_parameters(prompts, image, mask, negative_prompts=None, seed=None)
Source code in griptape/drivers/image_generation_model/bedrock_titan_image_generation_model_driver.py
image_outpainting_request_parameters(prompts, image, mask, negative_prompts=None, seed=None)
Source code in griptape/drivers/image_generation_model/bedrock_titan_image_generation_model_driver.py
image_variation_request_parameters(prompts, image, negative_prompts=None, seed=None)
Source code in griptape/drivers/image_generation_model/bedrock_titan_image_generation_model_driver.py
text_to_image_request_parameters(prompts, image_width, image_height, negative_prompts=None, seed=None)
Source code in griptape/drivers/image_generation_model/bedrock_titan_image_generation_model_driver.py
CohereEmbeddingDriver
Bases: BaseEmbeddingDriver
Cohere Embedding Driver.
Attributes:
| Name | Type | Description |
|---|---|---|
api_key |
str
|
Cohere API key. |
model |
str
|
Cohere model name. |
client |
Client
|
Custom |
tokenizer |
CohereTokenizer
|
Custom |
input_type |
str
|
Cohere embedding input type. |
Source code in griptape/drivers/embedding/cohere_embedding_driver.py
DEFAULT_MODEL = 'models/embedding-001'
class-attribute
instance-attribute
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
api_key = field(kw_only=True, metadata={'serializable': False})
class-attribute
instance-attribute
input_type = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
tokenizer = field(default=Factory(lambda self: CohereTokenizer(model=self.model, client=self.client), takes_self=True), kw_only=True)
class-attribute
instance-attribute
client()
try_embed_chunk(chunk, **kwargs)
Source code in griptape/drivers/embedding/cohere_embedding_driver.py
CoherePromptDriver
Bases: BasePromptDriver
Cohere Prompt Driver.
Attributes:
| Name | Type | Description |
|---|---|---|
api_key |
str
|
Cohere API key. |
model |
str
|
Cohere model name. |
client |
ClientV2
|
Custom |
Source code in griptape/drivers/prompt/cohere_prompt_driver.py
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 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | |
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
api_key = field(default=None, metadata={'serializable': False})
class-attribute
instance-attribute
force_single_step = field(default=False, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
model = field(metadata={'serializable': True})
class-attribute
instance-attribute
tokenizer = field(default=Factory(lambda self: CohereTokenizer(model=self.model, client=self.client), takes_self=True))
class-attribute
instance-attribute
use_native_tools = field(default=True, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
__to_cohere_message_content(content)
Source code in griptape/drivers/prompt/cohere_prompt_driver.py
__to_cohere_messages(messages)
Source code in griptape/drivers/prompt/cohere_prompt_driver.py
__to_cohere_role(message, message_content=None)
Source code in griptape/drivers/prompt/cohere_prompt_driver.py
__to_cohere_tools(tools)
Source code in griptape/drivers/prompt/cohere_prompt_driver.py
__to_prompt_stack_delta_message_content(event)
Source code in griptape/drivers/prompt/cohere_prompt_driver.py
__to_prompt_stack_message_content(response)
Source code in griptape/drivers/prompt/cohere_prompt_driver.py
_base_params(prompt_stack)
Source code in griptape/drivers/prompt/cohere_prompt_driver.py
client()
try_run(prompt_stack)
Source code in griptape/drivers/prompt/cohere_prompt_driver.py
try_stream(prompt_stack)
Source code in griptape/drivers/prompt/cohere_prompt_driver.py
CohereRerankDriver
Bases: BaseRerankDriver
Source code in griptape/drivers/rerank/cohere_rerank_driver.py
api_key = field(metadata={'serializable': True})
class-attribute
instance-attribute
client = field(default=Factory(lambda self: import_optional_dependency('cohere').Client(self.api_key), takes_self=True))
class-attribute
instance-attribute
model = field(default='rerank-english-v3.0', metadata={'serializable': True})
class-attribute
instance-attribute
top_n = field(default=None)
class-attribute
instance-attribute
run(query, artifacts)
Source code in griptape/drivers/rerank/cohere_rerank_driver.py
DatadogObservabilityDriver
Bases: OpenTelemetryObservabilityDriver
Source code in griptape/drivers/observability/datadog_observability_driver.py
datadog_agent_endpoint = field(default=Factory(lambda: os.getenv('DD_AGENT_ENDPOINT', 'http://localhost:4318')), kw_only=True)
class-attribute
instance-attribute
span_processor = field(default=Factory(lambda self: import_optional_dependency('opentelemetry.sdk.trace.export').BatchSpanProcessor(import_optional_dependency('opentelemetry.exporter.otlp.proto.http.trace_exporter').OTLPSpanExporter(endpoint=f'{self.datadog_agent_endpoint}/v1/traces')), takes_self=True), kw_only=True)
class-attribute
instance-attribute
DuckDuckGoWebSearchDriver
Bases: BaseWebSearchDriver
Source code in griptape/drivers/web_search/duck_duck_go_web_search_driver.py
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
country = field(default='us', kw_only=True)
class-attribute
instance-attribute
language = field(default='en', kw_only=True)
class-attribute
instance-attribute
client()
search(query, **kwargs)
Source code in griptape/drivers/web_search/duck_duck_go_web_search_driver.py
DummyAudioTranscriptionDriver
Bases: BaseAudioTranscriptionDriver
Source code in griptape/drivers/audio_transcription/dummy_audio_transcription_driver.py
model = field(init=False)
class-attribute
instance-attribute
DummyEmbeddingDriver
Bases: BaseEmbeddingDriver
Source code in griptape/drivers/embedding/dummy_embedding_driver.py
model = field(init=False, default=None, kw_only=True)
class-attribute
instance-attribute
DummyImageGenerationDriver
Bases: BaseImageGenerationDriver
Source code in griptape/drivers/image_generation/dummy_image_generation_driver.py
model = field(init=False, default=None, kw_only=True)
class-attribute
instance-attribute
try_image_inpainting(prompts, image, mask, negative_prompts=None)
Source code in griptape/drivers/image_generation/dummy_image_generation_driver.py
try_image_outpainting(prompts, image, mask, negative_prompts=None)
Source code in griptape/drivers/image_generation/dummy_image_generation_driver.py
try_image_variation(prompts, image, negative_prompts=None)
try_text_to_image(prompts, negative_prompts=None)
DummyPromptDriver
Bases: BasePromptDriver
Source code in griptape/drivers/prompt/dummy_prompt_driver.py
model = field(init=False, default=None, kw_only=True)
class-attribute
instance-attribute
tokenizer = field(default=Factory(DummyTokenizer), kw_only=True)
class-attribute
instance-attribute
try_run(prompt_stack)
DummyTextToSpeechDriver
Bases: BaseTextToSpeechDriver
Source code in griptape/drivers/text_to_speech/dummy_text_to_speech_driver.py
model = field(init=False, default=None, kw_only=True)
class-attribute
instance-attribute
DummyVectorStoreDriver
Bases: BaseVectorStoreDriver
Source code in griptape/drivers/vector/dummy_vector_store_driver.py
embedding_driver = field(kw_only=True, default=Factory(DummyEmbeddingDriver), metadata={'serializable': True})
class-attribute
instance-attribute
delete_vector(vector_id)
load_entries(*, namespace=None)
load_entry(vector_id, *, namespace=None)
query(query, *, count=None, namespace=None, include_vectors=False, **kwargs)
Source code in griptape/drivers/vector/dummy_vector_store_driver.py
query_vector(vector, *, count=None, namespace=None, include_vectors=False, **kwargs)
Source code in griptape/drivers/vector/dummy_vector_store_driver.py
upsert_vector(vector, vector_id=None, namespace=None, meta=None, **kwargs)
ElevenLabsTextToSpeechDriver
Bases: BaseTextToSpeechDriver
Source code in griptape/drivers/text_to_speech/elevenlabs_text_to_speech_driver.py
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
api_key = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
output_format = field(default='mp3_44100_128', kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
voice = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
client()
try_text_to_audio(prompts)
Source code in griptape/drivers/text_to_speech/elevenlabs_text_to_speech_driver.py
ExaWebSearchDriver
Bases: BaseWebSearchDriver
Source code in griptape/drivers/web_search/exa_web_search_driver.py
_client = field(default=None, kw_only=True, alias='client')
class-attribute
instance-attribute
api_key = field(kw_only=True, default=None)
class-attribute
instance-attribute
highlights = field(default=False, kw_only=True)
class-attribute
instance-attribute
params = field(factory=dict, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
use_autoprompt = field(default=False, kw_only=True)
class-attribute
instance-attribute
__attrs_post_init__()
Source code in griptape/drivers/web_search/exa_web_search_driver.py
client()
search(query, **kwargs)
Source code in griptape/drivers/web_search/exa_web_search_driver.py
GoogleEmbeddingDriver
Bases: BaseEmbeddingDriver
Google Embedding Driver.
Attributes:
| Name | Type | Description |
|---|---|---|
api_key |
str | None
|
Google API key. |
model |
str
|
Google model name. |
client |
Client
|
Custom |
task_type |
str
|
Embedding model task type (https://ai.google.dev/gemini-api/docs/embeddings#task-types). Defaults to |
title |
str | None
|
Optional title for the content. Only works with |
Source code in griptape/drivers/embedding/google_embedding_driver.py
DEFAULT_MODEL = 'models/embedding-001'
class-attribute
instance-attribute
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
api_key = field(default=None, kw_only=True, metadata={'serializable': False})
class-attribute
instance-attribute
model = field(default=DEFAULT_MODEL, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
task_type = field(default='retrieval_document', kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
title = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
_params(chunk)
client()
try_embed_chunk(chunk, **kwargs)
Source code in griptape/drivers/embedding/google_embedding_driver.py
GooglePromptDriver
Bases: BasePromptDriver
Google Prompt Driver.
Attributes:
| Name | Type | Description |
|---|---|---|
api_key |
str | None
|
Google API key. |
model |
str
|
Google model name. |
client |
Client
|
Custom |
top_p |
float | None
|
Optional value for top_p. |
top_k |
int | None
|
Optional value for top_k. |
Source code in griptape/drivers/prompt/google_prompt_driver.py
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 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | |
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
api_key = field(default=None, kw_only=True, metadata={'serializable': False})
class-attribute
instance-attribute
model = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
structured_output_strategy = field(default='tool', kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
tokenizer = field(default=Factory(lambda self: GoogleTokenizer(api_key=self.api_key, model=self.model), takes_self=True), kw_only=True)
class-attribute
instance-attribute
tool_choice = field(default='auto', kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
top_k = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
top_p = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
use_native_tools = field(default=True, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
__is_thought_part(content)
Source code in griptape/drivers/prompt/google_prompt_driver.py
__to_google_message_content(content)
Source code in griptape/drivers/prompt/google_prompt_driver.py
__to_google_messages(prompt_stack)
Source code in griptape/drivers/prompt/google_prompt_driver.py
__to_google_role(message)
__to_google_tools(tools)
Source code in griptape/drivers/prompt/google_prompt_driver.py
__to_prompt_stack_delta_message_content(content)
Source code in griptape/drivers/prompt/google_prompt_driver.py
__to_prompt_stack_message_content(content)
Source code in griptape/drivers/prompt/google_prompt_driver.py
_base_params(prompt_stack)
Source code in griptape/drivers/prompt/google_prompt_driver.py
client()
try_run(prompt_stack)
Source code in griptape/drivers/prompt/google_prompt_driver.py
try_stream(prompt_stack)
Source code in griptape/drivers/prompt/google_prompt_driver.py
GoogleWebSearchDriver
Bases: BaseWebSearchDriver
Source code in griptape/drivers/web_search/google_web_search_driver.py
api_key = field(kw_only=True)
class-attribute
instance-attribute
country = field(default='us', kw_only=True)
class-attribute
instance-attribute
language = field(default='en', kw_only=True)
class-attribute
instance-attribute
search_id = field(kw_only=True)
class-attribute
instance-attribute
_search_google(query, **kwargs)
Source code in griptape/drivers/web_search/google_web_search_driver.py
GriptapeCloudAssistantDriver
Bases: BaseAssistantDriver
Source code in griptape/drivers/assistant/griptape_cloud_assistant_driver.py
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 | |
additional_knowledge_base_ids = field(factory=list, kw_only=True)
class-attribute
instance-attribute
additional_ruleset_ids = field(factory=list, kw_only=True)
class-attribute
instance-attribute
additional_structure_ids = field(factory=list, kw_only=True)
class-attribute
instance-attribute
additional_tool_ids = field(factory=list, kw_only=True)
class-attribute
instance-attribute
api_key = field(default=Factory(lambda: os.environ['GT_CLOUD_API_KEY']))
class-attribute
instance-attribute
assistant_id = field(kw_only=True)
class-attribute
instance-attribute
auto_create_thread = field(default=True, kw_only=True)
class-attribute
instance-attribute
base_url = field(default=Factory(lambda: os.getenv('GT_CLOUD_BASE_URL', 'https://cloud.griptape.ai')))
class-attribute
instance-attribute
headers = field(default=Factory(lambda self: {'Authorization': f'Bearer {self.api_key}'}, takes_self=True), kw_only=True)
class-attribute
instance-attribute
input = field(default=None, kw_only=True)
class-attribute
instance-attribute
knowledge_base_ids = field(default=None, kw_only=True)
class-attribute
instance-attribute
max_attempts = field(default=20, kw_only=True)
class-attribute
instance-attribute
poll_interval = field(default=1, kw_only=True)
class-attribute
instance-attribute
ruleset_ids = field(default=None, kw_only=True)
class-attribute
instance-attribute
stream = field(default=False, kw_only=True)
class-attribute
instance-attribute
structure_ids = field(default=None, kw_only=True)
class-attribute
instance-attribute
thread_alias = field(default=None, kw_only=True)
class-attribute
instance-attribute
thread_id = field(default=None, kw_only=True)
class-attribute
instance-attribute
tool_ids = field(default=None, kw_only=True)
class-attribute
instance-attribute
_create_or_find_thread(thread_alias=None)
Source code in griptape/drivers/assistant/griptape_cloud_assistant_driver.py
_create_run(*args)
Source code in griptape/drivers/assistant/griptape_cloud_assistant_driver.py
_create_thread(thread_alias=None)
Source code in griptape/drivers/assistant/griptape_cloud_assistant_driver.py
_find_thread_by_alias(thread_alias)
Source code in griptape/drivers/assistant/griptape_cloud_assistant_driver.py
_get_run_events(assistant_run_id)
Source code in griptape/drivers/assistant/griptape_cloud_assistant_driver.py
_get_run_result(assistant_run_id)
Source code in griptape/drivers/assistant/griptape_cloud_assistant_driver.py
try_run(*args)
Source code in griptape/drivers/assistant/griptape_cloud_assistant_driver.py
GriptapeCloudConversationMemoryDriver
Bases: BaseConversationMemoryDriver
A driver for storing conversation memory in the Griptape Cloud.
Attributes:
| Name | Type | Description |
|---|---|---|
thread_id |
str | None
|
The ID of the Thread to store the conversation memory in. If not provided, the driver will attempt to
retrieve the ID from the environment variable |
alias |
str | None
|
The alias of the Thread to store the conversation memory in. |
base_url |
str
|
The base URL of the Griptape Cloud API. Defaults to the value of the environment variable
|
api_key |
str
|
The API key to use for authenticating with the Griptape Cloud API. If not provided, the driver will
attempt to retrieve the API key from the environment variable |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in griptape/drivers/memory/conversation/griptape_cloud_conversation_memory_driver.py
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 | |
_thread = field(default=None, init=False)
class-attribute
instance-attribute
alias = field(default=None, metadata={'serializable': True})
class-attribute
instance-attribute
api_key = field(default=Factory(lambda: os.environ['GT_CLOUD_API_KEY']))
class-attribute
instance-attribute
base_url = field(default=Factory(lambda: os.getenv('GT_CLOUD_BASE_URL', 'https://cloud.griptape.ai')))
class-attribute
instance-attribute
headers = field(default=Factory(lambda self: {'Authorization': f'Bearer {self.api_key}'}, takes_self=True), init=False)
class-attribute
instance-attribute
thread
property
Try to get the Thread by ID, alias, or create a new one.
thread_id = field(default=None, metadata={'serializable': True})
class-attribute
instance-attribute
_call_api(method, path, json=None, *, raise_for_status=True)
Source code in griptape/drivers/memory/conversation/griptape_cloud_conversation_memory_driver.py
_get_url(path)
load()
Source code in griptape/drivers/memory/conversation/griptape_cloud_conversation_memory_driver.py
store(runs, metadata)
Source code in griptape/drivers/memory/conversation/griptape_cloud_conversation_memory_driver.py
validate_api_key(_, value)
Source code in griptape/drivers/memory/conversation/griptape_cloud_conversation_memory_driver.py
GriptapeCloudEventListenerDriver
Bases: BaseEventListenerDriver
Driver for publishing events to Griptape Cloud.
Attributes:
| Name | Type | Description |
|---|---|---|
base_url |
str
|
The base URL of Griptape Cloud. Defaults to the GT_CLOUD_BASE_URL environment variable. |
api_key |
str | None
|
The API key to authenticate with Griptape Cloud. |
headers |
dict
|
The headers to use when making requests to Griptape Cloud. Defaults to include the Authorization header. |
structure_run_id |
str | None
|
The ID of the Structure Run to publish events to. Defaults to the GT_CLOUD_STRUCTURE_RUN_ID environment variable. |
Source code in griptape/drivers/event_listener/griptape_cloud_event_listener_driver.py
api_key = field(default=Factory(lambda: os.getenv('GT_CLOUD_API_KEY')), kw_only=True)
class-attribute
instance-attribute
base_url = field(default=Factory(lambda: os.getenv('GT_CLOUD_BASE_URL', 'https://cloud.griptape.ai')), kw_only=True)
class-attribute
instance-attribute
headers = field(default=Factory(lambda self: {'Authorization': f'Bearer {self.api_key}'}, takes_self=True), kw_only=True)
class-attribute
instance-attribute
structure_run_id = field(default=Factory(lambda: os.getenv('GT_CLOUD_STRUCTURE_RUN_ID')), kw_only=True)
class-attribute
instance-attribute
_get_event_request(event_payload)
Source code in griptape/drivers/event_listener/griptape_cloud_event_listener_driver.py
_post_event(json)
Source code in griptape/drivers/event_listener/griptape_cloud_event_listener_driver.py
publish_event(event)
Source code in griptape/drivers/event_listener/griptape_cloud_event_listener_driver.py
try_publish_event_payload(event_payload)
try_publish_event_payload_batch(event_payload_batch)
validate_api_key(_, api_key)
Source code in griptape/drivers/event_listener/griptape_cloud_event_listener_driver.py
validate_run_id(_, structure_run_id)
Source code in griptape/drivers/event_listener/griptape_cloud_event_listener_driver.py
GriptapeCloudFileManagerDriver
Bases: BaseFileManagerDriver
GriptapeCloudFileManagerDriver can be used to list, load, and save files as Assets in Griptape Cloud Buckets.
Attributes:
| Name | Type | Description |
|---|---|---|
bucket_id |
str | None
|
The ID of the Bucket to list, load, and save Assets in. If not provided, the driver will attempt to
retrieve the ID from the environment variable |
workdir |
str
|
The working directory. List, load, and save operations will be performed relative to this directory. |
base_url |
str
|
The base URL of the Griptape Cloud API. Defaults to the value of the environment variable
|
api_key |
str
|
The API key to use for authenticating with the Griptape Cloud API. If not provided, the driver will
attempt to retrieve the API key from the environment variable |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in griptape/drivers/file_manager/griptape_cloud_file_manager_driver.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 | |
_workdir = field(default='/', kw_only=True, alias='workdir')
class-attribute
instance-attribute
api_key = field(default=Factory(lambda: os.environ['GT_CLOUD_API_KEY']))
class-attribute
instance-attribute
base_url = field(default=Factory(lambda: os.getenv('GT_CLOUD_BASE_URL', 'https://cloud.griptape.ai')))
class-attribute
instance-attribute
bucket_id = field(default=Factory(lambda: os.getenv('GT_CLOUD_BUCKET_ID')), kw_only=True)
class-attribute
instance-attribute
headers = field(default=Factory(lambda self: {'Authorization': f'Bearer {self.api_key}'}, takes_self=True), init=False)
class-attribute
instance-attribute
workdir
property
writable
__attrs_post_init__()
Source code in griptape/drivers/file_manager/griptape_cloud_file_manager_driver.py
_call_api(method, path, json=None, params=None, *, raise_for_status=True)
Source code in griptape/drivers/file_manager/griptape_cloud_file_manager_driver.py
_get_asset_url(full_key)
Source code in griptape/drivers/file_manager/griptape_cloud_file_manager_driver.py
_get_url(path)
_is_a_directory(path)
_to_full_key(path)
try_list_files(path, postfix='')
Source code in griptape/drivers/file_manager/griptape_cloud_file_manager_driver.py
try_load_file(path)
Source code in griptape/drivers/file_manager/griptape_cloud_file_manager_driver.py
try_save_file(path, value)
Source code in griptape/drivers/file_manager/griptape_cloud_file_manager_driver.py
validate_bucket_id(_, value)
Source code in griptape/drivers/file_manager/griptape_cloud_file_manager_driver.py
GriptapeCloudImageGenerationDriver
Bases: BaseImageGenerationDriver
Driver for the OpenAI image generation API.
Attributes:
| Name | Type | Description |
|---|---|---|
model |
str
|
Image generation model. Supported values: 'gpt-image-1-mini', 'gpt-image-1.5'. Defaults to 'gpt-image-1-mini'. |
base_url |
str
|
Griptape Cloud API URL. |
api_key |
str
|
Griptape Cloud API Key. |
headers |
dict
|
Headers for Griptape Cloud request. Overwrites api_key. |
image_size |
Literal['1024x1024', '1536x1024', '1024x1536'] | None
|
Size of the generated image. Must be one of: 1024x1024, 1024x1536, 1536x1024. |
quality |
Literal['low', 'medium', 'high'] | None
|
Optional quality level. Accepts 'low', 'medium', 'high'. |
background |
Literal['transparent', 'opaque', 'auto'] | None
|
Optional background setting. Can be either 'transparent', 'opaque', or 'auto'. |
moderation |
Literal['low', 'auto'] | None
|
Optional moderation level. Can be either 'low' or 'auto'. |
output_compression |
int | None
|
Optional compression level. Can be an integer between 0 and 100. |
output_format |
Literal['png', 'jpeg'] | None
|
Optional output format. Can be either 'png' or 'jpeg'. |
Source code in griptape/drivers/image_generation/griptape_cloud_image_generation_driver.py
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 | |
api_key = field(default=Factory(lambda: os.environ['GT_CLOUD_API_KEY']))
class-attribute
instance-attribute
background = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
base_url = field(default=Factory(lambda: os.getenv('GT_CLOUD_BASE_URL', 'https://cloud.griptape.ai')))
class-attribute
instance-attribute
headers = field(default=Factory(lambda self: {'Authorization': f'Bearer {self.api_key}'}, takes_self=True), kw_only=True)
class-attribute
instance-attribute
image_size = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
model = field(default=DEFAULT_MODEL, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
moderation = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
output_compression = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
output_format = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
quality = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
_build_driver_configuration()
Builds parameters while considering field metadata and None values.
Field will be added to the params dictionary if all conditions are met
- The field value is not None
- The model_allowlist is None or the model is in the allowlist
Source code in griptape/drivers/image_generation/griptape_cloud_image_generation_driver.py
try_image_inpainting(prompts, image, mask, negative_prompts=None)
Source code in griptape/drivers/image_generation/griptape_cloud_image_generation_driver.py
try_image_outpainting(prompts, image, mask, negative_prompts=None)
Source code in griptape/drivers/image_generation/griptape_cloud_image_generation_driver.py
try_image_variation(prompts, image, negative_prompts=None)
Source code in griptape/drivers/image_generation/griptape_cloud_image_generation_driver.py
try_text_to_image(prompts, negative_prompts=None)
Source code in griptape/drivers/image_generation/griptape_cloud_image_generation_driver.py
validate_image_size(attribute, value)
Validates the image size.
Must be one of 1024x1024, 1536x1024 (landscape), or 1024x1536 (portrait).
Source code in griptape/drivers/image_generation/griptape_cloud_image_generation_driver.py
GriptapeCloudObservabilityDriver
Bases: OpenTelemetryObservabilityDriver
Source code in griptape/drivers/observability/griptape_cloud_observability_driver.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 | |
api_key = field(default=Factory(lambda: os.environ['GT_CLOUD_API_KEY']), kw_only=True)
class-attribute
instance-attribute
base_url = field(default=Factory(lambda: os.getenv('GT_CLOUD_BASE_URL', 'https://cloud.griptape.ai')), kw_only=True)
class-attribute
instance-attribute
headers = field(default=Factory(lambda self: {'Authorization': f'Bearer {self.api_key}'}, takes_self=True), kw_only=True)
class-attribute
instance-attribute
span_processor = field(default=Factory(lambda self: import_optional_dependency('opentelemetry.sdk.trace.export').BatchSpanProcessor(GriptapeCloudObservabilityDriver.build_span_exporter(base_url=self.base_url, api_key=self.api_key, headers=self.headers, structure_run_id=self.structure_run_id)), takes_self=True), kw_only=True)
class-attribute
instance-attribute
structure_run_id = field(default=Factory(lambda: os.getenv('GT_CLOUD_STRUCTURE_RUN_ID')), kw_only=True)
class-attribute
instance-attribute
build_span_exporter(base_url, api_key, headers, structure_run_id)
staticmethod
Source code in griptape/drivers/observability/griptape_cloud_observability_driver.py
format_span_id(span_id)
staticmethod
format_trace_id(trace_id)
staticmethod
get_span_id()
Source code in griptape/drivers/observability/griptape_cloud_observability_driver.py
validate_run_id(_, structure_run_id)
Source code in griptape/drivers/observability/griptape_cloud_observability_driver.py
GriptapeCloudPromptDriver
Bases: BasePromptDriver
Source code in griptape/drivers/prompt/griptape_cloud_prompt_driver.py
api_key = field(default=Factory(lambda: os.environ['GT_CLOUD_API_KEY']))
class-attribute
instance-attribute
base_url = field(default=Factory(lambda: os.getenv('GT_CLOUD_BASE_URL', 'https://cloud.griptape.ai')))
class-attribute
instance-attribute
headers = field(default=Factory(lambda self: {'Authorization': f'Bearer {self.api_key}'}, takes_self=True), kw_only=True)
class-attribute
instance-attribute
model = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
structured_output_strategy = field(default='native', kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
tokenizer = field(default=Factory(lambda self: SimpleTokenizer(characters_per_token=4, max_input_tokens=500000, max_output_tokens=self.max_tokens), takes_self=True), kw_only=True)
class-attribute
instance-attribute
use_native_tools = field(default=True, kw_only=True)
class-attribute
instance-attribute
__to_griptape_tools(tools)
Source code in griptape/drivers/prompt/griptape_cloud_prompt_driver.py
_base_params(prompt_stack)
Source code in griptape/drivers/prompt/griptape_cloud_prompt_driver.py
try_run(prompt_stack)
Source code in griptape/drivers/prompt/griptape_cloud_prompt_driver.py
try_stream(prompt_stack)
Source code in griptape/drivers/prompt/griptape_cloud_prompt_driver.py
GriptapeCloudRulesetDriver
Bases: BaseRulesetDriver
A driver for storing conversation memory in the Griptape Cloud.
Attributes:
| Name | Type | Description |
|---|---|---|
ruleset_id |
str | None
|
The ID of the Thread to store the conversation memory in. If not provided, the driver will attempt to
retrieve the ID from the environment variable |
base_url |
str
|
The base URL of the Griptape Cloud API. Defaults to the value of the environment variable
|
api_key |
str | None
|
The API key to use for authenticating with the Griptape Cloud API. If not provided, the driver will
attempt to retrieve the API key from the environment variable |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in griptape/drivers/ruleset/griptape_cloud_ruleset_driver.py
api_key = field(default=Factory(lambda: os.getenv('GT_CLOUD_API_KEY')))
class-attribute
instance-attribute
base_url = field(default=Factory(lambda: os.getenv('GT_CLOUD_BASE_URL', 'https://cloud.griptape.ai')))
class-attribute
instance-attribute
headers = field(default=Factory(lambda self: {'Authorization': f'Bearer {self.api_key}'}, takes_self=True), init=False)
class-attribute
instance-attribute
ruleset_id = field(default=None, metadata={'serializable': True})
class-attribute
instance-attribute
_call_api(method, path, *, raise_for_status=True)
Source code in griptape/drivers/ruleset/griptape_cloud_ruleset_driver.py
_get_url(path)
load(ruleset_name)
Load the ruleset from Griptape Cloud, using the ruleset name as an alias if ruleset_id is not provided.
Source code in griptape/drivers/ruleset/griptape_cloud_ruleset_driver.py
validate_api_key(_, value)
Source code in griptape/drivers/ruleset/griptape_cloud_ruleset_driver.py
GriptapeCloudStructureRunDriver
Bases: BaseStructureRunDriver
Source code in griptape/drivers/structure_run/griptape_cloud_structure_run_driver.py
api_key = field(kw_only=True)
class-attribute
instance-attribute
async_run = field(default=False, kw_only=True)
class-attribute
instance-attribute
base_url = field(default='https://cloud.griptape.ai', kw_only=True)
class-attribute
instance-attribute
headers = field(default=Factory(lambda self: {'Authorization': f'Bearer {self.api_key}'}, takes_self=True), kw_only=True)
class-attribute
instance-attribute
structure_id = field(kw_only=True)
class-attribute
instance-attribute
structure_run_max_wait_time_attempts = field(default=20, kw_only=True)
class-attribute
instance-attribute
structure_run_wait_time_interval = field(default=2, kw_only=True)
class-attribute
instance-attribute
_create_run(*args)
Source code in griptape/drivers/structure_run/griptape_cloud_structure_run_driver.py
_get_run_events(structure_run_id)
Source code in griptape/drivers/structure_run/griptape_cloud_structure_run_driver.py
_get_run_result(structure_run_id)
Source code in griptape/drivers/structure_run/griptape_cloud_structure_run_driver.py
try_run(*args)
Source code in griptape/drivers/structure_run/griptape_cloud_structure_run_driver.py
GriptapeCloudVectorStoreDriver
Bases: BaseVectorStoreDriver
A vector store driver for Griptape Cloud Knowledge Bases.
Attributes:
| Name | Type | Description |
|---|---|---|
api_key |
str
|
API Key for Griptape Cloud. |
knowledge_base_id |
str
|
Knowledge Base ID for Griptape Cloud. |
base_url |
str
|
Base URL for Griptape Cloud. |
headers |
dict
|
Headers for Griptape Cloud. |
Source code in griptape/drivers/vector/griptape_cloud_vector_store_driver.py
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 | |
api_key = field(default=Factory(lambda: os.environ['GT_CLOUD_API_KEY']))
class-attribute
instance-attribute
base_url = field(default=Factory(lambda: os.getenv('GT_CLOUD_BASE_URL', 'https://cloud.griptape.ai')))
class-attribute
instance-attribute
embedding_driver = field(default=Factory(DummyEmbeddingDriver), metadata={'serializable': True}, kw_only=True, init=False)
class-attribute
instance-attribute
headers = field(default=Factory(lambda self: {'Authorization': f'Bearer {self.api_key}'}, takes_self=True), kw_only=True)
class-attribute
instance-attribute
knowledge_base_id = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
delete_vector(vector_id)
load_artifacts(*, namespace=None)
load_entries(*, namespace=None)
load_entry(vector_id, *, namespace=None)
query(query, *, count=None, namespace=None, include_vectors=None, distance_metric=None, filter=None, **kwargs)
Performs a query on the Knowledge Base.
Performs a query on the Knowledge Base and returns Artifacts with close vector proximity to the query, optionally filtering to only those that match the provided filter(s).
Source code in griptape/drivers/vector/griptape_cloud_vector_store_driver.py
upsert_text(string, vector_id=None, namespace=None, meta=None, **kwargs)
Source code in griptape/drivers/vector/griptape_cloud_vector_store_driver.py
upsert_text_artifact(artifact, namespace=None, meta=None, vector_id=None, **kwargs)
Source code in griptape/drivers/vector/griptape_cloud_vector_store_driver.py
upsert_vector(vector, vector_id=None, namespace=None, meta=None, **kwargs)
Source code in griptape/drivers/vector/griptape_cloud_vector_store_driver.py
GrokPromptDriver
Bases: OpenAiChatPromptDriver
Source code in griptape/drivers/prompt/grok_prompt_driver.py
base_url = field(default='https://api.x.ai/v1', kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
tokenizer = field(default=Factory(lambda self: GrokTokenizer(base_url=self.base_url, api_key=self.api_key, model=self.model), takes_self=True), kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
HuggingFaceHubEmbeddingDriver
Bases: BaseEmbeddingDriver
Hugging Face Hub Embedding Driver.
Attributes:
| Name | Type | Description |
|---|---|---|
api_token |
str
|
Hugging Face Hub API token. |
model |
str
|
Hugging Face Hub model name. |
client |
InferenceClient
|
Custom |
Source code in griptape/drivers/embedding/huggingface_hub_embedding_driver.py
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
api_token = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
client()
HuggingFaceHubPromptDriver
Bases: BasePromptDriver
Hugging Face Hub Prompt Driver.
Attributes:
| Name | Type | Description |
|---|---|---|
api_token |
str
|
Hugging Face Hub API token. |
use_gpu |
str
|
Use GPU during model run. |
model |
str
|
Hugging Face Hub model name. |
client |
InferenceClient
|
Custom |
tokenizer |
HuggingFaceTokenizer
|
Custom |
Source code in griptape/drivers/prompt/huggingface_hub_prompt_driver.py
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 | |
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
api_token = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
max_tokens = field(default=250, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
model = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
structured_output_strategy = field(default='native', kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
tokenizer = field(default=Factory(lambda self: HuggingFaceTokenizer(model=self.model, max_output_tokens=self.max_tokens), takes_self=True), kw_only=True)
class-attribute
instance-attribute
__prompt_stack_to_tokens(prompt_stack)
Source code in griptape/drivers/prompt/huggingface_hub_prompt_driver.py
_base_params(prompt_stack)
Source code in griptape/drivers/prompt/huggingface_hub_prompt_driver.py
_prompt_stack_to_messages(prompt_stack)
Source code in griptape/drivers/prompt/huggingface_hub_prompt_driver.py
client()
prompt_stack_to_string(prompt_stack)
try_run(prompt_stack)
Source code in griptape/drivers/prompt/huggingface_hub_prompt_driver.py
try_stream(prompt_stack)
Source code in griptape/drivers/prompt/huggingface_hub_prompt_driver.py
validate_structured_output_strategy(_, value)
Source code in griptape/drivers/prompt/huggingface_hub_prompt_driver.py
HuggingFacePipelineImageGenerationDriver
Bases: BaseImageGenerationDriver, ABC
Image generation driver for models hosted by Hugging Face's Diffusion Pipeline.
For more information, see the HuggingFace documentation for Diffusers: https://huggingface.co/docs/diffusers/en/index
Attributes:
| Name | Type | Description |
|---|---|---|
pipeline_driver |
BaseDiffusionImageGenerationPipelineDriver
|
A pipeline image generation model driver typed for the specific pipeline required by the model. |
device |
str | None
|
The hardware device used for inference. For example, "cpu", "cuda", or "mps". |
output_format |
str
|
The format the generated image is returned in. Defaults to "png". |
Source code in griptape/drivers/image_generation/huggingface_pipeline_image_generation_driver.py
device = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
output_format = field(default='png', kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
pipeline_driver = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
try_image_inpainting(prompts, image, mask, negative_prompts=None)
Source code in griptape/drivers/image_generation/huggingface_pipeline_image_generation_driver.py
try_image_outpainting(prompts, image, mask, negative_prompts=None)
Source code in griptape/drivers/image_generation/huggingface_pipeline_image_generation_driver.py
try_image_variation(prompts, image, negative_prompts=None)
Source code in griptape/drivers/image_generation/huggingface_pipeline_image_generation_driver.py
try_text_to_image(prompts, negative_prompts=None)
Source code in griptape/drivers/image_generation/huggingface_pipeline_image_generation_driver.py
HuggingFacePipelinePromptDriver
Bases: BasePromptDriver
Hugging Face Pipeline Prompt Driver.
Attributes:
| Name | Type | Description |
|---|---|---|
model |
str
|
Hugging Face Hub model name. |
Source code in griptape/drivers/prompt/huggingface_pipeline_prompt_driver.py
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 | |
_pipeline = field(default=None, kw_only=True, alias='pipeline', metadata={'serializable': False})
class-attribute
instance-attribute
max_tokens = field(default=250, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
model = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
structured_output_strategy = field(default='rule', kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
tokenizer = field(default=Factory(lambda self: HuggingFaceTokenizer(model=self.model, max_output_tokens=self.max_tokens), takes_self=True), kw_only=True)
class-attribute
instance-attribute
__prompt_stack_to_tokens(prompt_stack)
Source code in griptape/drivers/prompt/huggingface_pipeline_prompt_driver.py
_base_params(prompt_stack)
_prompt_stack_to_messages(prompt_stack)
Source code in griptape/drivers/prompt/huggingface_pipeline_prompt_driver.py
pipeline()
Source code in griptape/drivers/prompt/huggingface_pipeline_prompt_driver.py
prompt_stack_to_string(prompt_stack)
try_run(prompt_stack)
Source code in griptape/drivers/prompt/huggingface_pipeline_prompt_driver.py
try_stream(prompt_stack)
validate_structured_output_strategy(_, value)
Source code in griptape/drivers/prompt/huggingface_pipeline_prompt_driver.py
LeonardoImageGenerationDriver
Bases: BaseImageGenerationDriver
Driver for the Leonardo image generation API.
Details on Leonardo image generation parameters can be found here: https://docs.leonardo.ai/reference/creategeneration
Attributes:
| Name | Type | Description |
|---|---|---|
model |
str
|
The ID of the model to use when generating images. |
api_key |
str
|
The API key to use when making requests to the Leonardo API. |
requests_session |
Session
|
The requests session to use when making requests to the Leonardo API. |
api_base |
str
|
The base URL of the Leonardo API. |
max_attempts |
int
|
The maximum number of times to poll the Leonardo API for a completed image. |
image_width |
int
|
The width of the generated image in the range [32, 1024] and divisible by 8. |
image_height |
int
|
The height of the generated image in the range [32, 1024] and divisible by 8. |
steps |
int | None
|
Optionally specify the number of inference steps to run for each image generation request, [30, 60]. |
seed |
int | None
|
Optionally provide a consistent seed to generation requests, increasing consistency in output. |
init_strength |
float | None
|
Optionally specify the strength of the initial image, [0.0, 1.0]. |
Source code in griptape/drivers/image_generation/leonardo_image_generation_driver.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 | |
api_base = 'https://cloud.leonardo.ai/api/rest/v1'
class-attribute
instance-attribute
api_key = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
control_net = field(default=False, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
control_net_type = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
image_height = field(default=512, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
image_width = field(default=512, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
init_strength = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
max_attempts = field(default=10, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
requests_session = field(default=Factory(requests.Session), kw_only=True)
class-attribute
instance-attribute
seed = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
steps = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
_create_generation(prompts, negative_prompts, init_image_id=None)
Source code in griptape/drivers/image_generation/leonardo_image_generation_driver.py
_download_image(url)
_get_image_url(generation_id)
Source code in griptape/drivers/image_generation/leonardo_image_generation_driver.py
_make_api_request(endpoint, request, method='POST')
Source code in griptape/drivers/image_generation/leonardo_image_generation_driver.py
_upload_init_image(image)
Source code in griptape/drivers/image_generation/leonardo_image_generation_driver.py
try_image_inpainting(prompts, image, mask, negative_prompts=None)
Source code in griptape/drivers/image_generation/leonardo_image_generation_driver.py
try_image_outpainting(prompts, image, mask, negative_prompts=None)
Source code in griptape/drivers/image_generation/leonardo_image_generation_driver.py
try_image_variation(prompts, image, negative_prompts=None)
Source code in griptape/drivers/image_generation/leonardo_image_generation_driver.py
try_text_to_image(prompts, negative_prompts=None)
Source code in griptape/drivers/image_generation/leonardo_image_generation_driver.py
LocalConversationMemoryDriver
Bases: BaseConversationMemoryDriver
Source code in griptape/drivers/memory/conversation/local_conversation_memory_driver.py
persist_file = field(default=None, metadata={'serializable': True})
class-attribute
instance-attribute
load()
Source code in griptape/drivers/memory/conversation/local_conversation_memory_driver.py
store(runs, metadata)
LocalFileManagerDriver
Bases: BaseFileManagerDriver
LocalFileManagerDriver can be used to list, load, and save files on the local file system.
Attributes:
| Name | Type | Description |
|---|---|---|
workdir |
str
|
The working directory as an absolute path. List, load, and save operations will be performed relative to this directory. Defaults to the current working directory. Setting this to None will disable the working directory and all paths will be treated as absolute paths. |
Source code in griptape/drivers/file_manager/local_file_manager_driver.py
_workdir = field(default=Factory(os.getcwd), kw_only=True, alias='workdir')
class-attribute
instance-attribute
workdir
property
writable
_full_path(path)
Source code in griptape/drivers/file_manager/local_file_manager_driver.py
_is_dir(full_path)
try_list_files(path)
try_load_file(path)
try_save_file(path, value)
Source code in griptape/drivers/file_manager/local_file_manager_driver.py
LocalRerankDriver
Bases: BaseRerankDriver, FuturesExecutorMixin
Source code in griptape/drivers/rerank/local_rerank_driver.py
calculate_relatedness = field(default=Factory(lambda self: self._default_cosine_similarity, takes_self=True))
class-attribute
instance-attribute
embedding_driver = field(kw_only=True, default=Factory(lambda: Defaults.drivers_config.embedding_driver), metadata={'serializable': True})
class-attribute
instance-attribute
_default_cosine_similarity(x, y)
staticmethod
Lazily import numpy and calculate cosine similarity.
Source code in griptape/drivers/rerank/local_rerank_driver.py
run(query, artifacts)
Source code in griptape/drivers/rerank/local_rerank_driver.py
LocalRulesetDriver
Bases: BaseRulesetDriver
Source code in griptape/drivers/ruleset/local_ruleset_driver.py
persist_dir = field(default=None, metadata={'serializable': True})
class-attribute
instance-attribute
load(ruleset_name)
Source code in griptape/drivers/ruleset/local_ruleset_driver.py
LocalStructureRunDriver
Bases: BaseStructureRunDriver
Source code in griptape/drivers/structure_run/local_structure_run_driver.py
create_structure = field(kw_only=True)
class-attribute
instance-attribute
try_run(*args)
Source code in griptape/drivers/structure_run/local_structure_run_driver.py
LocalVectorStoreDriver
Bases: BaseVectorStoreDriver
Source code in griptape/drivers/vector/local_vector_store_driver.py
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 | |
calculate_relatedness = field(default=Factory(lambda self: self._default_cosine_similarity, takes_self=True))
class-attribute
instance-attribute
entries = field(factory=dict)
class-attribute
instance-attribute
persist_file = field(default=None)
class-attribute
instance-attribute
thread_lock = field(default=Factory(threading.Lock))
class-attribute
instance-attribute
__attrs_post_init__()
Source code in griptape/drivers/vector/local_vector_store_driver.py
__namespaced_vector_id(vector_id, *, namespace)
__save_entries_to_file(json_file)
_default_cosine_similarity(x, y)
staticmethod
Lazily import numpy and calculate cosine similarity.
Source code in griptape/drivers/vector/local_vector_store_driver.py
delete_vector(vector_id)
load_entries(*, namespace=None)
load_entries_from_file(json_file)
Source code in griptape/drivers/vector/local_vector_store_driver.py
load_entry(vector_id, *, namespace=None)
query_vector(vector, *, count=None, namespace=None, include_vectors=False, **kwargs)
Source code in griptape/drivers/vector/local_vector_store_driver.py
upsert_vector(vector, *, vector_id=None, namespace=None, meta=None, **kwargs)
Source code in griptape/drivers/vector/local_vector_store_driver.py
MarkdownifyWebScraperDriver
Bases: BaseWebScraperDriver
Driver to scrape a webpage and return the content in markdown format.
As a prerequisite to using MarkdownifyWebScraperDriver, you need to install the browsers used by
playwright. You can do this by running: poetry run playwright install.
For more details about playwright, see https://playwright.dev/python/docs/library.
Attributes:
| Name | Type | Description |
|---|---|---|
include_links |
bool
|
If |
exclude_tags |
list[str]
|
Optionally provide custom tags to exclude from the scraped content. |
exclude_classes |
list[str]
|
Optionally provide custom classes to exclude from the scraped content. |
exclude_ids |
list[str]
|
Optionally provide custom ids to exclude from the scraped content. |
timeout |
int | None
|
Optionally provide a timeout in milliseconds for the page to continue loading after the browser has emitted the "load" event. |
Source code in griptape/drivers/web_scraper/markdownify_web_scraper_driver.py
DEFAULT_EXCLUDE_TAGS = ['script', 'style', 'head', 'audio', 'img', 'picture', 'source', 'video']
class-attribute
instance-attribute
exclude_classes = field(default=Factory(list), kw_only=True)
class-attribute
instance-attribute
exclude_ids = field(default=Factory(list), kw_only=True)
class-attribute
instance-attribute
exclude_tags = field(default=Factory(lambda self: self.DEFAULT_EXCLUDE_TAGS, takes_self=True), kw_only=True)
class-attribute
instance-attribute
include_links = field(default=True, kw_only=True)
class-attribute
instance-attribute
timeout = field(default=None, kw_only=True)
class-attribute
instance-attribute
extract_page(page)
Source code in griptape/drivers/web_scraper/markdownify_web_scraper_driver.py
fetch_url(url)
Source code in griptape/drivers/web_scraper/markdownify_web_scraper_driver.py
MarqoVectorStoreDriver
Bases: BaseVectorStoreDriver
A Vector Store Driver for Marqo.
Attributes:
| Name | Type | Description |
|---|---|---|
api_key |
str
|
The API key for the Marqo API. |
url |
str
|
The URL to the Marqo API. |
client |
Client
|
An optional Marqo client. Defaults to a new client with the given URL and API key. |
index |
str
|
The name of the index to use. |
Source code in griptape/drivers/vector/marqo_vector_store_driver.py
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 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | |
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
api_key = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
index = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
url = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
__process_results(results, *, include_vectors)
Source code in griptape/drivers/vector/marqo_vector_store_driver.py
client()
delete_index(name)
Delete an index in the Marqo client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the index to delete. |
required |
delete_vector(vector_id)
get_indexes()
Get a list of all indexes in the Marqo client.
Returns:
| Type | Description |
|---|---|
list[str]
|
The list of all indexes. |
load_entries(*, namespace=None)
Load all document entries from the Marqo index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
namespace
|
str | None
|
The namespace to filter entries by. |
None
|
Returns:
| Type | Description |
|---|---|
list[Entry]
|
The list of loaded Entries. |
Source code in griptape/drivers/vector/marqo_vector_store_driver.py
load_entry(vector_id, *, namespace=None)
Load a document entry from the Marqo index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vector_id
|
str
|
The ID of the vector to load. |
required |
namespace
|
str | None
|
The namespace of the vector to load. |
None
|
Returns:
| Type | Description |
|---|---|
Entry | None
|
The loaded Entry if found, otherwise None. |
Source code in griptape/drivers/vector/marqo_vector_store_driver.py
query(query, *, count=None, namespace=None, include_vectors=False, include_metadata=True, **kwargs)
Query the Marqo index for documents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str | TextArtifact | ImageArtifact
|
The query string. |
required |
count
|
int | None
|
The maximum number of results to return. |
None
|
namespace
|
str | None
|
The namespace to filter results by. |
None
|
include_vectors
|
bool
|
Whether to include vector data in the results. |
False
|
include_metadata
|
bool
|
Whether to include metadata in the results. |
True
|
kwargs
|
Any
|
Additional keyword arguments to pass to the Marqo client. |
{}
|
Returns:
| Type | Description |
|---|---|
list[Entry]
|
The list of query results. |
Source code in griptape/drivers/vector/marqo_vector_store_driver.py
query_vector(vector, *, count=None, namespace=None, include_vectors=False, include_metadata=True, **kwargs)
Query the Marqo index for documents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vector
|
list[float]
|
The vector to query by. |
required |
count
|
int | None
|
The maximum number of results to return. |
None
|
namespace
|
str | None
|
The namespace to filter results by. |
None
|
include_vectors
|
bool
|
Whether to include vector data in the results. |
False
|
include_metadata
|
bool
|
Whether to include metadata in the results. |
True
|
kwargs
|
Any
|
Additional keyword arguments to pass to the Marqo client. |
{}
|
Returns:
| Type | Description |
|---|---|
list[Entry]
|
The list of query results. |
Source code in griptape/drivers/vector/marqo_vector_store_driver.py
upsert(value, *, namespace=None, meta=None, vector_id=None, **kwargs)
Upsert a text document into the Marqo index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str | TextArtifact | ImageArtifact
|
The value to be indexed. |
required |
namespace
|
str | None
|
An optional namespace for the document. |
None
|
meta
|
dict | None
|
An optional dictionary of metadata for the document. |
None
|
vector_id
|
str | None
|
The ID for the vector. If None, Marqo will generate an ID. |
None
|
kwargs
|
Any
|
Additional keyword arguments to pass to the Marqo client. |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The ID of the document that was added. |
Source code in griptape/drivers/vector/marqo_vector_store_driver.py
upsert_vector(vector, *, vector_id=None, namespace=None, meta=None, **kwargs)
Upsert a vector into the Marqo index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vector
|
list[float]
|
The vector to be indexed. |
required |
vector_id
|
str | None
|
The ID for the vector. If None, Marqo will generate an ID. |
None
|
namespace
|
str | None
|
An optional namespace for the vector. |
None
|
meta
|
dict | None
|
An optional dictionary of metadata for the vector. |
None
|
kwargs
|
Any
|
Additional keyword arguments to pass to the Marqo client. |
{}
|
Raises:
| Type | Description |
|---|---|
Exception
|
This function is not yet implemented. |
Returns:
| Type | Description |
|---|---|
str
|
The ID of the vector that was added. |
Source code in griptape/drivers/vector/marqo_vector_store_driver.py
MongoDbAtlasVectorStoreDriver
Bases: BaseVectorStoreDriver
A Vector Store Driver for MongoDb Atlas.
Attributes:
| Name | Type | Description |
|---|---|---|
connection_string |
str
|
The connection string for the MongoDb Atlas cluster. |
database_name |
str
|
The name of the database to use. |
collection_name |
str
|
The name of the collection to use. |
index_name |
str
|
The name of the index to use. |
vector_path |
str
|
The path to the vector field in the collection. |
client |
MongoClient
|
An optional MongoDb client to use. Defaults to a new client using the connection string. |
Source code in griptape/drivers/vector/mongodb_atlas_vector_store_driver.py
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 | |
MAX_NUM_CANDIDATES = 10000
class-attribute
instance-attribute
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
collection_name = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
connection_string = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
database_name = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
index_name = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
num_candidates_multiplier = field(default=10, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
vector_path = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
client()
delete_vector(vector_id)
Deletes the vector from the collection.
get_collection()
Returns the MongoDB Collection instance for the specified database and collection name.
load_entries(*, namespace=None)
Loads all document entries from the MongoDB collection.
Entries can optionally be filtered by namespace.
Source code in griptape/drivers/vector/mongodb_atlas_vector_store_driver.py
load_entry(vector_id, *, namespace=None)
Loads a document entry from the MongoDB collection based on the vector ID.
Returns:
| Type | Description |
|---|---|
Entry | None
|
The loaded Entry if found; otherwise, None is returned. |
Source code in griptape/drivers/vector/mongodb_atlas_vector_store_driver.py
query_vector(vector, *, count=None, namespace=None, include_vectors=False, offset=None, **kwargs)
Queries the MongoDB collection for documents that match the provided vector list.
Results can be customized based on parameters like count, namespace, inclusion of vectors, offset, and index.
Source code in griptape/drivers/vector/mongodb_atlas_vector_store_driver.py
upsert_vector(vector, *, vector_id=None, namespace=None, meta=None, **kwargs)
Inserts or updates a vector in the collection.
If a vector with the given vector ID already exists, it is updated; otherwise, a new vector is inserted.
Source code in griptape/drivers/vector/mongodb_atlas_vector_store_driver.py
NoOpObservabilityDriver
Bases: BaseObservabilityDriver
Source code in griptape/drivers/observability/no_op_observability_driver.py
get_span_id()
OllamaEmbeddingDriver
Bases: BaseEmbeddingDriver
Ollama Embedding Driver.
Attributes:
| Name | Type | Description |
|---|---|---|
model |
str
|
Ollama embedding model name. |
host |
str | None
|
Optional Ollama host. |
client |
Client
|
Ollama |
Source code in griptape/drivers/embedding/ollama_embedding_driver.py
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
host = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
model = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
client()
OllamaPromptDriver
Bases: BasePromptDriver
Ollama Prompt Driver.
Attributes:
| Name | Type | Description |
|---|---|---|
model |
str
|
Model name. |
Source code in griptape/drivers/prompt/ollama_prompt_driver.py
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 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | |
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
host = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
model = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
options = field(default=Factory(lambda self: {'temperature': self.temperature, 'stop': self.tokenizer.stop_sequences, 'num_predict': self.max_tokens}, takes_self=True), kw_only=True)
class-attribute
instance-attribute
tokenizer = field(default=Factory(lambda self: SimpleTokenizer(characters_per_token=4, max_input_tokens=2000, max_output_tokens=self.max_tokens), takes_self=True), kw_only=True)
class-attribute
instance-attribute
use_native_tools = field(default=True, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
__to_ollama_message_content(content)
Source code in griptape/drivers/prompt/ollama_prompt_driver.py
__to_ollama_role(message, message_content=None)
Source code in griptape/drivers/prompt/ollama_prompt_driver.py
__to_ollama_tools(tools)
Source code in griptape/drivers/prompt/ollama_prompt_driver.py
__to_prompt_stack_delta_message_content(content_delta)
Source code in griptape/drivers/prompt/ollama_prompt_driver.py
__to_prompt_stack_message_content(response)
Source code in griptape/drivers/prompt/ollama_prompt_driver.py
_base_params(prompt_stack)
Source code in griptape/drivers/prompt/ollama_prompt_driver.py
_prompt_stack_to_messages(prompt_stack)
Source code in griptape/drivers/prompt/ollama_prompt_driver.py
client()
try_run(prompt_stack)
Source code in griptape/drivers/prompt/ollama_prompt_driver.py
try_stream(prompt_stack)
Source code in griptape/drivers/prompt/ollama_prompt_driver.py
OpenAiAssistantDriver
Bases: BaseAssistantDriver
Source code in griptape/drivers/assistant/openai_assistant_driver.py
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
api_key = field(default=None, kw_only=True, metadata={'serializable': False})
class-attribute
instance-attribute
assistant_id = field(kw_only=True)
class-attribute
instance-attribute
auto_create_thread = field(default=True, kw_only=True)
class-attribute
instance-attribute
base_url = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
event_handler = field(default=Factory(lambda self: self._create_event_handler_class()(), takes_self=True), kw_only=True, metadata={'serializable': False})
class-attribute
instance-attribute
organization = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
thread_id = field(default=None, kw_only=True)
class-attribute
instance-attribute
_create_event_handler_class()
staticmethod
Lazily import and create EventHandler class.
Source code in griptape/drivers/assistant/openai_assistant_driver.py
_create_run(thread_id, *args)
Source code in griptape/drivers/assistant/openai_assistant_driver.py
client()
try_run(*args)
Source code in griptape/drivers/assistant/openai_assistant_driver.py
OpenAiAudioTranscriptionDriver
Bases: BaseAudioTranscriptionDriver
Source code in griptape/drivers/audio_transcription/openai_audio_transcription_driver.py
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
api_key = field(default=None, kw_only=True, metadata={'serializable': False})
class-attribute
instance-attribute
api_type = field(default=None, kw_only=True)
class-attribute
instance-attribute
api_version = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
base_url = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
organization = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
client()
try_run(audio, prompts=None)
Source code in griptape/drivers/audio_transcription/openai_audio_transcription_driver.py
OpenAiChatPromptDriver
Bases: BasePromptDriver
OpenAI Chat Prompt Driver.
Attributes:
| Name | Type | Description |
|---|---|---|
base_url |
str | None
|
An optional OpenAi API URL. |
api_key |
str | None
|
An optional OpenAi API key. If not provided, the |
organization |
str | None
|
An optional OpenAI organization. If not provided, the |
client |
OpenAI
|
An |
model |
str
|
An OpenAI model name. |
tokenizer |
BaseTokenizer
|
An |
user |
str
|
A user id. Can be used to track requests by user. |
response_format |
dict | None
|
An optional OpenAi Chat Completion response format. Currently only supports |
seed |
int | None
|
An optional OpenAi Chat Completion seed. |
ignored_exception_types |
tuple[type[Exception], ...]
|
An optional tuple of exception types to ignore. Defaults to OpenAI's known exception types. |
parallel_tool_calls |
bool
|
A flag to enable parallel tool calls. Defaults to |
Source code in griptape/drivers/prompt/openai_chat_prompt_driver.py
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 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 | |
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
api_key = field(default=None, kw_only=True, metadata={'serializable': False})
class-attribute
instance-attribute
audio = field(default=Factory(lambda: {'voice': 'alloy', 'format': 'pcm16'}), kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
base_url = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
ignored_exception_types = field(default=Factory(lambda self: self._default_ignored_exception_types(), takes_self=True), kw_only=True)
class-attribute
instance-attribute
modalities = field(factory=list, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
model = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
organization = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
parallel_tool_calls = field(default=True, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
reasoning_effort = field(default='medium', kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
response_format = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
seed = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
structured_output_strategy = field(default='native', kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
supports_modalities
property
supports_reasoning_effort
property
supports_stop_sequences
property
supports_temperature
property
tokenizer = field(default=Factory(lambda self: OpenAiTokenizer(model=self.model), takes_self=True), kw_only=True)
class-attribute
instance-attribute
tool_choice = field(default='auto', kw_only=True, metadata={'serializable': False})
class-attribute
instance-attribute
use_native_tools = field(default=True, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
user = field(default='', kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
__to_openai_message_content(content)
Source code in griptape/drivers/prompt/openai_chat_prompt_driver.py
__to_openai_messages(messages)
Source code in griptape/drivers/prompt/openai_chat_prompt_driver.py
__to_openai_role(message, message_content=None)
Source code in griptape/drivers/prompt/openai_chat_prompt_driver.py
__to_openai_tools(tools)
Source code in griptape/drivers/prompt/openai_chat_prompt_driver.py
__to_prompt_stack_delta_message_content(content_delta)
Source code in griptape/drivers/prompt/openai_chat_prompt_driver.py
__to_prompt_stack_message_content(response)
Source code in griptape/drivers/prompt/openai_chat_prompt_driver.py
_base_params(prompt_stack)
Source code in griptape/drivers/prompt/openai_chat_prompt_driver.py
_default_ignored_exception_types()
Lazily import openai and return default exception types.
This is a method rather than inline in the Factory lambda to avoid calling import_optional_dependency multiple times during serialization introspection.
Source code in griptape/drivers/prompt/openai_chat_prompt_driver.py
_to_delta_message_stream(result)
Source code in griptape/drivers/prompt/openai_chat_prompt_driver.py
_to_message(result)
Source code in griptape/drivers/prompt/openai_chat_prompt_driver.py
client()
try_run(prompt_stack)
Source code in griptape/drivers/prompt/openai_chat_prompt_driver.py
try_stream(prompt_stack)
Source code in griptape/drivers/prompt/openai_chat_prompt_driver.py
OpenAiEmbeddingDriver
Bases: BaseEmbeddingDriver
OpenAI Embedding Driver.
Attributes:
| Name | Type | Description |
|---|---|---|
model |
str
|
OpenAI embedding model name. Defaults to |
base_url |
str | None
|
API URL. Defaults to OpenAI's v1 API URL. |
api_key |
str | None
|
API key to pass directly. Defaults to |
organization |
str | None
|
OpenAI organization. Defaults to 'OPENAI_ORGANIZATION' environment variable. |
tokenizer |
OpenAiTokenizer
|
Optionally provide custom |
client |
OpenAI
|
Optionally provide custom |
azure_deployment |
OpenAI
|
An Azure OpenAi deployment id. |
azure_endpoint |
OpenAI
|
An Azure OpenAi endpoint. |
azure_ad_token |
OpenAI
|
An optional Azure Active Directory token. |
azure_ad_token_provider |
OpenAI
|
An optional Azure Active Directory token provider. |
api_version |
OpenAI
|
An Azure OpenAi API version. |
Source code in griptape/drivers/embedding/openai_embedding_driver.py
DEFAULT_MODEL = 'text-embedding-3-small'
class-attribute
instance-attribute
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
api_key = field(default=None, kw_only=True, metadata={'serializable': False})
class-attribute
instance-attribute
base_url = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
model = field(default=DEFAULT_MODEL, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
organization = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
tokenizer = field(default=Factory(lambda self: OpenAiTokenizer(model=self.model), takes_self=True), kw_only=True)
class-attribute
instance-attribute
_params(chunk)
client()
try_embed_chunk(chunk, **kwargs)
Source code in griptape/drivers/embedding/openai_embedding_driver.py
OpenAiImageGenerationDriver
Bases: BaseImageGenerationDriver
Driver for the OpenAI image generation API.
Attributes:
| Name | Type | Description |
|---|---|---|
model |
str
|
OpenAI model, for example 'dall-e-2' or 'dall-e-3'. |
api_type |
str | None
|
OpenAI API type, for example 'open_ai' or 'azure'. |
api_version |
str | None
|
API version. |
base_url |
str | None
|
API URL. |
api_key |
str | None
|
OpenAI API key. |
organization |
str | None
|
OpenAI organization ID. |
style |
Literal['vivid', 'natural'] | None
|
Optional and only supported for dall-e-3, can be either 'vivid' or 'natural'. |
quality |
Literal['standard', 'hd', 'low', 'medium', 'high', 'auto'] | None
|
Optional and only supported for dall-e-3. Accepts 'standard', 'hd'. |
image_size |
Literal['256x256', '512x512', '1024x1024', '1024x1792', '1792x1024'] | None
|
Size of the generated image. Must be one of the following, depending on the requested model: dall-e-2: [256x256, 512x512, 1024x1024] dall-e-3: [1024x1024, 1024x1792, 1792x1024] gpt-image-1: [1024x1024, 1536x1024, 1024x1536, auto] |
response_format |
Literal['b64_json']
|
The response format. Currently only supports 'b64_json' which will return a base64 encoded image in a JSON object. |
background |
Literal['transparent', 'opaque', 'auto'] | None
|
Optional and only supported for gpt-image-1. Can be either 'transparent', 'opaque', or 'auto'. |
moderation |
Literal['low', 'auto'] | None
|
Optional and only supported for gpt-image-1. Can be either 'low' or 'auto'. |
output_compression |
int | None
|
Optional and only supported for gpt-image-1. Can be an integer between 0 and 100. |
output_format |
Literal['png', 'jpeg'] | None
|
Optional and only supported for gpt-image-1. Can be either 'png' or 'jpeg'. |
Source code in griptape/drivers/image_generation/openai_image_generation_driver.py
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 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | |
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
api_key = field(default=None, kw_only=True, metadata={'serializable': False})
class-attribute
instance-attribute
api_type = field(default=None, kw_only=True)
class-attribute
instance-attribute
api_version = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
background = field(default=None, kw_only=True, metadata={'serializable': True, 'model_allowlist': ['gpt-image-1']})
class-attribute
instance-attribute
base_url = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
ignored_exception_types = field(default=Factory(lambda self: self._default_ignored_exception_types(), takes_self=True), kw_only=True)
class-attribute
instance-attribute
image_size = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
moderation = field(default=None, kw_only=True, metadata={'serializable': True, 'model_allowlist': ['gpt-image-1']})
class-attribute
instance-attribute
organization = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
output_compression = field(default=None, kw_only=True, metadata={'serializable': True, 'model_allowlist': ['gpt-image-1']})
class-attribute
instance-attribute
output_format = field(default=None, kw_only=True, metadata={'serializable': True, 'model_allowlist': ['gpt-image-1']})
class-attribute
instance-attribute
quality = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
response_format = field(default='b64_json', kw_only=True, metadata={'serializable': True, 'model_denylist': ['gpt-image-1']})
class-attribute
instance-attribute
style = field(default=None, kw_only=True, metadata={'serializable': True, 'model_allowlist': ['dall-e-3']})
class-attribute
instance-attribute
_build_model_params(values)
Builds parameters while considering field metadata and None values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
values
|
dict
|
A dictionary mapping parameter names to field names. |
required |
Field will be added to the params dictionary if all conditions are met
- The field value is not None
- The model_allowlist is None or the model is in the allowlist
- The model_denylist is None or the model is not in the denylist
Source code in griptape/drivers/image_generation/openai_image_generation_driver.py
_default_ignored_exception_types()
Lazily import openai and return default exception types.
This is a method rather than inline in the Factory lambda to avoid calling import_optional_dependency multiple times during serialization introspection.
Source code in griptape/drivers/image_generation/openai_image_generation_driver.py
_parse_image_response(response, prompt)
Source code in griptape/drivers/image_generation/openai_image_generation_driver.py
client()
try_image_inpainting(prompts, image, mask, negative_prompts=None)
Source code in griptape/drivers/image_generation/openai_image_generation_driver.py
try_image_outpainting(prompts, image, mask, negative_prompts=None)
Source code in griptape/drivers/image_generation/openai_image_generation_driver.py
try_image_variation(prompts, image, negative_prompts=None)
Creates a variation of an image.
Only supported by for dall-e-2. Requires image size to be one of the following: [256x256, 512x512, 1024x1024]
Source code in griptape/drivers/image_generation/openai_image_generation_driver.py
try_text_to_image(prompts, negative_prompts=None)
Source code in griptape/drivers/image_generation/openai_image_generation_driver.py
validate_image_size(attribute, value)
Validates the image size based on the model.
Must be one of 1024x1024, 1536x1024 (landscape), 1024x1536 (portrait), or auto (default value) for
gpt-image-1, one of 256x256, 512x512, or 1024x1024 for dall-e-2, and
one of 1024x1024, 1792x1024, or 1024x1792 for dall-e-3.
Source code in griptape/drivers/image_generation/openai_image_generation_driver.py
OpenAiTextToSpeechDriver
Bases: BaseTextToSpeechDriver
Source code in griptape/drivers/text_to_speech/openai_text_to_speech_driver.py
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
api_key = field(default=None, kw_only=True)
class-attribute
instance-attribute
api_type = field(default=None, kw_only=True)
class-attribute
instance-attribute
api_version = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
base_url = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
format = field(default='mp3', kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
model = field(default='tts-1', kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
organization = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
voice = field(default='alloy', kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
client()
Source code in griptape/drivers/text_to_speech/openai_text_to_speech_driver.py
try_text_to_audio(prompts)
Source code in griptape/drivers/text_to_speech/openai_text_to_speech_driver.py
OpenSearchVectorStoreDriver
Bases: BaseVectorStoreDriver
A Vector Store Driver for OpenSearch.
Attributes:
| Name | Type | Description |
|---|---|---|
host |
str
|
The host of the OpenSearch cluster. |
port |
int
|
The port of the OpenSearch cluster. |
http_auth |
str | tuple[str, str | None]
|
The HTTP authentication credentials to use. |
use_ssl |
bool
|
Whether to use SSL. |
verify_certs |
bool
|
Whether to verify SSL certificates. |
index_name |
str
|
The name of the index to use. |
Source code in griptape/drivers/vector/opensearch_vector_store_driver.py
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 | |
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
host = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
http_auth = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
index_name = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
port = field(default=443, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
use_ssl = field(default=True, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
verify_certs = field(default=True, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
client()
Source code in griptape/drivers/vector/opensearch_vector_store_driver.py
delete_vector(vector_id)
load_entries(*, namespace=None)
Retrieves all vector entries from OpenSearch that match the optional namespace.
Returns:
| Type | Description |
|---|---|
list[Entry]
|
A list of BaseVectorStoreDriver.Entry objects. |
Source code in griptape/drivers/vector/opensearch_vector_store_driver.py
load_entry(vector_id, *, namespace=None)
Retrieves a specific vector entry from OpenSearch based on its identifier and optional namespace.
Returns:
| Type | Description |
|---|---|
Entry | None
|
If the entry is found, it returns an instance of BaseVectorStoreDriver.Entry; otherwise, None is returned. |
Source code in griptape/drivers/vector/opensearch_vector_store_driver.py
query_vector(vector, *, count=None, namespace=None, include_vectors=False, include_metadata=True, field_name='vector', **kwargs)
Performs a nearest neighbor search on OpenSearch to find vectors similar to the provided vector list.
Results can be limited using the count parameter and optionally filtered by a namespace.
Returns:
| Type | Description |
|---|---|
list[Entry]
|
A list of BaseVectorStoreDriver.Entry objects, each encapsulating the retrieved vector, its similarity score, metadata, and namespace. |
Source code in griptape/drivers/vector/opensearch_vector_store_driver.py
upsert_vector(vector, *, vector_id=None, namespace=None, meta=None, **kwargs)
Inserts or updates a vector in OpenSearch.
If a vector with the given vector ID already exists, it is updated; otherwise, a new vector is inserted. Metadata associated with the vector can also be provided.
Source code in griptape/drivers/vector/opensearch_vector_store_driver.py
OpenTelemetryObservabilityDriver
Bases: BaseObservabilityDriver
Source code in griptape/drivers/observability/open_telemetry_observability_driver.py
_root_span_context_manager = None
class-attribute
instance-attribute
_tracer = field(init=False)
class-attribute
instance-attribute
deployment_env = field(default=None, kw_only=True)
class-attribute
instance-attribute
service_name = field(default='griptape', kw_only=True)
class-attribute
instance-attribute
service_version = field(default=None, kw_only=True)
class-attribute
instance-attribute
span_processor = field(kw_only=True)
class-attribute
instance-attribute
trace_provider = field(default=Factory(lambda self: self._trace_provider_factory(), takes_self=True), kw_only=True)
class-attribute
instance-attribute
__attrs_post_init__()
Source code in griptape/drivers/observability/open_telemetry_observability_driver.py
__enter__()
Source code in griptape/drivers/observability/open_telemetry_observability_driver.py
__exit__(exc_type, exc_value, exc_traceback)
Source code in griptape/drivers/observability/open_telemetry_observability_driver.py
_trace_provider_factory()
Source code in griptape/drivers/observability/open_telemetry_observability_driver.py
get_span_id()
Source code in griptape/drivers/observability/open_telemetry_observability_driver.py
observe(call)
Source code in griptape/drivers/observability/open_telemetry_observability_driver.py
PerplexityPromptDriver
Bases: OpenAiChatPromptDriver
Source code in griptape/drivers/prompt/perplexity_prompt_driver.py
base_url = field(default='https://api.perplexity.ai', kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
structured_output_strategy = field(default='native', kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
_base_params(prompt_stack)
_to_message(result)
PerplexityWebSearchDriver
Bases: BaseWebSearchDriver
Source code in griptape/drivers/web_search/perplexity_web_search_driver.py
_prompt_driver = field(default=None, alias='prompt_driver')
class-attribute
instance-attribute
api_key = field(kw_only=True, default=None)
class-attribute
instance-attribute
model = field(default='sonar-pro', kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
prompt_driver()
PgAiKnowledgeBaseVectorStoreDriver
Bases: BaseVectorStoreDriver
Source code in griptape/drivers/vector/pgai_knowledge_base_vector_store_driver.py
_engine = field(default=None, kw_only=True, alias='engine', metadata={'serializable': False})
class-attribute
instance-attribute
connection_string = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
embedding_driver = field(default=Factory(DummyEmbeddingDriver), metadata={'serializable': True}, kw_only=True, init=False)
class-attribute
instance-attribute
knowledge_base_name = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
delete_vector(vector_id)
engine()
load_artifacts(*, namespace=None)
load_entries(*, namespace=None)
load_entry(vector_id, *, namespace=None)
query(query, *, count=BaseVectorStoreDriver.DEFAULT_QUERY_COUNT, **kwargs)
Source code in griptape/drivers/vector/pgai_knowledge_base_vector_store_driver.py
upsert_text(string, vector_id=None, namespace=None, meta=None, **kwargs)
Source code in griptape/drivers/vector/pgai_knowledge_base_vector_store_driver.py
upsert_text_artifact(artifact, namespace=None, meta=None, vector_id=None, **kwargs)
Source code in griptape/drivers/vector/pgai_knowledge_base_vector_store_driver.py
upsert_vector(vector, vector_id=None, namespace=None, meta=None, **kwargs)
Source code in griptape/drivers/vector/pgai_knowledge_base_vector_store_driver.py
PgVectorVectorStoreDriver
Bases: BaseVectorStoreDriver
A vector store driver to Postgres using the PGVector extension.
Attributes:
| Name | Type | Description |
|---|---|---|
connection_string |
str | None
|
An optional string describing the target Postgres database instance. |
create_engine_params |
dict
|
Additional configuration params passed when creating the database connection. |
engine |
Engine
|
An optional sqlalchemy Postgres engine to use. |
table_name |
str
|
Optionally specify the name of the table to used to store vectors. |
Source code in griptape/drivers/vector/pgvector_vector_store_driver.py
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 | |
_engine = field(default=None, kw_only=True, alias='engine', metadata={'serializable': False})
class-attribute
instance-attribute
_model = field(default=Factory(lambda self: self.default_vector_model(), takes_self=True))
class-attribute
instance-attribute
connection_string = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
create_engine_params = field(factory=dict, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
table_name = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
default_vector_model()
Source code in griptape/drivers/vector/pgvector_vector_store_driver.py
delete_vector(vector_id)
engine()
load_entries(*, namespace=None)
Retrieves all vector entries from the collection, optionally filtering to only those that match the provided namespace.
Source code in griptape/drivers/vector/pgvector_vector_store_driver.py
load_entry(vector_id, *, namespace=None)
Retrieves a specific vector entry from the collection based on its identifier and optional namespace.
Source code in griptape/drivers/vector/pgvector_vector_store_driver.py
query_vector(vector, *, count=None, namespace=None, include_vectors=False, distance_metric='cosine_distance', **kwargs)
Performs a search on the collection to find vectors similar to the provided input vector, optionally filtering to only those that match the provided namespace.
Source code in griptape/drivers/vector/pgvector_vector_store_driver.py
setup(*, create_schema=True, install_uuid_extension=True, install_vector_extension=True)
Provides a mechanism to initialize the database schema and extensions.
Source code in griptape/drivers/vector/pgvector_vector_store_driver.py
upsert_vector(vector, *, vector_id=None, namespace=None, meta=None, **kwargs)
Inserts or updates a vector in the collection.
Source code in griptape/drivers/vector/pgvector_vector_store_driver.py
validate_connection_string(_, connection_string)
Source code in griptape/drivers/vector/pgvector_vector_store_driver.py
PineconeVectorStoreDriver
Bases: BaseVectorStoreDriver
Source code in griptape/drivers/vector/pinecone_vector_store_driver.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 | |
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
_index = field(default=None, kw_only=True, alias='index', metadata={'serializable': False})
class-attribute
instance-attribute
api_key = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
environment = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
index_name = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
project_name = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
client()
delete_vector(vector_id)
index()
load_entries(*, namespace=None)
Source code in griptape/drivers/vector/pinecone_vector_store_driver.py
load_entry(vector_id, *, namespace=None)
Source code in griptape/drivers/vector/pinecone_vector_store_driver.py
query_vector(vector, *, count=None, namespace=None, include_vectors=False, include_metadata=True, **kwargs)
Source code in griptape/drivers/vector/pinecone_vector_store_driver.py
upsert_vector(vector, vector_id=None, namespace=None, meta=None, **kwargs)
Source code in griptape/drivers/vector/pinecone_vector_store_driver.py
ProxyWebScraperDriver
Bases: BaseWebScraperDriver
Source code in griptape/drivers/web_scraper/proxy_web_scraper_driver.py
_extract_page = field(default=Factory(lambda: lambda _, page: TextArtifact(page)), kw_only=True, alias='extract_page', metadata={'serializable': False})
class-attribute
instance-attribute
params = field(default=Factory(dict), kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
proxies = field(kw_only=True, metadata={'serializable': False})
class-attribute
instance-attribute
extract_page(page)
PusherEventListenerDriver
Bases: BaseEventListenerDriver
Source code in griptape/drivers/event_listener/pusher_event_listener_driver.py
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
app_id = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
channel = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
cluster = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
event_name = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
key = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
secret = field(kw_only=True, metadata={'serializable': False})
class-attribute
instance-attribute
ssl = field(default=True, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
client()
try_publish_event_payload(event_payload)
try_publish_event_payload_batch(event_payload_batch)
Source code in griptape/drivers/event_listener/pusher_event_listener_driver.py
QdrantVectorStoreDriver
Bases: BaseVectorStoreDriver
Vector Store Driver for Qdrant.
Attributes:
| Name | Type | Description |
|---|---|---|
location |
str | None
|
An optional location for the Qdrant client. If set to ':memory:', an in-memory client is used. |
url |
str | None
|
An optional Qdrant API URL. |
host |
str | None
|
An optional Qdrant host. |
path |
str | None
|
Persistence path for QdrantLocal. Default: None |
port |
int
|
The port number for the Qdrant client. Defaults: 6333. |
grpc_port |
int
|
The gRPC port number for the Qdrant client. Defaults: 6334. |
prefer_grpc |
bool
|
A boolean indicating whether to prefer gRPC over HTTP. Defaults: False. |
force_disable_check_same_thread |
bool | None
|
For QdrantLocal, force disable check_same_thread. Default: False Only use this if you can guarantee that you can resolve the thread safety outside QdrantClient. |
timeout |
int | None
|
Timeout for REST and gRPC API requests. Default: 5 seconds for REST and unlimited for gRPC |
api_key |
str | None
|
API key for authentication in Qdrant Cloud. Defaults: False |
https |
bool
|
If true - use HTTPS(SSL) protocol. Default: True |
prefix |
str | None
|
Add prefix to the REST URL path. Example: service/v1 will result in Example: service/v1 will result in http://localhost:6333/service/v1/{qdrant-endpoint} for REST API. Defaults: None |
distance |
str
|
The distance metric to be used for the vectors. Defaults: 'COSINE'. |
collection_name |
str
|
The name of the Qdrant collection. |
vector_name |
str | None
|
An optional name for the vectors. |
content_payload_key |
str
|
The key for the content payload in the metadata. Defaults: 'data'. |
Source code in griptape/drivers/vector/qdrant_vector_store_driver.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 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 | |
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
api_key = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
collection_name = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
content_payload_key = field(default=CONTENT_PAYLOAD_KEY, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
distance = field(default=DEFAULT_DISTANCE, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
force_disable_check_same_thread = field(default=False, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
grpc_port = field(default=6334, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
host = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
https = field(default=True, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
location = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
path = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
port = field(default=6333, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
prefer_grpc = field(default=False, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
prefix = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
timeout = field(default=5, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
url = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
vector_name = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
client()
Source code in griptape/drivers/vector/qdrant_vector_store_driver.py
delete_vector(vector_id)
Delete a vector from the Qdrant collection based on its ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vector_id
|
str | id
|
ID of the vector to delete. |
required |
Source code in griptape/drivers/vector/qdrant_vector_store_driver.py
load_entries(*, namespace=None, **kwargs)
Load vector entries from the Qdrant collection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
namespace
|
str | None
|
Optional namespace of the vectors. |
None
|
Returns:
| Type | Description |
|---|---|
list[Entry]
|
List of points. |
Source code in griptape/drivers/vector/qdrant_vector_store_driver.py
load_entry(vector_id, *, namespace=None)
Load a vector entry from the Qdrant collection based on its ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vector_id
|
str
|
ID of the vector to load. |
required |
namespace
|
str
|
Optional namespace of the vector. |
None
|
Returns:
| Type | Description |
|---|---|
Entry | None
|
Optional[BaseVectorStoreDriver.Entry]: Vector entry if found, else None. |
Source code in griptape/drivers/vector/qdrant_vector_store_driver.py
query_vector(vector, *, count=None, namespace=None, include_vectors=False, **kwargs)
Query the Qdrant collection based on a query vector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vector
|
list[float]
|
Query vector. |
required |
count
|
Optional[int]
|
Optional number of results to return. |
None
|
namespace
|
Optional[str]
|
Optional namespace of the vectors. |
None
|
include_vectors
|
bool
|
Whether to include vectors in the results. |
False
|
Returns:
| Type | Description |
|---|---|
list[Entry]
|
list[BaseVectorStoreDriver.Entry]: List of Entry objects. |
Source code in griptape/drivers/vector/qdrant_vector_store_driver.py
upsert_vector(vector, *, vector_id=None, namespace=None, meta=None, content=None, **kwargs)
Upsert vectors into the Qdrant collection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vector
|
list[float]
|
The vector to be upserted. |
required |
vector_id
|
Optional[str]
|
Optional vector ID. |
None
|
namespace
|
Optional[str]
|
Optional namespace for the vector. |
None
|
meta
|
Optional[dict]
|
Optional dictionary containing metadata. |
None
|
content
|
Optional[str]
|
The text content to be included in the payload. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The ID of the upserted vector. |
Source code in griptape/drivers/vector/qdrant_vector_store_driver.py
RedisConversationMemoryDriver
Bases: BaseConversationMemoryDriver
A Conversation Memory Driver for Redis.
This driver interfaces with a Redis instance and utilizes the Redis hashes and RediSearch module to store, retrieve, and query conversations in a structured manner. Proper setup of the Redis instance and RediSearch is necessary for the driver to function correctly.
Attributes:
| Name | Type | Description |
|---|---|---|
host |
str
|
The host of the Redis instance. |
port |
int
|
The port of the Redis instance. |
db |
int
|
The database of the Redis instance. |
username |
str
|
The username of the Redis instance. |
password |
str | None
|
The password of the Redis instance. |
index |
str
|
The name of the index to use. |
conversation_id |
str
|
The id of the conversation. |
Source code in griptape/drivers/memory/conversation/redis_conversation_memory_driver.py
client = field(default=Factory(lambda self: import_optional_dependency('redis').Redis(host=self.host, port=self.port, db=self.db, username=self.username, password=self.password, decode_responses=False), takes_self=True))
class-attribute
instance-attribute
conversation_id = field(kw_only=True, default=uuid.uuid4().hex)
class-attribute
instance-attribute
db = field(kw_only=True, default=0, metadata={'serializable': True})
class-attribute
instance-attribute
host = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
index = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
password = field(default=None, kw_only=True, metadata={'serializable': False})
class-attribute
instance-attribute
port = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
username = field(kw_only=True, default='default', metadata={'serializable': False})
class-attribute
instance-attribute
load()
Source code in griptape/drivers/memory/conversation/redis_conversation_memory_driver.py
RedisVectorStoreDriver
Bases: BaseVectorStoreDriver
A Vector Store Driver for Redis.
This driver interfaces with a Redis instance and utilizes the Redis hashes and RediSearch module to store, retrieve, and query vectors in a structured manner. Proper setup of the Redis instance and RediSearch is necessary for the driver to function correctly.
Attributes:
| Name | Type | Description |
|---|---|---|
host |
str
|
The host of the Redis instance. |
port |
int
|
The port of the Redis instance. |
db |
int
|
The database of the Redis instance. |
username |
str
|
The username of the Redis instance. |
password |
str | None
|
The password of the Redis instance. |
index |
str
|
The name of the index to use. |
Source code in griptape/drivers/vector/redis_vector_store_driver.py
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 | |
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
db = field(kw_only=True, default=0, metadata={'serializable': True})
class-attribute
instance-attribute
host = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
index = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
password = field(default=None, kw_only=True, metadata={'serializable': False})
class-attribute
instance-attribute
port = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
username = field(kw_only=True, default='default', metadata={'serializable': False})
class-attribute
instance-attribute
_generate_key(vector_id, namespace=None)
Generates a Redis key using the provided vector ID and optionally a namespace.
Source code in griptape/drivers/vector/redis_vector_store_driver.py
_get_doc_prefix(namespace=None)
Get the document prefix based on the provided namespace.
client()
Source code in griptape/drivers/vector/redis_vector_store_driver.py
delete_vector(vector_id)
load_entries(*, namespace=None)
Retrieves all vector entries from Redis that match the optional namespace.
Returns:
| Type | Description |
|---|---|
list[Entry]
|
A list of |
Source code in griptape/drivers/vector/redis_vector_store_driver.py
load_entry(vector_id, *, namespace=None)
Retrieves a specific vector entry from Redis based on its identifier and optional namespace.
Returns:
| Type | Description |
|---|---|
Entry | None
|
If the entry is found, it returns an instance of BaseVectorStoreDriver.Entry; otherwise, None is returned. |
Source code in griptape/drivers/vector/redis_vector_store_driver.py
query_vector(vector, *, count=None, namespace=None, include_vectors=False, **kwargs)
Performs a nearest neighbor search on Redis to find vectors similar to the provided input vector.
Results can be limited using the count parameter and optionally filtered by a namespace.
Returns:
| Type | Description |
|---|---|
list[Entry]
|
A list of BaseVectorStoreDriver.Entry objects, each encapsulating the retrieved vector, its similarity score, metadata, and namespace. |
Source code in griptape/drivers/vector/redis_vector_store_driver.py
upsert_vector(vector, vector_id=None, namespace=None, meta=None, **kwargs)
Inserts or updates a vector in Redis.
If a vector with the given vector ID already exists, it is updated; otherwise, a new vector is inserted. Metadata associated with the vector can also be provided.
Source code in griptape/drivers/vector/redis_vector_store_driver.py
SnowflakeSqlDriver
Bases: BaseSqlDriver
Source code in griptape/drivers/sql/snowflake_sql_driver.py
_engine = field(default=None, kw_only=True, alias='engine', metadata={'serializable': False})
class-attribute
instance-attribute
get_connection = field(kw_only=True)
class-attribute
instance-attribute
engine()
execute_query(query)
execute_query_raw(query)
Source code in griptape/drivers/sql/snowflake_sql_driver.py
get_table_schema(table_name, schema=None)
Source code in griptape/drivers/sql/snowflake_sql_driver.py
validate_get_connection(_, get_connection)
Source code in griptape/drivers/sql/snowflake_sql_driver.py
SqlDriver
Bases: BaseSqlDriver
Source code in griptape/drivers/sql/sql_driver.py
_engine = field(default=None, kw_only=True, alias='engine', metadata={'serializable': False})
class-attribute
instance-attribute
create_engine_params = field(factory=dict, kw_only=True)
class-attribute
instance-attribute
engine_url = field(kw_only=True)
class-attribute
instance-attribute
_get_table_schema(engine, table_name, schema=None)
cached
staticmethod
Source code in griptape/drivers/sql/sql_driver.py
engine()
execute_query(query)
execute_query_raw(query)
Source code in griptape/drivers/sql/sql_driver.py
get_table_schema(table_name, schema=None)
Source code in griptape/drivers/sql/sql_driver.py
StableDiffusion3ControlNetImageGenerationPipelineDriver
Bases: StableDiffusion3ImageGenerationPipelineDriver
Image generation model driver for Stable Diffusion 3 models with ControlNet.
For more information, see the HuggingFace documentation for the StableDiffusion3ControlNetPipeline: https://huggingface.co/docs/diffusers/en/api/pipelines/controlnet_sd3
Attributes:
| Name | Type | Description |
|---|---|---|
controlnet_model |
str
|
The ControlNet model to use for image generation. |
controlnet_conditioning_scale |
float | None
|
The conditioning scale for the ControlNet model. Defaults to None. |
Source code in griptape/drivers/image_generation_pipeline/stable_diffusion_3_controlnet_image_generation_pipeline_driver.py
controlnet_conditioning_scale = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
controlnet_model = field(kw_only=True)
class-attribute
instance-attribute
make_additional_params(negative_prompts, device)
Source code in griptape/drivers/image_generation_pipeline/stable_diffusion_3_controlnet_image_generation_pipeline_driver.py
make_image_param(image)
Source code in griptape/drivers/image_generation_pipeline/stable_diffusion_3_controlnet_image_generation_pipeline_driver.py
prepare_pipeline(model, device)
Source code in griptape/drivers/image_generation_pipeline/stable_diffusion_3_controlnet_image_generation_pipeline_driver.py
StableDiffusion3ImageGenerationPipelineDriver
Bases: BaseDiffusionImageGenerationPipelineDriver
Image generation model driver for Stable Diffusion 3 models.
For more information, see the HuggingFace documentation for the StableDiffusion3Pipeline: https://huggingface.co/docs/diffusers/main/en/api/pipelines/stable_diffusion/stable_diffusion_3
Attributes:
| Name | Type | Description |
|---|---|---|
width |
int
|
The width of the generated image. Defaults to 1024. Must be a multiple of 64. |
height |
int
|
The height of the generated image. Defaults to 1024. Must be a multiple of 64. |
seed |
int | None
|
The random seed to use for image generation. If not provided, a random seed will be used. |
guidance_scale |
float | None
|
The strength of the guidance loss. If not provided, the default value will be used. |
steps |
int | None
|
The number of inference steps to use in image generation. If not provided, the default value will be used. |
torch_dtype |
dtype | None
|
The torch data type to use for image generation. If not provided, the default value will be used. |
Source code in griptape/drivers/image_generation_pipeline/stable_diffusion_3_image_generation_pipeline_driver.py
drop_t5_encoder = field(default=False, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
enable_model_cpu_offload = field(default=False, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
guidance_scale = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
height = field(default=1024, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
output_image_dimensions
property
seed = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
steps = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
torch_dtype = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
width = field(default=1024, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
make_additional_params(negative_prompts, device)
Source code in griptape/drivers/image_generation_pipeline/stable_diffusion_3_image_generation_pipeline_driver.py
make_image_param(image)
prepare_pipeline(model, device)
Source code in griptape/drivers/image_generation_pipeline/stable_diffusion_3_image_generation_pipeline_driver.py
StableDiffusion3Img2ImgImageGenerationPipelineDriver
Bases: StableDiffusion3ImageGenerationPipelineDriver
Image generation model driver for Stable Diffusion 3 model image to image pipelines.
For more information, see the HuggingFace documentation for the StableDiffusion3Img2ImgPipeline: https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion_3/pipeline_stable_diffusion_3_img2img.py
Attributes:
| Name | Type | Description |
|---|---|---|
strength |
float | None
|
A value [0.0, 1.0] that determines the strength of the initial image in the output. |
Source code in griptape/drivers/image_generation_pipeline/stable_diffusion_3_img_2_img_image_generation_pipeline_driver.py
strength = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
make_additional_params(negative_prompts, device)
Source code in griptape/drivers/image_generation_pipeline/stable_diffusion_3_img_2_img_image_generation_pipeline_driver.py
make_image_param(image)
Source code in griptape/drivers/image_generation_pipeline/stable_diffusion_3_img_2_img_image_generation_pipeline_driver.py
prepare_pipeline(model, device)
Source code in griptape/drivers/image_generation_pipeline/stable_diffusion_3_img_2_img_image_generation_pipeline_driver.py
TavilyWebSearchDriver
Bases: BaseWebSearchDriver
Source code in griptape/drivers/web_search/tavily_web_search_driver.py
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
api_key = field(kw_only=True)
class-attribute
instance-attribute
params = field(factory=dict, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
client()
search(query, **kwargs)
Source code in griptape/drivers/web_search/tavily_web_search_driver.py
TrafilaturaWebScraperDriver
Bases: BaseWebScraperDriver
Source code in griptape/drivers/web_scraper/trafilatura_web_scraper_driver.py
include_links = field(default=True, kw_only=True)
class-attribute
instance-attribute
no_ssl = field(default=False, kw_only=True)
class-attribute
instance-attribute
extract_page(page)
Source code in griptape/drivers/web_scraper/trafilatura_web_scraper_driver.py
fetch_url(url)
Source code in griptape/drivers/web_scraper/trafilatura_web_scraper_driver.py
TwelveLabsEmbeddingDriver
Bases: BaseEmbeddingDriver
TwelveLabs Marengo Embedding Driver.
Generates multimodal embeddings with TwelveLabs' Marengo model. Marengo maps text, images, and video into the same 512-dimensional vector space, so text queries can be matched against visual content stored in a vector store.
Attributes:
| Name | Type | Description |
|---|---|---|
model |
str
|
TwelveLabs Marengo model name. Defaults to |
api_key |
str | None
|
TwelveLabs API key. Defaults to the |
client |
TwelveLabs
|
Optionally provide a custom |
Source code in griptape/drivers/embedding/twelvelabs_embedding_driver.py
DEFAULT_MODEL = 'marengo3.0'
class-attribute
instance-attribute
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
api_key = field(default=None, kw_only=True, metadata={'serializable': False})
class-attribute
instance-attribute
model = field(default=DEFAULT_MODEL, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
_extract_vector(result)
Source code in griptape/drivers/embedding/twelvelabs_embedding_driver.py
client()
try_embed_artifact(artifact, **kwargs)
Source code in griptape/drivers/embedding/twelvelabs_embedding_driver.py
try_embed_chunk(chunk, **kwargs)
VoyageAiEmbeddingDriver
Bases: BaseEmbeddingDriver
VoyageAI Embedding Driver.
Attributes:
| Name | Type | Description |
|---|---|---|
model |
str
|
VoyageAI embedding model name. Defaults to |
api_key |
str | None
|
API key to pass directly. Defaults to |
tokenizer |
VoyageAiTokenizer
|
Optionally provide custom |
client |
Any
|
Optionally provide custom VoyageAI |
input_type |
str
|
VoyageAI input type. Defaults to |
Source code in griptape/drivers/embedding/voyageai_embedding_driver.py
DEFAULT_MODEL = 'voyage-large-2'
class-attribute
instance-attribute
_client = field(default=None, kw_only=True, alias='client', metadata={'serializable': False})
class-attribute
instance-attribute
api_key = field(default=None, kw_only=True, metadata={'serializable': False})
class-attribute
instance-attribute
input_type = field(default='document', kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
model = field(default=DEFAULT_MODEL, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
tokenizer = field(default=Factory(lambda self: VoyageAiTokenizer(model=self.model, api_key=self.api_key), takes_self=True), kw_only=True)
class-attribute
instance-attribute
client()
try_embed_artifact(artifact, **kwargs)
Source code in griptape/drivers/embedding/voyageai_embedding_driver.py
WebhookEventListenerDriver
Bases: BaseEventListenerDriver