From cef72ee947694469ded97c2d7fb958ae73c2f7a3 Mon Sep 17 00:00:00 2001 From: Collin Dutter Date: Thu, 18 Jul 2024 09:35:55 -0700 Subject: [PATCH] Rename EventsMixin --- .../audio_transcription/base_audio_transcription_driver.py | 4 ++-- griptape/drivers/embedding/base_embedding_driver.py | 4 ++-- .../drivers/image_generation/base_image_generation_driver.py | 4 ++-- griptape/drivers/image_query/base_image_query_driver.py | 4 ++-- .../memory/conversation/base_conversation_memory_driver.py | 4 ++-- griptape/drivers/prompt/base_prompt_driver.py | 4 ++-- griptape/drivers/text_to_speech/base_text_to_speech_driver.py | 4 ++-- griptape/drivers/vector/base_vector_store_driver.py | 4 ++-- griptape/mixins/__init__.py | 4 ++-- griptape/mixins/events_mixin.py | 2 +- griptape/structures/structure.py | 4 ++-- 11 files changed, 21 insertions(+), 21 deletions(-) diff --git a/griptape/drivers/audio_transcription/base_audio_transcription_driver.py b/griptape/drivers/audio_transcription/base_audio_transcription_driver.py index 405324f197..c81ea1d5b0 100644 --- a/griptape/drivers/audio_transcription/base_audio_transcription_driver.py +++ b/griptape/drivers/audio_transcription/base_audio_transcription_driver.py @@ -6,14 +6,14 @@ from attrs import define, field from griptape.events import FinishAudioTranscriptionEvent, StartAudioTranscriptionEvent -from griptape.mixins import EventsMixin, ExponentialBackoffMixin, SerializableMixin +from griptape.mixins import EventPublisherMixin, ExponentialBackoffMixin, SerializableMixin if TYPE_CHECKING: from griptape.artifacts import AudioArtifact, TextArtifact @define -class BaseAudioTranscriptionDriver(EventsMixin, SerializableMixin, ExponentialBackoffMixin, ABC): +class BaseAudioTranscriptionDriver(EventPublisherMixin, SerializableMixin, ExponentialBackoffMixin, ABC): model: str = field(kw_only=True, metadata={"serializable": True}) def before_run(self) -> None: diff --git a/griptape/drivers/embedding/base_embedding_driver.py b/griptape/drivers/embedding/base_embedding_driver.py index 3e1c99f777..690726060b 100644 --- a/griptape/drivers/embedding/base_embedding_driver.py +++ b/griptape/drivers/embedding/base_embedding_driver.py @@ -7,7 +7,7 @@ from attrs import define, field from griptape.chunkers import BaseChunker, TextChunker -from griptape.mixins import EventsMixin, ExponentialBackoffMixin, SerializableMixin +from griptape.mixins import EventPublisherMixin, ExponentialBackoffMixin, SerializableMixin if TYPE_CHECKING: from griptape.artifacts import TextArtifact @@ -15,7 +15,7 @@ @define -class BaseEmbeddingDriver(EventsMixin, SerializableMixin, ExponentialBackoffMixin, ABC): +class BaseEmbeddingDriver(EventPublisherMixin, SerializableMixin, ExponentialBackoffMixin, ABC): """Base Embedding Driver. Attributes: diff --git a/griptape/drivers/image_generation/base_image_generation_driver.py b/griptape/drivers/image_generation/base_image_generation_driver.py index 5deadc402e..f500d6d094 100644 --- a/griptape/drivers/image_generation/base_image_generation_driver.py +++ b/griptape/drivers/image_generation/base_image_generation_driver.py @@ -6,14 +6,14 @@ from attrs import define, field from griptape.events import FinishImageGenerationEvent, StartImageGenerationEvent -from griptape.mixins import EventsMixin, ExponentialBackoffMixin, SerializableMixin +from griptape.mixins import EventPublisherMixin, ExponentialBackoffMixin, SerializableMixin if TYPE_CHECKING: from griptape.artifacts import ImageArtifact @define -class BaseImageGenerationDriver(EventsMixin, SerializableMixin, ExponentialBackoffMixin, ABC): +class BaseImageGenerationDriver(EventPublisherMixin, SerializableMixin, ExponentialBackoffMixin, ABC): model: str = field(kw_only=True, metadata={"serializable": True}) def before_run(self, prompts: list[str], negative_prompts: Optional[list[str]] = None) -> None: diff --git a/griptape/drivers/image_query/base_image_query_driver.py b/griptape/drivers/image_query/base_image_query_driver.py index 19b1ff73c4..b39f198d4e 100644 --- a/griptape/drivers/image_query/base_image_query_driver.py +++ b/griptape/drivers/image_query/base_image_query_driver.py @@ -6,14 +6,14 @@ from attrs import define, field from griptape.events import FinishImageQueryEvent, StartImageQueryEvent -from griptape.mixins import EventsMixin, ExponentialBackoffMixin, SerializableMixin +from griptape.mixins import EventPublisherMixin, ExponentialBackoffMixin, SerializableMixin if TYPE_CHECKING: from griptape.artifacts import ImageArtifact, TextArtifact @define -class BaseImageQueryDriver(EventsMixin, SerializableMixin, ExponentialBackoffMixin, ABC): +class BaseImageQueryDriver(EventPublisherMixin, SerializableMixin, ExponentialBackoffMixin, ABC): max_tokens: int = field(default=256, kw_only=True, metadata={"serializable": True}) def before_run(self, query: str, images: list[ImageArtifact]) -> None: diff --git a/griptape/drivers/memory/conversation/base_conversation_memory_driver.py b/griptape/drivers/memory/conversation/base_conversation_memory_driver.py index 9344668339..f13b82c29b 100644 --- a/griptape/drivers/memory/conversation/base_conversation_memory_driver.py +++ b/griptape/drivers/memory/conversation/base_conversation_memory_driver.py @@ -3,13 +3,13 @@ from abc import ABC, abstractmethod from typing import TYPE_CHECKING, Optional -from griptape.mixins import EventsMixin, SerializableMixin +from griptape.mixins import EventPublisherMixin, SerializableMixin if TYPE_CHECKING: from griptape.memory.structure import BaseConversationMemory -class BaseConversationMemoryDriver(EventsMixin, SerializableMixin, ABC): +class BaseConversationMemoryDriver(EventPublisherMixin, SerializableMixin, ABC): @abstractmethod def store(self, memory: BaseConversationMemory) -> None: ... diff --git a/griptape/drivers/prompt/base_prompt_driver.py b/griptape/drivers/prompt/base_prompt_driver.py index 8de958f24e..e5fd0408d4 100644 --- a/griptape/drivers/prompt/base_prompt_driver.py +++ b/griptape/drivers/prompt/base_prompt_driver.py @@ -17,7 +17,7 @@ observable, ) from griptape.events import CompletionChunkEvent, FinishPromptEvent, StartPromptEvent -from griptape.mixins import EventsMixin, ExponentialBackoffMixin, SerializableMixin +from griptape.mixins import EventPublisherMixin, ExponentialBackoffMixin, SerializableMixin if TYPE_CHECKING: from collections.abc import Iterator @@ -26,7 +26,7 @@ @define(kw_only=True) -class BasePromptDriver(SerializableMixin, ExponentialBackoffMixin, EventsMixin, ABC): +class BasePromptDriver(SerializableMixin, ExponentialBackoffMixin, EventPublisherMixin, ABC): """Base class for the Prompt Drivers. Attributes: diff --git a/griptape/drivers/text_to_speech/base_text_to_speech_driver.py b/griptape/drivers/text_to_speech/base_text_to_speech_driver.py index 432ff0a919..788d929747 100644 --- a/griptape/drivers/text_to_speech/base_text_to_speech_driver.py +++ b/griptape/drivers/text_to_speech/base_text_to_speech_driver.py @@ -7,14 +7,14 @@ from griptape.events.finish_text_to_speech_event import FinishTextToSpeechEvent from griptape.events.start_text_to_speech_event import StartTextToSpeechEvent -from griptape.mixins import EventsMixin, ExponentialBackoffMixin, SerializableMixin +from griptape.mixins import EventPublisherMixin, ExponentialBackoffMixin, SerializableMixin if TYPE_CHECKING: from griptape.artifacts.audio_artifact import AudioArtifact @define -class BaseTextToSpeechDriver(SerializableMixin, ExponentialBackoffMixin, EventsMixin, ABC): +class BaseTextToSpeechDriver(SerializableMixin, ExponentialBackoffMixin, EventPublisherMixin, ABC): model: str = field(kw_only=True, metadata={"serializable": True}) def before_run(self, prompts: list[str]) -> None: diff --git a/griptape/drivers/vector/base_vector_store_driver.py b/griptape/drivers/vector/base_vector_store_driver.py index a452dcb8b4..2b00266a84 100644 --- a/griptape/drivers/vector/base_vector_store_driver.py +++ b/griptape/drivers/vector/base_vector_store_driver.py @@ -10,14 +10,14 @@ from griptape import utils from griptape.artifacts import BaseArtifact, ListArtifact, TextArtifact -from griptape.mixins import EventsMixin, SerializableMixin +from griptape.mixins import EventPublisherMixin, SerializableMixin if TYPE_CHECKING: from griptape.drivers import BaseEmbeddingDriver @define -class BaseVectorStoreDriver(EventsMixin, SerializableMixin, ABC): +class BaseVectorStoreDriver(EventPublisherMixin, SerializableMixin, ABC): DEFAULT_QUERY_COUNT = 5 @dataclass diff --git a/griptape/mixins/__init__.py b/griptape/mixins/__init__.py index 082d1173c8..419e560a5f 100644 --- a/griptape/mixins/__init__.py +++ b/griptape/mixins/__init__.py @@ -4,7 +4,7 @@ from .rule_mixin import RuleMixin from .serializable_mixin import SerializableMixin from .media_artifact_file_output_mixin import BlobArtifactFileOutputMixin -from .events_mixin import EventsMixin +from .events_mixin import EventPublisherMixin __all__ = [ "ActivityMixin", @@ -13,5 +13,5 @@ "RuleMixin", "BlobArtifactFileOutputMixin", "SerializableMixin", - "EventsMixin", + "EventPublisherMixin", ] diff --git a/griptape/mixins/events_mixin.py b/griptape/mixins/events_mixin.py index 992a567b3d..c4bd99fe2a 100644 --- a/griptape/mixins/events_mixin.py +++ b/griptape/mixins/events_mixin.py @@ -9,7 +9,7 @@ @define -class EventsMixin: +class EventPublisherMixin: event_listeners: list[EventListener] = field(factory=list, kw_only=True) def add_event_listeners(self, event_listeners: list[EventListener]) -> list[EventListener]: diff --git a/griptape/structures/structure.py b/griptape/structures/structure.py index 461c0e529b..b8600ac820 100644 --- a/griptape/structures/structure.py +++ b/griptape/structures/structure.py @@ -29,7 +29,7 @@ from griptape.memory.meta import MetaMemory from griptape.memory.structure import ConversationMemory from griptape.memory.task.storage import BlobArtifactStorage, TextArtifactStorage -from griptape.mixins import EventsMixin +from griptape.mixins import EventPublisherMixin from griptape.utils import deprecation_warn if TYPE_CHECKING: @@ -39,7 +39,7 @@ @define -class Structure(ABC, EventsMixin): +class Structure(ABC, EventPublisherMixin): LOGGER_NAME = "griptape" id: str = field(default=Factory(lambda: uuid.uuid4().hex), kw_only=True)