mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-23 07:09:31 +00:00
fix env var loader (#143)
This commit is contained in:
parent
1835e8a681
commit
a4b502d92f
@ -11,6 +11,6 @@ def enforce_stop_tokens(text: str, stop: List[str]) -> str:
|
|||||||
|
|
||||||
def get_from_dict_or_env(data: Dict[str, Any], key: str, env_key: str) -> Any:
|
def get_from_dict_or_env(data: Dict[str, Any], key: str, env_key: str) -> Any:
|
||||||
"""Get a value from a dictionary or an environment variable."""
|
"""Get a value from a dictionary or an environment variable."""
|
||||||
if key in data:
|
if key in data and data[key]:
|
||||||
return data[key]
|
return data[key]
|
||||||
return os.environ.get(env_key, None)
|
return os.environ.get(env_key, None)
|
||||||
|
Loading…
Reference in New Issue
Block a user