diff --git a/.github/workflows/docs-integration-tests.yml b/.github/workflows/docs-integration-tests.yml index 241c4a2ef..ce30f83bb 100644 --- a/.github/workflows/docs-integration-tests.yml +++ b/.github/workflows/docs-integration-tests.yml @@ -72,6 +72,7 @@ jobs: GOOGLE_AUTH_URI: ${{ secrets.INTEG_GOOGLE_AUTH_URI }} GOOGLE_TOKEN_URI: ${{ secrets.INTEG_GOOGLE_TOKEN_URI }} GOOGLE_AUTH_PROVIDER_X509_CERT_URL: ${{ secrets.INTEG_GOOGLE_AUTH_PROVIDER_X509_CERT_URL }} + GT_CLOUD_API_KEY: ${{ secrets.INTEG_GRIPTAPE_CLOUD_API_KEY }} GRIPTAPE_CLOUD_API_KEY: ${{ secrets.INTEG_GRIPTAPE_CLOUD_API_KEY }} GRIPTAPE_CLOUD_STRUCTURE_ID: ${{ secrets.INTEG_GRIPTAPE_CLOUD_STRUCTURE_ID }} GRIPTAPE_CLOUD_BASE_URL: ${{ secrets.INTEG_GRIPTAPE_CLOUD_BASE_URL }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 6483152d6..d146d815a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Native function calling support to `OpenAiChatPromptDriver`, `AzureOpenAiChatPromptDriver`, `AnthropicPromptDriver`, `AmazonBedrockPromptDriver`, `GooglePromptDriver`, and `CoherePromptDriver`. - `OllamaEmbeddingDriver` for generating embeddings with Ollama. - `GriptapeCloudKnowledgeBaseVectorStoreDriver` to query Griptape Cloud Knowledge Bases. +- `GriptapeCloudEventListenerDriver.api_key` defaults to the value in the `GT_CLOUD_API_KEY` environment variable. ### Changed - **BREAKING**: `BaseVectorStoreDriver.upsert_text_artifacts` optional arguments are now keyword-only arguments. diff --git a/docs/griptape-framework/drivers/event-listener-drivers.md b/docs/griptape-framework/drivers/event-listener-drivers.md index 4a85bc9a4..5e73f1a09 100644 --- a/docs/griptape-framework/drivers/event-listener-drivers.md +++ b/docs/griptape-framework/drivers/event-listener-drivers.md @@ -50,9 +50,9 @@ from griptape.drivers import GriptapeCloudEventListenerDriver from griptape.events import FinishStructureRunEvent from griptape.artifacts import TextArtifact -event_driver = GriptapeCloudEventListenerDriver( - api_key=os.environ["GRIPTAPE_CLOUD_API_KEY"] -) +# By default, GriptapeCloudEventListenerDriver uses the api key provided +# in the GT_CLOUD_API_KEY environment variable. +event_driver = GriptapeCloudEventListenerDriver() done_event = FinishStructureRunEvent( output_task_input=TextArtifact("Just started!"), @@ -173,9 +173,9 @@ agent = Agent( event_listeners=[ EventListener( event_types=[FinishStructureRunEvent], - driver=GriptapeCloudEventListenerDriver( - api_key=os.environ["GRIPTAPE_CLOUD_API_KEY"], - ), + # By default, GriptapeCloudEventListenerDriver uses the api key provided + # in the GT_CLOUD_API_KEY environment variable. + driver=GriptapeCloudEventListenerDriver(), ), ], ) diff --git a/griptape/drivers/event_listener/griptape_cloud_event_listener_driver.py b/griptape/drivers/event_listener/griptape_cloud_event_listener_driver.py index 2e208d786..cf9dd7bd2 100644 --- a/griptape/drivers/event_listener/griptape_cloud_event_listener_driver.py +++ b/griptape/drivers/event_listener/griptape_cloud_event_listener_driver.py @@ -24,7 +24,7 @@ class GriptapeCloudEventListenerDriver(BaseEventListenerDriver): default=Factory(lambda: os.getenv("GT_CLOUD_BASE_URL", "https://cloud.griptape.ai")), kw_only=True, ) - api_key: str = field(kw_only=True) + api_key: str = field(default=Factory(lambda: os.getenv("GT_CLOUD_API_KEY")), kw_only=True) headers: dict = field( default=Factory(lambda self: {"Authorization": f"Bearer {self.api_key}"}, takes_self=True), kw_only=True, diff --git a/griptape/tools/calculator/tool.py b/griptape/tools/calculator/tool.py index 141d1a333..e8fcb1ed4 100644 --- a/griptape/tools/calculator/tool.py +++ b/griptape/tools/calculator/tool.py @@ -21,7 +21,7 @@ class Calculator(BaseTool): }, ) def calculate(self, params: dict) -> BaseArtifact: - import numexpr + import numexpr # pyright: ignore[reportMissingImports] try: expression = params["values"]["expression"]