Skip to content

Commit

Permalink
Remove voyageai from anthropic drivers config
Browse files Browse the repository at this point in the history
  • Loading branch information
collindutter committed Oct 22, 2024
1 parent dab865a commit ccc87fe
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **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**: `AnthropicDriversConfig` no longer bundles `VoyageAiEmbeddingDriver`.
- Updated `EventListener.handler` return type to `Optional[BaseEvent | dict]`.
- `BaseTask.parent_outputs` type has changed from `dict[str, str | None]` to `dict[str, BaseArtifact]`.
- `Workflow.context["parent_outputs"]` type has changed from `dict[str, str | None]` to `dict[str, BaseArtifact]`.
Expand Down
36 changes: 35 additions & 1 deletion MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,40 @@

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

### `AnthropicDriversConfig` Embedding Driver

`AnthropicDriversConfig` no longer bundles `VoyageAiEmbeddingDriver`. If you rely on embeddings when using Anthropic, you must specify an Embedding Driver yourself.

#### Before

```python
from griptape.configs import Defaults
from griptape.configs.drivers import AnthropicDriversConfig
from griptape.structures import Agent

Defaults.drivers_config = AnthropicDriversConfig()

agent = Agent()
```

#### After

````python
from griptape.configs import Defaults
from griptape.configs.drivers import AnthropicDriversConfig
from griptape.drivers import VoyageAiEmbeddingDriver, LocalVectorStoreDriver

Defaults.drivers_config = AnthropicDriversConfig(
embedding_driver=VoyageAiEmbeddingDriver(),
vector_store_driver=LocalVectorStoreDriver(
embedding_driver=VoyageAiEmbeddingDriver()
)
)
```


## 0.33.X to 0.34.X

### Removed `CompletionChunkEvent`
Expand All @@ -21,7 +55,7 @@ def handler_fn_stream_text(event: CompletionChunkEvent) -> None:

EventListener(handler=handler_fn_stream, event_types=[CompletionChunkEvent])
EventListener(handler=handler_fn_stream_text, event_types=[CompletionChunkEvent])
```
````

#### After

Expand Down
1 change: 0 additions & 1 deletion docs/griptape-framework/structures/configs.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ The [Anthropic Driver config](../../reference/griptape/configs/drivers/anthropic

!!! info
Anthropic does not provide an embeddings API which means you will need to use another service for embeddings.
The `AnthropicDriversConfig` defaults to using `VoyageAiEmbeddingDriver` which integrates with [VoyageAI](https://www.voyageai.com/), the service used in Anthropic's [embeddings documentation](https://docs.anthropic.com/claude/docs/embeddings).
To override the default embedding driver, see: [Override Default Structure Embedding Driver](../drivers/embedding-drivers.md#override-default-structure-embedding-driver).

```python
Expand Down
10 changes: 0 additions & 10 deletions griptape/configs/drivers/anthropic_drivers_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
from griptape.drivers import (
AnthropicImageQueryDriver,
AnthropicPromptDriver,
LocalVectorStoreDriver,
VoyageAiEmbeddingDriver,
)
from griptape.utils.decorators import lazy_property

Expand All @@ -16,14 +14,6 @@ class AnthropicDriversConfig(DriversConfig):
def prompt_driver(self) -> AnthropicPromptDriver:
return AnthropicPromptDriver(model="claude-3-5-sonnet-20240620")

@lazy_property()
def embedding_driver(self) -> VoyageAiEmbeddingDriver:
return VoyageAiEmbeddingDriver(model="voyage-large-2")

@lazy_property()
def vector_store_driver(self) -> LocalVectorStoreDriver:
return LocalVectorStoreDriver(embedding_driver=VoyageAiEmbeddingDriver(model="voyage-large-2"))

@lazy_property()
def image_query_driver(self) -> AnthropicImageQueryDriver:
return AnthropicImageQueryDriver(model="claude-3-5-sonnet-20240620")

0 comments on commit ccc87fe

Please sign in to comment.