Skip to content

Commit

Permalink
Merge branch 'dev' into french/240514/transcription--transcription
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewfrench authored Jun 3, 2024
2 parents 949792c + 9f78733 commit 0e944d0
Show file tree
Hide file tree
Showing 243 changed files with 487 additions and 356 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `AudioLoader` for loading audio content into an `AudioArtifact`.
- `AudioTranscriptionTask` and `AudioTranscriptionClient` for transcribing audio content in Structures.
- `OpenAiAudioTranscriptionDriver` for integration with OpenAI's speech-to-text models, including Whisper.
- Parameter `env` to `BaseStructureRunDriver` to set environment variables for a Structure Run.

### Changed
- **BREAKING**: Updated OpenAI-based image query drivers to remove Vision from the name.
Expand Down
2 changes: 1 addition & 1 deletion griptape/artifacts/audio_artifact.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from attr import define
from attrs import define

from griptape.artifacts import MediaArtifact

Expand Down
2 changes: 1 addition & 1 deletion griptape/artifacts/base_artifact.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import json
import uuid
from abc import ABC, abstractmethod
from attr import define, field, Factory
from attrs import define, field, Factory


@define()
Expand Down
2 changes: 1 addition & 1 deletion griptape/artifacts/blob_artifact.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations
import os.path
from typing import Optional
from attr import field, define
from attrs import field, define
from griptape.artifacts import BaseArtifact


Expand Down
2 changes: 1 addition & 1 deletion griptape/artifacts/csv_row_artifact.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations
import csv
import io
from attr import define, field
from attrs import define, field
from griptape.artifacts import TextArtifact, BaseArtifact


Expand Down
2 changes: 1 addition & 1 deletion griptape/artifacts/error_artifact.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations
from typing import Optional
from attr import define, field
from attrs import define, field
from griptape.artifacts import BaseArtifact


Expand Down
2 changes: 1 addition & 1 deletion griptape/artifacts/image_artifact.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from attr import define, field
from attrs import define, field

from griptape.artifacts import MediaArtifact

Expand Down
2 changes: 1 addition & 1 deletion griptape/artifacts/info_artifact.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from __future__ import annotations
from attr import define, field
from attrs import define, field
from griptape.artifacts import BaseArtifact


Expand Down
5 changes: 3 additions & 2 deletions griptape/artifacts/list_artifact.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
from typing import Optional
from collections.abc import Sequence
from attr import field, define
from attrs import field, define
from griptape.artifacts import BaseArtifact


@define
class ListArtifact(BaseArtifact):
value: Sequence[BaseArtifact] = field(factory=list, metadata={"serializable": True})
item_separator: str = field(default="\n\n", kw_only=True, metadata={"serializable": True})
validate_uniform_types: bool = field(default=False, kw_only=True, metadata={"serializable": True})

@value.validator # pyright: ignore
def validate_value(self, _, value: list[BaseArtifact]) -> None:
if len(value) > 0:
if self.validate_uniform_types and len(value) > 0:
first_type = type(value[0])

if not all(isinstance(v, first_type) for v in value):
Expand Down
2 changes: 1 addition & 1 deletion griptape/artifacts/media_artifact.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import random
from typing import Optional

from attr import define, field
from attrs import define, field
from griptape.artifacts import BlobArtifact
import base64

Expand Down
2 changes: 1 addition & 1 deletion griptape/artifacts/text_artifact.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Optional
from attr import define, field
from attrs import define, field
from griptape.artifacts import BaseArtifact

if TYPE_CHECKING:
Expand Down
2 changes: 1 addition & 1 deletion griptape/chunkers/base_chunker.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations
from abc import ABC
from typing import Optional
from attr import define, field, Factory
from attrs import define, field, Factory
from griptape.artifacts import TextArtifact
from griptape.chunkers import ChunkSeparator
from griptape.tokenizers import BaseTokenizer, OpenAiTokenizer
Expand Down
2 changes: 1 addition & 1 deletion griptape/config/base_structure_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from abc import ABC
from typing import Optional

from attr import define, field
from attrs import define, field

from griptape.config import BaseConfig
from griptape.drivers import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations
import json
from typing import Any, TYPE_CHECKING
from attr import define, field, Factory
from attrs import define, field, Factory
from griptape.drivers import BaseEmbeddingDriver
from griptape.tokenizers import BedrockCohereTokenizer
from griptape.utils import import_optional_dependency
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations
import json
from typing import Any, TYPE_CHECKING
from attr import define, field, Factory
from attrs import define, field, Factory
from griptape.drivers import BaseEmbeddingDriver
from griptape.tokenizers import BedrockTitanTokenizer
from griptape.utils import import_optional_dependency
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import json
from typing import Any

from attr import Factory, define, field
from attrs import Factory, define, field

from griptape.drivers import BaseMultiModelEmbeddingDriver
from griptape.utils import import_optional_dependency
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from typing import Callable, Optional
from attr import define, field, Factory
from attrs import define, field, Factory
from griptape.drivers import OpenAiEmbeddingDriver
from griptape.tokenizers import OpenAiTokenizer
import openai
Expand Down
2 changes: 1 addition & 1 deletion griptape/drivers/embedding/base_embedding_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import numpy as np
from typing import Optional
from abc import ABC, abstractmethod
from attr import define, field
from attrs import define, field
from griptape.artifacts import TextArtifact
from griptape.mixins import ExponentialBackoffMixin
from griptape.tokenizers import BaseTokenizer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from abc import ABC
from typing import TYPE_CHECKING

from attr import define, field
from attrs import define, field

from griptape.drivers import BaseEmbeddingDriver

