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

Add config classes #591

Merged
merged 89 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from 84 commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
2960468
Add config classes
collindutter Jan 3, 2024
e0fbd0e
Update config layout
collindutter Jan 3, 2024
5f90b95
Create marshmallow schemas
collindutter Jan 3, 2024
88d12a3
Dynamic serialization mixin untested
collindutter Jan 4, 2024
5ff1db0
Some progress with cattrs
collindutter Jan 4, 2024
32ce57c
Partially working cattrs unstructure
collindutter Jan 4, 2024
d9234c3
Partially working marshmallow attrs
collindutter Jan 4, 2024
eecd9fc
Dynamic schema loading and dumping works
collindutter Jan 5, 2024
0ab1e21
Merge branch 'dev' into feature/config
collindutter Jan 8, 2024
a072af9
Delete config schemas
collindutter Jan 8, 2024
41d998e
Remove extra space
collindutter Jan 8, 2024
c0579aa
Remove drivers schemas
collindutter Jan 8, 2024
921bdc8
Fix tests
collindutter Jan 9, 2024
7e75e06
Fix loading
collindutter Jan 9, 2024
9ebad74
Merge branch 'dev' into feature/config
collindutter Jan 9, 2024
a9a91b3
Auto serialize artifacts
collindutter Jan 10, 2024
c1504e5
Auto serialize events
collindutter Jan 10, 2024
7b1ec6d
Auto serialize memory
collindutter Jan 10, 2024
942ca51
Misc fixes
collindutter Jan 10, 2024
71046ce
In progress of deleting all schemas
collindutter Jan 10, 2024
c58b340
Merge branch 'dev' into refactor/auto-serialize
collindutter Jan 11, 2024
5504e93
In progress refactor
collindutter Jan 11, 2024
2ac97b0
Fix field name
collindutter Jan 11, 2024
140be19
Mostly working
collindutter Jan 11, 2024
11baf50
Remove config
collindutter Jan 11, 2024
2c944c3
Check ABC for polymorphic
collindutter Jan 11, 2024
35004b3
Fix tests
collindutter Jan 11, 2024
36da3b7
Remove old libs
collindutter Jan 11, 2024
9d4832e
Revert type remove
collindutter Jan 11, 2024
5b78e8b
Cleanup
collindutter Jan 11, 2024
c042586
Add python version check
collindutter Jan 11, 2024
0bd6e07
Revert pyupgrade pep 604 typing rewrites
collindutter Jan 11, 2024
f0d57d8
Add py39-plus to pre-commit args
collindutter Jan 11, 2024
1d27584
Merge branch 'fix/revert-types' into refactor/auto-serialize
collindutter Jan 11, 2024
df45392
Format code
collindutter Jan 11, 2024
e5bff8e
Fix optionals
collindutter Jan 12, 2024
7253194
Add missing imports
collindutter Jan 12, 2024
d4cbce2
Fix imports
collindutter Jan 12, 2024
da492b5
Rerun replace
collindutter Jan 12, 2024
fb65e65
Merge branch 'fix/revert-types' into refactor/auto-serialize
collindutter Jan 12, 2024
fc57891
Add missing imports
collindutter Jan 12, 2024
d063c00
Rerun replace
collindutter Jan 12, 2024
d6a0c5a
Add pyupgrade flag
collindutter Jan 12, 2024
287f77f
Add back unions
collindutter Jan 12, 2024
d4536d1
Merge branch 'dev' into refactor/auto-serialize
collindutter Jan 12, 2024
a340f0c
Remove extra optionals
collindutter Jan 12, 2024
67dcd4b
Rename method, clean up variables
collindutter Jan 12, 2024
c7e955e
Rename serialize to serializable
collindutter Jan 12, 2024
f54722d
Run black
collindutter Jan 12, 2024
949be05
Simplify schema loading
collindutter Jan 16, 2024
8389d97
Remove try_get_schema
collindutter Jan 16, 2024
4b901fa
Clean up base schema
collindutter Jan 16, 2024
e3a5045
Add tests
collindutter Jan 16, 2024
30b0af6
Add comment
collindutter Jan 16, 2024
25059f7
Check if serializable
collindutter Jan 16, 2024
669f591
Merge branch 'dev' into refactor/auto-serialize
collindutter Jan 17, 2024
73c291d
Fix tests for sequences
collindutter Jan 17, 2024
73dc252
Merge branch 'dev' into refactor/auto-serialize
collindutter Jan 17, 2024
9d87bfa
Add config classes
collindutter Jan 18, 2024
7e3769f
Add test
collindutter Jan 18, 2024
81afccb
Begin applying to structure
collindutter Jan 18, 2024
cd729ea
Add merge config
collindutter Jan 19, 2024
a6ab72b
Serialize Driver fields
collindutter Jan 19, 2024
4bdcdbe
Config updates
collindutter Jan 19, 2024
eccb0c6
Inherit from BaseConfig
collindutter Jan 24, 2024
069b394
Add pytest clarity
collindutter Jan 24, 2024
48f46d0
Partially fix tests
collindutter Jan 24, 2024
d8fa2ee
Revert field removal
collindutter Jan 24, 2024
a84db08
Revert field
collindutter Jan 24, 2024
eba57c3
Fix base64 field
collindutter Jan 24, 2024
3f3a9b1
Revert import
collindutter Jan 24, 2024
03cbf90
Fix conversation memory
collindutter Jan 24, 2024
1798a26
Merge branch 'dev' into feature/default-config
collindutter Jan 29, 2024
87577ac
Misc fixes
collindutter Jan 30, 2024
c71ddb1
Merge branch 'dev' into feature/default-config
collindutter Jan 31, 2024
815e3ea
Change how tasks use engines
collindutter Feb 1, 2024
54ebb24
Fix check
collindutter Feb 1, 2024
4e84d01
Fix tests
collindutter Feb 2, 2024
137a981
Add nop tests
collindutter Feb 2, 2024
9a05f8e
More nop changes
collindutter Feb 7, 2024
bc92356
Add tests for task properties
collindutter Feb 7, 2024
4ae312c
Mock aws creds
collindutter Feb 7, 2024
81172e1
Mock region
collindutter Feb 7, 2024
d2b66fa
Update changelog
collindutter Feb 7, 2024
503bc47
Remove kw_only from @define
collindutter Feb 12, 2024
1b668b0
Revert structure check
collindutter Feb 12, 2024
6342b1a
Negate conditions to improve readability
collindutter Feb 12, 2024
5c01d68
Refactor deprecated warning
collindutter Feb 12, 2024
da8b50d
Rename Nop to Dummy
collindutter Feb 12, 2024
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
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `AzureMongoDbVectorStoreDriver` for using CosmosDB with MongoDB vCore API.
- `vector_path` field on `MongoDbAtlasVectorStoreDriver`.
- `LeonardoImageGenerationDriver` supports image to image generation.
- `OpenAiStructureConfig` for providing Structures with all OpenAi Driver configuration.
- `AmazonBedrockStructureConfig` for providing Structures with all Amazon Bedrock Driver configuration.
- `StructureConfig` for building your own Structure configuration.
- `JsonExtractionTask` for convenience over using `ExtractionTask` with a `JsonExtractionEngine`.
- `CsvExtractionTask` for convenience over using `ExtractionTask` with a `CsvExtractionEngine`.

