Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove voyageai from anthropic drivers config #1277

Merged
merged 2 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- 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**: Moved `griptape.common.observable.observable` to `griptape.common.decorators.observable`.
- **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
34 changes: 34 additions & 0 deletions 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()
)
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could add the agent line here, not really critical

```


## 0.33.X to 0.34.X

### Removed `CompletionChunkEvent`
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
4 changes: 2 additions & 2 deletions docs/griptape-tools/official-tools/prompt-summary-tool.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The [PromptSummaryTool](../../reference/griptape/tools/prompt_summary/tool.md) e
--8<-- "docs/griptape-tools/official-tools/src/prompt_summary_tool_1.py"
```

````
```
[08/12/24 15:54:46] INFO ToolkitTask 8be73eb542c44418ba880399044c017a
Input: How can I build Neovim from source for MacOS according to this https://github.com/neovim/neovim/blob/master/BUILD.md
[08/12/24 15:54:47] INFO Subtask cd362a149e1d400997be93c1342d1663
Expand Down Expand Up @@ -103,4 +103,4 @@ The [PromptSummaryTool](../../reference/griptape/tools/prompt_summary/tool.md) e

By following these steps, you should be able to build and install Neovim from source on macOS. For more detailed instructions and
troubleshooting tips, refer to the [BUILD.md](https://github.com/neovim/neovim/blob/master/BUILD.md) file in the Neovim repository.
````
```
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")
10 changes: 3 additions & 7 deletions tests/unit/configs/drivers/test_anthropic_drivers_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,12 @@ def test_to_dict(self, config):
"max_tokens": 256,
},
"embedding_driver": {
"type": "VoyageAiEmbeddingDriver",
"model": "voyage-large-2",
"input_type": "document",
"type": "DummyEmbeddingDriver",
},
"vector_store_driver": {
"type": "LocalVectorStoreDriver",
"type": "DummyVectorStoreDriver",
"embedding_driver": {
"type": "VoyageAiEmbeddingDriver",
"model": "voyage-large-2",
"input_type": "document",
"type": "DummyEmbeddingDriver",
},
},
"conversation_memory_driver": {
Expand Down
Loading