Skip to content

Commit

Permalink
Rename EventsMixin
Browse files Browse the repository at this point in the history
  • Loading branch information
collindutter committed Jul 18, 2024
1 parent 3622d31 commit cef72ee
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions griptape/drivers/embedding/base_embedding_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
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
from griptape.tokenizers import BaseTokenizer


@define
class BaseEmbeddingDriver(EventsMixin, SerializableMixin, ExponentialBackoffMixin, ABC):
class BaseEmbeddingDriver(EventPublisherMixin, SerializableMixin, ExponentialBackoffMixin, ABC):
"""Base Embedding Driver.
Attributes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions griptape/drivers/image_query/base_image_query_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...

Expand Down
4 changes: 2 additions & 2 deletions griptape/drivers/prompt/base_prompt_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions griptape/drivers/text_to_speech/base_text_to_speech_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions griptape/drivers/vector/base_vector_store_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions griptape/mixins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -13,5 +13,5 @@
"RuleMixin",
"BlobArtifactFileOutputMixin",
"SerializableMixin",
"EventsMixin",
"EventPublisherMixin",
]
2 changes: 1 addition & 1 deletion griptape/mixins/events_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down
4 changes: 2 additions & 2 deletions griptape/structures/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
Expand Down

0 comments on commit cef72ee

Please sign in to comment.