### Fixed
- `BedrockStableDiffusionImageGenerationModelDriver` request parameters for SDXLv1.
Expand All @@ -21,6 +26,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **BREAKING**: Make `index_name` on `MongoDbAtlasVectorStoreDriver` a required field.
- **BREAKING**: Remove `create_index()` from `MarqoVectorStoreDriver`, `OpenSearchVectorStoreDriver`, `PineconeVectorStoreDriver`, `RedisVectorStoreDriver`.
- **BREAKING**: `ImageLoader().load()` now accepts image bytes instead of a file path.
- Deprecated `Structure.prompt_driver` in favor of `Structure.global_drivers.prompt_driver`.
- Deprecated `Structure.embedding_driver` in favor of `Structure.global_drivers.embedding_driver`.
- Deprecated `Structure.stream` in favor of `Structure.global_drivers.prompt_driver.stream`.
- `TextSummaryTask.summary_engine` now defaults to a `PromptSummaryEngine` with a Prompt Driver default of `Structure.global_drivers.prompt_driver`.
- `TextQueryTask.query_engine` now defaults to a `VectorQueryEngine` with a Prompt Driver default of `Structure.global_drivers.prompt_driver` and Vector Store Driver default of `Structure.global_drivers.vector_store_driver`.
- `PromptImageGenerationTask.image_generation_engine` now defaults to a `PromptImageGenerationEngine` with an Image Generation Driver default of `Structure.global_drivers.image_generation_driver`.
- `VariationImageGenerationTask.image_generation_engine` now defaults to a `VariationImageGenerationEngine` with an Image Generation Driver default of `Structure.global_drivers.image_generation_driver`.
- `InpaintingImageGenerationTask.image_generation_engine` now defaults to an `InpaintingImageGenerationEngine` with an Image Generation Driver default of `Structure.global_drivers.image_generation_driver`.
- `OutpaintingImageGenerationTask.image_generation_engine` now defaults to an `OutpaintingImageGenerationEngine` with an Image Generation Driver default of `Structure.global_drivers.image_generation_driver`.

