mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-17 14:04:27 +01:00
fix(agent): Support OpenAI Project API keys (#7099)
Amend regex expression in config.py that OpenAI API keys are validated against Signed-off-by: Fullstop000 <fullstop1005@gmail.com>
This commit is contained in:
@@ -289,7 +289,7 @@ class ConfigBuilder(Configurable[Config]):
|
|||||||
|
|
||||||
def assert_config_has_openai_api_key(config: Config) -> None:
|
def assert_config_has_openai_api_key(config: Config) -> None:
|
||||||
"""Check if the OpenAI API key is set in config.py or as an environment variable."""
|
"""Check if the OpenAI API key is set in config.py or as an environment variable."""
|
||||||
key_pattern = r"^sk-\w{48}"
|
key_pattern = r"^sk-(proj-)?\w{48}"
|
||||||
openai_api_key = (
|
openai_api_key = (
|
||||||
config.openai_credentials.api_key.get_secret_value()
|
config.openai_credentials.api_key.get_secret_value()
|
||||||
if config.openai_credentials
|
if config.openai_credentials
|
||||||
|
|||||||
Reference in New Issue
Block a user