Skip to content

Commit

Permalink
Version bump v0.26.0 (#829)
Browse files Browse the repository at this point in the history
Co-authored-by: dylanholmes <4370153+dylanholmes@users.noreply.github.com>
Co-authored-by: CJ Kindel <cjkindel@users.noreply.github.com>
Co-authored-by: Andrew French <andrew@afren.ch>
Co-authored-by: Vasily Vasinov <vasily@griptape.ai>
Co-authored-by: Matt Vallillo <matt@griptape.ai>
Co-authored-by: Michal <salin87@gmail.com>
Co-authored-by: Zach Giordano <32624672+zachgiordano@users.noreply.github.com>
Co-authored-by: Ikko Eltociear Ashimine <eltociear@gmail.com>
Co-authored-by: torabshaikh <torab.shaikh@gmail.com>
Co-authored-by: Aodhan Roche <aodhan@griptape.ai>
Co-authored-by: Kyle Roche <kyleroche@users.noreply.github.com>
Co-authored-by: Emily Danielson <2302515+emjay07@users.noreply.github.com>
  • Loading branch information
13 people authored Jun 4, 2024
1 parent a83fe51 commit 6056209
Show file tree
Hide file tree
Showing 414 changed files with 6,027 additions and 3,611 deletions.
45 changes: 41 additions & 4 deletions .github/workflows/code-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,67 @@ on:
pull_request:
branches: [ "main", "dev" ]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
format:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9"]
python-version: ["3.12"]
steps:
- name: Checkout actions
uses: actions/checkout@v3
- name: Init environment
uses: ./.github/actions/init-environment
- name: Run formatter
run: poetry run black --check .
run: make check/format
type-check:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ "3.9" ]
python-version: [ "3.12" ]
steps:
- name: Checkout actions
uses: actions/checkout@v3
- name: Init environment
uses: ./.github/actions/init-environment
- name: Run type checker
run: poetry run pyright griptape/
run: make check/types
lint:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ "3.12" ]
steps:
- name: Checkout actions
uses: actions/checkout@v3
- name: Init environment
uses: ./.github/actions/init-environment
- name: Run linter
run: make check/lint
coverage:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.12"]
steps:
- name: Checkout actions
uses: actions/checkout@v3
- name: Init environment
uses: ./.github/actions/init-environment
- name: Run unit tests
run: make test/unit/coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
flags: smart-tests
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
30 changes: 25 additions & 5 deletions .github/workflows/docs-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,18 @@ name: Docs Integration Tests
on:
pull_request_review:
types: [submitted]
push:
branches:
- main
- dev

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
test:
if: github.event.review.state == 'APPROVED'
if: github.event.review.state == 'APPROVED' || github.event_name == 'push'
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down Expand Up @@ -66,15 +75,20 @@ jobs:
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 }}
GRIPTAPE_CLOUD_KB_ID: ${{ secrets.INTEG_GRIPTAPE_CLOUD_KB_ID }}
OPENWEATHER_API_KEY: ${{ secrets.INTEG_OPENWEATHER_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.INTEG_ANTHROPIC_API_KEY }}
SAGEMAKER_LLAMA_ENDPOINT_NAME: ${{ secrets.INTEG_LLAMA_ENDPOINT_NAME }}
SAGEMAKER_LLAMA_3_INSTRUCT_ENDPOINT_NAME: ${{ secrets.SAGEMAKER_LLAMA_3_INSTRUCT_ENDPOINT_NAME }}
SAGEMAKER_LLAMA_3_INSTRUCT_INFERENCE_COMPONENT_NAME: ${{ secrets.SAGEMAKER_LLAMA_3_INSTRUCT_INFERENCE_COMPONENT_NAME }}
SAGEMAKER_FALCON_ENDPOINT_NAME: ${{ secrets.INTEG_FALCON_ENDPOINT_NAME }}
SAGEMAKER_FALCON_INFERENCE_COMPONENT_NAME: ${{ secrets.INTEG_FALCON_INFERENCE_COMPONENT_NAME }}
HUGGINGFACE_HUB_ACCESS_TOKEN: ${{ secrets.INTEG_HUGGINGFACE_HUB_ACCESS_TOKEN }}
AZURE_OPENAI_ENDPOINT_1: ${{ secrets.INTEG_AZURE_OPENAI_ENDPOINT_1 }}
AZURE_OPENAI_API_KEY_1: ${{ secrets.INTEG_AZURE_OPENAI_API_KEY_1 }}
AZURE_OPENAI_ENDPOINT_2: ${{ secrets.INTEG_AZURE_OPENAI_ENDPOINT_2 }}
AZURE_OPENAI_API_KEY_2: ${{ secrets.INTEG_AZURE_OPENAI_API_KEY_2 }}
AZURE_OPENAI_ENDPOINT_3: ${{ secrets.INTEG_AZURE_OPENAI_ENDPOINT_3 }}
AZURE_OPENAI_API_KEY_3: ${{ secrets.INTEG_AZURE_OPENAI_API_KEY_3 }}
AZURE_OPENAI_35_TURBO_16K_DEPLOYMENT_ID: ${{ secrets.INTEG_OPENAI_35_TURBO_16K_DEPLOYMENT_ID }}
AZURE_OPENAI_DAVINCI_DEPLOYMENT_ID: ${{ secrets.INTEG_OPENAI_DAVINCI_DEPLOYMENT_ID }}
AZURE_OPENAI_4_DEPLOYMENT_ID: ${{ secrets.INTEG_OPENAI_4_DEPLOYMENT_ID }}
Expand All @@ -100,6 +114,11 @@ jobs:
GT_CLOUD_STRUCTURE_RUN_ID: ${{ secrets.INTEG_GT_CLOUD_STRUCTURE_RUN_ID }}
AWS_IOT_CORE_ENDPOINT: ${{ secrets.INTEG_AWS_IOT_CORE_ENDPOINT }}
AWS_IOT_CORE_TOPIC: ${{ secrets.INTEG_AWS_IOT_CORE_TOPIC }}
ELEVEN_LABS_API_KEY: ${{ secrets.INTEG_ELEVEN_LABS_API_KEY }}
PUSHER_APP_ID: ${{ secrets.INTEG_PUSHER_APP_ID }}
PUSHER_KEY: ${{ secrets.INTEG_PUSHER_KEY }}
PUSHER_SECRET: ${{ secrets.INTEG_PUSHER_SECRET }}
PUSHER_CLUSTER: ${{ secrets.INTEG_PUSHER_CLUSTER }}
services:
postgres:
image: ankane/pgvector:v0.5.0
Expand All @@ -122,6 +141,7 @@ jobs:
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44
if: github.event_name == 'pull_request_review'
with:
files: |
**.md
Expand All @@ -133,7 +153,7 @@ jobs:
echo "$file was changed"
done
- name: Run integration tests
if: steps.changed-files.outputs.any_changed == 'true'
run: pytest -n auto tests/integration/test_code_blocks.py
if: steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'push'
run: make test/integration
env:
DOCS_ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
DOCS_ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files || '' }}
4 changes: 4 additions & 0 deletions .github/workflows/pull-request-links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
paths:
- "docs/**"

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions:
pull-requests: write

Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
pull_request:
branches: [ "main", "dev" ]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-latest
Expand All @@ -19,4 +23,4 @@ jobs:
- name: Init environment
uses: ./.github/actions/init-environment
- name: Run unit tests
run: pytest -n auto tests/unit
run: make test/unit
29 changes: 21 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
repos:
- repo: https://github.com/ambv/black
rev: 23.7.0
hooks:
- id: black
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
hooks:
- id: pyupgrade
args: [--py39-plus, --keep-runtime-typing]
- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.355
hooks:
- id: pyright
- repo: local
hooks:
- id: ruff-lint
name: Ruff
entry: make lint
language: system
types: [python]
- repo: local
hooks:
- id: ruff-format
name: Ruff
entry: make format
language: system
types: [python]
- repo: local
hooks:
- id: pyright
name: Pyright
entry: make check/types
language: system
types: [python]
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

