-
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.
Update docs for saving/loading drivers configs
- Loading branch information
1 parent
ca39b3b
commit 79ca6c0
Showing
3 changed files
with
17 additions
and
15 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
24 changes: 12 additions & 12 deletions
24
docs/griptape-framework/structures/src/drivers_config_8.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
from pathlib import Path | ||
|
||
from griptape.configs import Defaults | ||
from griptape.configs.drivers import AmazonBedrockDriversConfig | ||
from griptape.configs.drivers import DriversConfig | ||
from griptape.structures import Agent | ||
|
||
custom_config = AmazonBedrockDriversConfig() | ||
dict_config = custom_config.to_dict() | ||
# Use OpenAi for embeddings | ||
dict_config["embedding_driver"] = { | ||
"base_url": None, | ||
"model": "text-embedding-3-small", | ||
"organization": None, | ||
"type": "OpenAiEmbeddingDriver", | ||
} | ||
custom_config = AmazonBedrockDriversConfig.from_dict(dict_config) | ||
config_file = "config.json" | ||
|
||
# Save config | ||
config_text = Defaults.drivers_config.to_json() | ||
Path(config_file).write_text(config_text) | ||
|
||
# Load config | ||
config_text = Path(config_file).read_text() | ||
Defaults.drivers_config = DriversConfig.from_json(config_text) | ||
|
||
Defaults.drivers_config = custom_config | ||
|
||
agent = Agent() |