Skip to content

Commit

Permalink
Update migration guide (#1296)
Browse files Browse the repository at this point in the history
  • Loading branch information
collindutter authored Oct 29, 2024
1 parent 79af0ef commit 90311a2
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 6 deletions.
5 changes: 2 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- **BREAKING**: Removed `BaseEventListener.publish_event` `flush` argument. Use `BaseEventListener.flush_events()` instead.
- **BREAKING**: Removed `BaseEventListenerDriver.publish_event` `flush` argument. Use `BaseEventListenerDriver.flush_events()` instead.
- **BREAKING**: Renamed parameter `driver` on `EventListener` to `event_listener_driver`.
- **BREAKING**: Changed default value of parameter `handler` on `EventListener` to `None`.
- **BREAKING**: Updated `EventListener.handler` return value behavior.
- **BREAKING**: Removed `CompletionChunkEvent`.
- If `EventListener.handler` returns `None`, the event will not be published to the `event_listener_driver`.
- If `EventListener.handler` is None, the event will be published to the `event_listener_driver` as-is.
- **BREAKING**: Removed `CompletionChunkEvent`.
- **BREAKING**: Moved `griptape.common.observable.observable` to `griptape.common.decorators.observable`.
- **BREAKING**: `AnthropicDriversConfig` no longer bundles `VoyageAiEmbeddingDriver`.
- **BREAKING**: Removed `HuggingFaceHubPromptDriver.params`, use `HuggingFaceHubPromptDriver.extra_params` instead.
Expand Down
79 changes: 76 additions & 3 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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

## 0.34.X to 0.35.X
## 0.33.X to 0.34.X

### `AnthropicDriversConfig` Embedding Driver

Expand Down Expand Up @@ -35,8 +35,6 @@ Defaults.drivers_config = AnthropicDriversConfig(
)
```

## 0.33.X to 0.34.X

### Removed `CompletionChunkEvent`

`CompletionChunkEvent` has been removed. There is now `BaseChunkEvent` with children `TextChunkEvent` and `ActionChunkEvent`. `BaseChunkEvent` can replace `completion_chunk_event.token` by doing `str(base_chunk_event)`.
Expand Down Expand Up @@ -122,6 +120,81 @@ EventListener(handler=handler_fn_return_dict, event_listener_driver=driver)
EventListener(handler=handler_fn_return_base_event, event_listener_driver=driver)
```

### Removed `BaseEventListener.publish_event` `flush` argument.

`BaseEventListenerDriver.publish_event` no longer takes a `flush` argument. If you need to flush the event, call `BaseEventListenerDriver.flush_events` directly.

#### Before

```python
event_listener_driver.publish_event(event, flush=True)
```

#### After

```python
event_listener_driver.publish_event(event)
event_listener_driver.flush_events()
```

### Moved `observable` decorator location.

The `observable` decorator has been moved to `griptape.common.decorators`. Update your imports accordingly.


#### Before

```python
from griptape.common.observable import observable
```

#### After

```python
from griptape.common.decorators import observable
```

### Removed `HuggingFacePipelinePromptDriver.params`

`HuggingFacePipelinePromptDriver.params` has been removed. Use `HuggingFacePipelinePromptDriver.extra_params` instead.

#### Before

```python
driver = HuggingFacePipelinePromptDriver(
params={"max_length": 50}
)
```

#### After

```python
driver = HuggingFacePipelinePromptDriver(
extra_params={"max_length": 50}
)
```

### Renamed `execute` to `run` in several places

`execute` has been renamed to `run` in several places. Update your code accordingly.


#### Before

```python
task = PromptTask()
if task.can_execute():
task.execute()
```

#### After

```python
task = PromptTask()
if task.can_run():
task.run()
```

## 0.32.X to 0.33.X

### Removed `DataframeLoader`
Expand Down

0 comments on commit 90311a2

Please sign in to comment.