## [0.26.0] - 2024-06-04

### Added
- `AzureOpenAiStructureConfig` for providing Structures with all Azure OpenAI Driver configuration.
- `AzureOpenAiVisionImageQueryDriver` to support queries on images using Azure's OpenAI Vision models.
- `AudioLoader` for loading audio content into an `AudioArtifact`.
- `AudioTranscriptionTask` and `AudioTranscriptionClient` for transcribing audio content in Structures.
- `OpenAiAudioTranscriptionDriver` for integration with OpenAI's speech-to-text models, including Whisper.
- Parameter `env` to `BaseStructureRunDriver` to set environment variables for a Structure Run.
- `PusherEventListenerDriver` to enable sending of framework events over a Pusher WebSocket.

### Changed
- **BREAKING**: Removed `StructureConfig.global_drivers`. Pass Drivers directly to the Structure Config instead.
- **BREAKING**: Removed `StructureConfig.task_memory` in favor of configuring directly on the Structure.
- **BREAKING**: Updated OpenAI-based image query drivers to remove Vision from the name.
- **BREAKING**: `off_prompt` now defaults to `False` on all Tools, making Task Memory something that must be explicitly opted into.
- **BREAKING**: `AmazonSageMakerPromptDriver.model` parameter, which gets passed to `SageMakerRuntime.Client.invoke_endpoint` as `EndpointName`, is now renamed to `AmazonSageMakerPromptDriver.endpoint`.
- **BREAKING**: `AmazonSageMakerPromptDriver.model` parameter is now optional being passed to `SageMakerRuntime.Client.invoke_endpoint` as `InferenceComponentName` (instead of `EndpointName`).
- **BREAKING**: `SageMakerLlamaPromptModelDriver` modified to exclusively support the Llama 3 Instruct model deployed via SageMaker JumpStart. (Support for Llama 2 models has been removed.)
- Simplified custom Task Memory configurations by making several `TextArtifactStorage` Engines optional.
- Default the value of `azure_deployment` on all Azure Drivers to the model the Driver is using.
- Field `azure_ad_token` on all Azure Drivers is no longer serializable.
- Default standard OpenAI and Azure OpenAI image query model to `gpt-4o`.
- Error message to be more helpful when importing optional dependencies.