## [0.22.3] - 2024-01-22

Expand Down
30 changes: 30 additions & 0 deletions griptape/config/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from .base_config import BaseConfig

from .structure_global_drivers_config import StructureGlobalDriversConfig
from .structure_task_memory_extraction_engine_csv_config import StructureTaskMemoryExtractionEngineCsvConfig
from .structure_task_memory_extraction_engine_json_config import StructureTaskMemoryExtractionEngineJsonConfig
from .structure_task_memory_extraction_engine_config import StructureTaskMemoryExtractionEngineConfig
from .structure_task_memory_query_engine_config import StructureTaskMemoryQueryEngineConfig
from .structure_task_memory_summary_engine_config import StructureTaskMemorySummaryEngineConfig
from .structure_task_memory_config import StructureTaskMemoryConfig
from .base_structure_config import BaseStructureConfig

from .structure_config import StructureConfig
from .openai_structure_config import OpenAiStructureConfig
from .amazon_bedrock_structure_config import AmazonBedrockStructureConfig


__all__ = [
"BaseConfig",
"BaseStructureConfig",
"StructureTaskMemoryConfig",
"StructureGlobalDriversConfig",
"StructureTaskMemoryQueryEngineConfig",
"StructureTaskMemorySummaryEngineConfig",
"StructureTaskMemoryExtractionEngineConfig",
"StructureTaskMemoryExtractionEngineCsvConfig",
"StructureTaskMemoryExtractionEngineJsonConfig",
"StructureConfig",
"OpenAiStructureConfig",
"AmazonBedrockStructureConfig",
]
77 changes: 77 additions & 0 deletions griptape/config/amazon_bedrock_structure_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
from attrs import Factory, define, field

from griptape.config import (
BaseStructureConfig,
StructureGlobalDriversConfig,
StructureTaskMemoryConfig,
StructureTaskMemoryExtractionEngineConfig,
StructureTaskMemoryExtractionEngineCsvConfig,
StructureTaskMemoryExtractionEngineJsonConfig,
StructureTaskMemoryQueryEngineConfig,
StructureTaskMemorySummaryEngineConfig,
)
from griptape.drivers import (
AmazonBedrockImageGenerationDriver,
AmazonBedrockPromptDriver,
AmazonBedrockTitanEmbeddingDriver,
BedrockClaudePromptModelDriver,
BedrockTitanImageGenerationModelDriver,
BedrockTitanPromptModelDriver,
LocalVectorStoreDriver,
)