Expand Down
2 changes: 1 addition & 1 deletion griptape/drivers/embedding/google_embedding_driver.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations
from typing import Optional
from attr import define, field
from attrs import define, field
from griptape.drivers import BaseEmbeddingDriver
from griptape.utils import import_optional_dependency

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations
from typing import TYPE_CHECKING
from griptape.utils import import_optional_dependency
from attr import define, field, Factory
from attrs import define, field, Factory
from griptape.drivers import BaseEmbeddingDriver

if TYPE_CHECKING:
Expand Down
2 changes: 1 addition & 1 deletion griptape/drivers/embedding/openai_embedding_driver.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations
from typing import Optional
from attr import define, field, Factory
from attrs import define, field, Factory
from griptape.drivers import BaseEmbeddingDriver
from griptape.tokenizers import OpenAiTokenizer
import openai
Expand Down
2 changes: 1 addition & 1 deletion griptape/drivers/embedding/voyageai_embedding_driver.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations
from typing import Optional, Any
from attr import define, field, Factory
from attrs import define, field, Factory
from griptape.utils import import_optional_dependency
from griptape.drivers import BaseEmbeddingDriver
from griptape.tokenizers import VoyageAiTokenizer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from attr import define
from attrs import define
from abc import ABC, abstractmethod


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from attr import define
from attrs import define
from griptape.drivers import BaseEmbeddingModelDriver


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from attr import define
from attrs import define
from griptape.drivers import BaseEmbeddingModelDriver


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import json
from typing import TYPE_CHECKING, Any

from attr import Factory, define, field
from attrs import Factory, define, field

from griptape.drivers.event_listener.base_event_listener_driver import BaseEventListenerDriver
from griptape.utils import import_optional_dependency
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import json
from typing import TYPE_CHECKING, Any

from attr import Factory, define, field
from attrs import Factory, define, field

from griptape.drivers.event_listener.base_event_listener_driver import BaseEventListenerDriver
from griptape.utils import import_optional_dependency
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from concurrent import futures
from logging import Logger

from attr import Factory, define, field
from attrs import Factory, define, field

from griptape.events import BaseEvent

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import requests

from urllib.parse import urljoin
from attr import define, field, Factory
from attrs import define, field, Factory

from griptape.drivers.event_listener.base_event_listener_driver import BaseEventListenerDriver

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import requests

from attr import define, field
from attrs import define, field

from griptape.drivers.event_listener.base_event_listener_driver import BaseEventListenerDriver

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
from pathlib import Path
from typing import TYPE_CHECKING, Any
from attr import define, field, Factory
from attrs import define, field, Factory
from griptape.utils.import_utils import import_optional_dependency
from .base_file_manager_driver import BaseFileManagerDriver

Expand Down
2 changes: 1 addition & 1 deletion griptape/drivers/file_manager/base_file_manager_driver.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations
from abc import ABC, abstractmethod
from attr import Factory, define, field
from attrs import Factory, define, field
from griptape.artifacts import BaseArtifact, ErrorArtifact, TextArtifact, InfoArtifact, ListArtifact
import griptape.loaders as loaders

Expand Down
2 changes: 1 addition & 1 deletion griptape/drivers/file_manager/local_file_manager_driver.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations
import os
from pathlib import Path
from attr import define, field, Factory
from attrs import define, field, Factory
from .base_file_manager_driver import BaseFileManagerDriver


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import json
from typing import TYPE_CHECKING, Any, Optional

from attr import define, field, Factory
from attrs import define, field, Factory

from griptape.artifacts import ImageArtifact
from griptape.drivers import BaseMultiModelImageGenerationDriver
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import openai
from attr import field, Factory, define
from attrs import field, Factory, define
from typing import Callable, Optional

from griptape.drivers import OpenAiImageGenerationDriver
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Optional

from attr import define, field
from attrs import define, field

from griptape.artifacts import ImageArtifact
from griptape.events import StartImageGenerationEvent, FinishImageGenerationEvent
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations
from abc import ABC

from attr import field, define
from attrs import field, define

from griptape.drivers import BaseImageGenerationDriver, BaseImageGenerationModelDriver

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import Optional, Literal

import requests
from attr import field, define, Factory
from attrs import field, define, Factory

from griptape.artifacts import ImageArtifact
from griptape.drivers import BaseImageGenerationDriver
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import openai
from openai.types.images_response import ImagesResponse
from attr import field, Factory, define
from attrs import field, Factory, define

from griptape.artifacts import ImageArtifact
from griptape.drivers import BaseImageGenerationDriver
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from abc import ABC, abstractmethod
from typing import Any, Optional

from attr import define
from attrs import define

from griptape.artifacts import ImageArtifact
from griptape.mixins import SerializableMixin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import logging
from typing import Optional

from attr import field, define
from attrs import field, define

from griptape.artifacts import ImageArtifact
from griptape.drivers import BaseImageGenerationModelDriver
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import base64
from typing import Any, Optional

from attr import field, define
from attrs import field, define

from griptape.artifacts import ImageArtifact
from griptape.drivers import BaseImageGenerationModelDriver
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from attr import define, field, Factory
from attrs import define, field, Factory
from griptape.artifacts import ImageArtifact, TextArtifact
from griptape.drivers import BaseMultiModelImageQueryDriver
from griptape.utils import import_optional_dependency
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations
from typing import Optional, Any
from attr import define, field, Factory
from attrs import define, field, Factory
from griptape.artifacts import ImageArtifact, TextArtifact
from griptape.drivers import BaseImageQueryDriver
from griptape.utils import import_optional_dependency
Expand Down
Loading

0 comments on commit 0e944d0

Please sign in to comment.