-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into refactor/task-memory-cleanup
- Loading branch information
Showing
47 changed files
with
266 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
docs/griptape-framework/drivers/src/event_listener_drivers_4.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import logging | ||
|
||
from griptape.config import config | ||
from griptape.config.drivers import OpenAiDriverConfig | ||
from griptape.config.logging import TruncateLoggingFilter | ||
from griptape.structures import Agent | ||
|
||
config.drivers = OpenAiDriverConfig() | ||
|
||
logger = logging.getLogger(config.logging.logger_name) | ||
logger.setLevel(logging.ERROR) | ||
logger.addFilter(TruncateLoggingFilter(max_log_length=100)) | ||
|
||
agent = Agent() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,8 @@ | ||
from .base_config import BaseConfig | ||
|
||
from .base_driver_config import BaseDriverConfig | ||
|
||
from .driver_config import DriverConfig | ||
from .openai_driver_config import OpenAiDriverConfig | ||
from .azure_openai_driver_config import AzureOpenAiDriverConfig | ||
from .amazon_bedrock_driver_config import AmazonBedrockDriverConfig | ||
from .anthropic_driver_config import AnthropicDriverConfig | ||
from .google_driver_config import GoogleDriverConfig | ||
from .cohere_driver_config import CohereDriverConfig | ||
from .config import config | ||
|
||
|
||
__all__ = [ | ||
"BaseConfig", | ||
"BaseDriverConfig", | ||
"DriverConfig", | ||
"OpenAiDriverConfig", | ||
"AzureOpenAiDriverConfig", | ||
"AmazonBedrockDriverConfig", | ||
"AnthropicDriverConfig", | ||
"GoogleDriverConfig", | ||
"CohereDriverConfig", | ||
"config", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,22 @@ | ||
from __future__ import annotations | ||
|
||
from abc import ABC | ||
from typing import TYPE_CHECKING, Optional | ||
|
||
from attrs import define | ||
from attrs import define, field | ||
|
||
from griptape.mixins.serializable_mixin import SerializableMixin | ||
|
||
from .base_driver_config import BaseDriverConfig | ||
from .logging_config import LoggingConfig | ||
if TYPE_CHECKING: | ||
from .drivers.base_driver_config import BaseDriverConfig | ||
from .logging.logging_config import LoggingConfig | ||
|
||
|
||
@define(kw_only=True) | ||
class BaseConfig(SerializableMixin, ABC): | ||
drivers: BaseDriverConfig | ||
logging: LoggingConfig | ||
_logging: Optional[LoggingConfig] = field(alias="logging") | ||
_drivers: Optional[BaseDriverConfig] = field(alias="drivers") | ||
|
||
def reset(self) -> None: | ||
self._logging = None | ||
self._drivers = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,42 @@ | ||
from attrs import Factory, define, field | ||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING, Optional | ||
|
||
from attrs import define, field | ||
|
||
from .base_config import BaseConfig | ||
from .base_driver_config import BaseDriverConfig | ||
from .logging_config import LoggingConfig | ||
from .openai_driver_config import OpenAiDriverConfig | ||
from .drivers.openai_driver_config import OpenAiDriverConfig | ||
from .logging.logging_config import LoggingConfig | ||
|
||
if TYPE_CHECKING: | ||
from .drivers.base_driver_config import BaseDriverConfig | ||
|
||
@define | ||
|
||
@define(kw_only=True) | ||
class _Config(BaseConfig): | ||
drivers: BaseDriverConfig = field(default=Factory(lambda: OpenAiDriverConfig()), kw_only=True) | ||
logging: LoggingConfig = field(default=Factory(lambda: LoggingConfig()), kw_only=True) | ||
_logging: Optional[LoggingConfig] = field(default=None, alias="logging") | ||
_drivers: Optional[BaseDriverConfig] = field(default=None, alias="drivers") | ||
|
||
@property | ||
def drivers(self) -> BaseDriverConfig: | ||
"""Lazily instantiates the drivers configuration to avoid client errors like missing API key.""" | ||
if self._drivers is None: | ||
self._drivers = OpenAiDriverConfig() | ||
return self._drivers | ||
|
||
@drivers.setter | ||
def drivers(self, drivers: BaseDriverConfig) -> None: | ||
self._drivers = drivers | ||
|
||
@property | ||
def logging(self) -> LoggingConfig: | ||
if self._logging is None: | ||
self._logging = LoggingConfig() | ||
return self._logging | ||
|
||
@logging.setter | ||
def logging(self, logging: LoggingConfig) -> None: | ||
self._logging = logging | ||
|
||
|
||
config = _Config() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from .base_driver_config import BaseDriverConfig | ||
from .driver_config import DriverConfig | ||
|
||
from .openai_driver_config import OpenAiDriverConfig | ||
from .azure_openai_driver_config import AzureOpenAiDriverConfig | ||
from .amazon_bedrock_driver_config import AmazonBedrockDriverConfig | ||
from .anthropic_driver_config import AnthropicDriverConfig | ||
from .google_driver_config import GoogleDriverConfig | ||
from .cohere_driver_config import CohereDriverConfig | ||
|
||
__all__ = [ | ||
"BaseDriverConfig", | ||
"DriverConfig", | ||
"OpenAiDriverConfig", | ||
"AzureOpenAiDriverConfig", | ||
"AmazonBedrockDriverConfig", | ||
"AnthropicDriverConfig", | ||
"GoogleDriverConfig", | ||
"CohereDriverConfig", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
griptape/config/anthropic_driver_config.py → ...config/drivers/anthropic_driver_config.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
griptape/config/cohere_driver_config.py → ...pe/config/drivers/cohere_driver_config.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.