diff --git a/packages/graph-rag-example-helpers/src/graph_rag_example_helpers/env.py b/packages/graph-rag-example-helpers/src/graph_rag_example_helpers/env.py index d37f2a9..334c859 100644 --- a/packages/graph-rag-example-helpers/src/graph_rag_example_helpers/env.py +++ b/packages/graph-rag-example-helpers/src/graph_rag_example_helpers/env.py @@ -74,25 +74,13 @@ def initialize_from_prompts(env: Environment = Environment.CASSIO): import getpass for required in env.required_envvars(): - if required in NON_SECRETS: + if required in os.environ: + continue + elif required in NON_SECRETS: os.environ[required] = input(required) else: os.environ[required] = getpass.getpass(required) - if (keyspace := input("ASTRA_DB_KEYSPACE (empty for default)")) is not None: - os.environ["ASTRA_DB_KEYSPACE"] = keyspace - else: - os.environ.pop("ASTRA_DB_KEYSPACE", None) - - if ( - lc_api_key := getpass.getpass("LANGCHAIN_API_KEY (empty for no tracing)") - ) is not None: - os.environ["LANGCHAIN_API_KEY"] = lc_api_key - os.environ["LANGCHAIN_TRACING_V2"] = "True" - else: - os.environ.pop("LANGCHAIN_API_KEY") - os.environ.pop("LANGCHAIN_TRACING_V2") - def initialize_environment(env: Environment = Environment.CASSIO): """ @@ -113,7 +101,7 @@ def initialize_environment(env: Environment = Environment.CASSIO): 3. If necessary variables aren't set by the above, then prompts the user. """ # 1. If a `.env` file is found, load environment variables from that. - if (dotenv_path := find_dotenv()) is not None: + if dotenv_path := find_dotenv(): load_dotenv(dotenv_path) verify_environment(env) return