@define(kw_only=True)
class AmazonBedrockStructureConfig(BaseStructureConfig):
global_drivers: StructureGlobalDriversConfig = field(
Copy link
Member

Choose a reason for hiding this comment

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

Should we rename it to global and StructureGlobalConfig in case we add more things, other than drivers, to it in the future?

Or should we keep it namespaced to drivers for clarity and just introduce another config "bundle" in the future?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd prefer to keep it namespaced; I could see a singular global becoming quite unruly.

default=Factory(
lambda: StructureGlobalDriversConfig(
prompt_driver=AmazonBedrockPromptDriver(
model="anthropic.claude-v2", stream=False, prompt_model_driver=BedrockClaudePromptModelDriver()
),
image_generation_driver=AmazonBedrockImageGenerationDriver(
model="amazon.titan-image-generator-v1",
image_generation_model_driver=BedrockTitanImageGenerationModelDriver(),
),
embedding_driver=AmazonBedrockTitanEmbeddingDriver(model="amazon.titan-embed-text-v1"),
vector_store_driver=LocalVectorStoreDriver(
embedding_driver=AmazonBedrockTitanEmbeddingDriver(model="amazon.titan-embed-text-v1")
),
)
),
kw_only=True,
metadata={"serializable": True},
)
task_memory: StructureTaskMemoryConfig = field(
default=Factory(
lambda: StructureTaskMemoryConfig(
query_engine=StructureTaskMemoryQueryEngineConfig(
prompt_driver=AmazonBedrockPromptDriver(
model="amazon.titan-text-express-v1", prompt_model_driver=BedrockTitanPromptModelDriver()
),
vector_store_driver=LocalVectorStoreDriver(
embedding_driver=AmazonBedrockTitanEmbeddingDriver(model="amazon.titan-embed-text-v1")
),
),
extraction_engine=StructureTaskMemoryExtractionEngineConfig(
csv=StructureTaskMemoryExtractionEngineCsvConfig(
prompt_driver=AmazonBedrockPromptDriver(
model="amazon.titan-text-express-v1", prompt_model_driver=BedrockTitanPromptModelDriver()
)
),
json=StructureTaskMemoryExtractionEngineJsonConfig(
prompt_driver=AmazonBedrockPromptDriver(
model="amazon.titan-text-express-v1", prompt_model_driver=BedrockTitanPromptModelDriver()
)
),
),
summary_engine=StructureTaskMemorySummaryEngineConfig(
prompt_driver=AmazonBedrockPromptDriver(
model="amazon.titan-text-express-v1", prompt_model_driver=BedrockTitanPromptModelDriver()
)
),
)
),
kw_only=True,
metadata={"serializable": True},
)
10 changes: 10 additions & 0 deletions griptape/config/base_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from abc import ABC

from attrs import define

from griptape.mixins.serializable_mixin import SerializableMixin


@define
class BaseConfig(SerializableMixin, ABC):
...
20 changes: 20 additions & 0 deletions griptape/config/base_structure_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from __future__ import annotations

from abc import ABC

from attr import define, field

from griptape.config import BaseConfig, StructureGlobalDriversConfig, StructureTaskMemoryConfig
from griptape.utils import dict_merge


@define
class BaseStructureConfig(BaseConfig, ABC):
global_drivers: StructureGlobalDriversConfig = field(kw_only=True, metadata={"serializable": True})
task_memory: StructureTaskMemoryConfig = field(kw_only=True, metadata={"serializable": True})

def merge_config(self, config: dict) -> BaseStructureConfig:
base_config = self.to_dict()
merged_config = dict_merge(base_config, config)

return BaseStructureConfig.from_dict(merged_config)
61 changes: 61 additions & 0 deletions griptape/config/openai_structure_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
from attrs import Factory, define, field

from griptape.config import (
BaseStructureConfig,
StructureGlobalDriversConfig,
StructureTaskMemoryConfig,
StructureTaskMemoryExtractionEngineConfig,
StructureTaskMemoryExtractionEngineCsvConfig,
StructureTaskMemoryExtractionEngineJsonConfig,
StructureTaskMemoryQueryEngineConfig,
StructureTaskMemorySummaryEngineConfig,
)
from griptape.drivers import (
LocalVectorStoreDriver,
OpenAiChatPromptDriver,
OpenAiEmbeddingDriver,
OpenAiImageGenerationDriver,
)


