langgraph adapter

This commit is contained in:
lingyuzeng
2025-08-30 23:29:26 +08:00
parent 273e6088fc
commit e1a36bc1e6
6 changed files with 703 additions and 0 deletions

22
langgraph_qwen/utils.py Normal file
View File

@@ -0,0 +1,22 @@
_DOTENV_LOADED = False
def ensure_env_loaded() -> None:
global _DOTENV_LOADED
if _DOTENV_LOADED:
return
try:
# Lazy import to avoid hard failure if not installed
from dotenv import load_dotenv, find_dotenv # type: ignore
path = find_dotenv(usecwd=True)
if path:
load_dotenv(dotenv_path=path, override=False)
else:
# Fall back to default discovery in CWD
load_dotenv(override=False)
except Exception:
# Silently ignore if python-dotenv is not available or errors out
pass
_DOTENV_LOADED = True