feat(config): TRADINGAGENTS_* env-var overlay for DEFAULT_CONFIG
Adds a single _ENV_OVERRIDES table in default_config.py with type-aware coercion (str/int/bool), so users can switch llm_provider, deep/quick models, backend URL, output language, debate rounds, and the checkpoint flag purely via .env. Centralizes load_dotenv in the package __init__ so the overlay applies for every entry point (CLI, main.py, programmatic). Drops the hardcoded model assignments and duplicate dotenv loads in main.py and cli/main.py. Verified live with OpenAI and Gemini. #602
This commit is contained in:
1 parent
6b384f74f9
commit
d13e9b7946
6 files changed
+176
-25
No files matched your search
@@ -1,5 +1,20 @@
|
||||
import warnings
|
||||
|
||||
# Load .env files at package import so DEFAULT_CONFIG's env-var overlay
|
||||
# (and every llm_clients consumer) sees the user's keys regardless of
|
||||
# which entry point started the process. find_dotenv(usecwd=True) walks
|
||||
# from the CWD, so the installed `tradingagents` console script picks up
|
||||
# the project's .env instead of stepping up from site-packages.
|
||||
# load_dotenv defaults to override=False, so it never clobbers values
|
||||
# the caller has already exported.
|
||||
try:
|
||||
from dotenv import find_dotenv, load_dotenv
|
||||
|
||||
load_dotenv(find_dotenv(usecwd=True))
|
||||
load_dotenv(find_dotenv(".env.enterprise", usecwd=True), override=False)
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
# langchain-core 1.3.3 calls surface_langchain_deprecation_warnings() in
|
||||
# its own __init__, which prepends default-action filters for its
|
||||
# subclassed warning categories. To suppress a specific warning we must
|
||||
|
||||
Reference in new issue
Block a user