@define(kw_only=True)
Copy link
Member

Choose a reason for hiding this comment

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

Should we apply this to all new classes in this PR and, in a separate PR, to most (or all?) classes in Griptape?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think I'd actually vote to remove it from this PR, and do it in a single sweep in another.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, let's remove it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

class OpenAiStructureConfig(BaseStructureConfig):
global_drivers: StructureGlobalDriversConfig = field(
default=Factory(
lambda: StructureGlobalDriversConfig(
prompt_driver=OpenAiChatPromptDriver(model="gpt-4"),
image_generation_driver=OpenAiImageGenerationDriver(model="dall-e-2", image_size="512x512"),
embedding_driver=OpenAiEmbeddingDriver(model="text-embedding-ada-002"),
vector_store_driver=LocalVectorStoreDriver(
embedding_driver=OpenAiEmbeddingDriver(model="text-embedding-ada-002")
),
)
),
kw_only=True,
metadata={"serializable": True},
)
task_memory: StructureTaskMemoryConfig = field(
default=Factory(
lambda: StructureTaskMemoryConfig(
query_engine=StructureTaskMemoryQueryEngineConfig(
prompt_driver=OpenAiChatPromptDriver(model="gpt-3.5-turbo"),
vector_store_driver=LocalVectorStoreDriver(
embedding_driver=OpenAiEmbeddingDriver(model="text-embedding-ada-002")
),
),
extraction_engine=StructureTaskMemoryExtractionEngineConfig(
csv=StructureTaskMemoryExtractionEngineCsvConfig(
prompt_driver=OpenAiChatPromptDriver(model="gpt-3.5-turbo")
),
json=StructureTaskMemoryExtractionEngineJsonConfig(
prompt_driver=OpenAiChatPromptDriver(model="gpt-3.5-turbo")
),
),
summary_engine=StructureTaskMemorySummaryEngineConfig(
prompt_driver=OpenAiChatPromptDriver(model="gpt-3.5-turbo")
),
)
),
kw_only=True,
metadata={"serializable": True},
)
13 changes: 13 additions & 0 deletions griptape/config/structure_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from attrs import Factory, define, field

from griptape.config import BaseStructureConfig, StructureGlobalDriversConfig, StructureTaskMemoryConfig


@define(kw_only=True)
class StructureConfig(BaseStructureConfig):
global_drivers: StructureGlobalDriversConfig = field(
default=Factory(lambda: StructureGlobalDriversConfig()), kw_only=True, metadata={"serializable": True}
)
task_memory: StructureTaskMemoryConfig = field(
default=Factory(lambda: StructureTaskMemoryConfig()), kw_only=True, metadata={"serializable": True}
)
35 changes: 35 additions & 0 deletions griptape/config/structure_global_drivers_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from typing import Optional

from attrs import Factory, define, field

from griptape.drivers import (
BaseConversationMemoryDriver,
BaseEmbeddingDriver,
BaseImageGenerationDriver,
BasePromptDriver,
BaseVectorStoreDriver,
NopVectorStoreDriver,
NopEmbeddingDriver,
NopImageGenerationDriver,
NopPromptDriver,
)
from griptape.mixins.serializable_mixin import SerializableMixin


