core: [env.py/get_from_env] change default value None -> sentinel object
Description Install sentinel value by default in get_from_env and get_from_dict_and_env function in env.py for let's None value by default and not raise ValueError in this case.
Issue : [Partners-HuggingFace] Breaking Change - impossible to skip login after PR #23309 #26085
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| langchain | ⬜️ Ignored (Inspect) | Visit Preview | Sep 12, 2024 8:06am |
I changed the code to only return a string as you asked. Do you think I can further improve this code?
Thanks @morgandiverrez , as mentionned in the issue :
Introducing a sentinel value may be considered as a breaking change, get_from_env will then accept None as default value without raising any exception which is currently not accepted 🤔. This would assume that users rely on this exception being raised, which I my opinion shouldn't be considered as "nominal" usage of this method.
https://github.com/langchain-ai/langchain/issues/26085#issuecomment-2331968516
What do you think about this @eyurtsev ?
Moved to needs status since there was no activity on this.
Developers can use the existing from_env and secret_from_env in langchain_core.utils to get factories for this use case.
Closing the PR due to lack of activity. Will be happy to re-review if folks want to tackle and can get the type annotations working correctly.