### Fixed
- Extra fields being excluded when using `SerializableMixin.from_dict`.

## [0.25.1] - 2024-05-15

### Fixed
Expand Down
42 changes: 42 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,48 @@ publish: ## Push git tag and publish version to PyPI.
@poetry build
@poetry publish

.PHONY: install
install: ## Install all dependencies.
@poetry install --with dev --with test --with docs --all-extras

.PHONY: test
test: test/unit test/integration ## Run all tests.

.PHONY: test/unit
test/unit: ## Run unit tests.
@poetry run pytest -n auto tests/unit

.PHONY: test/unit/coverage
test/unit/coverage:
@poetry run pytest -n auto --cov=griptape tests/unit

.PHONY: test/integration
test/integration:
@poetry run pytest -n auto tests/integration/test_code_blocks.py

.PHONY: lint
lint: ## Lint project.
@poetry run ruff check --fix griptape/

.PHONY: format
format: ## Format project.
@poetry run ruff format .

.PHONY: check
check: check/format check/lint check/types ## Run all checks.

.PHONY: check/format
check/format:
@poetry run ruff format --check griptape/

.PHONY: check/lint
check/lint:
@poetry run ruff check griptape/

.PHONY: check/types
check/types:
@poetry run pyright griptape/

.DEFAULT_GOAL := help
.PHONY: help
help: ## Print Makefile help text.
Expand Down
27 changes: 17 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
[![Tests](https://github.com/griptape-ai/griptape/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/griptape-ai/griptape/actions/workflows/unit-tests.yml)
[![Docs](https://readthedocs.org/projects/griptape/badge/)](https://griptape.readthedocs.io/)
[![Checked with pyright](https://microsoft.github.io/pyright/img/pyright_badge.svg)](https://microsoft.github.io/pyright/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![codecov](https://codecov.io/github/griptape-ai/griptape/graph/badge.svg?token=HUBqUpl3NB)](https://codecov.io/github/griptape-ai/griptape)
[![Griptape Discord](https://dcbadge.vercel.app/api/server/gnWRz88eym?compact=true&style=flat)](https://discord.gg/gnWRz88eym)

Griptape is a modular Python framework for building AI-powered applications that securely connect to your enterprise data and APIs. It offers developers the ability to maintain control and flexibility at every step.
Expand Down Expand Up @@ -93,9 +94,9 @@ from griptape.tools import WebScraper, FileManager, TaskMemoryClient
agent = Agent(
input_template="Load {{ args[0] }}, summarize it, and store it in a file called {{ args[1] }}.",
tools=[
WebScraper(),
FileManager(),
TaskMemoryClient(off_prompt=True)
WebScraper(off_prompt=True),
TaskMemoryClient(off_prompt=True),
FileManager()
]
)
agent.run("https://griptape.ai", "griptape.txt")
Expand Down Expand Up @@ -141,13 +142,13 @@ And here is the output:
Output: The summarized content of the website https://griptape.ai has been successfully saved to a file named 'griptape.txt'.
```

During the run, the Griptape Agent loaded a webpage with a **Tool**, stored its full content in **Task Memory**, queried it to answer the original question, and finally saved the answer to a file.
During the run, the Griptape Agent loaded a webpage with a [Tool](https://docs.griptape.ai/stable/griptape-tools/), stored its full content in [Task Memory](https://docs.griptape.ai/stable/griptape-framework/structures/task-memory.md), queried it to answer the original question, and finally saved the answer to a file.

The important thing to note here is that no matter how big the webpage is it can never blow up the prompt token limit because the full content of the page never goes back to the LLM. Additionally, no data from the subsequent subtasks were returned back to the prompt either. So, how does it work?

All Tools have the `off_prompt` property enabled be default. Disabling it (`off_prompt=False`) will force the framework to return all tool outputs directly to the LLM prompt. `TaskMemoryClient` requires the user to set this property explicitly for usability reasons. In the above example, we set `off_prompt` to `True`, which means that the LLM can never see the data it manipulates, but can send it to other Tools.
In the above example, we set [off_prompt](https://docs.griptape.ai/stable/griptape-framework/structures/task-memory.md#off-prompt) to `True`, which means that the LLM can never see the data it manipulates, but can send it to other Tools.

[Check out our docs](https://docs.griptape.ai/latest/griptape-framework/drivers/prompt-drivers/) to learn more about how to use Griptape with other LLM providers like Anthropic, Claude, Hugging Face, and Azure.
[Check out our docs](https://docs.griptape.ai/stable/griptape-framework/drivers/prompt-drivers/) to learn more about how to use Griptape with other LLM providers like Anthropic, Claude, Hugging Face, and Azure.

## Versioning

Expand Down Expand Up @@ -179,14 +180,20 @@ We welcome and encourage pull requests. To streamline the process, please follow

4. **Documentation:** Every pull request must include updates to documentation or explicitly explain why a documentation update is not required. Documentation is crucial for maintaining a comprehensive and user-friendly project.

5. **Code Style:** Griptape uses [Black](https://github.com/ambv/black) to enforce style guidelines. You can ensure that your code is formatted accordingly and will pass formatting checks using `pre-commit`. See [Tools](#tools) for information on how to configure this and other dev tools.
5. **Code Style:** Griptape uses [Ruff](https://github.com/astral-sh/ruff) to enforce style guidelines. You can ensure that your code is formatted accordingly and will pass formatting checks using `pre-commit`. See [Tools](#tools) for information on how to configure this and other dev tools.

### Tools

Install dev dependencies with Poetry:
Install dev dependencies via Make:

```shell
poetry install --all-extras --with dev --with test
make install
```

Or install by calling Poetry directly:

```shell
poetry install --all-extras --with dev --with test --with docs
```

Configure pre-commit to ensure that your code is formatted correctly and passes all checks:
Expand Down
1 change: 0 additions & 1 deletion docs/examples/load-query-and-chat-marqo.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ vector_store_tool = VectorStoreClient(
description="Contains information about the Griptape Framework from www.griptape.ai",
query_engine=query_engine,
namespace=namespace,
off_prompt=False
)

# Load artifacts from the web
Expand Down
1 change: 0 additions & 1 deletion docs/examples/multi-agent-workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ def build_researcher():
WebSearch(
google_api_key=os.environ["GOOGLE_API_KEY"],
google_api_search_id=os.environ["GOOGLE_API_SEARCH_ID"],
off_prompt=False,
),
WebScraper(
off_prompt=True,
Expand Down
Loading

0 comments on commit 6056209

Please sign in to comment.