@define(kw_only=True)
class StructureGlobalDriversConfig(SerializableMixin):
prompt_driver: BasePromptDriver = field(
kw_only=True, default=Factory(lambda: NopPromptDriver()), metadata={"serializable": True}
Copy link
Member

Choose a reason for hiding this comment

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

Just wanted to make sure this is the best convention...do we like NoOp, Null, Dummy, Stub, or Empty better? Or should we stick with Nop?

Copy link
Member Author

Choose a reason for hiding this comment

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

I like Stub. Nop and NoOp feel a bit technical, and Null feels dangerous.

Copy link
Member Author

Choose a reason for hiding this comment

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

What do you think @andrewfrench?

Copy link
Member

Choose a reason for hiding this comment

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

Traditionally I use Dummy

Copy link
Member Author

Choose a reason for hiding this comment

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

Good with me too. Before I do a big refactor, @vasinov are you also good with Dummy? DummyPromptDriver?

Copy link
Member

Choose a reason for hiding this comment

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

That works! It's more fun than Stub and Stub is too Java-y anyways :)

)
image_generation_driver: BaseImageGenerationDriver = field(
kw_only=True, default=Factory(lambda: NopImageGenerationDriver()), metadata={"serializable": True}
)
embedding_driver: BaseEmbeddingDriver = field(
kw_only=True, default=Factory(lambda: NopEmbeddingDriver()), metadata={"serializable": True}
)
vector_store_driver: BaseVectorStoreDriver = field(
default=Factory(lambda: NopVectorStoreDriver()), kw_only=True, metadata={"serializable": True}
)
conversation_memory_driver: Optional[BaseConversationMemoryDriver] = field(
default=None, kw_only=True, metadata={"serializable": True}
)
21 changes: 21 additions & 0 deletions griptape/config/structure_task_memory_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from attrs import Factory, define, field

from griptape.config import (
StructureTaskMemoryExtractionEngineConfig,
StructureTaskMemoryQueryEngineConfig,
StructureTaskMemorySummaryEngineConfig,
)
from griptape.mixins.serializable_mixin import SerializableMixin


@define(kw_only=True)
class StructureTaskMemoryConfig(SerializableMixin):
query_engine: StructureTaskMemoryQueryEngineConfig = field(
default=Factory(lambda: StructureTaskMemoryQueryEngineConfig()), metadata={"serializable": True}
)
extraction_engine: StructureTaskMemoryExtractionEngineConfig = field(
default=Factory(lambda: StructureTaskMemoryExtractionEngineConfig()), metadata={"serializable": True}
)
summary_engine: StructureTaskMemorySummaryEngineConfig = field(
default=Factory(lambda: StructureTaskMemorySummaryEngineConfig()), metadata={"serializable": True}
)
14 changes: 14 additions & 0 deletions griptape/config/structure_task_memory_extraction_engine_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from attrs import Factory, define, field

from griptape.config import StructureTaskMemoryExtractionEngineCsvConfig, StructureTaskMemoryExtractionEngineJsonConfig
from griptape.mixins.serializable_mixin import SerializableMixin


@define(kw_only=True)
class StructureTaskMemoryExtractionEngineConfig(SerializableMixin):
Copy link
Member

Choose a reason for hiding this comment

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

Random thought: will we ever want to use configs as mixins? In other words, will it ever make sense to inherit from two configs at once? If that's the case, should we add the Mixin suffix to config files and @define(slots=False)?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm having a difficult time imaging a configuration situation where we'd inherit from multiple. Did you have something specific in mind?

Copy link
Member

Choose a reason for hiding this comment

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

Nothing specific, just wondering. Let's keep it the way it is then :)

csv: StructureTaskMemoryExtractionEngineCsvConfig = field(
default=Factory(lambda: StructureTaskMemoryExtractionEngineCsvConfig()), metadata={"serializable": True}
)
json: StructureTaskMemoryExtractionEngineJsonConfig = field(
default=Factory(lambda: StructureTaskMemoryExtractionEngineJsonConfig()), metadata={"serializable": True}
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from attrs import define, field, Factory

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


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

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


@define(kw_only=True)
class StructureTaskMemoryExtractionEngineJsonConfig(SerializableMixin):
prompt_driver: BasePromptDriver = field(default=Factory(lambda: NopPromptDriver()), metadata={"serializable": True})
19 changes: 19 additions & 0 deletions griptape/config/structure_task_memory_query_engine_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from attrs import Factory, define, field

from griptape.drivers import (
BasePromptDriver,
BaseVectorStoreDriver,
NopVectorStoreDriver,
NopEmbeddingDriver,
NopPromptDriver,
)
from griptape.mixins.serializable_mixin import SerializableMixin


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

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


@define(kw_only=True)
class StructureTaskMemorySummaryEngineConfig(SerializableMixin):
prompt_driver: BasePromptDriver = field(default=Factory(lambda: NopPromptDriver()), metadata={"serializable": True})
Loading
Loading