Skip to content

Commit

Permalink
Release/v0.32.0 (#1181)
Browse files Browse the repository at this point in the history
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Andrew French <[email protected]>
Co-authored-by: Matt Vallillo <[email protected]>
Co-authored-by: Kyle Roche <[email protected]>
Co-authored-by: dylanholmes <[email protected]>
Co-authored-by: Emily Danielson <[email protected]>
Co-authored-by: CJ Kindel <[email protected]>
Co-authored-by: Zach Giordano <[email protected]>
Co-authored-by: Vasily Vasinov <[email protected]>
Co-authored-by: hkhajgiwale <[email protected]>
Co-authored-by: Harsh Khajgiwale <[email protected]>
Co-authored-by: Anush <[email protected]>
Co-authored-by: datashaman <[email protected]>
Co-authored-by: Stefano Lottini <[email protected]>
Co-authored-by: James Clarendon <[email protected]>
Co-authored-by: Michal <[email protected]>
Co-authored-by: Ikko Eltociear Ashimine <[email protected]>
Co-authored-by: torabshaikh <[email protected]>
Co-authored-by: Aodhan Roche <[email protected]>
Co-authored-by: William Price <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: billytrend-cohere <[email protected]>
  • Loading branch information
1 parent 2ba3e92 commit 191dacb
Show file tree
Hide file tree
Showing 157 changed files with 1,510 additions and 972 deletions.
10 changes: 0 additions & 10 deletions .dependabot.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .github/actions/init-bare-environment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ runs:
- name: Checkout actions
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
- id: setup-python
name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
Expand Down
3 changes: 2 additions & 1 deletion .github/actions/init-environment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ runs:
- name: Checkout actions
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
- id: setup-python
name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
Expand Down
21 changes: 21 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: 2
updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
groups:
dependencies:
dependency-type: "production"
update-types:
- "minor"
- "patch"
group-dependencies:
dependency-type: "development"
update-types:
- "minor"
- "patch"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
10 changes: 5 additions & 5 deletions .github/workflows/code-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
python-version: ["3.12"]
steps:
- name: Checkout actions
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Init environment
uses: ./.github/actions/init-environment
- name: Run formatter
Expand All @@ -32,7 +32,7 @@ jobs:
python-version: [ "3.12" ]
steps:
- name: Checkout actions
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Init environment
uses: ./.github/actions/init-environment
- name: Run type checker
Expand All @@ -45,7 +45,7 @@ jobs:
python-version: [ "3.12" ]
steps:
- name: Checkout actions
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Init environment
uses: ./.github/actions/init-environment
- name: Run linter
Expand All @@ -58,7 +58,7 @@ jobs:
python-version: ["3.12"]
steps:
- name: Checkout actions
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Init environment
uses: ./.github/actions/init-environment
- name: Run unit tests
Expand All @@ -78,7 +78,7 @@ jobs:
python-version: [ "3.12" ]
steps:
- name: Checkout actions
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Init environment
uses: ./.github/actions/init-environment
- name: Run linter
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/docs-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ jobs:
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_ENDPOINT_4: ${{ secrets.INTEG_AZURE_OPENAI_ENDPOINT_4 }}
AZURE_OPENAI_API_KEY_4: ${{ secrets.INTEG_AZURE_OPENAI_API_KEY_4 }}
AZURE_OPENAI_35_TURBO_16K_DEPLOYMENT_ID: ${{ secrets.INTEG_OPENAI_35_TURBO_16K_DEPLOYMENT_ID }}
AZURE_OPENAI_35_TURBO_DEPLOYMENT_ID: ${{ secrets.INTEG_OPENAI_35_TURBO_DEPLOYMENT_ID }}
AZURE_OPENAI_DAVINCI_DEPLOYMENT_ID: ${{ secrets.INTEG_OPENAI_DAVINCI_DEPLOYMENT_ID }}
Expand Down Expand Up @@ -137,7 +139,7 @@ jobs:
--health-retries 5
steps:
- name: Checkout actions
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Init environment
uses: ./.github/actions/init-environment
- name: Run integration tests
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout actions
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Init environment
uses: ./.github/actions/init-environment
- name: Run unit tests
Expand All @@ -32,7 +32,7 @@ jobs:
python-version: ["3.9"]
steps:
- name: Checkout actions
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Init environment
uses: ./.github/actions/init-bare-environment
- name: Run unit tests
Expand All @@ -48,7 +48,7 @@ jobs:
shell: bash
steps:
- name: Checkout actions
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Init environment
uses: ./.github/actions/init-environment
- name: Run unit tests
Expand Down
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,38 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

## [0.32.0] - 2024-09-17

### Added
- `BaseArtifact.to_bytes()` method to convert an Artifact's value to bytes.
- `BlobArtifact.base64` property for converting a `BlobArtifact`'s value to a base64 string.
- `CsvLoader`/`SqlLoader`/`DataframeLoader` `formatter_fn` field for customizing how SQL results are formatted into `TextArtifact`s.
- `AzureOpenAiTextToSpeechDriver`.
- `JsonSchemaRule` for instructing the LLM to output a JSON object that conforms to a schema.
- Ability to use Event Listeners as Context Managers for temporarily setting the Event Bus listeners.
- Ability to use Drivers Configs as Context Managers for temporarily setting the default Drivers.
- Generic type support to `ListArtifact`.
- Iteration support to `ListArtifact`.


### Changed
- **BREAKING**: Removed `CsvRowArtifact`. Use `TextArtifact` instead.
- **BREAKING**: Removed `MediaArtifact`, use `ImageArtifact` or `AudioArtifact` instead.
- **BREAKING**: `CsvLoader`, `DataframeLoader`, and `SqlLoader` now return `list[TextArtifact]`.
- **BREAKING**: Removed `ImageArtifact.media_type`.
- **BREAKING**: Removed `AudioArtifact.media_type`.
- **BREAKING**: Removed `BlobArtifact.dir_name`.
- **BREAKING**: Moved `ImageArtifact.prompt` and `ImageArtifact.model` into `ImageArtifact.meta`.
- **BREAKING**: `ImageArtifact.format` is now required.
- **BREAKING**: Removed the `__all__` declaration from the `griptape.mixins` module.
- Updated `JsonArtifact` value converter to properly handle more types.
- `AudioArtifact` now subclasses `BlobArtifact` instead of `MediaArtifact`.
- `ImageArtifact` now subclasses `BlobArtifact` instead of `MediaArtifact`.
- Removed `__add__` method from `BaseArtifact`, implemented it where necessary.

### Fixed
- Crash when passing "empty" Artifacts or no Artifacts to `CohereRerankDriver`.

## [0.31.0] - 2024-09-03

**Note**: This release includes breaking changes. Please refer to the [Migration Guide](./MIGRATION.md#030x-to-031x) for details.
Expand Down
136 changes: 136 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,142 @@
# Migration Guide

This document provides instructions for migrating your codebase to accommodate breaking changes introduced in new versions of Griptape.
## 0.31.X to 0.32.X

### Removed `MediaArtifact`

`MediaArtifact` has been removed. Use `ImageArtifact` or `AudioArtifact` instead.

#### Before

```python
image_media = MediaArtifact(
b"image_data",
media_type="image",
format="jpeg"
)

audio_media = MediaArtifact(
b"audio_data",
media_type="audio",
format="wav"
)
```

#### After
```python
image_artifact = ImageArtifact(
b"image_data",
format="jpeg"
)

audio_artifact = AudioArtifact(
b"audio_data",
format="wav"
)
```

### `ImageArtifact.format` is now required

`ImageArtifact.format` is now a required parameter. Update any code that does not provide a `format` parameter.

#### Before

```python
image_artifact = ImageArtifact(
b"image_data"
)
```

#### After
```python
image_artifact = ImageArtifact(
b"image_data",
format="jpeg"
)
```

### Removed `CsvRowArtifact`

`CsvRowArtifact` has been removed. Use `TextArtifact` instead.

#### Before

```python
artifact = CsvRowArtifact({"name": "John", "age": 30})
print(artifact.value) # {"name": "John", "age": 30}
print(type(artifact.value)) # <class 'dict'>
```

#### After
```python
artifact = TextArtifact("name: John\nage: 30")
print(artifact.value) # name: John\nage: 30
print(type(artifact.value)) # <class 'str'>
```

If you require storing a dictionary as an Artifact, you can use `GenericArtifact` instead.

### `CsvLoader`, `DataframeLoader`, and `SqlLoader` return types

`CsvLoader`, `DataframeLoader`, and `SqlLoader` now return a `list[TextArtifact]` instead of `list[CsvRowArtifact]`.

If you require a dictionary, set a custom `formatter_fn` and then parse the text to a dictionary.

#### Before

```python
results = CsvLoader().load(Path("people.csv").read_text())

print(results[0].value) # {"name": "John", "age": 30}
print(type(results[0].value)) # <class 'dict'>
```

#### After
```python
results = CsvLoader().load(Path("people.csv").read_text())

print(results[0].value) # name: John\nAge: 30
print(type(results[0].value)) # <class 'str'>

# Customize formatter_fn
results = CsvLoader(formatter_fn=lambda x: json.dumps(x)).load(Path("people.csv").read_text())
print(results[0].value) # {"name": "John", "age": 30}
print(type(results[0].value)) # <class 'str'>

dict_results = [json.loads(result.value) for result in results]
print(dict_results[0]) # {"name": "John", "age": 30}
print(type(dict_results[0])) # <class 'dict'>
```

### Moved `ImageArtifact.prompt` and `ImageArtifact.model` to `ImageArtifact.meta`

`ImageArtifact.prompt` and `ImageArtifact.model` have been moved to `ImageArtifact.meta`.

#### Before

```python
image_artifact = ImageArtifact(
b"image_data",
format="jpeg",
prompt="Generate an image of a cat",
model="DALL-E"
)

print(image_artifact.prompt, image_artifact.model) # Generate an image of a cat, DALL-E
```

#### After
```python
image_artifact = ImageArtifact(
b"image_data",
format="jpeg",
meta={"prompt": "Generate an image of a cat", "model": "DALL-E"}
)

print(image_artifact.meta["prompt"], image_artifact.meta["model"]) # Generate an image of a cat, DALL-E
```


## 0.30.X to 0.31.X

Expand Down
8 changes: 7 additions & 1 deletion docs/griptape-cloud/data-sources/create-data-source.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ You can connect to your personal or company Confluence by providing a URL, [Atla

You can specify a [Structure](../structures/create-structure.md) to run as a Data Source as long as your Structure returns a [`TextArtifact` or `ListArtifact` from the Griptape Framework](../../griptape-framework/data/artifacts.md). You can use this as a way to build custom Data Sources.

## Other Data Source Types
### Other Data Source Types

If you do not see a Data Source configuration you'd wish to use, you can submit a request via [Discord](https://discord.gg/gnWRz88eym) or `[email protected]`.

## Adding Structure as Transform to Data Source (Experimental)

When creating any Data Source, you can optionally specify a [Structure](../structures/create-structure.md) to run as a transform step of your data ingetstion before loading into the vector store. Ensure the Structure you select to run as a transform is configured to take in a `ListArtifact` as its first positional argument and returns either a `TextArtifact` or `ListArtifact`.

Take a look at the [Find and Replace Sample Structure](https://github.com/griptape-ai/griptape-sample-structures/tree/main/griptape-find-replace-transform) for more details on how to implement this for your own Structure.
Loading

0 comments on commit 191dacb

Please sign in to comment.