Skip to content

Commit

Permalink
Remove kw_only from @define
Browse files Browse the repository at this point in the history
  • Loading branch information
collindutter committed Feb 12, 2024
1 parent d2b66fa commit 503bc47
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 21 deletions.
2 changes: 1 addition & 1 deletion griptape/config/amazon_bedrock_structure_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
)


@define(kw_only=True)
@define()
class AmazonBedrockStructureConfig(BaseStructureConfig):
global_drivers: StructureGlobalDriversConfig = field(
default=Factory(
Expand Down
2 changes: 1 addition & 1 deletion griptape/config/openai_structure_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
)


@define(kw_only=True)
@define
class OpenAiStructureConfig(BaseStructureConfig):
global_drivers: StructureGlobalDriversConfig = field(
default=Factory(
Expand Down
2 changes: 1 addition & 1 deletion griptape/config/structure_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from griptape.config import BaseStructureConfig, StructureGlobalDriversConfig, StructureTaskMemoryConfig


@define(kw_only=True)
@define
class StructureConfig(BaseStructureConfig):
global_drivers: StructureGlobalDriversConfig = field(
default=Factory(lambda: StructureGlobalDriversConfig()), kw_only=True, metadata={"serializable": True}
Expand Down
2 changes: 1 addition & 1 deletion griptape/config/structure_global_drivers_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from griptape.mixins.serializable_mixin import SerializableMixin


@define(kw_only=True)
@define
class StructureGlobalDriversConfig(SerializableMixin):
prompt_driver: BasePromptDriver = field(
kw_only=True, default=Factory(lambda: NopPromptDriver()), metadata={"serializable": True}
Expand Down
10 changes: 6 additions & 4 deletions griptape/config/structure_task_memory_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@
from griptape.mixins.serializable_mixin import SerializableMixin


@define(kw_only=True)
@define
class StructureTaskMemoryConfig(SerializableMixin):
query_engine: StructureTaskMemoryQueryEngineConfig = field(
default=Factory(lambda: StructureTaskMemoryQueryEngineConfig()), metadata={"serializable": True}
kw_only=True, default=Factory(lambda: StructureTaskMemoryQueryEngineConfig()), metadata={"serializable": True}
)
extraction_engine: StructureTaskMemoryExtractionEngineConfig = field(
default=Factory(lambda: StructureTaskMemoryExtractionEngineConfig()), metadata={"serializable": True}
kw_only=True,
default=Factory(lambda: StructureTaskMemoryExtractionEngineConfig()),
metadata={"serializable": True},
)
summary_engine: StructureTaskMemorySummaryEngineConfig = field(
default=Factory(lambda: StructureTaskMemorySummaryEngineConfig()), metadata={"serializable": True}
kw_only=True, default=Factory(lambda: StructureTaskMemorySummaryEngineConfig()), metadata={"serializable": True}
)
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@
from griptape.mixins.serializable_mixin import SerializableMixin


@define(kw_only=True)
@define
class StructureTaskMemoryExtractionEngineConfig(SerializableMixin):
csv: StructureTaskMemoryExtractionEngineCsvConfig = field(
default=Factory(lambda: StructureTaskMemoryExtractionEngineCsvConfig()), metadata={"serializable": True}
kw_only=True,
default=Factory(lambda: StructureTaskMemoryExtractionEngineCsvConfig()),
metadata={"serializable": True},
)
json: StructureTaskMemoryExtractionEngineJsonConfig = field(
default=Factory(lambda: StructureTaskMemoryExtractionEngineJsonConfig()), metadata={"serializable": True}
kw_only=True,
default=Factory(lambda: StructureTaskMemoryExtractionEngineJsonConfig()),
metadata={"serializable": True},
)
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from griptape.mixins.serializable_mixin import SerializableMixin


@define(kw_only=True)
@define
class StructureTaskMemoryExtractionEngineCsvConfig(SerializableMixin):
prompt_driver: BasePromptDriver = field(default=Factory(lambda: NopPromptDriver()), metadata={"serializable": True})
prompt_driver: BasePromptDriver = field(
kw_only=True, default=Factory(lambda: NopPromptDriver()), metadata={"serializable": True}
)
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from griptape.mixins.serializable_mixin import SerializableMixin


@define(kw_only=True)
@define
class StructureTaskMemoryExtractionEngineJsonConfig(SerializableMixin):
prompt_driver: BasePromptDriver = field(default=Factory(lambda: NopPromptDriver()), metadata={"serializable": True})
prompt_driver: BasePromptDriver = field(
kw_only=True, default=Factory(lambda: NopPromptDriver()), metadata={"serializable": True}
)
7 changes: 5 additions & 2 deletions griptape/config/structure_task_memory_query_engine_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@
from griptape.mixins.serializable_mixin import SerializableMixin


@define(kw_only=True)
@define
class StructureTaskMemoryQueryEngineConfig(SerializableMixin):
prompt_driver: BasePromptDriver = field(default=Factory(lambda: NopPromptDriver()), metadata={"serializable": True})
prompt_driver: BasePromptDriver = field(
kw_only=True, default=Factory(lambda: NopPromptDriver()), metadata={"serializable": True}
)
vector_store_driver: BaseVectorStoreDriver = field(
kw_only=True,
default=Factory(lambda: NopVectorStoreDriver(embedding_driver=NopEmbeddingDriver())),
metadata={"serializable": True},
)
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from attrs import define, field, Factory
from attrs import Factory, define, field

from griptape.drivers import BasePromptDriver, NopPromptDriver
from griptape.mixins.serializable_mixin import SerializableMixin


@define(kw_only=True)
@define
class StructureTaskMemorySummaryEngineConfig(SerializableMixin):
prompt_driver: BasePromptDriver = field(default=Factory(lambda: NopPromptDriver()), metadata={"serializable": True})
prompt_driver: BasePromptDriver = field(
kw_only=True, default=Factory(lambda: NopPromptDriver()), metadata={"serializable": True}
)
2 changes: 1 addition & 1 deletion tests/mocks/mock_structure_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from tests.mocks.mock_embedding_driver import MockEmbeddingDriver


@define(kw_only=True)
@define
class MockStructureConfig(BaseStructureConfig):
global_drivers: StructureGlobalDriversConfig = field(
default=Factory(
Expand Down

0 comments on commit 503bc47

Please sign in to comment.